Skip to main content
POST
Create a model response from a list of chat messages. GPT-5.6, GPT-6, Grok, Gemini, and DeepSeek models accept this protocol; choose an exact model page under Text Series for pricing and the recommended model ID.
string
required
A text model ID available to your API key. Use GET /v1/models to discover IDs, then open its individual model page for current pricing.
array
required
Ordered chat messages. Each message includes a role and content.
boolean
default:"false"
Set to true to receive server-sent events.
number
Controls sampling variation where the selected model supports it. Some GPT reasoning models restrict sampling parameters; omit it unless you have verified support for your model and reasoning setting.
integer
Caps generated GPT-5.6 and GPT-6 tokens, including reasoning tokens. If you send max_tokens instead, SnapGen forwards it as max_completion_tokens. When both are present, max_completion_tokens wins.
integer
Caps generated tokens for other model families. GPT-5.6 and GPT-6 accept it as an alias for max_completion_tokens.
string
Sets GPT reasoning effort, for example medium. Supported effort levels vary by model; check your selected model’s capabilities before changing it.
array
Function tools use the Chat Completions format: { "type": "function", "function": { "name": "...", "parameters": {} } }. Read choices[].message.tool_calls, execute the requested functions in your application, then send their results as role: "tool" messages with the matching tool_call_id. SnapGen does not execute your functions.

Stream a response

Set stream to true. The response uses server-sent events (SSE).
Each event begins with data:. Read events until the data: [DONE] marker. To request token usage in the stream, include stream_options: { "include_usage": true }.
Concatenate choices[0].delta.content values as they arrive. A delta can omit content, especially in the first or final event.
For the input/output item format used by agent clients, see the Responses protocol.