Text
Claude Opus 4.6
Use Claude Opus 4.6 through TokLab with the Anthropic Messages API, streaming, current token prices, and downloadable OpenAPI.
Model and endpoint
Use claude-opus-4-6 with POST https://api.toklab.ai/v1/messages. Keep your TokLab API key on the server.
This reference covers the core text-generation request. Optional reasoning, tool and sampling controls depend on the model and selected route; do not assume that settings from another model version are interchangeable.
Quick example
curl https://api.toklab.ai/v1/messages \
-H "x-api-key: $TOKLAB_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "claude-opus-4-6", "max_tokens": 1024, "messages": [{"role": "user", "content": "Explain optimistic concurrency in three bullet points."}]}'Python
import os
import anthropic
client = anthropic.Anthropic(
api_key=os.environ["TOKLAB_API_KEY"],
base_url="https://api.toklab.ai",
)
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain optimistic concurrency."}],
)
print("".join(block.text for block in response.content if block.type == "text"))Request parameters
| Field | Type | Usage |
|---|---|---|
model | string | Required; claude-opus-4-6 or an available full model:group ID |
messages | object[] | Required conversation turns; each has role and content |
max_tokens | integer | Required positive output-token budget; the example uses 1024 |
system | string or content blocks | Optional system instructions |
stream | boolean | Optional; true returns server-sent events |
Omit optional controls to use the upstream defaults. Token budgets must fit the selected model's context and output limits; this reference does not advertise unverified limits.
Response and streaming
The JSON response contains id, model, content, stop_reason, and usage. Read text blocks from content where type is text.
Set stream: true and add -N to cURL to consume the event stream. For streaming, handle message_start, content_block_delta, message_delta, and message_stop events. Text deltas are carried in delta.text. A closed connection alone does not establish a successful response.
Chat Completions compatibility
The shared gateway also accepts POST /v1/chat/completions with Bearer authentication:
{
"model": "claude-opus-4-6",
"messages": [
{
"role": "user",
"content": "Explain optimistic concurrency."
}
]
}Read the answer from choices[0].message.content; streamed deltas appear in choices[0].delta.content. Use the native endpoint above for provider-specific features.
Pricing and route selection
TokLab reads prices from the shared gateway. Input, output, cache usage and any context-length tiers are listed in Current rates below; all amounts are USD. The catalogue's starting price is the input rate per million tokens, not the total request cost.
Discover the calling IDs available to your key:
curl https://api.toklab.ai/v1/models \
-H "Authorization: Bearer $TOKLAB_API_KEY"Use an exact ID returned by discovery. A listed model:group ID selects that group's rates and requires access to that group. Public pricing alone does not guarantee that every key can call a route.
Errors
Check the HTTP status and response body before reading the output. Authentication failures return 401; access or permission failures may return 403; malformed or unsupported parameters return a 4xx response; rate limits return 429. Retry transient errors with backoff, and avoid automatically resubmitting an interrupted request whose outcome is unknown. See the shared error reference.
Pricing
Every rate this model is billed at, read live from the price list billing uses. A tier applies when its condition matches, checked top to bottom.
claude-opus-4-6
per 1M tokens| Default | AWSB:claude-0.7 | |
|---|---|---|
| Input | $1.75 | $3.50 |
| Output | $8.75 | $17.50 |
| Cache read | $0.175 | $0.35 |
| Cache write (5 min) | $2.1875 | $4.375 |
| Cache write (1 h) | $3.50 | $7.00 |
Call as claude-opus-4-6:<tier>