API documentation

Chat Completions

Messages, streaming, tools, JSON output, multimodal input, and chat image output.

Use /v1/chat/completions as the main text endpoint. It also handles providers that return generated images through chat, such as Gemini image models.

Basic request

Request
curl https://api.aigate.shop/v1/chat/completions \  -H "Authorization: Bearer sk-your-api-key" \  -H "Content-Type: application/json" \  -d '{    "model": "openai/gpt-5.5",    "messages": [      { "role": "system", "content": "You are concise." },      { "role": "user", "content": "Explain what AIGate does in one sentence." }    ],    "temperature": 0.4,    "max_tokens": 120,    "stream": false  }'
Response
{  "id": "gate-1779703910",  "object": "chat.completion",  "created": 1779703910,  "model": "openai/gpt-5.5",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "AIGate lets you call enabled AI models through one OpenAI-compatible API."      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 34,    "completion_tokens": 19,    "total_tokens": 53  }}

Streaming

Streaming request
curl https://api.aigate.shop/v1/chat/completions \  -H "Authorization: Bearer sk-your-api-key" \  -H "Content-Type: application/json" \  -d '{    "model": "openai/gpt-5.5",    "messages": [{ "role": "user", "content": "Count to three." }],    "stream": true,    "stream_options": { "include_usage": true }  }'
SSE response
data: {"id":"gate-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"One"}}]}data: {"id":"gate-...","object":"chat.completion.chunk","choices":[{"delta":{"content":", two"}}]}data: {"id":"gate-...","object":"chat.completion.chunk","choices":[{"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":12,"completion_tokens":4,"total_tokens":16}}data: [DONE]

Vision input

json
{  "model": "openai/gpt-5.5",  "messages": [    {      "role": "user",      "content": [        { "type": "text", "text": "What is visible in this image?" },        { "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }      ]    }  ]}

Tools

json
{  "model": "openai/gpt-5.5",  "messages": [{ "role": "user", "content": "What is the weather in Paris?" }],  "tools": [    {      "type": "function",      "function": {        "name": "get_weather",        "description": "Get weather by city",        "parameters": {          "type": "object",          "properties": { "city": { "type": "string" } },          "required": ["city"]        }      }    }  ],  "tool_choice": "auto"}

JSON output

json
{  "model": "openai/gpt-5.5",  "messages": [{ "role": "user", "content": "Return {ok: true} as JSON." }],  "response_format": { "type": "json_object" }}