Skip to content

Chat Completions

POST https://api.inferam.ai/v1/chat/completions is OpenAI’s Chat Completions format. It’s the model server’s native format, so requests pass through with the fewest changes.

Terminal window
curl https://api.inferam.ai/v1/chat/completions \
-H "Authorization: Bearer $INFERAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "DeepSeek-V4.1-Flash-1017",
"stream": true,
"stream_options": {"include_usage": true},
"reasoning_effort": "low",
"messages": [
{"role": "system", "content": "You are a terse senior engineer."},
{"role": "user", "content": "Why is my Go map iteration order random?"}
]
}'

model, messages, stream, stream_options.include_usage, max_tokens, max_completion_tokens, temperature, top_p, stop, seed, presence_penalty, frequency_penalty, tools, tool_choice, parallel_tool_calls, response_format (text, json_object, json_schema), reasoning_effort and thinking_budget.

Other fields (n, logprobs, best_of, logit_bias, engine-specific sampling options, and so on) are ignored.

  • Roles: system, developer, user, assistant, tool.
  • Tools: function tools with JSON Schema parameters, parallel tool calls and tool_choice (auto, none, required or a named function).
  • Images: image_url content parts with a base64 data: URL. Remote URLs are rejected (see The model).

The model thinks before it answers by default. Its reasoning arrives in message.reasoning_content, or in delta.reasoning_content when streaming, separate from content. When you send an assistant turn that made tool calls back to the model, include its reasoning_content: the model expects to see its earlier reasoning on tool-calling turns.

  • reasoning_effort: none (thinking off), minimal, low, medium, high, xhigh or max.
  • thinking_budget: a cap on reasoning tokens, no larger than the output limit.

With "stream": true the response is server-sent events of chat.completion.chunk objects, ending with data: [DONE]. Set "stream_options": {"include_usage": true} to get a final chunk with usage and no choices.

"usage": {
"prompt_tokens": 2048,
"completion_tokens": 312,
"total_tokens": 2360,
"prompt_tokens_details": { "cached_tokens": 1792 }
}