API429 / API reference

Claude models through API429

Claude on API429: available models, the Anthropic-compatible Messages API, prompt-cache rates, web search and headers for long workloads.

Reference version 3.31.0 · revised · the same text in the client portal

Claude models are available through two public API surfaces:

Surface Endpoint Auth Use when
OpenAI-compatible POST /v1/chat/completions Authorization: Bearer <token> Your client already uses OpenAI Chat Completions or Responses-style tooling.
Anthropic-compatible POST /v1/messages x-api-key: <token> Your client already uses Anthropic Messages API / Anthropic SDK shape and you want to change only the base URL and token.

Use the canonical claude-* model IDs below for public integrations.

All Claude models listed here support chat, streaming, tool calling, web search and vision/image input unless otherwise noted. Vision means text + image input with text output; these models do not generate images.

Available Models

Model IDs use dash separators. Dotted aliases are accepted for compatibility, but new integrations should send the canonical model ID from the first column. The -1m / [1m] Opus IDs are retired (see "Retired model IDs"); 1M context is not a separate model ID. The prices below are API429 list prices per 1 million tokens before your client-level discount. Prompt-cache tokens are billed as described in Prompt-cache rates for Claude models.

Model ID Accepted Alias(es) Input $/1M Output $/1M Context Best For
claude-fable-5 — $10.00 $50.00 1M Most capable Claude model for the hardest reasoning and long-horizon work
claude-opus-5 — $5.00 $25.00 1M Newest Opus for demanding reasoning, coding and analysis
claude-sonnet-5 claude-sonnet-5.0 $2.00 $10.00 1M Newest Sonnet for coding, agents and professional work
claude-opus-4-8 claude-opus-4.8 $5.00 $25.00 1M Highest quality reasoning, coding, analysis
claude-opus-4-7 claude-opus-4.7 $5.00 $25.00 1M Highest quality reasoning, coding, analysis
claude-opus-4-6 claude-opus-4.6 $5.00 $25.00 1M Complex analysis and long-form work
claude-sonnet-4-6 claude-sonnet-4.6 $3.00 $15.00 1M Balanced intelligence, speed and cost
claude-haiku-4-5-20251001 claude-haiku-4-5, claude-haiku-4.5 $1.00 $5.00 200k Lowest latency and lowest cost Claude model

You can also call GET /v1/models with your API key to see the exact Claude models enabled for your token. A model that cannot be served at the moment (for example a -1m ID) is temporarily hidden there and reappears automatically.

Anthropic-compatible Messages API

Use this endpoint when your code already targets Anthropic's Messages API. The request body and response body follow the Anthropic Messages shape.

POST https://gateway.api429.com/v1/messages

Required headers:

x-api-key: YOUR_API_KEY
content-type: application/json
anthropic-version: 2023-06-01

anthropic-version is accepted for SDK compatibility and may be omitted; when it is omitted API429 forwards 2023-06-01 upstream.

cURL

curl -X POST https://gateway.api429.com/v1/messages -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" -H "anthropic-version: 2023-06-01" --data @payload.json

payload.json:

{
  "model": "claude-sonnet-5",
  "max_tokens": 512,
  "system": "You are a concise technical assistant.",
  "messages": [
    {"role": "user", "content": "Explain Mutex vs RwLock in Rust."}
  ]
}

Response

{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-5",
  "content": [
    {"type": "text", "text": "..."}
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 23,
    "output_tokens": 87
  }
}

Native streaming

Set "stream": true on /v1/messages to receive Anthropic-style SSE events:

curl -N -X POST https://gateway.api429.com/v1/messages -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" -H "anthropic-version: 2023-06-01" --data @payload.json

payload.json:

{
  "model": "claude-sonnet-5",
  "max_tokens": 512,
  "stream": true,
  "messages": [
    {"role": "user", "content": "Write a haiku about Rust."}
  ]
}

Events arrive in Anthropic order:

message_start
content_block_start
content_block_delta
content_block_stop
message_delta
message_stop

Anthropic may also send ping events between content events. Usage is split across the stream: message_start includes input usage, and message_delta includes final output usage.

