Endpoint
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | — | Model name (e.g. gpt-4o-mini, claude-sonnet-4-6, gpt-4-1-nano-2025-04-14) |
messages | array | yes | — | Array of message objects. Must not be empty. |
stream | boolean | no | false | Stream the response as server-sent events. |
max_tokens | integer | no | varies | Maximum tokens in the response. |
temperature | number | no | varies | Sampling temperature (0-2). |
top_p | number | no | — | Nucleus sampling parameter. |
frequency_penalty | number | no | — | Penalize repeated tokens. |
presence_penalty | number | no | — | Penalize tokens already present. |
tools | array | no | — | Tool/function definitions for tool calling. |
tool_choice | string/object | no | — | Control tool selection behavior. |
parallel_tool_calls | boolean | no | — | Allow parallel tool calls. |
response_format | object | no | — | Constrain response format (e.g. {"type": "json_object"}). |
Message Format
Each message has arole and content:
Vision (multimodal)
Use a content array to include images or video:Examples
Basic text generation
Response
Streaming
delta instead of a full message:
Tool calling
finish_reason is "tool_calls":
Structured output (JSON mode)
Errors
| Condition | Error |
|---|---|
| No model specified | "You must specify a model to call" |
| Model not found | "Model not found: <name>" |
| Empty messages | "Messages array cannot be empty" |
| Insufficient credits | Credit-related error message |