POST/v1/chat/completionsOpenAI Compatible

Chat 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

ParameterRequiredDescription
model RequiredModel ID. See Models & Pricing for the full list.
messages RequiredArray of {role, content}. Roles: system, user, assistant.
temperatureOptionalSampling temperature 0-2. Higher = more creative. Default: 1.
max_tokensOptionalMaximum tokens in the response. Varies by model.
streamOptionalEnable SSE streaming for real-time tokens. Default: false.
top_pOptionalNucleus sampling parameter. 0-1.
toolsOptionalFunction definitions for tool calling (OpenAI format).
thinkingOptionalExtended 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

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
  }'