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.
GPT reasoning models with tool callsAlpha
Most users do not need to change anything. This is a compatibility step the gateway applies automatically, only in the case below.
When a reasoning model such as GPT-5 and later or the o series is called with tool calls (the request has tools, or the history contains tool_calls / role: "tool"), the gateway sends it to the model over the Responses protocol and still returns the result in Chat Completions format, so your code does not change. This lets reasoning and tool calls work together correctly, and avoids reasoning content being unreadable across resources on routes backed by multi-region Azure OpenAI resources. This handling is still in Alpha.
In this case, note that:
- These parameters cannot be expressed and return 400:
stop,n> 1,logprobs/top_logprobs, non-zerofrequency_penalty/presence_penalty/seed, the legacyfunctions/function_call,audio/modalities,prediction,web_search_options, and the object form ofreasoning(usereasoning_effortinstead). temperature/top_pare ignored (reasoning models do not support them).- If set,
max_completion_tokens(ormax_tokens) must be at least 16. - The reasoning summary is returned in
message.reasoning_content;completion_tokens_details.reasoning_tokensis reported in usage as usual. - The response
iddoes not start withchatcmpl-; do not rely on its format. - Requests with
"reasoning_effort": "none"or without tools are not affected and are handled as before.
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.