ドキュメント

クイックスタート

JoinGonka Gatewayは、GonkaモデルへのアクセスにOpenAIおよびAnthropic APIをサポートしています。 base_url をクライアントで置き換えるだけで、すべてが機能します。

ベースURL: https://gate.joingonka.ai/v1

モデル: MiniMaxAI/MiniMax-M2.7

認証: Bearer YOUR_API_KEY

Python (OpenAI SDK)

python
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)

typescript
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

bash
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は、Anthropic Messages API (/v1/messages) をネイティブにサポートしています。Claude Code、Anthropic SDK、およびAnthropic形式を使用するすべてのツールは、プロキシなしで直接動作します。

Claude Code

Recommended — set it up with one command (also configures OpenClaw and Cline):

bash
npx @joingonka/setup

Or configure it manually:

bash
export ANTHROPIC_BASE_URL=https://gate.joingonka.ai
export ANTHROPIC_API_KEY=YOUR_API_KEY
claude

Python (Anthropic SDK)

python
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)

bash
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?"}
    ]
  }'

ストリーミング (Python)

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)

ツール利用 (cURL)

bash
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?"}]
  }'

両方の形式 (OpenAIとAnthropic) は、1つのAPIキーと1つの残高を使用します。

APIエンドポイント

Inference

POST/v1/chat/completions

応答生成 — OpenAIフォーマット (ストリーミング対応)

json
{
  "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"
  }
}
POST/v1/messages

応答生成 — Anthropicフォーマット (ストリーミング、ツール使用)

json
{
  "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}
}
GET/v1/models

利用可能なモデルのリスト

json
{
  "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
    }
  }]
}

プラグイン

プラグインはAPIの機能を拡張します。アクティブ化するには、リクエストにplugins配列を渡してください。

GET/v1/plugins

利用可能なプラグインのリスト

json
{
  "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"}
  ]
}

リクエストでの使用

json
{
  "model": "MiniMaxAI/MiniMax-M2.7",
  "messages": [{"role": "user", "content": "..."}],
  "plugins": ["response-healing", "privacy-sanitization"]
}

web

Gonkaモデル内での直接的なウェブ検索。モデル自体(Kimi, MiniMax, DeepSeek)には検索機能はありませんが、gatewayがインターネットからの最新結果をコンテキストに注入し、ソースの引用を返します。streamおよびnon-streamの両方で動作します。バックエンドはself-hostedであり、リクエストはユーザーのアカウントを使用してサードパーティの検索APIに送信されることはありません。

方法 1 — plugins 配列内の web オブジェクト(オプション付きの結果注入):

json
{
  "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:"
  }]
}

方法 2 — エージェントモード (mode: "agent"):検索が必要な場合にのみモデル自身が web_search を呼び出します:

json
{
  "model": "MiniMaxAI/MiniMax-M2.7",
  "messages": [{"role": "user", "content": "What's new in the Gonka network?"}],
  "plugins": [{ "id": "web", "mode": "agent", "max_searches": 3 }]
}

オプション:max_results — 結果の数(デフォルト 5、上限 10)、search_prompt — 結果の前に追加する独自の grounding プロンプト。

レスポンスは annotations[].url_citation (url, title) で強化されます — OpenRouter 規格:

json
{
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "...",
      "annotations": [{
        "type": "url_citation",
        "url_citation": {
          "url": "https://gonka.ai/...",
          "title": "Gonka Network"
        }
      }]
    }
  }]
}

料金体系: plugins モード:[{ "id": "web" }] — トークンのみ(追加された結果は通常の prompt-tokens としてカウントされます)。エージェントモード (mode: "agent") — すべてのサイクルステップのトークンに加え、web_search 呼び出しごとに 1000 nGNK の追加料金(1000 回の検索につき ≈ $0.0001、レートは 1 GNK あたり ~$0.15)。

privacy-sanitization とは併用できません:両方を同時にリクエストすると 400 が返されます。

response-healing

切り詰められたJSON/構造化出力を自動的に修復します。ストリーミングなしのJSONコンテンツを含むリクエストのみに機能します。

privacy-sanitization

モデルに送信する前に、メッセージ内の機密データ (APIキー、メールアドレス、IPアドレス、JWT、カード番号) をマスクします。

モード:redact([REDACTED]に置き換え)またはtokenize([TOKEN_001]に置き換え)。bodyにprivacy_modeを渡します。

file-parser

PDFドキュメントからテキストを抽出します。data:application/pdf;base64,... および生のbase64をサポートします。

管理キー

SaaS統合用の階層的なAPIキー。管理キー(gm-)は、制限とTTLを持つ子キー(gc-)を作成します。

POST/api/management/keys

管理キー(プレフィックスgm-)を作成します。子キーの管理にのみ使用されます。

POST/api/management/keys/:id/children

オプションの制限を持つ子キー(プレフィックスgc-)を作成します。請求は管理キーの所有者の残高から差し引かれます。

json
{
  "name": "Client A",
  "limit_daily_ngonka": "1000000000",
  "limit_monthly_ngonka": "10000000000",
  "expires_at": "2026-04-01T00:00:00Z",
  "rate_limit_rpm": 30
}
GET/api/management/keys/:id/children

