本文へ移動
メイン ドキュメント
ドキュメント

CLI 早見表

curl だけで一通り。KOTOBA_API_TOKEN を環境に置いてから。

カタログと状態
curl -s https://api.kotoba.cloud/v1/models -H "Authorization: Bearer $KOTOBA_API_TOKEN"
curl -s https://api.kotoba.cloud/v1/research/status -H "Authorization: Bearer $KOTOBA_API_TOKEN"        # eligible / pending + reason
curl -s https://api.kotoba.cloud/v1/billing/status -H "Authorization: Bearer $KOTOBA_API_TOKEN"         # plan + balances
curl -s https://api.kotoba.cloud/v1/secure                          # guardrail / firewall / compliance versions
補完
curl -s -X POST https://api.kotoba.cloud/v1/chat/completions -H "Authorization: Bearer $KOTOBA_API_TOKEN" -H "content-type: application/json" \
  -d '{"model":"qwen3.8-flash-next-whitehacker","max_tokens":2048,"messages":[{"role":"user","content":"Review this: ..."}]}'

# stream (one-chunk SSE)
curl -sN -X POST https://api.kotoba.cloud/v1/chat/completions -H "Authorization: Bearer $KOTOBA_API_TOKEN" -H "content-type: application/json" \
  -d '{"model":"qwen3.8-flash-next-whitehacker","stream":true,"messages":[{"role":"user","content":"..."}]}'

# with a file as context (JSON-escape it with jq)
jq -n --arg m "qwen3.8-flash-next-whitehacker" --rawfile f src/auth.ts '{model:$m,max_tokens:4096,messages:[{role:"user",content:("Review for auth bypasses:\n"+$f)}]}' \
  | curl -s -X POST https://api.kotoba.cloud/v1/chat/completions -H "Authorization: Bearer $KOTOBA_API_TOKEN" -H "content-type: application/json" -d @-
ツール呼び出し
curl -s -X POST https://api.kotoba.cloud/v1/chat/completions -H "Authorization: Bearer $KOTOBA_API_TOKEN" -H "content-type: application/json" -d '{
  "model":"qwen3.8-flash-next-whitehacker","max_tokens":2048,"tool_choice":"auto",
  "tools":[{"type":"function","function":{"name":"read_file","parameters":{"type":"object","properties":{"path":{"type":"string"}}}}}],
  "messages":[{"role":"user","content":"Review src/auth.ts"}]}' | jq '.choices[0].message.tool_calls'
ジョブ API(自分で poll する)
ID=$(uuidgen | tr A-Z a-z)
curl -s -X POST https://api.kotoba.cloud/v1/research/jobs -H "Authorization: Bearer $KOTOBA_API_TOKEN" -H "content-type: application/json" -H "idempotency-key: $ID" \
  -d '{"model":"qwen3.8-flash-next-whitehacker","task":"code-review","scopeId":"owned","max_tokens":2048,"messages":[{"role":"user","content":"..."}]}'
curl -s "https://api.kotoba.cloud/v1/research/job?jobId=$ID" -H "Authorization: Bearer $KOTOBA_API_TOKEN"   # 202 queued/running · 200 succeeded (content / toolCalls)
応答の読み方
... | jq '{text:.choices[0].message.content, billing, charged:.chargedMicroUSD, usage}'
# billing: "free" | "paid" · charged only on paid · usage only on paid

エラーは {"error":{"code":…}}。全 code は Errors の頁。同じ本文の再送は同じジョブに再接続します(二重課金なし)。