Response Format¶
Non-Streaming Responses¶
Non-streaming chat responses are OpenAI-compatible:
{
"id": "chatcmpl-1760000000000",
"object": "chat.completion",
"created": 1760000000,
"model": "google/gemma-2-2b-it",
"model_id": "google/gemma-2-2b-it",
"chat_id": "chat_...",
"info": {
"provider": "nvidia",
"model": "google/gemma-2-2b-it",
"pool": "LITE"
},
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
},
"memory": {
"mode": "auto",
"saved": true,
"injected": false,
"injected_message_count": 0,
"recalled_message_count": 0,
"total_indexed_messages": 1
},
"router": {
"classified_tier": "LITE",
"tier": "LITE",
"provider": "nvidia",
"selected_model": "google/gemma-2-2b-it",
"model": "google/gemma-2-2b-it",
"classifier_provider": "nvidia",
"classifier_model": "meta/llama-3.1-8b-instruct",
"attempted_classifier_models": [
"meta/llama-3.1-8b-instruct"
],
"nvidia_attempted_models": [
"google/gemma-2-2b-it"
],
"puter_attempted_models": [],
"attempted_models": [
"google/gemma-2-2b-it"
],
"fallback": false,
"reason": "classifier"
}
}
The info Object¶
The compact info object is the easiest place for clients to read which model actually answered:
Field meanings¶
| Field | Meaning |
|---|---|
provider |
Always "x0root" (internal provider names are masked). |
model |
The exact model id that produced the final answer. |
pool |
The router tier/pool selected by the classifier. |
Example:
Streaming¶
Set:
Example:
curl https://puter-api.x0root.workers.dev/v1/chat/completions \
-H "Authorization: Bearer qp-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "router",
"messages": [
{ "role": "user", "content": "Write a short haiku." }
],
"stream": true
}'
Response headers¶
Content-Type: text/event-stream
Cache-Control: no-cache
X-Chat-Id: chat_...
X-Model-Id: selected-model-id
X-Memory-Mode: auto
X-Memory-Injected: true
Chunk format¶
Each chunk is OpenAI-style:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1760000000,"model":"google/gemma-2-2b-it","model_id":"google/gemma-2-2b-it","chat_id":"chat_...","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
data: [DONE]
Streaming chunks also include the compact info object:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1760000000,"model":"meta/llama-3.1-8b-instruct","model_id":"meta/llama-3.1-8b-instruct","chat_id":"chat_...","info":{"provider":"x0root","model":"meta/llama-3.1-8b-instruct","pool":"NORMAL"},"choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}