POST
/v1/chat/completionsOpenAI CompatibleChat Completions
Create a chat completion. Fully compatible with the OpenAI Chat Completions API. Just change the base URL and API key.
Compatibility
OpenAI SDK
Streaming
SSE Supported
Auth
Bearer Token
Parameters
| Parameter | Required | Description |
|---|---|---|
model | Required | Model ID. See Models & Pricing for the full list. |
messages | Required | Array of {role, content}. Roles: system, user, assistant. |
temperature | Optional | Sampling temperature 0-2. Higher = more creative. Default: 1. |
max_tokens | Optional | Maximum tokens in the response. Varies by model. |
stream | Optional | Enable SSE streaming for real-time tokens. Default: false. |
top_p | Optional | Nucleus sampling parameter. 0-1. |
tools | Optional | Function definitions for tool calling (OpenAI format). |
thinking | Optional | Extended thinking for Claude models. {type: "enabled", budget_tokens: 2000}. |
Response Format
200 OK — application/json
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "gpt-5.5",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing uses..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 50,
"total_tokens": 75
}
}Examples
1
2
3
4
5
6
7
8
9
10
11
12
curl https://api.aipilotads.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
"temperature": 0.7,
"max_tokens": 1024
}'