clawcu Docs 简 繁 ID

Docs / Model API

Model API guide

One base_url for every model on sale, OpenAI-compatible: swap the base_url and key in your SDK and you're done. The model list, context windows and prices always follow the console (the Models page and the rate card on the Billing page).

Quick Start

Create a key on the API Keys page, then choose an example below to make your first call. Replace sk-your-key with your key.

SDK / HTTP

CURL

curl https://token.clawcu.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-flash",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Python (openai SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://token.clawcu.ai/v1",
    api_key="sk-your-key",
)

resp = client.chat.completions.create(
    model="deepseek-flash",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

Node.js (openai SDK)

Save as hello.mjs, run npm install openai, then node hello.mjs:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://token.clawcu.ai/v1",
  apiKey: "sk-your-key",
});

const resp = await client.chat.completions.create({
  model: "deepseek-flash",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);

OpenAI-compatible endpoint

Base URLhttps://token.clawcu.ai/v1
Auth headerAuthorization: Bearer sk-…
Getting a keyCreate one yourself in the console under API Keys; the plaintext is shown only once, at creation
Key lifetime365 days, after which requests are rejected. Revoke it and create a new one (keys don't auto-renew)
The sk-… on this page is the key for calling models. It is not interchangeable with your console password or with tokens from other platforms.

Anthropic-compatible endpoint

The same key also serves the Anthropic Messages API shape (Claude Code / Anthropic SDK): point the SDK's base URL at https://token.clawcu.ai — it appends /v1/messages itself.

EndpointPOST /v1/messages; stream: true streams over SSE
Auth headerx-api-key: sk-… (what Claude Code sends); Authorization: Bearer sk-… also works
ModelsAny model on sale — requests are translated, so it is not limited to Claude models

Supported endpoints

MethodPathDescription
GET/v1/modelsLists the models and capability fields available to this key (call it with the same key)
POST/v1/chat/completionsChat completions, the main endpoint; stream: true streams over SSE
POST/v1/responsesOpenAI Responses API (Codex CLI's default; verified with the real CLI)
POST/v1/messagesAnthropic Messages API (Claude Code / Anthropic SDK); stream: true streams over SSE. Setup: see the Anthropic-compatible endpoint block above
POST/v1/embeddingsEmbeddings; available models: text-embedding-v3, text-embedding-v4, qwen3.7-text-embedding, qwen3.7-text-embedding-flash (billed per input token)
POST/v1/systemoneTypeSafe Jev decision model (send a state and a question, get probabilities; not a chat endpoint). See the separate guide ↗

Available models

The live list from GET /v1/models is authoritative: it returns the models currently available to your account, with exact context windows and image support. Put the model ID from that list into the request's model field as is; you don't need a different key per model.

The specs shown on our pages (1M context; 384K max output for DeepSeek, 128K for Kimi and GLM) are headline figures; /v1/models has the exact values.

Coding and agent tools

Create a key on the API Keys page of the console and put it in the CLAWCU_LLM_KEY environment variable — every example below reads it from there:

export CLAWCU_LLM_KEY=sk-your-key

Windows (PowerShell)

$env:CLAWCU_LLM_KEY="sk-your-key"

Install, configure and verify commands for Codex CLI, Claude Code, OpenCode, OpenClaw and Hermes Agent are all below, each tested as written in a clean Docker environment. Claude Code uses the Anthropic-compatible address https://token.clawcu.ai; the others use https://token.clawcu.ai/v1. Each tool also has its own page under Tool setup on the docs home page.

Codex CLI

Codex uses the OpenAI Responses protocol. The one-line script is recommended: it writes the gateway config and installs a model catalog so Codex knows each model's context window.

Install

npm install -g @openai/codex

Configure

Recommended: the one-line script (with CLAWCU_LLM_KEY set, --model kimi-k3 --yes skips the questions; leave them off to be asked step by step).

macOS / Linux

bash <(curl -fsSL https://docs.clawcu.ai/clawcu-codex-setup.sh) --model kimi-k3 --yes

Windows (PowerShell)

irm https://docs.clawcu.ai/clawcu-codex-setup.ps1 | iex

Run the script again to switch models; pick r in its menu to restore your previous config.

Verify

codex exec --skip-git-repo-check "Reply with exactly: OK"

Full steps, everyday use and FAQ: Codex CLI setup page.

Claude Code

Claude Code speaks the Anthropic protocol. Point it at clawcu and swap the model for Kimi, GLM or DeepSeek — everything else works as before.

Install

npm install -g @anthropic-ai/claude-code

Configure

Set the environment variables: kimi-k3 as the main model, the cheaper deepseek-flash for background work (the Haiku tier and subagents).

macOS / Linux

export ANTHROPIC_BASE_URL=https://token.clawcu.ai
export ANTHROPIC_AUTH_TOKEN=$CLAWCU_LLM_KEY
export ANTHROPIC_MODEL=kimi-k3
export ANTHROPIC_DEFAULT_OPUS_MODEL=kimi-k3
export ANTHROPIC_DEFAULT_SONNET_MODEL=kimi-k3
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-flash

Windows (PowerShell)

$env:ANTHROPIC_BASE_URL="https://token.clawcu.ai"
$env:ANTHROPIC_AUTH_TOKEN=$env:CLAWCU_LLM_KEY
$env:ANTHROPIC_MODEL="kimi-k3"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k3"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k3"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-flash"
$env:CLAUDE_CODE_SUBAGENT_MODEL="deepseek-flash"

Or put them in the env block of ~/.claude/settings.json so every terminal picks them up (replace sk-your-key with your key):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://token.clawcu.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "kimi-k3",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-flash",
    "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-flash"
  }
}

Verify

claude -p "Reply with exactly: OK"

Full steps, everyday use and FAQ: Claude Code setup page.

OpenCode

OpenCode connects to custom providers over the OpenAI-compatible protocol. Add a clawcu provider to its config and switch between the models with /models.

Install

npm install -g opencode-ai

Configure

Write the config (the key is referenced as {env:CLAWCU_LLM_KEY} and read at runtime, never written to disk):

mkdir -p ~/.config/opencode
cat > ~/.config/opencode/opencode.json <<'EOF'
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "clawcu": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "clawcu",
      "options": { "baseURL": "https://token.clawcu.ai/v1", "apiKey": "{env:CLAWCU_LLM_KEY}" },
      "models": {
        "kimi-k3": { "name": "Kimi K3" },
        "glm-5.3": { "name": "GLM-5.3" },
        "deepseek-flash": { "name": "DeepSeek V4.1 Flash" }
      }
    }
  },
  "model": "clawcu/kimi-k3"
}
EOF