Native request fields

Field Type Required Notes
model string Yes Use a Claude model ID from GET /v1/models.
messages array Yes Anthropic message list: role is user or assistant; content may be a string or content blocks.
max_tokens integer Yes Maximum output tokens.
system string or array No System prompt, including content blocks with cache_control where supported upstream.
stream boolean No Returns Anthropic SSE events when true.
temperature number No Sampling temperature.
tools array No Anthropic tool-use format, including server tools.
stop_sequences array No Anthropic stop sequences.

Native usage and billing

Native responses expose Anthropic-style usage:

{
  "usage": {
    "input_tokens": 123,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 45
  }
}

These numbers are also recorded in API429 usage analytics and billing. For Claude requests, billable input tokens are:

input_tokens + cache_creation_input_tokens + cache_read_input_tokens

Billable output tokens are output_tokens. On the OpenAI-compatible surface, the same values are exposed as prompt_tokens, completion_tokens, and, when available, prompt_tokens_details.

If upstream returns prompt-cache fields such as cache_creation_input_tokens or cache_read_input_tokens, API429 passes them through in native usage and includes them in analytics. When those fields are absent, clients should bill and display the reported input_tokens / output_tokens values and use the client usage endpoints for the final charged amount.

Prompt-cache rates for Claude models

For every Claude model, prompt-cache tokens are billed at no more than:

Token class Rate
Cache read (cache_read_input_tokens, prompt_tokens_details.cached_tokens) the model's cache-read rate, a fraction of its input price: 0.05× for Claude Opus 5.5 and Sonnet 5.5
Cache write (cache_creation_input_tokens) up to 1.25× the model's input price

The input price is the one that applies to the request, including the long-context tier where a model has one. On some routes prompt caching is switched on automatically; cache writes there are billed at no more than the input price, so automatic caching never makes a request cost more than it would without it. Ordinary input and output prices are unchanged. The public catalog (GET /api/public/catalog) quotes the cache rates of each model in its cached_input_tokens and cache_write_input_tokens rows; the exact amount charged for each request is shown in the client usage endpoints.

From 2026-11-22 to 2026-11-23 cache reads on Claude models were billed at up to the full input price. That change has been reversed.

Repeated beginning of a request

Some routes do not report prompt caching. On those routes the gateway recognises a repeated beginning itself. When a chat request starts with the same tool definitions and messages that the same API key sent to the same model a short time ago, that part of the prompt is reported in usage.prompt_tokens_details.cached_tokens and billed at the model's cache-read rate.

How long a beginning is remembered and how long it must be follow the published prompt-caching rules of the model's vendor:

Models Remembered for Minimum repeated part
Claude 5 minutes; 1 hour when the request carries cache_control with "ttl": "1h" 512 tokens for Opus 5.5, Sonnet 5.5, Haiku 5.5, Opus 5 and Fable 5.x; 1,024 for Sonnet 5, Opus 4.8 and Sonnet 4.x; 2,048 for Opus 4.7; 4,096 for Opus 4.6, Opus 4.5 and Haiku 4.5
GPT 30 minutes (GPT-5.6 and later); 10 minutes for earlier models 1,024 tokens
Gemini 1 hour 4,096 tokens (2,048 for Gemini 2.5)
  • Every use renews the time. The first request of a series is billed as ordinary input; nothing extra is charged for it.
  • The match is exact and is counted at message boundaries: tool definitions first, then each message in order. Anything after the first difference is ordinary input.
  • A repeated part shorter than the minimum is billed as ordinary input.
  • A model without a cache-read rate is billed at its input price.

