caft/docs
Dashboard

API reference

OpenAI Chat Completions, JSON over HTTPS.

SettingValue
Base URLhttps://api.caft.dev/v1
AuthenticationAuthorization: Bearer $CAFT_API_KEY

List models

GET /models returns the model IDs your key can use, in OpenAI format. It needs a key.

Shell
curl https://api.caft.dev/v1/models \
  -H "Authorization: Bearer $CAFT_API_KEY"

IDs have no vendor prefix, such as glm-5.3-flash. Use them exactly as listed. Prices and context lengths are on the Models page.

Create a chat completion

POST /chat/completions, streaming or not.

Shell
curl https://api.caft.dev/v1/chat/completions \
  -H "Authorization: Bearer $CAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": true
  }'

model and messages are required. The standard OpenAI parameters pass through to the model: stream, stream_options, max_tokens, temperature, top_p, stop, seed, tools, tool_choice, response_format, reasoning_effort and so on.

Support varies by model. A parameter a model doesn't accept returns HTTP 400 invalid_request; remove it and retry. Send the full conversation in messages each time; nothing is stored between requests.

Streaming

With stream: true the response is server-sent events. Read text from choices[0].delta.content and tool calls from choices[0].delta.tool_calls. A complete stream ends with data: [DONE]. Add "stream_options": {"include_usage": true} for a final event with token counts.

Tool calls

Read the function name and arguments from tool_calls. Send the result back as a tool message with the matching tool_call_id, after the assistant message that made the call.

Other endpoints

Balance and usage are in Balance and usage. Unsupported paths return HTTP 404 unknown_endpoint. For clients that need the Responses API or Anthropic Messages (Codex, Claude Code), use a local translating router; see Coding agents.

x402 top-ups, for agents paying from a wallet: POST https://caft.dev/api/x402/topup?amount_usd=<amount> to pay, and GET https://caft.dev/api/x402 for discovery (enabled state, networks, amount band, the register endpoint). These are served from https://caft.dev, not api.caft.dev. See Pay with x402.

Register by paying: POST https://caft.dev/api/x402/register?amount_usd=<amount> with a payment header and no Authorization header opens an account for the paying wallet. Manage its keys at POST https://caft.dev/api/wallet/keys with a signed SIWE message whose statement names the action (action: create, list or revoke). See Wallet accounts.