Chat completions
The request and response follow the OpenAI Chat Completions schema. Fields marked supported are forwarded; everything else is dropped before the upstream call.
Supported fields
| Field | Notes |
|---|---|
model | Required. Must be a FreeGate model id, not an upstream id. |
messages | Required. Text parts, plus images and files where the model supports them. |
max_completion_tokens | Clamped to the operator's per-request ceiling; the live value is on status. |
temperature, top_p | Forwarded as-is. |
stop | String or array of strings. |
presence_penalty, frequency_penalty | Forwarded as-is. |
seed | Forwarded when the model supports it. |
tools | Forwarded. Function tools only; up to 128 definitions. |
tool_choice, parallel_tool_calls | Forwarded with tools. |
stream | See streaming. |
Messages
All four roles are accepted, including tool results and assistant turns that carry
only tool_calls with null content.
- Text · everywhere.
- Images ·
image_urlparts, only on vision-capable models (see models). Everything else returns400 model_no_vision. - Files ·
fileparts with afile_datadata URL. Text-like files (source code, JSON, YAML, CSV, Markdown…) are decoded and inlined as a text part, capped at 500 KB. Binary formats return400, because upstreams reject file parts outright.
Dropped fields
response_format, logprobs, n, user,
store and metadata are removed. Everything else listed above is forwarded
unchanged.
Request
POST https://api.firesafety.men/v1/chat/completions
{
"model": "oss-20b",
"messages": [
{ "role": "system", "content": "You are terse." },
{ "role": "user", "content": "What is a race condition?" }
],
"max_completion_tokens": 512,
"temperature": 0.7,
"stream": false
} Response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"created": 1795935635,
"model": "oss-20b",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Two processes…" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 24, "completion_tokens": 88, "total_tokens": 112 }
} Limits enforced before dispatch
- Unknown model →
400 unsupported_model. - Model not granted to your account →
403 model_not_allowed. - Estimated prompt + output above the context window →
400 context_length_exceeded. - Body above 1 MiB → rejected by the edge before it reaches the app.