Google publishes no lifetime for automatic caching; one hour is the default lifetime of its explicit caches. This is a billing rule and does not change the answer. Keep stable content (instructions, reference material, tool definitions) at the beginning and put anything that changes (the date, the user's name, the new question) at the end.

Web search for Claude models

Claude models on this gateway accept Anthropic's stable web_search_20250305 server tool. On the Anthropic-compatible /v1/messages surface, this is a native Anthropic tool-use contract: the model may return stop_reason: "tool_use" with a content block of type tool_use, and the client continues the tool loop in the next request.

Declare it as:

{
  "model": "claude-sonnet-5",
  "messages": [{"role": "user", "content": "Latest Anthropic news?"}],
  "tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}]
}

For convenience the balancer also accepts two non-canonical input shapes and rewrites them automatically:

Sent by client Forwarded to Anthropic Notes
{"type": "web_search_preview"} (OpenAI Responses API style) web_search_20250305 OpenAI-only fields (search_context_size, user_location, include_domains, exclude_domains, search_content_types) are stripped — Anthropic 400s on unknown keys.
{"type": "web_search_20260209"} (newer Anthropic dated variant) web_search_20250305 name and max_uses are preserved. The newer variant is not yet broadly available, so the rewrite avoids a "tools unavailable" response.

The gateway forwards this server-tool declaration to the Claude route. On the OpenAI-compatible surface, the final shape is still a Chat Completions response and structured citation metadata is not exposed. On the Anthropic-compatible Messages surface, inspect returned tool_use content blocks and continue the native tool loop when the model stops with stop_reason: "tool_use".

Behaviour change (2026-04-25): Before this release, requests with web_search_preview were silently dropped at the balancer (model answered "I have no real-time access"). They now activate a real web search — the response text changes accordingly. Clients that passed web_search_preview "defensively" should remove it if they don't actually want search.

Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.api429.com/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain the difference between TCP and UDP."},
    ],
)
print(response.choices[0].message.content)

cURL (vision / image input)

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-8",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "Describe this image in one sentence."},
        {"type": "image_url", "image_url": {"url": "data:image/png;base64,BASE64_IMAGE"}}
      ]
    }],
    "max_tokens": 256
  }'

Python (Streaming, frontier model)

stream = client.chat.completions.create(
    model="claude-opus-4-7",
    messages=[{"role": "user", "content": "Write a Python async web scraper"}],
    stream=True,
)

finished = False
for chunk in stream:
    if getattr(chunk, "error", None):
        raise RuntimeError("Streaming generation failed; preserve partial output")
    for choice in chunk.choices:  # Usage-only chunks can have no choices.
        if choice.delta.content:
            print(choice.delta.content, end="", flush=True)
        reason = choice.finish_reason
        if reason in {"error", "length", "content_filter"}:
            raise RuntimeError("Generation failed, was truncated, or was filtered")
        if reason in {"stop", "tool_calls"}:
            finished = True
if not finished:
    raise RuntimeError("Stream ended without a terminal completion")

cURL (fastest / cheapest — Haiku snapshot)

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-haiku-4-5-20251001",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 256
  }'

Optional headers for batch / long-running Claude workflows

Two optional headers are useful for long-running Claude integrations. Clients that do not send them get normal synchronous behavior.

Header Endpoints Effect
X-Session-Key POST /v1/chat/completions, POST /v1/balancer/jobs/chat-completions Stable string per logical conversation. Helps API429 reuse server-side conversation/cache state across multi-turn batches. Tenant-namespaced server-side. Format: 1–256 chars [a-zA-Z0-9._/+-]. Full contract: client-facing X-Session-Key guide.
X-Async-Jobs-Optin: true POST /v1/chat/completions Allows API429 to move a non-streaming request into the durable jobs queue during overload. Normal success still returns 200 inline. If queued, the response is 202 with Location: /v1/balancer/jobs/{id}/result; poll that URL for the final result. Ignored for stream=true because jobs are non-streaming.

Recommended combo for batch screenwriter clients:

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Session-Key: scenario/iceberg/run-001/scene-3" \
  -H "X-Async-Jobs-Optin: true" \
  -d '{
    "model": "claude-sonnet-5.5",
    "messages": [{"role": "user", "content": "Draft scene 3 of the iceberg scenario."}]
  }'

Streaming note: plain Claude stream:true is token-progressive SSE. Jobs API responses are never streaming; use polling for durability.

Quickstart: the first request · Models and prices · Get an API key

Telegram