OpenAI-Compatible API
Chat Completions
OpenAI-compatible chat completions endpoint
POST
Chat Completions
Overview
Create a chat completion using the OpenAI-compatible API format. Works with any OpenAI SDK, LangChain, LlamaIndex, and tools like Cursor or Continue.Request
Headers
string
required
Bearer token:
Bearer YOUR_API_KEYBody
string
required
Model identifier. See available models. Example:
"gemma3:27b", "deepseek-v3.2".array
required
Array of message objects:
role—"system","user", or"assistant"content— message text (or array of content objects for vision)
boolean
default:"false"
If
true, returns a stream of text/event-stream Server-Sent Events.number
default:"1"
Sampling temperature between 0 and 2. Higher = more random, lower = more focused.
integer
Maximum number of tokens to generate. If unset, uses model default.
number
default:"1"
Nucleus sampling probability mass. Use with
temperature not both.string or array
Up to 4 sequences where the model will stop generating tokens.
array
List of tool definitions for function calling. Each tool has
type: "function" and a function object with name, description, and parameters (JSON Schema).string or object
default:"auto"
Controls how the model responds to tools. Values:
"none", "auto", or {"type": "function", "function": {"name": "..."}}object
Set to
{"type": "json_object"} to enable JSON mode.Response
string
Unique identifier for this completion.
string
"chat.completion" or "chat.completion.chunk" for streaming.integer
Unix timestamp when the completion was created.
string
The model used.
array
Array of completion choices. Usually one unless
n > 1:index— choice indexmessage.role—"assistant"message.content— generated textfinish_reason—"stop","length", or"tool_calls"
object
Token usage statistics:
prompt_tokenscompletion_tokenstotal_tokens
