POST /v1/chat/completions
Example
curl https://api.zalthar.com/v1/chat/completions \
-H "Authorization: Bearer $ZALTHAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "acme/support-triage",
"messages": [
{"role": "system", "content": "You are Acme's support assistant."},
{"role": "user", "content": "My order arrived damaged."}
],
"temperature": 0.3
}'
Request body
| Field | Type | Notes |
|---|---|---|
model |
string | Required. A model slug from /v1/models. |
messages |
array | Required. The conversation, in OpenAI message format. |
stream |
boolean | Return server-sent events. |
stream_options |
object | Passed through. Usage is always included in the final chunk. |
temperature, top_p |
number | Sampling controls. |
max_tokens, max_completion_tokens |
integer | Capped at the model’s maximum output. |
stop |
string or array | Stop sequences. |
presence_penalty, frequency_penalty |
number | |
logit_bias |
object | |
logprobs, top_logprobs |
boolean, integer | |
seed |
integer | |
tools, tool_choice, parallel_tool_calls |
Function calling, where the model supports it. | |
response_format |
object | Structured output, where the model supports it. |
reasoning, reasoning_effort |
For models that support reasoning. | |
modalities, audio, prediction, store, metadata |
Passed through. |
Notes:
nis always 1.- Any field not listed above is ignored.
useris replaced with a hashed value before it leaves Zalthar.
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "acme/support-triage",
"system_fingerprint": "fp_zalthar",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Sorry about that. I can send a replacement today or refund you in full."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 31, "completion_tokens": 18, "total_tokens": 49, "cost": 0.0000412}
}
Streaming
With "stream": true the response is a stream of data: events in the OpenAI format, ending with data: [DONE]. If an error happens mid-stream it arrives as a data: event containing an error object. A stream that is interrupted is billed for the tokens generated so far.
