Messages (Anthropic)

Last updated:

On this page
text
POST https://api.staik.se/v1/messages

Anthropic Messages API-compatible endpoint — Claude Code, the Anthropic SDK, and other tools that speak the Anthropic protocol work directly. Authenticate with x-api-key or Authorization: Bearer (same key).

python
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.staik.se",
    api_key="sk-st-your-key",
)

message = client.messages.create(
    model="qwen3.6:35b-a3b",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain how a transformer works."}],
)
print(message.content[0].text)

Model mapping

Send either staik model names or Claude model names — Claude names are mapped automatically (mainly for seamless Claude Code integration):

Sent model nameMaps to
claude-sonnet-4-6qwen3.6:35b-a3b
claude-opus-4-6qwen3.6:35b-a3b
claude-haiku-4-5-20251001qwen3.5:9b

Prompt caching

cache_control breakpoints are supported (max 4 per request, matching Anthropic). Marked context is cached and reused — the cached part is billed as discounted cache_read instead of full price every turn. TTL is 5 minutes, or 1 hour with ttl: "1h". Cache hits show up in the response's usage fields.

json
{
  "system": [
    {
      "type": "text",
      "text": "...large system prompt or context...",
      "cache_control": {"type": "ephemeral"}
    }
  ]
}

Supported features

Streaming (Anthropic format: message_start, content_block_delta, message_stop), tool calling (tool_use/tool_result are translated automatically), system prompt as string or content blocks, and the same quotas and queues as the OpenAI endpoint.

Limitations

  • Extended thinking — the thinking parameter is ignored; the model reasons inline
  • Images — Anthropic-format base64 image blocks are not supported here; use the OpenAI endpoint for vision
  • PDF/document — Anthropic's document block type is not supported

Claude Code

Two environment variables are all it takes: ANTHROPIC_BASE_URL=https://api.staik.se and ANTHROPIC_API_KEY=sk-st-.... Full guide under Claude Code.