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.
Base URL
Section titled “Base URL”https://proxy.gonkabroker.comUse 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.
Authentication
Section titled “Authentication”Both header styles are accepted:
x-api-key: gnk-prx-...(the Anthropic SDK default)Authorization: Bearer gnk-prx-...
Supported endpoints
Section titled “Supported endpoints”| Endpoint | Status |
|---|---|
POST /v1/messages | Supported |
POST /v1/messages/count_tokens | Supported; returns an estimate (see below) |
GET /v1/models | Supported; Anthropic response shape when called with Anthropic headers |
Messages parameters
Section titled “Messages parameters”| Parameter | Supported |
|---|---|
model | Yes; a Gonka Broker model id (see Supported Models) |
messages | Yes |
max_tokens | Yes (required, per the Anthropic spec) |
system | Yes |
stream | Yes |
temperature | Yes |
top_p | Yes |
top_k | Yes |
stop_sequences | Yes |
tools | Yes |
tool_choice | Yes: auto, none, and named tools. any is passed through but not strictly enforced by every model |
metadata | Accepted and ignored |
thinking | Yes: type toggles thinking on models with a thinking switch (no effect otherwise); budget_tokens accepted and ignored. See Supported Models |
cache_control | Accepted and ignored; no prompt caching |
Responses and streaming
Section titled “Responses and streaming”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_delta → message_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.
Token counting
Section titled “Token counting”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.
Known divergences
Section titled “Known divergences”- Thinking defaults vary by model and can be inverted relative to Anthropic: Kimi and MiniMax think by default, so omitting
thinkingstill returns thinking blocks — sendthinking: {"type": "disabled"}to turn them off (on models with a switch). DeepSeek V4 Flash answers directly by default; sendthinking: {"type": "enabled"}to make it deliberate. See reasoning behavior. stop_sequencesare honored, butstop_reasonreportsend_turninstead ofstop_sequence: the network does not report which stop fired.system-role messages inside themessagesarray are accepted (Claude Code sends them mid-conversation) and mapped to system messages; other unknown roles are rejected with400.- Image and other non-text content blocks are not supported; text only.
- Request bodies are limited to 2 MiB.
Errors
Section titled “Errors”Errors use the Anthropic error shape, {"type": "error", "error": {"type": "...", "message": "..."}}:
| Status | Error type |
|---|---|
400 | invalid_request_error: validation errors, unsupported content, out-of-balance accounts |
401 | authentication_error |
404 | not_found_error: unknown endpoint or model |
413 | request_too_large |
429 | rate_limit_error: includes a Retry-After header |
Not supported
Section titled “Not supported”- 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.