Dokumentasyon
Mabilis na Pagsisimula
Sinusuportahan ng JoinGonka Gateway ang OpenAI at Anthropic API para ma-access ang mga modelong Gonka. Palitan ang base_url sa iyong kliyente — at gumagana na ang lahat.
Base URL: https://gate.joingonka.ai/v1
Modelo: MiniMaxAI/MiniMax-M2.7
Awtorisasyon: 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)
Ang JoinGonka Gateway ay natively sumusuporta sa Anthropic Messages API (/v1/messages). Ang Claude Code, Anthropic SDK at anumang mga tool na gumagamit ng Anthropic format ay gumagana nang direkta — walang 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?"}]
}'Parehong format (OpenAI at Anthropic) ay gumagamit ng isang API key at isang balanse.
Mga API Endpoint
Inference
/v1/chat/completionsPaggawa ng sagot — OpenAI format (sinusuportahan ang streaming)
{
"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/messagesPaggawa ng sagot — 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/modelsListahan ng mga available na modelo
{
"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
}
}]
}Mga Plugin
Pinapalawak ng mga plugin ang mga kakayahan ng API. Ipasa ang array ng plugins sa kahilingan para sa activation.
/v1/pluginsListahan ng mga available na plugin
{
"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"}
]
}Paggamit sa Kahilingan
{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [{"role": "user", "content": "..."}],
"plugins": ["response-healing", "privacy-sanitization"]
}web
Web search nang direkta sa loob ng mga modelong Gonka. Ang mga modelo mismo (Kimi, MiniMax, DeepSeek) ay walang search functionality; ang gateway ang naglalagay ng mga sariwang resulta mula sa internet sa context at nagbabalik ng source citations. Gumagana sa parehong stream at non-stream mode. Ang backend ay self-hosted: ang mga request ay hindi ipinapadala sa mga third-party search API gamit ang iyong account.
Paraan 1 – ang web object sa array ng plugins (pag-inject ng mga resulta na may mga opsyon):
{
"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:"
}]
}Paraan 2 – agent mode (mode: "agent"): ang modelo mismo ang tatawag sa web_search kapag kailangan lang ang paghahanap:
{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [{"role": "user", "content": "What's new in the Gonka network?"}],
"plugins": [{ "id": "web", "mode": "agent", "max_searches": 3 }]
}Mga opsyon: max_results — dami ng mga resulta (default ay 5, limitasyon ay 10); search_prompt — sarili mong paggabay na prompt (grounding prompt) bago ang mga resulta.
Pinapayaman ang response ng annotations[].url_citation (url, title) — pamantayan ng OpenRouter:
{
"choices": [{
"message": {
"role": "assistant",
"content": "...",
"annotations": [{
"type": "url_citation",
"url_citation": {
"url": "https://gonka.ai/...",
"title": "Gonka Network"
}
}]
}
}]
}Pagpepresyo: mode plugins:[{ "id": "web" }] — para lamang sa mga token (ang mga idinagdag na resulta ay binibilang bilang normal na prompt-tokens). Agent mode (mode: "agent") — mga token ng lahat ng hakbang ng cycle plus dagdag na 1000 nGNK sa bawat web_search call (≈ $0.0001 para sa 1000 na paghahanap sa rate na ~$0.15 bawat GNK).
Hindi tugma sa privacy-sanitization: ibabalik ang 400 sa magkasamang hiling.
response-healing
Awtomatikong pag-aayos ng pinutol na JSON/structured output. Gumagana lamang para sa mga non-streaming na kahilingan na may nilalaman na JSON.
privacy-sanitization
Pagmamaskara ng sensitibong data (mga API key, email, IP address, JWT, numero ng card) sa mga mensahe bago ipadala sa modelo.
Mga mode: redact (palitan ng [REDACTED]) o tokenize (palitan ng [TOKEN_001]). Ipasa ang privacy_mode sa body.
file-parser
Pagkuha ng text mula sa mga PDF-dokumento. Sinusuportahan ang data:application/pdf;base64,... at raw base64.
Management Keys
Hierarchical API-keys para sa SaaS-integrations. Ang Management key (gm-) ay gumagawa ng child keys (gc-) na may mga limitasyon at TTL.
/api/management/keysGumawa ng management key (prefix gm-). Ginagamit lamang para sa pamamahala ng mga child key.
/api/management/keys/:id/childrenGumawa ng child key (prefix gc-) na may opsyonal na mga limitasyon. Ang pagsingil ay binabawasan mula sa balanse ng may-ari ng management key.
{
"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/childrenListahan ng mga child key na may statistics ng paggamit.
/api/management/keys/:id/children/:childIdI-update ang mga limitasyon, RPM o status ng child key.
/api/management/keys/:id/children/:childIdI-deactivate ang child key (soft delete).
Account
/api/balanceKasalukuyang balanse
{
"balance_ngonka": "11999976",
"balance_usd": 0.008,
"cost_per_token_ngonka": 1,
"tokens_remaining": 11999976
}/api/keysListahan ng mga API key
/api/keysGumawa ng API key
/api/keys/:idTanggalin ang API key
Billing
/api/usageStatistics ng paggamit
Query: period=day|week|month&tz=-180
{
"period": "month",
"usage": [{
"date": "2026-03-20",
"requests": 42,
"tokens": 18500,
"costNgonka": "22200"
}]
}/api/depositsKasaysayan ng mga deposito
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/transactionsKasaysayan ng mga transaksyon
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/pricingMga Rate at Fee (pampubliko, walang 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
Kapag stream: true, ang sagot ay dumarating sa mga chunks sa pamamagitan ng 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"}Mga Error
// 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"}}Mga Modelo
Ang Gonka network ay naghahain ng maramihang modelo sa pamamagitan ng isang API — ang kasalukuyang listahan ay laging makukuha sa pamamagitan ng GET /v1/models request. Upang pumili ng modelo — ipasa ang ID nito sa field na model ng request body.
| Modelo | Vendor | Konteksto | Max output | VRAM | Status |
|---|---|---|---|---|---|
| MiniMax M2.7 | MiniMax | 195K | 8K | 320 GB | Available |
| Kimi K2.6 | Moonshot AI | 195K | 8K | 720 GB | Available |
| DeepSeek V4 Flash | DeepSeek | 371K | 32K | 280 GB | Available |
Bilang default (kung hindi tinukoy ang model), ginagamit ang flagship na modelo ng network. Ang kasalukuyang listahan na may metadata — GET /v1/models.
Ang kasalukuyang listahan ng mga modelo na may lahat ng metadata – GET /v1/models. Ang Vision at multimodal-input (image_url) ay hindi pa sinusuportahan ng upstream Gonka network.
Mga Rate at Fee
Ganap na transparency: nasa ibaba ang lahat ng fee ng gateway. Ang mga live na value ay kinukuha mula sa API — ang pampublikong endpoint na GET /api/pricing ay available nang walang authorization.
| Operasyon | Fee | Tandaan |
|---|---|---|
| Markup sa inference | 10% | Markup ng platform sa ibabaw ng presyo ng Gonka network — ang pangunahing pinagmumulan ng kita ng gateway. Ibinabawas sa bawat request kasama ang halaga ng mga token. |
| Pag-top up gamit ang USDT | 5% | Ibinabawas ng payment provider kapag nagbabayad gamit ang crypto (USDT). |
| Pag-top up gamit ang GNK | libre | Ang direktang GNK on-chain transfer ay iko-credit nang walang gateway fee. |
| Pag-withdraw ng Pondo | 5% | Ibinabawas kapag nagwi-withdraw ng GNK papunta sa panlabas na address. Ang pag-withdraw ay manu-manong pinoproseso sa loob ng 24–48 oras. |
| Kasalukuyang Presyo ng GNK | $0.147 | Ang GNK/USD rate kung saan kinakalkula ang mga deposit at balanse. Awtomatiko itong ina-update. |
GET /api/pricing
Mga Limitasyon
Mga Modelo: Lahat ng modelo ng network ng Gonka (DevShards multi-model architecture)
Limitasyon ng kahilingan: kapag may API key, ang dami ng requests ay walang nakapirming limitasyon (nililimitahan ng concurrency ng network); kapag walang key — 20/araw bawat IP (anti-spam)
Max. tokens: hanggang 32,768 tokens bawat request para sa DeepSeek V4 Flash at hanggang 8,192 para sa ibang mga model (ang mga value na lalampas sa limit ay pinuputol ng gateway). Para sa mahahabang sagot, gamitin ang stream:true para maiwasan ang mga timeout.
Streaming: sinusuportahan (SSE, stream: true)
Timeout ng network: Kung tinanggap ng network ng Gonka ang request ngunit hindi sumagot sa loob ng 300 segundo, ang request ay matatapos na may 504 error, at ang processing ng prompt ay ibabawas batay sa estimate: ang request na tinanggap ng network ay hindi maaaring kanselahin, ang node ay ipoproseso ito sa anumang paraan. Ang Completion ay hindi sisingilin kapag may timeout. Para sa mahabang generation, gamitin ang stream:true.