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

CLI cheat sheet

Everything with curl alone. Put KOTOBA_API_TOKEN in the environment first.

Catalog and state
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
Completion
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 @-
Tool calling
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'
Job API (poll it yourself)
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)
Reading an answer
... | jq '{text:.choices[0].message.content, billing, charged:.chargedMicroUSD, usage}'
# billing: "free" | "paid" · charged only on paid · usage only on paid

Errors come as {"error":{"code":…}}; every code is on the Errors page. Resending the same body re-attaches to the same job (never charged twice).