熟悉的對話格式。
POST
/v1/chat/completions傳送模型 ID 和訊息清單。各模型對工具、推理、結構化輸出及參數的支援有所不同。不要假設每個 checkpoint 都實作所有 OpenAI 功能。
{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "system", "content": "Be a useful writing partner."},
{"role": "user", "content": "Help me explore an idea."}
],
"max_tokens": 512,
"stream": false
}從回應中讀取用量
非串流成功回應遵循上游相容的 completion 格式。帳單核對請使用回應回報的 token 用量和控制台請求記錄,不要用字元數估算。
curl https://unlimit.chat/v1/chat/completions \
-H "Authorization: Bearer $UNLIMIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "What if we built something different?"}
],
"stream": true
}'