Skip to content

Anthropic API Compatibility

Gonka Broker API keys also work over the Anthropic Messages API. The same keys, models, and balance are served through both protocol surfaces: pick whichever your client speaks. Anthropic SDKs and Anthropic-native tools like Claude Code (see Connect Claude Code) work as drop-in clients.

https://proxy.gonkabroker.com

Use the bare host as the base URL (for example in ANTHROPIC_BASE_URL or the Anthropic SDK’s base_url); clients append the /v1/... paths themselves.

Both header styles are accepted:

  • x-api-key: gnk-prx-... (the Anthropic SDK default)
  • Authorization: Bearer gnk-prx-...
EndpointStatus
POST /v1/messagesSupported
POST /v1/messages/count_tokensSupported; returns an estimate (see below)
GET /v1/modelsSupported; Anthropic response shape when called with Anthropic headers
ParameterSupported
modelYes; a Gonka Broker model id (see Supported Models)
messagesYes
max_tokensYes (required, per the Anthropic spec)
systemYes
streamYes
temperatureYes
top_pYes
top_kYes
stop_sequencesYes
toolsYes
tool_choiceYes: auto, none, and named tools. any is passed through but not strictly enforced by every model
metadataAccepted and ignored
thinkingYes: type toggles thinking on models with a thinking switch (no effect otherwise); budget_tokens accepted and ignored. See Supported Models
cache_controlAccepted and ignored; no prompt caching

Responses follow the Anthropic Messages format: content blocks, stop_reason, and a usage object with input_tokens and output_tokens. Streaming uses the Anthropic SSE event grammar (message_start → content block events → message_deltamessage_stop).

Models that emit delimited thinking (Kimi K2.6, MiniMax M2.7) return it as separate thinking content blocks in both streaming and non-streaming modes, so Anthropic clients render it natively. For DeepSeek V4 Flash the separation depends on the network serving configuration: deliberation may arrive as thinking blocks or inside the regular text blocks — don’t rely on either shape for this model.

Tool use round-trips work end-to-end: the model returns tool_use blocks with parsed JSON input, and you send results back as tool_result blocks.

POST /v1/messages/count_tokens returns a documented estimate (derived from text length), not an exact tokenizer count. It is suitable for budgeting and context-window math, not for exact billing predictions; billing always uses the real token counts from the inference response.

  • Thinking defaults vary by model and can be inverted relative to Anthropic: Kimi and MiniMax think by default, so omitting thinking still returns thinking blocks — send thinking: {"type": "disabled"} to turn them off (on models with a switch). DeepSeek V4 Flash answers directly by default; send thinking: {"type": "enabled"} to make it deliberate. See reasoning behavior.
  • stop_sequences are honored, but stop_reason reports end_turn instead of stop_sequence: the network does not report which stop fired.
  • system-role messages inside the messages array are accepted (Claude Code sends them mid-conversation) and mapped to system messages; other unknown roles are rejected with 400.
  • Image and other non-text content blocks are not supported; text only.
  • Request bodies are limited to 2 MiB.

Errors use the Anthropic error shape, {"type": "error", "error": {"type": "...", "message": "..."}}:

StatusError type
400invalid_request_error: validation errors, unsupported content, out-of-balance accounts
401authentication_error
404not_found_error: unknown endpoint or model
413request_too_large
429rate_limit_error: includes a Retry-After header
  • Message Batches API (/v1/messages/batches)
  • Files API
  • Claude models: Gonka Broker serves open-source models, and claude-* model ids are not aliased. Use the model ids from Supported Models.