Rufen Sie Anthropic Claude modelle über den einheitlichen /chat/completions-Endpunkt von TokenHub auf. Vollständig OpenAI-compatible im Request- und Response-Format — keine SDK-Migration erforderlich. Streaming, Tool-Nutzung (Function Calling) und Vision (Bildeingabe) werden alle unterstützt. Abrechnung pro Token nach model-Tier.
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1Übergebe den API Key im Authorization-Header:
Authorization: Bearer th-your-api-keyPOST/chat/completionsChat Completion. Gleiches Schema wie OpenAI /v1/chat/completions, einschließlich Streaming, Tool-Nutzung, Vision und JSON mode.
Die Preise gelten pro 1 Million Tokens (USD). Nur erfolgreiche Aufrufe werden berechnet. Sowohl die kanonische ID als auch der anthropic/* Alias werden akzeptiert.
| Stufe | model ID | Eingabe | Ausgabe | Hinweise |
|---|---|---|---|---|
| Opus 4.7 | anthropic/claude-opus-4-7 | $5.00 | $25.00 | Neueste, höchste Qualität bei Reasoning & Coding. |
| Opus 4.6 | anthropic/claude-opus-4-6 | $5.00 | $25.00 | Neueste, höchste Qualität bei Reasoning & Coding. |
| Sonnet 4.6 | anthropic/claude-sonnet-4-6 | $3.00 | $15.00 | Flagship-Balance aus Qualität und Kosten (empfohlener Standard). |
| Haiku 4.5 | anthropic/claude-haiku-4-5 | $1.00 | $5.00 | Schnellstes & günstigstes 4-gen; ideal für hohe QPS und Klassifizierung. |
| Sonnet 4.5 | anthropic/claude-sonnet-4-5 | $3.00 | $15.00 | General-Purpose-Arbeitspferd der vorherigen Generation. |
| Opus 4.5 | anthropic/claude-opus-4-5 | $5.00 | $25.00 | Neueste, höchste Qualität bei Reasoning & Coding. |
| Sonnet 4 | anthropic/claude-4-sonnet | $3.00 | $15.00 | General-Purpose-Arbeitspferd der vorherigen Generation. |
| Opus 4 | anthropic/claude-4-opus | $15.00 | $75.00 | Neueste, höchste Qualität bei Reasoning & Coding. |
| 3.5 Sonnet | anthropic/claude-3-5-sonnet-latest | $3.00 | $15.00 | Stabil, produktionsbewährt; weitgehend kompatibel. |
| 3.5 Haiku | anthropic/claude-3-5-haiku-latest | $0.80 | $4.00 | Stabil, produktionsbewährt; weitgehend kompatibel. |
| Parameter | Typ | Erforderlich | Standard | Beschreibung |
|---|---|---|---|---|
| model | string | Erforderlich | — | Claude model ID. Beispiel: "anthropic/claude-sonnet-4-6". Sowohl die Form mit anthropic/* Präfix als auch der kurze Name ohne Präfix werden akzeptiert. |
| messages | array | Erforderlich | — | Chatverlauf. Jeder Eintrag ist { role, content }. role ∈ system | user | assistant. content ist ein String oder ein Array von Teilen (für Vision / Tool-Ergebnisse). |
| max_tokens | integer | Optional | 1024 | Maximale Output Tokens (Claude erfordert dies). Typisch 1024–4096. |
| temperature | number | Optional | 1.0 | Sampling temperature, 0.0–1.0. Lower = more deterministic. |
| top_p | number | Optional | 1.0 | Nucleus-Sampling. Verwende temperature ODER top_p, nicht beides. |
| stream | boolean | Optional | false | Wenn true, werden Server-Sent Events (SSE)-Deltas zurückgegeben. |
| stop | string[] | Optional | — | Bis zu 4 Stop-Sequenzen. |
| tools | array | Optional | — | Liste von Tool-/Funktionsdefinitionen für Tool-Nutzung (Function Calling). |
| tool_choice | string|object | Optional | auto | Steuere die Tool-Auswahl: auto | none | required | { type:'function', function:{ name } }. |
| response_format | object | Optional | — | JSON-Modus: { "type": "json_object" } erzwingt, dass das model gültiges JSON zurückgibt. |
| user | string | Optional | — | Optionale Endnutzer-ID für dein eigenes 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);Registrieren Sie sich bei TokenHub und beginnen Sie, Claude über unsere OpenAI-compatible API aufzurufen