Integration Guide
Drop your GonkaRouter key into Claude SDKs, Cursor IDE, OpenClaw, or WorkBuddy in under five minutes. Every snippet in this guide is tested end-to-end against https://api.gonkarouter.io.
Get your API Key
- Open the Dashboard, sign in with email or Google.
- Click Create API Key, give it a label, copy the value.
- New accounts get a one-time $20 free credit, so you can try every model before topping up.
Base URL
https://api.gonkarouter.ioAuth headers
x-api-key OR Authorization: Bearer30-second smoke test
Before wiring up an SDK, run the snippet below in a terminal — pick your OS tab and substitute your real key. If you get back a 200 with a content[].text field, every other example on this page will work too.
On Windows, pick the Windows (cmd) tab and run it in the Command Prompt (cmd) — curl.exe ships with Windows 10 and later, so no extra install is needed.
KEY="sk-xxxxxx" # paste your real key here
curl -s https://api.gonkarouter.io/v1/messages \
-H "x-api-key: $KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"max_tokens": 1024,
"messages": [{"role":"user","content":"Reply with just: pong"}]
}'
Expected output (abridged)
{
"id": "msg_…",
"type": "message",
"role": "assistant",
"model": "MiniMaxAI/MiniMax-M2.7",
"content": [{"type":"text","text":" pong"}],
"stop_reason": "end_turn",
"usage": {"input_tokens":15,"output_tokens":43}
}Wire it into your client
Claude / Anthropic SDK
GonkaRouter implements POST /v1/messages with the full Anthropic Messages API surface (streaming + tool use included). Point an official Anthropic SDK at the gateway by overriding base_url and api_key.
Endpoint
https://api.gonkarouter.io/v1/messagesRecommended Model
MiniMaxAI/MiniMax-M2.71. Install the SDK
# Python
pip install "anthropic>=0.40"
# Node / TypeScript
npm install @anthropic-ai/sdk
2. Python — one-shot (tested ✓)
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.gonkarouter.io",
api_key="sk-xxxxxx", # your GonkaRouter key
)
msg = client.messages.create(
model="MiniMaxAI/MiniMax-M2.7",
max_tokens=1024, # keep ≥ 1024 — see "reasoning tokens" note below
messages=[
{"role": "user", "content": "Reply with just: pong"},
],
)
# content is a list of blocks; grab the first text block.
text = next((b.text for b in msg.content if getattr(b, "text", None)), "")
print(text) # -> "pong"
print(msg.usage) # -> input_tokens=…, output_tokens=…
3. Python — streaming (tested ✓)
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.gonkarouter.io",
api_key="sk-xxxxxx",
)
# Idiomatic Anthropic streaming — text_stream yields each token chunk as a string.
with client.messages.stream(
model="MiniMaxAI/MiniMax-M2.7",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello in exactly three words."}],
) as stream:
for chunk in stream.text_stream:
print(chunk, end="", flush=True)
final = stream.get_final_message()
print()
print("usage:", final.usage)
4. TypeScript / Node
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.gonkarouter.io",
apiKey: process.env.GONKA_API_KEY!, // sk-xxxxxx
});
// One-shot
const msg = await client.messages.create({
model: "MiniMaxAI/MiniMax-M2.7",
max_tokens: 1024,
messages: [{ role: "user", content: "Reply with just: pong" }],
});
const text = msg.content
.filter((b): b is Anthropic.TextBlock => b.type === "text")
.map((b) => b.text)
.join("");
console.log(text);
// Streaming — idiomatic helper
const stream = client.messages.stream({
model: "MiniMaxAI/MiniMax-M2.7",
max_tokens: 1024,
messages: [{ role: "user", content: "Say hello in three words." }],
});
for await (const chunk of stream) {
if (chunk.type === "content_block_delta" && chunk.delta.type === "text_delta") {
process.stdout.write(chunk.delta.text);
}
}
const finalMsg = await stream.finalMessage();
console.log("\nusage:", finalMsg.usage);
5. Raw curl reference
curl https://api.gonkarouter.io/v1/messages \
-H "x-api-key: sk-xxxxxx" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
# Streaming variant — add "stream": true to the JSON body and pipe to a parser.
Limits & Specifications
Production-verified limits, last checked 2026-06-19. Subject to change as the upstream capacity scales — we update this section in place rather than rev a new endpoint.
Rate Limits (global shared pool)
- Burst capacity: ≥ 200 concurrent requests
- Sustainable throughput: ≤ 1000 req/min
- Sustained > 1500 req/min will start returning
429 429responses do not consume your balance — back off 30–60s and retry
Model Fallback
- When a requested model's upstream is temporarily saturated (a
429that persists after retries), the request is served by a fallback model instead of failing — so your call still returns a result. - A substitution is never silent: the response carries a header naming the requested and served model, e.g.
X-Gonka-Fallback: zai-org/GLM-5.3-Flash -> MiniMaxAI/MiniMax-M2.7. Themodelfield in the response body reflects the model that actually served it. - To enforce the exact requested model (no substitution), send the request header
X-Gonka-No-Fallback: true. Saturated requests then return the real upstream429instead of being re-routed — ideal for benchmarking and evals.
Request Receipts
- Every call returns an
X-Request-Idresponse header. You can look that id up later — no auth required — to independently confirm a recorded call:GET /v1/receipts/{x-request-id} - It returns metadata only —
model,created_at,total_tokens,x_devshard_id,outcome,status_code— never prompt/response content, account identity, or cost. Handy for reconciliation and letting third parties verify your usage. - Rate-limited per IP (60/min); unknown ids return
404.
Streaming Timeouts
- Hard cap: 10 minutes wall-clock per request
- Idle cap: 90 seconds — no new chunk in 90s closes the upstream connection
Context Windows
MiniMaxAI/MiniMax-M2.7
200K tokens