Create Chat Completion
POST
/v1/chatSend a chat completion request. Provider is selected by model prefix or provider_preference. Automatic fallback on failure — the response includes provider_used and model to indicate which served the request. The built-in Chat UI shows an amber warning banner when a fallback provider was used.
Request Body
| Parameter | Type | Description |
|---|---|---|
modelRequired | string | Model ID, e.g. "groq/llama-3.3-70b-versatile" |
messagesRequired | array | Array of {role, content} objects (max 100) |
stream | booleandefault: false | Enable SSE streaming |
provider_preference | string | Force provider: groq, openrouter, gemini, openai, claude, or huggingface |
Response
Returns the generated content along with which model and provider were actually used.
json
{
"id": "req_abc123...",
"provider_used": "groq",
"model": "llama-3.3-70b-versatile",
"content": "The meaning of life is a philosophical question...",
"usage": {
"prompt_tokens": 12,
"completion_tokens": 45,
"total_tokens": 57
},
"cost_usd": 0.000034
}