Claude 互換
利用可能
設定されている場合、Claude 互換の Messages とモデル一覧ルートを使用します。
POST /v1/messages
Messages は Claude 互換のリクエスト形式と token168 アカウント権限に従います。例では claude-opus-4-8 を使用し、現在の Claude DTO が受け付けるリクエストフィールドを含めています。
Claude メッセージ
curl https://www.token168.cc/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $TOKEN168_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-4-8",
"prompt": "",
"system": [{"type": "text", "text": "You are concise."}],
"messages": [{"role": "user", "content": [{"type": "text", "text": "Summarize this API."}]}],
"cache_control": {"type": "ephemeral"},
"inference_geo": "us",
"max_tokens": 800,
"max_tokens_to_sample": 800,
"stop_sequences": ["END"],
"temperature": 0.4,
"top_p": 0.9,
"top_k": 40,
"stream": false,
"tools": [{"name": "lookup", "input_schema": {"type": "object", "properties": {}}}],
"context_management": {"type": "auto"},
"output_config": {"type": "text"},
"output_format": {"type": "text"},
"container": {"id": "container_123"},
"tool_choice": {"type": "auto"},
"thinking": {"type": "enabled", "budget_tokens": 1024},
"mcp_servers": [],
"metadata": {"trace_id": "trace_123"},
"speed": "standard",
"service_tier": "default"
}'
GET /v1/models
Claude 互換モデルを一覧表示するときは、Claude 互換ヘッダーを送信してください。
Claude モデル一覧
curl https://www.token168.cc/v1/models \
-H "x-api-key: $TOKEN168_API_KEY" \
-H "anthropic-version: 2023-06-01"