Anthropic Claude modellari bilan TokenHub’ning yagona /chat/completions endpoint’i orqali ishlang. To‘liq OpenAI-compatible so‘rov va javob formati — SDK migratsiyasi shart emas. Streaming, tool use (function calling) va vision (image input) hammasi qo‘llab-quvvatlanadi. Billing model tier bo‘yicha token boshiga hisoblanadi.
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1API Key ni Authorization headerida uzating:
Authorization: Bearer th-your-api-keyPOST/chat/completionsChat completion. OpenAI /v1/chat/completions bilan bir xil sxema, jumladan streaming, tool use, vision va JSON mode.
Narx 1 million tokens uchun hisoblanadi (USD). Faqat muvaffaqiyatli so‘rovlar uchun haq olinadi. Canonical ID ham, anthropic/* alias ham qabul qilinadi.
| Daraja | Model ID | Kirish | Chiqish | Izohlar |
|---|---|---|---|---|
| Opus 4.7 | anthropic/claude-opus-4-7 | $5.00 | $25.00 | Eng so‘nggi, eng yuqori sifatli reasoning va kodlash. |
| Opus 4.6 | anthropic/claude-opus-4-6 | $5.00 | $25.00 | Eng so‘nggi, eng yuqori sifatli reasoning va kodlash. |
| Sonnet 4.6 | anthropic/claude-sonnet-4-6 | $3.00 | $15.00 | Sifat va narx bo‘yicha muvozanatli flagman (tavsiya etiladigan standart). |
| Haiku 4.5 | anthropic/claude-haiku-4-5 | $1.00 | $5.00 | Eng tez va eng arzon 4-gen; yuqori QPS va tasniflash uchun juda mos. |
| Sonnet 4.5 | anthropic/claude-sonnet-4-5 | $3.00 | $15.00 | Oldingi avloddagi umumiy vazifalar uchun ishchi ot. |
| Opus 4.5 | anthropic/claude-opus-4-5 | $5.00 | $25.00 | Eng so‘nggi, eng yuqori sifatli reasoning va kodlash. |
| Sonnet 4 | anthropic/claude-4-sonnet | $3.00 | $15.00 | Oldingi avloddagi umumiy vazifalar uchun ishchi ot. |
| Opus 4 | anthropic/claude-4-opus | $15.00 | $75.00 | Eng so‘nggi, eng yuqori sifatli reasoning va kodlash. |
| 3.5 Sonnet | anthropic/claude-3-5-sonnet-latest | $3.00 | $15.00 | Barqaror, ishlab chiqarishda sinovdan o‘tgan; keng mos keladi. |
| 3.5 Haiku | anthropic/claude-3-5-haiku-latest | $0.80 | $4.00 | Barqaror, ishlab chiqarishda sinovdan o‘tgan; keng mos keladi. |
| Parametr | Turi | Majburiy | Standart | Tavsif |
|---|---|---|---|---|
| model | string | Majburiy | — | Claude model ID. Masalan: "anthropic/claude-sonnet-4-6". anthropic/* prefiksli shakl ham, qisqa nom ham qabul qilinadi. |
| messages | array | Majburiy | — | Chat tarixi. Har bir element { role, content }. role ∈ system | user | assistant. content — satr yoki bo‘laklar massivi (vision / tool natijalari uchun). |
| max_tokens | integer | Ixtiyoriy | 1024 | Maksimal chiqish tokens (Claude buning talab qiladi). Odatda 1024–4096. |
| temperature | number | Ixtiyoriy | 1.0 | Sampling temperature, 0.0–1.0. Pastroq bo‘lsa = aniqroq natija. |
| top_p | number | Ixtiyoriy | 1.0 | Nucleus sampling. temperature YOKI top_p dan birini ishlating, ikkalasini emas. |
| stream | boolean | Ixtiyoriy | false | true bo‘lsa, Server-Sent Events (SSE) delta’lari qaytariladi. |
| stop | string[] | Ixtiyoriy | — | Ko‘pi bilan 4 ta stop ketma-ketligi. |
| tools | array | Ixtiyoriy | — | Tool use (function calling) uchun tool/function ta’riflari ro‘yxati. |
| tool_choice | string|object | Ixtiyoriy | auto | Tool tanlashni boshqarish: auto | none | required | { type:'function', function:{ name } }. |
| response_format | object | Ixtiyoriy | — | JSON mode: { "type": "json_object" } modelni valid JSON qaytarishga majbur qiladi. |
| user | string | Ixtiyoriy | — | O‘zingizning kuzatuvingiz uchun ixtiyoriy yakuniy foydalanuvchi ID. |
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);TokenHub’da ro‘yxatdan o‘ting va Claude’dan bizning OpenAI-compatible API orqali foydalanishni boshlang