Anthropic Messages API

By Tokuse
APIAnthropicClaude Code
Read in other languages:한국어日本語

POST https://tokuse.com/v1/messages speaks the Anthropic Messages protocol. It exists mainly for Claude Code and other Anthropic SDK clients that cannot switch to the OpenAI chat shape.

Item Value
Method and path POST /v1/messages
Authentication Authorization: Bearer $TOKUSE_API_KEY or x-api-key: $TOKUSE_API_KEY
Claude Code base URL https://tokuse.com without /v1
Pricing Tokuse pricing and the upstream provider console

Endpoint and authentication

Send the key as either a Bearer token or an x-api-key header. Both are accepted, so a client that only supports one form still works. The Messages API also expects the anthropic-version header; the example uses the current date-based value.

Claude Code configuration

Claude Code appends /v1/messages to the base URL itself. Set ANTHROPIC_BASE_URL to the host root, not to the API path:

export ANTHROPIC_BASE_URL="https://tokuse.com"
export ANTHROPIC_AUTH_TOKEN="$TOKUSE_API_KEY"
export ANTHROPIC_MODEL="deepseek-flash"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-flash"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"

A base URL ending in /v1 produces a duplicated /v1/v1/messages path. If Claude Code returns 404s after setup, check that first.

Models and upstream routing

The endpoint routes to models exposed through your Tokuse account. The Claude Code guide uses deepseek-flash for normal and background work, with deepseek-v4-pro as the heavier option.

Tokuse can route Messages requests to Volcengine's /api/compatible upstream. That routing is handled by the gateway; the client still speaks the Anthropic protocol.

Request

curl https://tokuse.com/v1/messages \
  -H "x-api-key: $TOKUSE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-flash",
    "max_tokens": 512,
    "messages": [
      {"role": "user", "content": "Write a two-line release note for a routing change."}
    ]
  }'

Response

{
  "id": "msg_019a",
  "type": "message",
  "role": "assistant",
  "model": "deepseek-flash",
  "content": [
    {"type": "text", "text": "Requests now route through the updated gateway. No client changes are required."}
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 22
  }
}

Notes and limits

  • Use the root host for ANTHROPIC_BASE_URL; Claude Code adds the versioned path.
  • Some Anthropic-specific helpers may not exist on this route. Test the exact client workflow, including background model calls, before a full rollout.
  • Anthropic does not officially support Claude Code with non-Claude models. Treat the setup as an integration to verify in your own environment.

Billing

No fixed prices are listed here. Messages requests are billed by input and output tokens at the rates for the routed model. Use the Tokuse pricing page and the upstream provider console for current numbers; gateway rates are on /pricing.