Documentation
Quickstart
JoinGonka Gateway supports OpenAI and Anthropic API for accessing Gonka models. Replace base_url in your client — and it works.
Base URL: https://gate.joingonka.ai/v1
Model: MiniMaxAI/MiniMax-M2.7
Authorization: Bearer YOUR_API_KEY
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://gate.joingonka.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is Gonka?"},
],
temperature=0.7,
max_tokens=1024,
)
print(response.choices[0].message.content)TypeScript (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gate.joingonka.ai/v1",
apiKey: "YOUR_API_KEY",
});
const response = await client.chat.completions.create({
model: "MiniMaxAI/MiniMax-M2.7",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What is Gonka?" },
],
temperature: 0.7,
max_tokens: 1024,
});
console.log(response.choices[0].message.content);cURL
curl https://gate.joingonka.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is Gonka?"}
],
"temperature": 0.7,
"max_tokens": 1024
}'Anthropic API (Claude Code)
JoinGonka Gateway natively supports Anthropic Messages API (/v1/messages). Claude Code, Anthropic SDK, and any tools using the Anthropic format work directly — without a proxy.
Claude Code
Recommended — set it up with one command (also configures OpenClaw and Cline):
npx @joingonka/setup
Or configure it manually:
export ANTHROPIC_BASE_URL=https://gate.joingonka.ai export ANTHROPIC_API_KEY=YOUR_API_KEY claude
Python (Anthropic SDK)
import anthropic
client = anthropic.Anthropic(
base_url="https://gate.joingonka.ai",
api_key="YOUR_API_KEY",
)
message = client.messages.create(
model="MiniMaxAI/MiniMax-M2.7",
max_tokens=1024,
messages=[
{"role": "user", "content": "What is Gonka?"},
],
)
print(message.content[0].text)cURL (Anthropic format)
curl https://gate.joingonka.ai/v1/messages \
-H "x-api-key: YOUR_API_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": "What is Gonka?"}
]
}'Streaming (Python)
import anthropic
client = anthropic.Anthropic(
base_url="https://gate.joingonka.ai",
api_key="YOUR_API_KEY",
)
with client.messages.stream(
model="MiniMaxAI/MiniMax-M2.7",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain Gonka"}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)Tool Use (cURL)
curl https://gate.joingonka.ai/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"max_tokens": 1024,
"tools": [{
"name": "get_weather",
"description": "Get current weather",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}],
"messages": [{"role": "user", "content": "Weather in Moscow?"}]
}'Both formats (OpenAI and Anthropic) use one API key and one balance.
API Endpoints
Inference
/v1/chat/completionsResponse generation — OpenAI format (streaming supported)
{
"id": "chatcmpl-abc123...",
"object": "chat.completion",
"model": "MiniMaxAI/MiniMax-M2.7",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?",
"tool_calls": []
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 8,
"total_tokens": 20
},
"x_joingonka": {
"cost_ngonka": "24",
"balance_ngonka": "11999976"
}
}/v1/messagesResponse generation — Anthropic format (streaming, tool_use)
{
"id": "msg_abc123...",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello!"}],
"model": "MiniMaxAI/MiniMax-M2.7",
"stop_reason": "end_turn",
"usage": {"input_tokens": 12, "output_tokens": 8}
}/v1/modelsList of available models
{
"object": "list",
"data": [{
"id": "MiniMaxAI/MiniMax-M2.7",
"object": "model",
"owned_by": "gonka-network",
"context_length": 200000,
"pricing": {
"prompt": "0.00000007",
"completion": "0.0000001"
},
"architecture": {
"modality": "text->text"
},
"top_provider": {
"context_length": 200000,
"max_completion_tokens": 8192,
"is_moderated": false
},
"supported_parameters": [
"temperature", "top_p", "tools",
"tool_choice", "max_tokens", "stop"
],
"x_gonka": {
"v_ram": 320,
"context_window": 200000,
"max_output": 8192,
"actual_cost_ngonka": 1.2
}
}]
}Plugins
Plugins extend API capabilities. Pass an array of plugins in the request to activate.
/v1/pluginsList of available plugins
{
"plugins": [
{"id": "web", "description": "Web search — inject fresh results with citations"},
{"id": "response-healing", "description": "Auto-fix truncated JSON"},
{"id": "privacy-sanitization", "description": "Mask sensitive data"},
{"id": "file-parser", "description": "Extract text from PDF"}
]
}Usage in request
{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [{"role": "user", "content": "..."}],
"plugins": ["response-healing", "privacy-sanitization"]
}web
Web search directly in Gonka models. The models themselves (Kimi, MiniMax) do not have search — gateway injects fresh results from the internet into the context and returns source citations. Works in stream and non-stream. Backend is self-hosted: requests do not go to third-party search APIs under your account.
Method 1 — web object in the plugins array (result injection with options):
{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [{"role": "user", "content": "What's new in the Gonka network?"}],
"plugins": [{
"id": "web",
"max_results": 5,
"search_prompt": "Relevant web search results:"
}]
}Method 2 — Agent mode (mode: "agent"): the model itself calls web_search only when search is needed:
{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [{"role": "user", "content": "What's new in the Gonka network?"}],
"plugins": [{ "id": "web", "mode": "agent", "max_searches": 3 }]
}Options: max_results — number of results (default 5, max 10); search_prompt — your own grounding prompt preceding the results.
The response is enriched with annotations[].url_citation (url, title) — OpenRouter standard:
{
"choices": [{
"message": {
"role": "assistant",
"content": "...",
"annotations": [{
"type": "url_citation",
"url_citation": {
"url": "https://gonka.ai/...",
"title": "Gonka Network"
}
}]
}
}]
}Pricing: plugins:[{ "id": "web" }] mode - only for tokens (mixed results are treated as regular prompt tokens). Agent mode (mode: "agent") - tokens for all cycle steps plus a surcharge of 1000 nGNK for each web_search call (≈ $0.0003 for 1000 searches at ~$0.33 per GNK).
Incompatible with privacy-sanitization: a joint request will return 400.
response-healing
Automatic healing of truncated JSON/structured output. Works only for non-streaming requests with JSON content.
privacy-sanitization
Masking sensitive data (API keys, email, IP addresses, JWTs, card numbers) in messages before sending to the model.
Modes: redact (replace with [REDACTED]) or tokenize (replace with [TOKEN_001]). Pass privacy_mode in the body.
file-parser
Extract text from PDF documents. Supports data:application/pdf;base64,... and raw base64.
Management Keys
Hierarchical API keys for SaaS integrations. A management key (gm-) creates child keys (gc-) with limits and TTL.
/api/management/keysCreate a management key (prefix gm-). Used only for managing child keys.
/api/management/keys/:id/childrenCreate a child key (prefix gc-) with optional limits. Billing is charged from the management key owner's balance.
{
"name": "Client A",
"limit_daily_ngonka": "1000000000",
"limit_monthly_ngonka": "10000000000",
"expires_at": "2026-04-01T00:00:00Z",
"rate_limit_rpm": 30
}/api/management/keys/:id/childrenList of child keys with usage statistics.
/api/management/keys/:id/children/:childIdUpdate limits, RPM, or status of a child key.
/api/management/keys/:id/children/:childIdDeactivate child key (soft delete).
Account
/api/balanceCurrent balance
{
"balance_ngonka": "11999976",
"balance_usd": 0.008,
"cost_per_token_ngonka": 1,
"tokens_remaining": 11999976
}/api/keysList of API keys
/api/keysCreate API key
/api/keys/:idDelete API key
Billing
/api/usageUsage statistics
Query: period=day|week|month&tz=-180
{
"period": "month",
"usage": [{
"date": "2026-03-20",
"requests": 42,
"tokens": 18500,
"costNgonka": "22200"
}]
}/api/depositsDeposit history
Query: limit=50&offset=0&from=2026-03-01&to=2026-03-21
{
"deposits": [{
"id": "abc-123",
"type": "DEPOSIT_GNK",
"amountNgonka": "10000000",
"description": "GNK deposit via memo",
"createdAt": "2026-03-20T12:00:00Z"
}],
"total": 3
}/api/transactionsTransaction history
Query: limit=50&offset=0&type=INFERENCE&from=2026-03-01&to=2026-03-21
{
"transactions": [{
"id": "def-456",
"type": "INFERENCE",
"amountNgonka": "-1200",
"feeNgonka": "120",
"description": null,
"createdAt": "2026-03-20T14:30:00Z"
}],
"total": 128
}/api/pricingRates and fees (public, without authorization)
{
"deposit_usdt_fee_percent": 5,
"deposit_gnk_fee_percent": 0,
"usage_fee_percent": 10,
"withdrawal_fee_percent": 5,
"gnk_usd_price": 0.3465
}Streaming & Errors
With stream: true, the response comes in chunks via SSE (Server-Sent Events).
OpenAI (stream: true)
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":"!"}}]}
data: {"choices":[],"x_joingonka":{"cost_ngonka":"24"}}
data: [DONE]Anthropic (stream: true)
event: message_start
data: {"type":"message_start","message":{...}}
event: content_block_delta
data: {"type":"content_block_delta","delta":{"type":"text_delta","text":"Hello"}}
event: message_stop
data: {"type":"message_stop"}Errors
// 400 — неверный запрос
{"error": {"message": "...", "type": "invalid_request_error"}}
// 401 — не авторизован
{"error": {"message": "...", "type": "authentication_error"}}
// 402 — недостаточный баланс
{"error": {"message": "...", "type": "insufficient_funds", "balance_ngonka": "0"}}
// 429 — rate limit
{"error": {"message": "...", "type": "rate_limit_error"}}
// 502 — ошибка сети Gonka
{"error": {"message": "...", "type": "api_error"}}Models
The Gonka network supports multiple models via a single API — the current list can always be retrieved by a GET /v1/models request. To select a model, pass its ID in the model field of the request body.
| Model | Vendor | Context | Max output | VRAM | Status |
|---|---|---|---|---|---|
| Loading models... | |||||
By default (if model is not specified), the network's flagship model is used. The current list with metadata — GET /v1/models.
The current list of models with all metadata - GET /v1/models. Vision and multimodal input (image_url) are not yet supported by the upstream Gonka network.
Rates and fees
Full transparency: all gateway fees are below. Current values are loaded live from the API — the public endpoint GET /api/pricing is available without authorization.
| Operation | Fee | Note |
|---|---|---|
| Inference markup | 10% | Platform markup above the Gonka network price — the gateway's main source of revenue. Charged per request alongside the token cost. |
| Deposit via USDT | 5% | Charged by the payment provider when paying with crypto (USDT). |
| Deposit via GNK | free | Direct on-chain GNK transfer is credited without gateway fees. |
| Withdrawal | 5% | Charged when withdrawing GNK to an external address. Withdrawal is processed manually within 24–48 hours. |
| Current GNK price | $0.3465 | The GNK/USD rate used to calculate deposits and balance. Updated automatically. |
Limits
Models: All Gonka network models (DevShards multi-model architecture)
Request limit: with API key, the number of requests is not strictly limited (limited by network concurrency); without a key — 20/day per IP (anti-spam)
Max tokens: up to 8192 tokens per request (gateway clips at 8192; all available models support this). For long responses, use stream:true to avoid timeouts.
Streaming: supported (SSE, stream: true)