Developer Docs › Chat completions (OpenAI-compatible)

Chat completions (OpenAI-compatible)

Call any text model — GPT, Claude, Gemini, DeepSeek, Qwen and more — with the OpenAI Chat Completions format.

Endpoint

POST https://api.onefast.ai/v1/chat/completions
Authorization: Bearer sk-xxx
Content-Type: application/json

This is the most widely supported endpoint: almost every SDK, framework (LangChain, LlamaIndex, Dify, etc.) and client works with it. It is not limited to GPT — set model to claude-sonnet-4-6, gemini-2.5-flash, deepseek-v4-flash and so on, and the gateway converts the protocol for you.

Basic request

cURL

curl https://api.onefast.ai/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Introduce yourself in one sentence."}
    ]
  }'

Python

from openai import OpenAI

client = OpenAI(api_key="sk-xxx", base_url="https://api.onefast.ai/v1")
resp = client.chat.completions.create(
    model="gpt-5.5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Introduce yourself in one sentence."},
    ],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ apiKey: "sk-xxx", baseURL: "https://api.onefast.ai/v1" });
const resp = await client.chat.completions.create({
  model: "gpt-5.5",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Introduce yourself in one sentence." },
  ],
});
console.log(resp.choices[0].message.content);

Common parameters

Parameter Type Description
model string Required. Model name; see the model catalog
messages array Required. Conversation messages; role is system / user / assistant / tool
stream boolean Stream the response (SSE)
stream_options object {"include_usage": true} returns usage at the end of the stream
max_tokens / max_completion_tokens integer Maximum output tokens
temperature / top_p number Sampling parameters (some reasoning models don't support them; the upstream ignores or rejects them)
tools / tool_choice array / string Tool calling; see Tools & reasoning
response_format object Structured output, e.g. {"type": "json_object"}
reasoning_effort string Reasoning effort: low / medium / high (GPT reasoning models)

All other official OpenAI parameters are passed through to the upstream unchanged. Whether a given model supports a parameter is determined by that model's official documentation.

Streaming

cURL

curl -N https://api.onefast.ai/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [{"role": "user", "content": "Count from 1 to 5"}]
  }'

The response is text/event-stream, one data: {...} per line, ending with data: [DONE]. With include_usage enabled, the second-to-last event carries usage.

Models that think for a long time may stay silent for a while before producing output. The gateway keeps a streaming request open for up to 10 minutes without data before disconnecting; set your client's read timeout to 600 seconds or more.

Image input (vision)

Models with vision support accept an image URL or Base64 data in content:

{
  "model": "gpt-5.5",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "What's in this image?"},
      {"type": "image_url", "image_url": {"url": "https://example.com/cat.jpg"}}
    ]
  }]
}

Base64 form: "url": "data:image/png;base64,iVBORw0KG...".

Using other models

Same endpoint, just change model:

Python

for model in ["claude-sonnet-4-6", "gemini-2.5-flash", "deepseek-v4-flash"]:
    r = client.chat.completions.create(model=model, messages=[{"role": "user", "content": "Hi"}])
    print(model, "→", r.choices[0].message.content)

For Claude, if you need the full native feature set such as prompt caching and extended thinking, use the Claude Messages endpoint directly.