使用状況統計付きの子キーのリスト。

PUT/api/management/keys/:id/children/:childId

子キーの制限、RPM、またはステータスを更新します。

DELETE/api/management/keys/:id/children/:childId

子キーを無効にします(ソフト削除)。

Account

GET/api/balance

現在の残高

json
{
  "balance_ngonka": "11999976",
  "balance_usd": 0.008,
  "cost_per_token_ngonka": 1,
  "tokens_remaining": 11999976
}
GET/api/keys

APIキーのリスト

POST/api/keys

APIキーを作成

DELETE/api/keys/:id

APIキーを削除

Billing

GET/api/usage

使用統計

Query: period=day|week|month&tz=-180

json
{
  "period": "month",
  "usage": [{
    "date": "2026-03-20",
    "requests": 42,
    "tokens": 18500,
    "costNgonka": "22200"
  }]
}
GET/api/deposits

入金履歴

Query: limit=50&offset=0&from=2026-03-01&to=2026-03-21

json
{
  "deposits": [{
    "id": "abc-123",
    "type": "DEPOSIT_GNK",
    "amountNgonka": "10000000",
    "description": "GNK deposit via memo",
    "createdAt": "2026-03-20T12:00:00Z"
  }],
  "total": 3
}
GET/api/transactions

取引履歴

Query: limit=50&offset=0&type=INFERENCE&from=2026-03-01&to=2026-03-21

json
{
  "transactions": [{
    "id": "def-456",
    "type": "INFERENCE",
    "amountNgonka": "-1200",
    "feeNgonka": "120",
    "description": null,
    "createdAt": "2026-03-20T14:30:00Z"
  }],
  "total": 128
}
GET/api/pricing

料金と手数料(公開、認証なし)

json
{
  "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

stream: trueの場合、応答はSSE (Server-Sent Events) を介してチャンクで届きます。

OpenAI (stream: true)

text
data: {"choices":[{"delta":{"content":"Hello"}}]}

data: {"choices":[{"delta":{"content":"!"}}]}

data: {"choices":[],"x_joingonka":{"cost_ngonka":"24"}}

data: [DONE]

Anthropic (stream: true)

text
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"}

エラー

json
// 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"}}

モデル

Gonkaネットワークは単一のAPIを通じて複数のモデルをサポートしており、最新のリストはいつでもGET /v1/modelsリクエストで取得できます。モデルを選択するには、リクエストボディのmodelフィールドにそのIDを渡してください。

モデルベンダーコンテキスト最大出力VRAMステータス
MiniMax M2.7MiniMax195K8K320 GB利用可能
Kimi K2.6Moonshot AI195K8K720 GB利用可能
DeepSeek V4 FlashDeepSeek371K32K280 GB利用可能

デフォルトでは(modelが指定されていない場合)、ネットワークの主力モデルが使用されます。メタデータ付きの現在のリスト — GET /v1/models。

すべてのメタデータを含む現在のモデルリスト - GET /v1/models。ビジョンおよびマルチモーダル入力 (image_url) は、まだ Gonka アップストリームネットワークではサポートされていません。

料金と手数料

完全な透明性:以下はすべてのゲートウェイ手数料です。現在の値はAPIからリアルタイムでロードされます — 公開エンドポイント GET /api/pricing は認証なしで利用可能です。

操作手数料備考
推論マークアップ10%Gonkaネットワーク価格を超えるプラットフォームマークアップ — ゲートウェイの主な収入源。トークンコストとともに各リクエストから差し引かれます。
USDTによる入金5%暗号資産(USDT)での支払い時に決済プロバイダーによって差し引かれます。
GNKによる入金無料直接のオンチェーン(on-chain)GNK送金は、ゲートウェイ手数料なしで反映されます。
資金の出金5%外部アドレスへのGNKの出金時に差し引かれます。出金は24〜48時間以内に手動で処理されます。
現在のGNK価格$0.147入金と残高の計算に使用されるGNK/USDレート。自動的に更新されます。

GET /api/pricing

制限

モデル: すべての Gonka ネットワークモデル (DevShards マルチモデルアーキテクチャ)

リクエスト制限: APIキーがある場合、リクエスト数は固定で制限されません(ネットワークの並行システムによって制限されます)。キーがない場合 — IPあたり1日20回(スパム対策)

最大トークン: DeepSeek V4 Flash はリクエストごとに最大 32,768 トークン、その他のモデルは最大 8,192 トークンです(制限を超える値は gateway によってクリップされます)。長い応答の場合は、タイムアウトを避けるために stream:true を使用してください。

ストリーミング: サポート (SSE, stream: true)

ネットワークタイムアウト: Gonka ネットワークがリクエストを受信したにもかかわらず300秒以内に応答がない場合、リクエストは 504 エラーで終了し、プロンプト処理は見積もりに基づいて差し引かれます。ネットワークが一度受け入れたリクエストはキャンセルできず、ノードは必ず処理を行います。タイムアウト時の Completion は課金されません。長い生成を行う場合は stream:true を使用してください。