TokenHub の統合 /chat/completions エンドポイント経由で Anthropic Claude model を呼び出せます。リクエストとレスポンスの形式は完全に OpenAI-compatible なので、SDK の移行は不要です。ストリーミング、tool use (function calling)、vision(画像入力)にすべて対応しています。課金は model tier ごとのトークン単価です。
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1Authorization ヘッダーに API Key を指定します:
Authorization: Bearer th-your-api-keyPOST/chat/completionsチャット補完。ストリーミング、ツール使用、ビジョン、JSON モードを含め、OpenAI /v1/chat/completions と同じスキーマです。
料金は 100 万 tokens あたりの USD です。成功した呼び出しのみ課金されます。正規 ID と anthropic/* エイリアスの両方が使用できます。
| ティア | Model ID | 入力 | 出力 | 備考 |
|---|---|---|---|---|
| Opus 4.7 | anthropic/claude-opus-4-7 | $5.00 | $25.00 | 最新で、推論とコーディングの品質が最高です。 |
| Opus 4.6 | anthropic/claude-opus-4-6 | $5.00 | $25.00 | 最新で、推論とコーディングの品質が最高です。 |
| Sonnet 4.6 | anthropic/claude-sonnet-4-6 | $3.00 | $15.00 | 品質とコストのバランスに優れた旗艦モデル(推奨のデフォルト)。 |
| Haiku 4.5 | anthropic/claude-haiku-4-5 | $1.00 | $5.00 | 4世代で最速かつ最安。高QPS や分類に最適です。 |
| Sonnet 4.5 | anthropic/claude-sonnet-4-5 | $3.00 | $15.00 | 前世代の汎用ワークホースです。 |
| Opus 4.5 | anthropic/claude-opus-4-5 | $5.00 | $25.00 | 最新で、推論とコーディングの品質が最高です。 |
| Sonnet 4 | anthropic/claude-4-sonnet | $3.00 | $15.00 | 前世代の汎用ワークホースです。 |
| Opus 4 | anthropic/claude-4-opus | $15.00 | $75.00 | 最新で、推論とコーディングの品質が最高です。 |
| 3.5 Sonnet | anthropic/claude-3-5-sonnet-latest | $3.00 | $15.00 | 安定しており本番運用で実績があり、幅広く互換性があります。 |
| 3.5 Haiku | anthropic/claude-3-5-haiku-latest | $0.80 | $4.00 | 安定しており本番運用で実績があり、幅広く互換性があります。 |
| パラメータ | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
| model | string | 必須 | — | Claude の model ID。例: "anthropic/claude-sonnet-4-6"。anthropic/* プレフィックス付き形式と、プレフィックスなしの短い名前の両方が使用できます。 |
| messages | array | 必須 | — | チャット履歴。各項目は { role, content } です。role ∈ system | user | assistant。content は文字列、またはパーツの配列です(ビジョン / tool 結果用)。 |
| max_tokens | integer | 任意 | 1024 | 最大出力 tokens(Claude では必須)。一般的には 1024–4096 です。 |
| temperature | number | 任意 | 1.0 | Sampling temperature、0.0–1.0。低いほど決定的になります。 |
| top_p | number | 任意 | 1.0 | ヌクレアス・サンプリング。temperature または top_p のどちらか一方を使用し、両方は使いません。 |
| stream | boolean | 任意 | false | true の場合、Server-Sent Events(SSE)で差分を返します。 |
| stop | string[] | 任意 | — | 最大 4 つの停止シーケンス。 |
| tools | array | 任意 | — | tool use(function calling)用の tool/function 定義の一覧です。 |
| tool_choice | string|object | 任意 | auto | tool の選択を制御します: auto | none | required | { type:'function', function:{ name } }. |
| response_format | object | 任意 | — | JSON mode: { "type": "json_object" } により、model は有効な JSON を返すようになります。 |
| user | string | 任意 | — | 独自の追跡用の任意のエンドユーザー 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 に登録して、OpenAI-compatible API 経由で Claude の利用を始めましょう