Claude-compatible-API
Aktiv
Verwenden Sie konfigurierte Messages- und Modelllistenrouten des Claude-compatible-Protokolls.
POST /v1/messages
Messages folgt der Anfragestruktur des Claude-compatible-Protokolls und den token168-Kontoberechtigungen. Das Beispiel verwendet claude-opus-4-8 und enthält die vom aktuellen Claude DTO akzeptierten Anfragefelder.
Claude Messages-Anfrage
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
Senden Sie beim Auflisten von Modellen des Claude-compatible-Protokolls die entsprechenden Claude-compatible-Header.
Claude-compatible-Modellliste
curl https://www.token168.cc/v1/models \
-H "x-api-key: $TOKEN168_API_KEY" \
-H "anthropic-version: 2023-06-01"