Chat completions
POST /v1/chat/completions is the OpenAI chat surface, re-exported by the
gateway. If your SDK already speaks OpenAI, only baseURL and the model group
change.
Try it
Try a completion
POST /v1/chat/completionsResponse
No response yet.
Request
{
"model": "deepseek-flash",
"messages": [
{ "role": "system", "content": "You are concise." },
{ "role": "user", "content": "What is an LLM gateway?" }
],
"temperature": 0.7,
"max_tokens": 1024,
"stream": false
}| Field | Notes |
|---|---|
model | A model group or one of its aliases. |
messages | Standard OpenAI roles: system, user, assistant. |
temperature | 0–2; forwarded to the provider. |
max_tokens | Upper bound on the completion, up to the group's max output. |
stream | true returns SSE chunks; recommended for slow reasoning. |
reasoning_effort | DeepSeek groups: none, low, high (default), max. |
The router runs with drop_params: true: a parameter the upstream does not
understand is dropped rather than failing the whole request. Validate provider
specific options you depend on.
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "deepseek-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "...",
"reasoning_content": "..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 61,
"total_tokens": 85
}
}usage is what the gateway meters against the key's budget. The model field
echoes the group you requested; it does not identify the provider or a fallback
that served the call.
Streaming
With "stream": true the response is text/event-stream. Each chunk is a
data: {...} line; the stream ends with data: [DONE].
const stream = await client.chat.completions.create({
model: 'deepseek-v4-pro',
stream: true,
messages: [{ role: 'user', content: 'Plan a migration in three bullets.' }],
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}Vision
deepseek-flash accepts images in the standard OpenAI content-part shape:
{
"model": "deepseek-flash",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image?" },
{
"type": "image_url",
"image_url": { "url": "https://example.com/chart.png" }
}
]
}
]
}Images are metered as input tokens by the provider. Prefer a public URL or a small data URL; very large base64 payloads make the request slow and expensive.
Reasoning
deepseek-flash (DeepSeek Flash) and deepseek-v4-pro (DeepSeek Pro) both run with
thinking enabled by default. The trace comes back in reasoning_content, and
usage.completion_tokens_details.reasoning_tokens counts the tokens it used.
Ask for less with reasoning_effort: "low", or turn it off with
reasoning_effort: "none" when latency matters more than depth. The gateway
forwards the control and meters the tokens the provider reports.