Claude-compatible

Active

Use Claude-compatible Messages and model listing routes where configured.

POST /v1/messages

Messages follows the Claude-compatible request shape and token168 account permissions. The example uses claude-opus-4-8 and includes the request fields accepted by the current Claude DTO.

Claude messages
curl https://www.token168.cc/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $TOKEN168_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-opus-4-8",
    "prompt": "",
    "system": [{"type": "text", "text": "You are concise."}],
    "messages": [{"role": "user", "content": [{"type": "text", "text": "Summarize this API."}]}],
    "cache_control": {"type": "ephemeral"},
    "inference_geo": "us",
    "max_tokens": 800,
    "max_tokens_to_sample": 800,
    "stop_sequences": ["END"],
    "temperature": 0.4,
    "top_p": 0.9,
    "top_k": 40,
    "stream": false,
    "tools": [{"name": "lookup", "input_schema": {"type": "object", "properties": {}}}],
    "context_management": {"type": "auto"},
    "output_config": {"type": "text"},
    "output_format": {"type": "text"},
    "container": {"id": "container_123"},
    "tool_choice": {"type": "auto"},
    "thinking": {"type": "enabled", "budget_tokens": 1024},
    "mcp_servers": [],
    "metadata": {"trace_id": "trace_123"},
    "speed": "standard",
    "service_tier": "default"
  }'

GET /v1/models

Send Claude-compatible headers when listing Claude-compatible models.

Claude model list
curl https://www.token168.cc/v1/models \
  -H "x-api-key: $TOKEN168_API_KEY" \
  -H "anthropic-version: 2023-06-01"