Claude Sonnet 4.6 API

Call Claude Sonnet 4.6 with one TokenMilo API key. Balanced speed, quality and cost — a strong default for coding tools like Claude Code. Billed per token at 79% below the official Anthropic price.

Get an API key

Model IDclaude-sonnet-4-6
ProviderAnthropic
FamilyClaude Sonnet
Discount79% off official

Claude Sonnet 4.6 pricing

USD per 1M tokens. Prices updated 2026-11-13.

TokenMiloOfficial AnthropicYou save
Input$0.639$3−79%
Output$3.19$15−79%
Cache read$0.064$0.3−79%
Cache write (5 min)$0.801$3.75−79%
Cache write (1 hour)$0.801$6−87%

Official cache prices follow Anthropic’s published multipliers (read 0.1×, 5-min write 1.25×, 1-hour write 2× the input price). On TokenMilo, 1-hour cache writes cost the same as 5-minute writes.

What it costs in practice

WorkloadTokenMiloOfficialYou save
1,000 requests × 2,000 in / 500 out tokens$2.88$13.50$10.62
1,000 requests × 50,000 in / 2,000 out tokens$38.34$180$142

Claude Sonnet price comparison: TokenMilo vs official

ModelTokenMilo in / outOfficial in / outSaved
Claude Sonnet 5.5$0.423 / $2.13$2 / $10−79%
Claude Sonnet 5$0.423 / $2.13$2 / $10−79%
Claude Sonnet 4.6 (this page)$0.639 / $3.19$3 / $15−79%

Claude Sonnet 4.6 use cases

Everyday coding

The default model for Claude Code and IDE assistants — fast enough for interactive work, strong enough for most tasks.

Chatbots and customer support

Customer-facing assistants that need good judgment at a sustainable price.

Writing and translation

Articles, marketing copy, documentation and natural Chinese ↔ English translation.

RAG and document Q&A

Answer questions over your own knowledge base, using long context and prompt caching to keep costs down.

Supported endpoints

Anthropic Messages · recommendedPOST https://api.tokenmilo.com/v1/messages
OpenAI Chat CompletionsPOST https://api.tokenmilo.com/v1/chat/completions

Base URL and API key are the same for every format. API guide →

Code examples

curl

curl https://api.tokenmilo.com/v1/messages \
  -H "x-api-key: $TOKENMILO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello, Claude Sonnet 4.6!"}]
  }'

Python

# pip install anthropic
import os, anthropic

client = anthropic.Anthropic(
    base_url="https://api.tokenmilo.com",
    api_key=os.environ["TOKENMILO_API_KEY"],
)
msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain prompt caching in one paragraph."}],
)
print(msg.content[0].text)

Use Claude Sonnet 4.6 in your tools

More Anthropic models

Common Claude Sonnet 4.6 API errors and how to fix them

Most errors come from the key, the base URL or the model ID. Check these first:

401 Unauthorized / invalid API key

Cause: The key is wrong, has an extra space or line break, was deleted, or is an official Anthropic/OpenAI key instead of a TokenMilo key.

Fix: Copy the key again from the Tokens page of the console (it starts with sk-). In Claude Code, set it as ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY — not both with different values.

The response is an HTML page, or "Unexpected token <" / JSON parse error

Cause: The base URL points at the website instead of the API, or has a typo.

Fix: Anthropic format: use https://api.tokenmilo.com (SDKs add /v1/messages themselves). OpenAI format: use https://api.tokenmilo.com/v1. If a tool asks for a single URL, https://api.tokenmilo.com/v1 works for both.

model_not_found / "no available channel for model"

Cause: The model name is misspelled, has the wrong case, or includes a vendor prefix.

Fix: Use the exact model ID claude-sonnet-4-6 — lowercase, with no prefix such as anthropic/ or openai/.

Insufficient quota / balance

Cause: Your account balance is used up, or the key has its own spending limit that has been reached.

Fix: Top up in the console, or edit the key and raise or remove its quota limit.

Connection error, timeout, ECONNRESET or "fetch failed"

Cause: A local proxy (for example Clash in fake-ip mode) or a firewall is intercepting the connection.

Fix: Set api.tokenmilo.com to DIRECT in your proxy rules, or turn the proxy off. TokenMilo does not need a proxy.

429 Too Many Requests

Cause: Too many concurrent requests in a short time.

Fix: Retry with exponential backoff and lower the concurrency of batch jobs.

Context too long ("prompt is too long" / context_length_exceeded)

Cause: The conversation plus attached files exceeds the model’s context window.

Fix: Start a new session or run /compact in Claude Code, attach fewer files, and trim long tool outputs.

400 "max_tokens: Field required"

Cause: The Anthropic Messages API requires max_tokens on every request.

Fix: Add max_tokens (for example 1024 or more) to the request body. OpenAI-format requests don’t need it.

400 tool_choice not supported

Cause: Some newer Claude models (for example Claude Sonnet 5.5) only accept tool_choice "auto"; forcing a specific tool or "any" is rejected upstream.

Fix: Use tool_choice "auto" (or omit it), or switch to a model that supports forced tool use, such as claude-sonnet-4-6.

500 / 502 / 503 upstream error

Cause: A temporary error from the upstream model provider.

Fix: Retry after a few seconds. If it keeps failing for several minutes, contact support with the time and request ID.

Still stuck? Ask in our Telegram support group and we will help, including remote setup. Telegram →

FAQ

Is this the real Claude Sonnet 4.6?

Yes. Requests with model ID claude-sonnet-4-6 are served by the genuine Anthropic model — no quantized, swapped or downgraded variant. Response quality is the same as calling Anthropic directly.

How much does Claude Sonnet 4.6 cost on TokenMilo?

$0.639 per 1M input tokens and $3.19 per 1M output tokens, compared with $3 / $15 officially — 79% less. There is no subscription or monthly minimum.

Which API format should I use for Claude Sonnet 4.6?

The Anthropic Messages API (https://api.tokenmilo.com/v1/messages) is recommended and supports every Claude feature, including prompt caching, tool use and extended thinking. The OpenAI-compatible Chat Completions endpoint also works for simple chat.

Does Claude Sonnet 4.6 support prompt caching?

Yes. Cache reads are billed at $0.064 per 1M tokens, which makes long system prompts and coding-agent sessions much cheaper.

Start using Claude Sonnet 4.6

Sign up, top up, create a key — and point your SDK at TokenMilo.

Get an API key All models Full pricing