On Windows the file is %USERPROFILE%\.config\opencode\opencode.json with the same JSON (between cat … EOF). If you already have a config, merge in provider.clawcu.

Verify

opencode run "Reply with exactly: OK"

Full steps, everyday use and FAQ: OpenCode setup page.

OpenClaw

OpenClaw connects to clawcu as a custom provider. The steps below use one non-interactive command; you can also run openclaw onboard and choose Custom Provider with the same URL, key and model.

Install

npm install -g openclaw

Configure

Connect clawcu (--skip-health skips the background-service check; to keep OpenClaw running in the background, use --install-daemon instead):

openclaw onboard --non-interactive --accept-risk --skip-health \
  --auth-choice custom-api-key --custom-provider-id clawcu \
  --custom-base-url https://token.clawcu.ai/v1 --custom-api-key "$CLAWCU_LLM_KEY" \
  --custom-model-id kimi-k3 --custom-compatibility openai --custom-text-input

Add the full model list and raise the context window (the wizard registers a single model with a 128K context by default):

openclaw config patch --stdin <<'EOF'
{ models: { providers: { clawcu: { models: [
  { id: "kimi-k3", name: "Kimi K3", contextWindow: 1000000, maxTokens: 32768, input: ["text", "image"] },
  { id: "glm-5.3", name: "GLM-5.3", contextWindow: 1000000, maxTokens: 32768, input: ["text"] },
  { id: "deepseek-flash", name: "DeepSeek V4.1 Flash", contextWindow: 1000000, maxTokens: 32768, input: ["text", "image"] }
] } } } }
EOF

The key is saved in ~/.openclaw/openclaw.json — keep that file out of repositories and don't share it.

Verify

openclaw agent --local -m "Reply with exactly: OK"

Full steps, everyday use and FAQ: OpenClaw setup page.

Hermes Agent

Hermes connects to clawcu as a custom endpoint. The four commands below do the same as choosing Custom endpoint in the hermes model wizard and filling in the URL, model and key.

Install

Official install script (only Git is required; on Windows, follow these steps inside WSL2):

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
export PATH="$HOME/.local/bin:$PATH"

Configure

Write the key as '${CLAWCU_LLM_KEY}' (single quotes, stored as-is); Hermes reads the environment variable at runtime, so the plaintext never lands in the config file:

hermes config set model.provider custom
hermes config set model.base_url https://token.clawcu.ai/v1
hermes config set model.default kimi-k3
hermes config set model.api_key '${CLAWCU_LLM_KEY}'

Verify

hermes -z "Reply with exactly: OK"

Full steps, everyday use and FAQ: Hermes Agent setup page.

Streaming

Add "stream": true to the request body to stream over SSE. For long contexts and reasoning models we recommend always streaming:

Rate limits and concurrency

Per key5 req/s (burst 30) · 32 concurrent · 10M tokens per minute
Per source IP20 req/s (burst 40), counted by your real egress IP
Over the limitReturns 429 with Retry-After; retry with exponential backoff

These are guaranteed minimums: the gateway runs several replicas that each count separately, so the rate and concurrency you can actually reach are usually higher, but please size your concurrency and retries to the table above. People at the same company behind one egress IP share the per-source-IP allowance. When an upstream provider rate-limits or fails, the gateway automatically cools that route down and sends requests to the next one.

Error codes

StatusMeaning and what to do
400Invalid request body (missing fields, or the model doesn't support a parameter)
401Key invalid / revoked / expired: create a new one under API Keys
402Insufficient balance: top up on the Billing page and service resumes automatically
403The model isn't in your account's available set (see /v1/models)
404The path or model ID doesn't exist
429Rate limited: back off per Retry-After and retry
5xxGateway or upstream error, safe to retry; if it keeps failing, contact us

Billing and usage

Security practices

FAQ

Why does my request get cut off after 60 seconds?

Most likely a non-streaming request hit the CDN's time-to-first-byte limit. Add "stream": true.

Can I call it over plain HTTP without an SDK?

Yes. Any client that can send HTTPS works: set the auth header correctly and send an OpenAI-shaped JSON body.

Do the model list and prices change?

Yes. We follow upstream changes; the live Models and Billing pages in the console are authoritative.