Connect Claude Code to Gonka Broker
Claude Code is Anthropic’s agentic coding tool. It talks the Anthropic Messages API, and Gonka Broker serves that same protocol natively, so pointing your agent at Gonka Broker is three environment variables, with no router or local proxy in between. The full agentic loop works over this endpoint: multi-turn sessions, tool use, streaming, and thinking blocks.
Prerequisites
Section titled “Prerequisites”- A Gonka API key (starts with
gnk-prx-). See Create a Gonka API Key. - Claude Code installed.
Point Claude Code at Gonka Broker
Section titled “Point Claude Code at Gonka Broker”Set the Anthropic environment variables and start Claude Code from the same shell:
export ANTHROPIC_BASE_URL="https://proxy.gonkabroker.com"export ANTHROPIC_AUTH_TOKEN="gnk-prx-your-api-key"export ANTHROPIC_MODEL="MiniMaxAI/MiniMax-M2.7"export ANTHROPIC_SMALL_FAST_MODEL="MiniMaxAI/MiniMax-M2.7"claudeANTHROPIC_BASE_URLis the bare proxy host, with no/v1suffix. Claude Code appends the API paths itself.ANTHROPIC_MODELmust be a model id Gonka Broker serves, exactly as listed in Supported Models.MiniMaxAI/MiniMax-M2.7is a strong default for agentic coding;moonshotai/Kimi-K2.6is an alternative with a bigger context window.ANTHROPIC_SMALL_FAST_MODELcovers the background tasks Claude Code normally sends to a small Claude model. Point it at the same id so those calls don’t go looking for a model Gonka Broker doesn’t serve.
To make the switch permanent instead of per-shell, put the same variables in the env block of ~/.claude/settings.json:
{ "env": { "ANTHROPIC_BASE_URL": "https://proxy.gonkabroker.com", "ANTHROPIC_AUTH_TOKEN": "gnk-prx-your-api-key", "ANTHROPIC_MODEL": "MiniMaxAI/MiniMax-M2.7", "ANTHROPIC_SMALL_FAST_MODEL": "MiniMaxAI/MiniMax-M2.7" }}Use it
Section titled “Use it”Work with Claude Code exactly as before: chat, let it read and edit files, run commands, and iterate. Only the endpoint and the model changed; requests are billed per token from your Gonka balance.
Verify
Section titled “Verify”Start claude and ask it to do something small but real: read a file and summarize it, or make a one-line edit. A completed answer confirms the connection; a completed edit confirms the full tool-use loop.
Troubleshooting
Section titled “Troubleshooting”- “Unknown model” / context-window warning at startup: cosmetic. Claude Code doesn’t recognize open-source model ids and assumes a default context size; requests work normally.
- 401 / invalid API key: wrong or paused key, or the variables aren’t set in the shell where you started
claude. Re-export them (or check~/.claude/settings.json), or create a fresh key from Create a Gonka API Key. - Model not found:
ANTHROPIC_MODELmust match a model Gonka Broker serves exactly (see Supported Models). - Errors only on background/sub-agent tasks: set
ANTHROPIC_SMALL_FAST_MODEL(some Claude Code versions readANTHROPIC_DEFAULT_HAIKU_MODELinstead) to the same model id. - Thinking blocks appear without extended thinking enabled: expected — the models Gonka Broker serves think by default, unlike Anthropic’s (see known divergences). The
thinkingparameter is honored if your client sends it.
Claude Code is a trademark of Anthropic. Gonka Broker is an independent service and is not affiliated with or endorsed by Anthropic.