Call Anthropic Claude models through the TokenHub unified /chat/completions endpoint. Fully OpenAI-compatible request and response format — no SDK migration required. Streaming, tool use (function calling) and vision (image input) are all supported. Billed per-token by model tier.
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1Pass the API Key in the Authorization header:
Authorization: Bearer th-your-api-keyPOST/chat/completionsChat completion. Same schema as OpenAI /v1/chat/completions, including streaming, tool use, vision, and JSON mode.
Pricing is per 1 million tokens (USD). Only successful calls are charged. Both the canonical ID and the anthropic/* alias are accepted.
| Tier | Model ID | Input | Output | Notes |
|---|---|---|---|---|
| Fable 5.1 | anthropic/claude-fable-5-1 | $10.00 | $50.00 | Latest, highest quality reasoning & coding. |
| Opus 5 | anthropic/claude-opus-5 | $5.00 | $25.00 | Latest, highest quality reasoning & coding. |
| Sonnet 5 | anthropic/claude-sonnet-5 | $2.00 | $10.00 | Latest, highest quality reasoning & coding. |
| Opus 4.8 | anthropic/claude-opus-4-8 | $5.00 | $25.00 | Latest, highest quality reasoning & coding. |
| Opus 4.7 | anthropic/claude-opus-4-7 | $5.00 | $25.00 | Latest, highest quality reasoning & coding. |
| Opus 4.6 | anthropic/claude-opus-4-6 | $5.00 | $25.00 | Latest, highest quality reasoning & coding. |
| Sonnet 4.6 | anthropic/claude-sonnet-4-6 | $3.00 | $15.00 | Flagship balance of quality and cost (recommended default). |
| Haiku 4.5 | anthropic/claude-haiku-4-5 | $1.00 | $5.00 | Fastest & cheapest 4-gen; great for high-QPS and classification. |
| Sonnet 4 | anthropic/claude-4-sonnet | $3.00 | $15.00 | Previous-gen general-purpose workhorse. |
| Opus 4 | anthropic/claude-4-opus | $15.00 | $75.00 | Latest, highest quality reasoning & coding. |
| 3.5 Sonnet | anthropic/claude-3-5-sonnet-latest | $3.00 | $15.00 | Stable, production-proven; widely compatible. |
| 3.5 Haiku | anthropic/claude-3-5-haiku-latest | $0.80 | $4.00 | Stable, production-proven; widely compatible. |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Required | — | Claude model ID. Example: "anthropic/claude-sonnet-5". Both the anthropic/* prefixed form and the bare short name are accepted. |
| messages | array | Required | — | Chat history. Each item is { role, content }. role ∈ system | user | assistant. content is a string or an array of parts (for vision / tool results). |
| max_tokens | integer | Optional | 1024 | Max output tokens (Claude requires this). Typical 1024–4096. |
| temperature | number | Optional | 1.0 | Sampling temperature, 0.0–1.0. Lower = more deterministic. |
| top_p | number | Optional | 1.0 | Nucleus sampling. Use temperature OR top_p, not both. |
| stream | boolean | Optional | false | If true, returns Server-Sent Events (SSE) deltas. |
| stop | string[] | Optional | — | Up to 4 stop sequences. |
| tools | array | Optional | — | List of tool/function definitions for tool use (function calling). |
| tool_choice | string|object | Optional | auto | Control tool selection: auto | none | required | { type:'function', function:{ name } }. |
| response_format | object | Optional | — | JSON mode: { "type": "json_object" } forces the model to return valid JSON. |
| user | string | Optional | — | Optional end-user ID for your own tracking. |
curl https://tokenhub.store/api/v1/chat/completions \
-H "Authorization: Bearer th-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain CAP theorem in 3 bullets."}
],
"max_tokens": 512,
"temperature": 0.3
}'from openai import OpenAI
client = OpenAI(
api_key="th-your-api-key",
base_url="https://tokenhub.store/api/v1",
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
max_tokens=512,
temperature=0.3,
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain CAP theorem in 3 bullets."},
],
)
print(resp.choices[0].message.content)
print("usage:", resp.usage)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "th-your-api-key",
baseURL: "https://tokenhub.store/api/v1",
});
const resp = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4-6",
max_tokens: 512,
temperature: 0.3,
messages: [
{ role: "system", content: "You are a concise assistant." },
{ role: "user", content: "Explain CAP theorem in 3 bullets." },
],
});
console.log(resp.choices[0].message.content);
console.log("usage:", resp.usage);Sign up for TokenHub and start calling Claude via our OpenAI-compatible API