Chat completions
Request and response fields for the public chat endpoint.
POST /v1/chat/completions
Send JSON with a model ID and a messages array. Authenticate with your CyberRouter bearer key. /api/v1/chat/completions is an equivalent mount.
curl http://localhost:3002/v1/chat/completions \
-H "Authorization: Bearer $CYBERROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-flash:cyberrouter",
"messages": [
{
"role": "user",
"content": "Summarize this maintenance note: the backup completed."
}
],
"max_completion_tokens": 256
}'| Field | Purpose |
|---|---|
| model | A catalog model ID; use :cyberrouter for enhancement. |
| messages | Conversation messages with role and content. Enhancement requires at least one user message. |
| max_completion_tokens | Requested output-token limit, subject to endpoint support and constraints. |
| stream | Set true for server-sent events; omit for a JSON response. |
| provider / models | Optional provider preferences and ordered fallback models. |
Response fields
The response contains id, model, provider, choices, and usage. The X-Generation-Id header carries the same request identifier. This illustrative receipt uses a 10% fee; your effective fee may differ.
{
"id": "gen-example",
"model": "deepseek/deepseek-flash:cyberrouter",
"provider": "DeepSeek",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The backup completed successfully."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 100,
"completion_tokens": 20,
"total_tokens": 120,
"cost": 0.0001,
"provider_cost": "0.001",
"is_byok": true
},
"cyberrouter": {
"mode": "cyber",
"service_fee_percent": "10",
"billing_status": "settled",
"cost_is_estimate": true,
"fallbacks": 0
}
}usage.cost is the CyberRouter credit charge. usage.provider_cost is the separate provider cost used as its basis. See cost fields for estimation and reconciliation behavior.
CyberRouter metadata
The cyberrouter extension reports the effective service fee, billing status, endpoint, fallback count, routing decisions, and dropped parameters. Enhanced responses also contain the reference trace under cyberrouter.enhancement.
Keep your parser tolerant of additional metadata fields. Use GET /v1/generation?id=… to inspect a request belonging to your account after completion.