Chat
Create chat completions using the OpenAI-compatible API format.Endpoint
Examples
- Python
- JavaScript
- cURL
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g., claude-sonnet-4.5) |
messages | array | Yes | Array of message objects |
max_tokens | integer | No | Maximum tokens to generate |
temperature | float | No | Randomness (0-2, default 1) |
top_p | float | No | Nucleus sampling (0-1) |
stream | boolean | No | Stream responses |
stop | string/array | No | Stop sequences |
fallback_models | array | No | Fallback model IDs |
Message Object
| Field | Type | Description |
|---|---|---|
role | string | system, user, or assistant |
content | string | Message content |
Response
Streaming
- Python
- JavaScript
- cURL
With Fallbacks
- Python
- JavaScript
- cURL
Available Models
| Model | Description |
|---|---|
claude-opus-4.5 | Most capable, best for complex tasks |
claude-sonnet-4.5 | Balanced performance and speed |
claude-haiku-4.5 | Fastest, best for simple tasks |
gemini-3-pro-preview | Google’s latest with 1M token context |
gemini-3-flash | Ultra-fast and cost-effective |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer sk_your_key |
Content-Type | Yes | application/json |