BlazeInferDocs
API reference

Create chat completion

POST /v1/chat/completions — the primary BlazeInfer endpoint.

POST /v1/chat/completions

Sends a conversation and returns one assistant message.

Request body

FieldTypeRequiredNotes
modelstringyesA full model ID or an alias. See console
messagesarrayyessystem, user, assistant and tool messages
max_tokensintegernoCap on the reply. On reasoning models it includes the reasoning tokens, so leave room for them. Set it explicitly
temperaturenumbernoSampling randomness
top_pnumbernoNucleus sampling
nintegernoNumber of choices to return
streambooleannoReturn Server-Sent Events
stream_optionsobjectnoLeave it out to get a final usage chunk. If you send it, set include_usage: true
stopstring | string[]noStop sequences. On reasoning models a stop sequence can also match inside the reasoning, which leaves content empty
seedintegernoBest-effort determinism
logprobsbooleannoReturn token log probabilities
toolsarraynoFunction definitions — see Tool calling
tool_choicestring | objectnoauto, none, required or a specific function
response_formatobjectno{"type": "json_object"} or {"type": "json_schema", ...} — see Structured outputs

The exact set of request fields a model accepts depends on the model. Unsupported fields may be rejected with 400.

Response

A standard OpenAI chat completion:

{
  "id": "chatcmpl-68a578067bc0c028",
  "object": "chat.completion",
  "created": 1793684132,
  "model": "google/gemma-4-31b-it",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello!" },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 3,
    "total_tokens": 22,
    "prompt_tokens_details": { "cached_tokens": 0 }
  }
}

The response is shortened here; some models add extra fields. Reasoning models also return their reasoning in message.reasoning_content or message.reasoning, depending on the model. prompt_tokens_details can be null on some models.

Streaming

With stream: true, the response is an SSE stream of chat.completion.chunk objects. The finish_reason arrives in its own chunk with an empty delta. When you leave out stream_options, or set include_usage: true, a final chunk with an empty choices list carries usage. The stream ends with data: [DONE]. See Streaming.

Errors

StatusWhen
400The model rejected the request, for example bad JSON, a missing messages field, a prompt that is too long, or tools sent to a model that does not accept them. The message is always The upstream provider rejected the request.
401Missing or invalid API key
404Unknown or unavailable model
429No credit left, or a temporary overload
503The model is temporarily unavailable

Error responses are JSON, except a 429 from a credit rule, which may be plain text. See Errors & retries for what to retry.

On this page