First request
The OpenAI API is what Gatelum implements: existing code on the official SDK will run once you swap in the new address and key.
Top up the balance and issue an API key in the cabinet.
Paste the key into the example below and send the request.
https://api.gatelum.com/v1Your first request
- GPT-6.2 Astra — openai/gpt-6.2-astraText models
- GPT-6.2 Sol — openai/gpt-6.2-solText models
- GPT-6 Astra — openai/gpt-6-astraText models
- GPT-6.1 Sol — openai/gpt-6.1-solText models
- GPT-6.1 Terra — openai/gpt-6.1-terraText models
- GPT-5.6 Sol — openai/gpt-5.6-solText models
- GPT-5.6 Terra — openai/gpt-5.6-terraText models
- GPT-6 Sol — openai/gpt-6-solText models
- GPT-5.6 Luna — openai/gpt-5.6-lunaText models
- GPT-6 Luna — openai/gpt-6-lunaText models
- GPT-5.5 — openai/gpt-5.5Text models
- GPT-5.4 — openai/gpt-5.4Text models
- GPT-5.4 Mini — openai/gpt-5.4-miniText models
- GPT-5.3 Codex — openai/gpt-5.3-codexText models
- Claude Fable 5.2 — anthropic/claude-fable-5.2Text models
- Claude Fable 5.1 — anthropic/claude-fable-5.1Text models
- Claude Fable 5 — anthropic/claude-fable-5Text models
- Claude Sonnet 5.5 — anthropic/claude-sonnet-5.5Text models
- Claude Fable 5 Compressed Context — anthropic/claude-fable-5-compressed-contextText models
- Claude Opus 5.5 — anthropic/claude-opus-5.5Text models
- Claude Opus 5 — anthropic/claude-opus-5Text models
- Claude Opus 4.8 — anthropic/claude-opus-4.8Text models
- Claude Opus 4.7 — anthropic/claude-opus-4.7Text models
- Claude Opus 4.6 — anthropic/claude-opus-4.6Text models
- Claude Opus 4.5 — anthropic/claude-opus-4.5Text models
- Claude Sonnet 5 — anthropic/claude-sonnet-5Text models
- Claude Sonnet 4.6 — anthropic/claude-sonnet-4.6Text models
- Claude Sonnet 4.5 — anthropic/claude-sonnet-4.5Text models
- Claude Haiku 4.5 — anthropic/claude-haiku-4.5Text models
- Gemini 4 Carbon — google/gemini-4-carbonText models
- Gemini 4 Hydrogen — google/gemini-4-hydrogenText models
- Gemini 4 Argon — google/gemini-4-argonText models
- Gemini 3.8 Flash — google/gemini-3.8-flashText models
- Gemini 3.5 Flash Lite — google/gemini-3.5-flash-liteText models
- Gemini 3.1 Pro Preview — google/gemini-3.1-pro-previewText models
- Gemini 3.1 Flash Lite — google/gemini-3.1-flash-liteText models
- Gemini 3 Flash Preview — google/gemini-3-flash-previewText models
- Gemini 2.5 Flash — google/gemini-2.5-flashText models
- Gemini 2.5 Pro — google/gemini-2.5-proText models
- DeepSeek V4.1 Flash — deepseek/deepseek-v4.1-flashText models
- DeepSeek V4.1 Flash 1017 — deepseek/deepseek-v4.1-flash-1017Text models
- DeepSeek V4 Pro — deepseek/deepseek-v4-proText models
- DeepSeek V4 Pro 0813 — deepseek/deepseek-v4-pro-0813Text models
- DeepSeek V4 Flash — deepseek/deepseek-v4-flashText models
- Grok 4.7 — x-ai/grok-4.7Text models
- Grok 4.6 — x-ai/grok-4.6Text models
- Grok 4.5 — x-ai/grok-4.5Text models
- Grok 4.3 — x-ai/grok-4.3Text models
- Grok Build 0.1 — x-ai/grok-build-0.1Text models
- GLM-5.3 — z-ai/glm-5.3Text models
- GLM-5.3 Flash — z-ai/glm-5.3-flashText models
- GLM-5.3 FlashX — z-ai/glm-5.3-flashxText models
- GLM-5.2 — z-ai/glm-5.2Text models
- GLM-5.1 — z-ai/glm-5.1Text models
- Kimi K3.1 Pro — moonshotai/kimi-k3.1-proText models
- Kimi K3.1 Pro HS — moonshotai/kimi-k3.1-pro-highspeedText models
- Kimi K3 — moonshotai/kimi-k3Text models
- Kimi K2.7 Code — moonshotai/kimi-k2.7-codeText models
- Kimi K2.6 — moonshotai/kimi-k2.6Text models
- Kimi K2.5 — moonshotai/kimi-k2.5Text models
- Qwen 3.8 Max — qwen/qwen3.8-maxText models
- Qwen 3.8 Omni Flash — qwen/qwen3.8-omni-flashText models
- Qwen 3.7 Max — qwen/qwen3.7-maxText models
- Qwen 3.8 Flash — qwen/qwen3.8-flashText models
- Qwen 3.7 Plus — qwen/qwen3.7-plusText models
- MiMo V2.5 Pro — xiaomi/mimo-v2.5-proText models
- MiMo V2.6 Pro — xiaomi/mimo-v2.6-proText models
- MiMo V2.5 — xiaomi/mimo-v2.5Text models
- MiMo V2.6 Flash — xiaomi/mimo-v2.6-flashText models
- MiniMax M3.1 Flash — minimax/minimax-m3.1-flashText models
- MiniMax M3 — minimax/minimax-m3Text models
- HY4 Preview — tencent/hy4-previewText models
- GPT Image 2.6 Sunburst — openai/gpt-image-2.6-sunburstPictures
- GPT Image 2.6 Flare — openai/gpt-image-2.6-flarePictures
- GPT Image 2.5 Sunburst — openai/gpt-image-2.5-sunburstPictures
- GPT Image 2.5 Flare — openai/gpt-image-2.5-flarePictures
- GPT Image 2 — openai/gpt-image-2Pictures
- Gemini 3.1 Flash Lite Image — google/gemini-3.1-flash-lite-imagePictures
- Gemini 3.1 Flash Image Preview — google/gemini-3.1-flash-image-previewPictures
- Gemini 2.5 Flash Image — google/gemini-2.5-flash-imagePictures
- Gemini 3 Pro Image — google/gemini-3-pro-imagePictures
- Grok Imagine Image 2.0 — x-ai/grok-imagine-image-2.0Pictures
- Qwen Image 3.0 Pro — qwen/qwen-image-3.0-proPictures
- Qwen Image 3.0 — qwen/qwen-image-3.0Pictures
- Qwen Image 2.1 — qwen/qwen-image-2.1Pictures
- FLUX.2 Pro — bfl/flux-2-proPictures
- FLUX Kontext Max — bfl/flux-kontext-maxPictures
- FLUX Kontext Pro — bfl/flux-kontext-proPictures
- Seedream 5.0 Flash — bytedance/seedream-5.0-flashPictures
- Seedream 5.0 Lite — bytedance/seedream-5.0-litePictures
- Seedream 4.5 — bytedance/seedream-4.5Pictures
- Seedream 4.0 — bytedance/seedream-4.0Pictures
- Seedream — bytedance/seedreamPictures
- Ideogram V3 — ideogram/ideogram-v3Pictures
- Wan 2.7 Image Pro — wan-ai/wan-2.7-image-proPictures
- Wan 2.7 Image — wan-ai/wan-2.7-imagePictures
- Z-Image Base — tongyi-mai/z-image-basePictures
- Wan 2.6 — alibaba/wan-2.6Video
- Seedance 2.0 Fast — bytedance/seedance-2.0-fastVideo
- Seedance 2.0 — bytedance/seedance-2.0Video
- Veo 3.1 Fast — google/veo-3.1-fastVideo
- Veo 3.1 — google/veo-3.1Video
- GPT-4o Transcribe — openai/gpt-4o-transcribeTranscription
- GPT Transcribe — openai/gpt-transcribeTranscription
- GPT-4o Transcribe Diarize — openai/gpt-4o-transcribe-diarizeTranscription
- Whisper 1 — openai/whisper-1Transcription
- Eleven v3 — elevenlabs/eleven-v3Speech
- Eleven Flash v2.5 — elevenlabs/eleven-flash-v2.5Speech
- Eleven v4 — elevenlabs/eleven-v4Speech
- Eleven Multilingual v2 — elevenlabs/eleven-multilingual-v2Speech
- Eleven v3 Conversational — elevenlabs/eleven-v3-conversationalSpeech
- Eleven Flash v2 — elevenlabs/eleven-flash-v2Speech
- Eleven v4 Turbo — elevenlabs/eleven-v4-turboSpeech
curl https://api.gatelum.com/v1/chat/completions \ -H "Authorization: Bearer glt_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "openai/gpt-5.4-mini", "messages": [{"role": "user", "content": "Hi there!"}]}'
from openai import OpenAI client = OpenAI(base_url="https://api.gatelum.com/v1", api_key="glt_YOUR_KEY") result = client.chat.completions.create( model="openai/gpt-5.4-mini", messages=[{"role": "user", "content": "Hi there!"}], ) print(result)
import { createReadStream } from "node:fs"; import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.gatelum.com/v1", apiKey: "glt_YOUR_KEY" }); const result = await client.chat.completions.create({ model: "openai/gpt-5.4-mini", messages: [{ role: "user", content: "Hi there!" }], }) console.log(result)
Pick a model and its ID and the matching endpoint appear in the code by themselves. The highlight marks the single spot for your key: create it on the keys page in the cabinet and paste it over the placeholder.
Three connection fields
| Base URL / Endpoint | https://api.gatelum.com/v1 |
|---|---|
| Your API key | glt_YOUR_KEY |
| Model ID | openai/gpt-5.4-mini |
base_url is the address above plus /v1. The model field decides which model to call.
Connecting an app
An app that speaks the OpenAI-compatible API needs just three values. The Anthropic SDK and Claude Code break the pattern: their own protocol, and a separate card.
| Base URL / Endpoint | https://api.gatelum.com/v1 |
|---|---|
| Your API key | glt_YOUR_KEY |
| Model ID | openai/gpt-5.4-mini |
If the field is labelled simply “Base URL”, the app will append /chat/completions by itself — no need to duplicate it. Also confirm the address did not turn into /v1/v1.
A key can be checked without any code: send the request from “First request” above.
parameter_not_supported instead of vanishing along the way. This covers two things: the retired functions format and the audio-output settings (audio, modalities). JSON output via response_format is accepted on OpenAI-compatible routes; a model reachable only through a direct Anthropic or Google connection answers unsupported_capability, and the gateway does not check the JSON it returns. Images are visible only to a model with that capability — the catalog labels it “Understands images”. The frame travels inside image_url as a data URI, and the gateway never pulls remote bytes. A model without vision replies bad_request and identifies itself; audio input is accepted by no one. What does work: as many as 120 tools per request, calls in both a plain reply and a stream, ordinary chat, and streaming on every model in the catalog.Step-by-step guides
- Claude Code
- Codex CLI
- Aider
- Qwen Code
- Gemini CLI
- OpenCode
- Hermes Agent
- DeepSeek Harness
- Cursor
- Zed
- Windsurf
- Cline
- Roo Code
- Continue
- Kilo Code
- GitHub Copilot
- JetBrains AI Assistant
- n8n
- Telegram Bot
- OpenClaw
- Open WebUI
- Claude Desktop
- LangChain
- LlamaIndex
- SillyTavern
- Cherry Studio
- Make
- 1С:Предприятие
- LiteLLM
Editor extensions: Cursor, Cline, Roo Code, Kilo Code
In the provider section choose “OpenAI Compatible” and put the details into the three fields above. Agent modes are supported too: the gateway can call functions, so an extension may read and edit files on its own. In Cursor, open Settings → Models → Override OpenAI Base URL and place the key there. Chat and the agent travel through Gatelum, while Tab and suggestions remain Cursor’s. If the model list fails to appear, enter the Model ID manually.
SillyTavern
In SillyTavern pick an OpenAI-compatible source under Chat Completion settings. Address, key and model go into the Custom Endpoint fields. If messages flow but the status check fails, tick Bypass API status check.
n8n
Create an OpenAI credential, enter the Base URL including /v1, and paste in the key. In the AI node, the model comes from the full Model ID. The AI Agent node is supported as well: it depends on function calling, which the gateway provides.
Janitor AI
Set the OpenAI-compatible API endpoint to https://gatelum.com/v1, then enter your API key and the complete model ID from the catalog. Send a short test message to confirm the connection.
OpenCode
Add a Gatelum provider to opencode.json with the gateway address https://gatelum.com/v1, your API key and the model IDs you plan to use. OpenCode lists models configured in that provider; choose one from /models.
{ "$schema": "https://opencode.ai/config.json", "provider": { "Gatelum": { "npm": "@ai-sdk/openai-compatible", "name": "Gatelum", "options": { "baseURL": "https://api.gatelum.com/v1", "apiKey": "glt_YOUR_KEY" }, "models": { "openai/gpt-5.4-mini": { "name": "GPT-5.4 Mini" }, "anthropic/claude-sonnet-4.6": { "name": "Claude Sonnet 4.6" } } } } }
Anthropic SDK / Claude Code
POST /v1/messages, the native Anthropic endpoint, is available here, and max_tokens is required. You can pass the key either as Authorization: Bearer or as x-api-key. Do not add /v1 to the address: Claude Code appends the path on its own, and the extra piece produces 404. count_tokens gives an approximation instead of an exact number; cache_control is accepted with no effect — there is no manual cache marking. On the “Models” page, a model that has its own cached-input rate enables caching automatically: a repeated prefix costs less, and usage.cache_read_input_tokens reports how many such tokens came from the cache. For step-by-step setup, including environment variables, see “Integrations”.
Pricing, cache and reserve
Three rules
- The balance is topped up in advance: no subscriptions, no end-of-month invoice.
- A request costs the chosen
model's rate times the number of tokens it returned. - The charge is taken right after the answer. If the money is short, the request gets 402 and never runs; the balance does not go negative.
How the charge is built
Every model has its own rate: one per million input tokens, another per million output. Input is what you send, output is what the model writes; output usually costs more. Current rates live in the model catalog.
in = tokens_in / 1 000 000 × price_in
out = tokens_out / 1 000 000 × price_out
───────────────────────────────────────────
sum = in + outRounding goes up to a millionth of a dollar, applied to each half of the bill. Token counts come from the usage field the model returns.
Worked through with numbers
model — openai/gpt-5.4-mini · input at $0.122 per 1M tokens · output at $0.625 per 1M tokens
The prices in the example come from the live catalog that feeds the bill.
A repeated prefix is cheaper
Nothing needs to be switched on: the cache works when the same prefix repeats in a row and is long enough — around a thousand tokens. The first request that fills the cache does not cost more.
in = (tokens_in − tokens_cached) / 1 000 000 × price_in
+ tokens_cached / 1 000 000 × rate_cache_inThe response tells you how many tokens were cached: usage.prompt_tokens_details.cached_tokens, while /v1/messages reports usage.cache_read_input_tokens. The cabinet and GET /v1/workspace/activity all show the same figures. A separate cached-input rate appears in the catalog and in GET /v1/workspace/catalog, though not every model has one; where it is missing, cached tokens cost the same as ordinary input.
Where the hold on the balance comes from
Nobody knows the answer length before it is written, so the gateway holds an amount for the worst case before calling the model.
hold = tokens_in / 1 000 000 × price_in
+ max_tokens / 1 000 000 × price_outIf the hold is larger than the balance, the request is refused before any model call. After the answer, the real cost is taken and the unused part of the hold goes straight back to the balance.
max_tokens: 4 000Set max_tokens roughly to the length you expect the answer to have. A higher ceiling means a larger hold, which leaves less money for requests running in parallel. If max_tokens is omitted, the hold is based on the 32,000-token ceiling.
When the bill is zero
A model error (502, 504) is not billed and the hold comes back in full. A refusal before the model — bad key, short balance, unsupported field, oversized body — is free as well. Counting tokens through /v1/messages/count_tokens never costs anything.
Where to see the spend
The key page in the cabinet shows a request table (model, tokens, cost) and a per-day chart. The spend area gives the period total and a breakdown by model. Neither request nor response bodies are stored, so those counters are the whole statistics.
Text chat: the model answer
An answer to the conversation, with stream=true (SSE) supported. Request and response follow OpenAI.
Streaming is switched on by "stream": true. Fragments arrive as data: {...} lines, the last one is data: [DONE].
What works: tools and tool_choice in text chat, image input for models that can take it, image creation and editing, and video. JSON output through response_format is accepted too, on OpenAI-compatible routes. Fields such as functions, audio and modalities in chat still answer 400: silently dropping a parameter is not something we will do.
Request fields
The body sent to POST /v1/chat/completions looks like this. Only model and messages are mandatory; everything else can be left out, since each field has a default.
Request body
| Field name | Value type | What it is for |
|---|---|---|
modelalways needed | string | The catalog id in full: the part before “/” cannot be dropped. |
messagesalways needed | array | The conversation as a list. Each entry has a role (system, user, assistant or tool) and content. The gateway keeps no memory of earlier requests, so send the history every time. |
stream | boolean | Set true and the answer streams as it is produced: chunks arrive on data: {…} lines, ending with data: [DONE]. |
temperature | 0 … 2 | Sampling temperature. Low keeps answers even and dry; high lets them run freer. |
top_p | 0 … 1 | The second lever for variety. Move one of temperature or top_p, not both. |
max_tokens | ≥ 1 (max 32 000) | The maximum length of an answer. The gateway reduces anything above 32,000 to 32,000. This field also determines the hold — more in “Pricing, cache and reserve”. |
max_completion_tokens | ≥ 1 (max 32 000) | The identical field, renamed by OpenAI. Should both be present, max_completion_tokens takes precedence. |
stop | string | string[] | Up to three strings: generation breaks on any of them, and the string itself is left out of the answer. |
stream_options | object | With {"include_usage": true} the last chunk of the stream carries the token count. |
tools | array (≤ 120) | Function definitions the model may call. The calls come back in choices[].message.tool_calls. |
tool_choice | string | object | none — call nothing, auto — the model decides, required — a call is mandatory, an object — call that one function. |
reasoning_effort | string | reasoning_effort controls how long a model spends thinking. With reasoning models, a low level yields a quick, inexpensive answer while a high one digs deeper; the depth is the model’s call. Models that do not reason accept the field and respond as usual; Grok currently ignores it. Values not on the list produce 400. |
response_format | object | Response format on OpenAI-compatible routes: {"type": "text"}, {"type": "json_object"} or {"type": "json_schema", "json_schema": {...}}. Direct Anthropic and Google routes return unsupported_capability. |
user | string | Your end-user id. The gateway passes it through untouched, and it does not change the price. |
functions, audio, modalities — Each of them returns 400 parameter_not_supported. The refusal is intentional: dropping a field silently and charging for an answer built on other rules is worse than a clear error.In the response
The response follows OpenAI’s format, and the official SDKs accept it unchanged.
| Field name | What it is for |
|---|---|
id | The request id. Include it when you write to support. |
model | The id of the model that generated the answer. |
choices[].message.content | The answer text; null if the model called a tool instead. |
choices[].message.tool_calls | The functions the model asked for. |
choices[].finish_reason | What ended generation: stop — the model finished by itself, length — max_tokens cut it short, tool_calls — the model requests a tool. |
usage.prompt_tokens | Request tokens — one half of what the call costs. |
usage.prompt_tokens_details.cached_tokens | The count of input tokens served from cache. Such tokens are included in prompt_tokens and, when the model has a cached-input rate, are priced by it. |
usage.completion_tokens | Tokens the model produced — the other half. |
usage.total_tokens | Input plus output. |
Images in a request
Put the frame straight into the message: a screenshot, a receipt photo or a mockup reaches a vision model that way. There is no separate endpoint — the image travels next to the text in POST /v1/chat/completions, and /v1/messages and /v1/responses behave the same.
How to attach an image
In a user message the content field becomes a list of parts. Text is a text part. An image is an image_url part: its url holds a data:image/png;base64,… string with the media type and the bytes. The gateway keeps the order, so the model sees the parts exactly as sent. detail (auto, low, high) is passed through unchanged. Text is optional — a message may consist of images alone.
{ "role": "user", "content": [ { "type": "text", "text": "What text is on this screenshot?" }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgo…", "detail": "auto" } } ] }
http/https links are not fetched — such a request gets 400 bad_request with a hint. Encode to base64 on your side: one line in any language.
curl https://api.gatelum.com/v1/chat/completions \ -H "Authorization: Bearer glt_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-5", "messages": [{ "role": "user", "content": [ { "type": "text", "text": "What text is on this screenshot?" }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,'"$(base64 -w0 shot.png)"'" } } ]}] }'
import base64 from openai import OpenAI client = OpenAI(base_url="https://api.gatelum.com/v1", api_key="glt_YOUR_KEY") with open("shot.png", "rb") as file: image = base64.b64encode(file.read()).decode() completion = client.chat.completions.create( model="anthropic/claude-sonnet-5", messages=[{"role": "user", "content": [ {"type": "text", "text": "What text is on this screenshot?"}, {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image}"}}, ]}], ) print(completion.choices[0].message.content)
import { readFileSync } from "node:fs"; import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.gatelum.com/v1", apiKey: "glt_YOUR_KEY" }); const image = readFileSync("shot.png").toString("base64"); const completion = await client.chat.completions.create({ model: "anthropic/claude-sonnet-5", messages: [{ role: "user", content: [ { type: "text", text: "What text is on this screenshot?" }, { type: "image_url", image_url: { url: `data:image/png;base64,${image}` } }, ]}], }); console.log(completion.choices[0].message.content);
What is allowed
- PNG, JPEG and WebP are accepted. The gateway reads the first bytes rather than the extension: a
filenamed “png” with foreign content is refused on our side and never reaches themodel. - Binary
datain one image is capped at 5 MB. Encoding it inbase64adds about a third more. - One request carries at most 50
images, and the count covers every frame in the conversation, not just the last message. - The whole body with
imagesmay be up to 32 MB. Size matters more than count: 50 frames fit only when each is small. - A body above 4 MB requires an active key (the large-body gate checks the key, rate limits, penalty, and concurrent upload slots; balance is checked later in the handler). Reading it can take as long as 30 s; exceed that and 408
body_read_timeoutarrives withRetry-After. Only a limited number of large uploads proceed together — the next one receives 429 withRetry-After. - When a request carries more than 20 frames, some models accept them only downscaled — 2000 px on the long side at most.
Which models see images
57 models understand images; each was checked with a real request. The catalog marks them “Understands images”, and GET /v1/workspace/catalog carries it in capabilities. Without the capability a model answers 400 bad_request, and nothing is charged.
What an image costs
A frame is billed as input tokens, and the model sets the count: roughly 1 089 per 1024×1024 frame, and several times that on some models. The charge is whatever arrives in usage.prompt_tokens, under the same formula as text. The hold is taken with a margin and the unused part comes back — see “Pricing, cache and reserve”. POST /v1/messages/count_tokens gives a rough number before you send.
Images from tools
A tool may return an image — an opened file or a screenshot — and it reaches the model too. The OpenAI protocol allows text only in a tool result, so the gateway adds such frames as a separate user message right after the results. The conversation order stays as it was, and nothing needs configuring.
Under Responses API, a frame arrives as an input_image part, where detail: original is treated as high. With the Messages API it becomes an image block whose source is base64; an url source is never fetched, just as in chat. Blocks of type document and file are rejected here with 400 parameter_not_supported, since PDF reading belongs to the chat endpoint alone (see “PDF in a request”).
When a refusal arrives
None of the refusals below incurs a charge. A 400 bad_request means the format is wrong, the bytes disagree with the declared type, the size or number of frames is too large, or an image appears in a message whose role is system, developer or assistant. Another 400 bad_request appears when the model cannot handle images. 400 context_length_exceeded — the text and frames combined did not fit the window. 408 body_read_timeout — the body never arrived. 413 body_too_large — the body exceeds the limit.
model. Statistics keep a counter — images_in in GET /v1/workspace/activity.PDF in a request
A PDF travels with the message as one more content part, in POST /v1/chat/completions only: a model with the pdf capability gets the file itself, while the rest receive just the text the gateway extracted.
How to attach a PDF
The document goes into the content of a user message. Beside the text part sits a file part, and its file_data holds data:application/pdf;base64,…. The file.filename field is optional; a name longer than 255 characters is trimmed by the gateway. A file part is accepted only in user messages: in system, developer, assistant or tool it returns 400 bad_request.
{ "role": "user", "content": [ { "type": "text", "text": "Summarise the key points of this report" }, { "type": "file", "file": { "filename": "report.pdf", "file_data": "data:application/pdf;base64,JVBERi0xLjc…" } } ] }
A document is uploaded together with a request only. There is no separate file_id because the gateway stores no files. External http/https links are not fetched — the answer is 400 bad_request with a hint. Only the chat endpoint reads PDF; the Responses API input_file and the Messages API document block get 400 parameter_not_supported.
What is allowed
- Only PDF is accepted, and the type is read from the first bytes (%PDF-), not from the extension: a
filenamed .pdf with foreign content is refused at the gateway. A password-protected PDF is not accepted. - A single
filemay be up to 10 MB of binarydata.base64makes it roughly a third larger. - A document holds up to 100 pages.
- A request may carry up to 10 documents. Every PDF in the history counts, not only the last message; the history goes again, so the document is paid for each time.
- The whole request body may be up to 32 MiB. This limit outranks the
filecount: two 10 MB PDFs inbase64will not fit one body. - Parsing is bounded by time, memory and the length of the extracted
text(150 000 characters). Anything outside those bounds gets 400document_too_complex. Concurrent parses are finite; under load the answer is 429too_many_requestswithRetry-After.
Which models read the whole PDF
The whole file is accepted by 10 catalog models — each verified by a real request, not a claim. GET /v1/workspace/catalog lists it as pdf. Other models still accept PDF, but only its text — see the modes above.
native and text modes
- native — a
modelwith thepdfcapability receives thefileuntouched: pages, tables, diagrams and scans. If an image travels with the PDF and the route does not takeimages, the document goes astext. text— the gateway pulls out thetextlayer and substitutes it for thefilepart as a <document name="…" pages="N">…</document>. Layout andimagesare lost. A scan with notextlayer returns 400document_no_text; it needs amodelwith thepdfcapability.
When a request carries a file part, the response includes the x-pdf-mode header — native or text. It tells whether the model got the file itself or only the extracted text. Without PDF there is no such header.
What a PDF costs
Parsing is not billed — only the input tokens are. In native mode the model counts pages itself: usually around 1 500 tokens per page, more on some models. In text mode the extracted text is billed as ordinary text. The amount comes from usage.prompt_tokens, with the same arithmetic as a text request. A hold is taken with a margin and the rest returns (see “Pricing, cache and reserve”). A PDF from the history is paid for again on every request.
When a rejection comes
None of the refusals below is billed. 400 document_invalid — the file is corrupted. 400 document_too_large — over 10 MB. 400 document_too_many_pages — over the page limit. 400 document_encrypted — the document is password-protected. 400 document_no_text — text mode, but the file has no text layer. 400 document_too_complex — parsing exceeded time, memory or text length. 400 bad_request — the file part is malformed: a file_id or a link instead of a data: URL, first bytes that are not PDF, too many files, the file outside a user message, or PDF input temporarily disabled. 400 context_length_exceeded — the document and the conversation do not fit the model context. 413 body_too_large — the body exceeds the allowed size. 429 too_many_requests — parsing is overloaded.
model. The error log keeps a refusal code alone — no file name, no content.Image generation
A synchronous answer comes back, with request and response shaped after OpenAI Images. One frame’s price is multiplied by n.
curl https://api.gatelum.com/v1/images/generations \ -H "Authorization: Bearer glt_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-image-2", "prompt": "a red cat wearing glasses", "n": 1 }'
An image-capable model is required; GET /v1/models provides the list. The reply holds a data array, and every element contains b64_json, where the frame is base64-encoded. Even when a model supplies a link, the gateway does not pass it on: you receive the frame as bytes. A per-frame model does report usage — precisely the numbers that were charged. x-trace-id identifies the charge record, and GET /v1/workspace/activity finds the request by it.
Accepted size values: auto, 1024x1024, 1536x1024, 1024x1536, 1792x1024, 1024x1792. Prompt length is capped at 15 000 characters. Generation will not work with the fields image, images, mask, aspect_ratio, image_size, resolution — it returns 400 parameter_not_supported. An image on input is POST /v1/images/edits.
When generation is not available
These models do not draw from scratch: their job is to change a ready frame. POST /v1/images/generations answers 400 bad_request and charges nothing. To edit, use POST /v1/images/edits. The catalog carries the “Edit only” mark, and GET /v1/workspace/catalog reports edit_only.
Editing an existing image
A ready frame is modified by POST /v1/images/edits using a text description: a background, a detail, a style. The request body follows OpenAI Images as multipart/form-data — one or more files and prompt. The frame comes back base64-encoded.
curl https://api.gatelum.com/v1/images/edits \ -H "Authorization: Bearer glt_YOUR_KEY" \ -F model=openai/gpt-image-2 \ -F prompt="Make the background a light gradient" \ -F image=@cat.png
from openai import OpenAI client = OpenAI(base_url="https://api.gatelum.com/v1", api_key="glt_YOUR_KEY") with open("cat.png", "rb") as image: result = client.images.edit( model="openai/gpt-image-2", image=image, prompt="Make the background a light gradient", ) print(result.data[0].b64_json[:32])
In the response:
{ "created": 1757700000, "data": [{ "b64_json": "iVBORw0KGgo…" }], "usage": { "input_tokens": 116, "output_tokens": 1650, "total_tokens": 1766 } }
The model chooses the frame format: PNG or JPEG. The gateway does not transcode — data[0].b64_json is the finished bytes; detect the type yourself if needed.
The usage field can be missing. A per-frame model omits it, because billing is per frame rather than per token. input_tokens_details and output_tokens_details come only if the model returns them — look for the fields instead of relying on them.
Form fields
| Field name | Value type | What it is for |
|---|---|---|
modelalways needed | string | An editing-capable image model is required. A chat model is rejected with 404 model_not_found; if the chosen image model lacks editing, it answers 400 bad_request. |
promptalways needed | string (≤ 15 000) | The editing instruction for the image, up to 15 000 characters. |
imagealways needed | file × 1 … 4 | PNG, JPEG and WebP are allowed, recognised by their first bytes, up to 5 MB per file. Put one frame in image and several in image[] (the OpenAI SDK packages them this way), with at most 4 files. Certain models, Gemini 3.1 Flash Image among them, take a single frame only; send more and they answer 400 with param=image. |
n | 1 … 4 | Number of frames in the answer. The default is one; the live probe covers one frame per request, so larger values have not been measured. |
size | auto | 1024x1024 | 1024x1536 | 1536x1024 | Picture dimensions. Left at auto, the model picks them, usually matching the photo’s shape: 1024x1536 stands upright, 1536x1024 lies flat, 1024x1024 is square. Anything else is a 400. Per-frame models support 1024x1024 alone. |
response_format | b64_json | b64_json is the sole accepted value and the default as well. url produces 400 parameter_not_supported: no storage exists here, so a link would have nowhere to point. |
input_fidelity: high, mask, stream=true, output_compression, background: transparent, output_format, partial_images. Any of these changes the output bytes or the model price, and swallowing one silently would return something other than what was asked. Masks remain unsupported by every model, so leave them out of the image.Accepted but not passed to the model
Accepted: quality, user, background (opaque or auto), and input_fidelity (low). Such a request passes, yet the output and the price stay the same.
Timing and parallel requests
A single edit can take a minute or several. The model gets 570 seconds; past that, 504 timeout comes with no charge. Give your client a timeout no lower than 600 seconds. Each account may run 2 edits simultaneously, and the next one meets 429 with Retry-After. Once 5 refusals 400 occur in a row, editing for that account stalls for roughly a minute, so verify how long the prompt is and what the field values are before you send.
Pricing, cache and reserve
An edit costs what generation on that model costs: there is no separate rate. Where the model bills tokens, input and output follow its rates and usage matches the charge. A per-frame model takes its frame price for each frame. A hold is placed with a margin and the rest returns; a failed model costs nothing.
Content-Length is required: a chunked upload without it returns 400 bad_request. If the client streams the file, buffer it or set the size yourself.
The answer’s x-trace-id leads directly to the charge. That id locates the record in GET /v1/workspace/activity (field id) or in the cabinet; the OpenAI SDK calls it trace_id.
Which models can edit
Editing is switched on for 7 catalog models today. On the catalog page they carry “Image editing” or “Edit only”, and GET /v1/workspace/catalog reports image_edit in capabilities.
Video generation
Video generation runs asynchronously: your request starts a job and immediately returns its id. seconds is mandatory — it sets the clip length, and the price depends on it.
curl https://api.gatelum.com/v1/videos \ -H "Authorization: Bearer glt_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "alibaba/wan-2.6", "prompt": "a paper boat drifting on a calm pond", "seconds": 5 }' # {"id": "c4e7…", "status": "processing", "created": 1755648000}
Check the status every 5–10 seconds. processing — working, succeeded — the clip is ready and its url is in the response, failed — an error in the error field. Most jobs take 30 seconds to 3 minutes, sometimes longer; keep polling for at least 10 minutes. The link lives for 24 hours after readiness — download the file.
curl https://api.gatelum.com/v1/videos/JOB_ID \ -H "Authorization: Bearer glt_YOUR_KEY" # {"id": "c4e7…", "status": "succeeded", "url": "https://…/clip.mp4"}
The charge is clip seconds × model rate. Creating the job puts the amount in a hold, and only a finished clip is charged. A failed generation returns the hold in full.
Models and lengths
| Model ID | Length (seconds) | Dimensions | Audio |
|---|---|---|---|
alibaba/wan-2.6 | 2–10 | 720p | with sound |
bytedance/seedance-2.0-fast | 4–15 | 720p | without sound |
bytedance/seedance-2.0 | 4–15 | 720p | without sound |
google/veo-3.1-fast | 4–8 | 1080p | without sound |
google/veo-3.1 | 4–8 | 1080p | without sound |
Use a video model — GET /v1/models lists them. Per-second rates are on the models page.
Image on input
image_url sets the first frame, reference_images sets up to 3 references, and only Veo 3.1 Fast and Veo 3.1 take them. The value is an https link or a data URI. The two fields cannot arrive together. The prompt is required even with an image.
| Model ID | First frame (seconds) | References (seconds) |
|---|---|---|
alibaba/wan-2.6 | — | — |
bytedance/seedance-2.0-fast | 5, 8 | — |
bytedance/seedance-2.0 | 5, 8 | — |
google/veo-3.1-fast | 4, 8 | 4, 8 |
google/veo-3.1 | 4, 8 | 4, 8 |
With an image, take the length from the table: without one the values differ. A dash means the input is unsupported; Seedance with a first frame and 4 seconds, for instance, will refuse.
Each image may be up to 5 MB; PNG/JPEG/WebP is detected from the content. The gateway fetches the link itself, so it has to be public; internal addresses are refused. The body may be up to 21 MB, and a data URI is about a third larger than the file.
The price is the same: seconds × rate. A mismatched image, model or length, or an unreachable link, gives 400 with the field name in param; no hold is created and nothing is charged.
A request carrying image, images, input_reference, first_frame, last_frame will not pass: it gets 400 parameter_not_supported with no charge. Pass an image only through image_url or reference_images.
Predictions: native input and output
POST /v1/predictions runs a supplier model that does not fit the chat, image or video shapes: segmentation, detection, upscaling and other utilities. The request names a prediction model and carries that model's native input; the answer is the same model's native output. Jobs are asynchronous, like video.
The body contains only model and input. model is a prediction model from GET /v1/models, and input is the model's own JSON object — the gateway forwards it after validation. Unknown top-level fields, and webhook or callback keys inside input, are rejected before any supplier call.
# Requires jq. ( set -e job=$( curl --silent --show-error --fail-with-body \ --header 'Authorization: Bearer glt_YOUR_KEY' \ 'https://api.gatelum.com/v1/predictions' \ --header "Content-Type: application/json" \ --data-binary @- <<'JSON' { "model": "meta/sam-3-image", "input": { "image_url": "https://example.com/cat.jpg", "prompt": "cat" } } JSON ) job_id=$(printf '%s\n' "$job" | jq -er '.id') while :; do case "$(printf '%s\n' "$job" | jq -er '.status')" in queued|running) sleep 5 ;; succeeded) printf '%s\n' "$job" | jq -r '.output'; break ;; *) printf '%s\n' "$job" >&2; exit 1 ;; esac job=$(curl --silent --show-error --fail-with-body \ --header 'Authorization: Bearer glt_YOUR_KEY' \ 'https://api.gatelum.com/v1/predictions/'"$job_id") done )
import json import time from urllib.request import Request, urlopen url = "https://api.gatelum.com/v1/predictions" auth = {"Authorization": "Bearer glt_YOUR_KEY"} payload = "{\n \"model\": \"meta/sam-3-image\",\n \"input\": {\n \"image_url\": \"https://example.com/cat.jpg\",\n \"prompt\": \"cat\"\n }\n}" request = Request( url, data=payload.encode("utf-8"), headers={**auth, "Content-Type": "application/json"}, ) with urlopen(request) as response: result = json.load(response) status_url = f"{url}/{result['id']}" while result["status"] in ["queued","running"]: time.sleep(5) with urlopen(Request(status_url, headers=auth)) as response: result = json.load(response) if result["status"] != "succeeded": raise RuntimeError(result) print(result["output"])
import { setTimeout as delay } from "node:timers/promises"; const url = "https://api.gatelum.com/v1/predictions"; const auth = { Authorization: "Bearer glt_YOUR_KEY" }; const payload = { "model": "meta/sam-3-image", "input": { "image_url": "https://example.com/cat.jpg", "prompt": "cat" } }; async function readJob(endpoint, options) { const response = await fetch(endpoint, options); if (!response.ok) throw new Error(await response.text()); return response.json(); } let job = await readJob(url, { method: "POST", headers: { ...auth, "Content-Type": "application/json" }, body: JSON.stringify(payload), }); const statusUrl = url + "/" + job.id; while (["queued","running"].includes(job.status)) { await delay(5000); job = await readJob(statusUrl, { headers: auth }); } if (job.status !== "succeeded") throw new Error(JSON.stringify(job)); console.log(job["output"]);
The example uses meta/sam-3-image: image_url points at a public image, and prompt names the object to segment. Field names and values differ per model; the catalogue shows each model's unit and per-unit price.
Every model has limits on its input, such as duration, num_images or image_size width and height. An input over a limit is refused with 400 invalid_request_error that names the field and its maximum, before any hold or charge.
A workspace may have at most 5 open predictions (queued or running) at a time. A sixth is refused with 429 too_many_requests; retry after one of them finishes.
Job states
The response status is one of four, and nothing else:
- queued — the job is accepted and waiting for the supplier.
- running — the supplier is working on it.
succeeded— the native output is ready in output.failed— the job ended with anerrorinerror; the hold returns and nothing is charged.
GET /v1/predictions/{id} returns the same id and status. Poll every few seconds; a job may take from seconds to a few minutes. Another workspace's id and an unknown id both answer 404.
On success output is exactly what the model returned — for SAM 3, a list of mask URLs. The gateway does not reshape it, so read the model's own fields. usage.cost_usd appears only after the actual charge is settled.
{ "id": "pred_…", "status": "succeeded", "output": { "masks": [{ "url": "https://…/mask.png", "content_type": "image/png" }] }, "usage": { "cost_usd": 0.0065 } }
What a prediction costs
The charge follows the supplier's actual usage for the call, not a fixed request price: the unit shown in the catalogue (units, images, megapixels, seconds, frames) is multiplied by what the model actually processed, at the model's per-unit price. The settled amount arrives in usage.cost_usd.
model's maximum price: the unit price multiplied by the largest quantity the model accepts. The hold is only a reservation — the actual charge replaces it after the job ends, and the unused part returns to the balance.If the balance cannot cover the hold, the request answers 402 before any supplier call and nothing is charged. Top up, or send an input that needs fewer units.
Audio transcription
The file goes to POST /v1/audio/transcriptions and text comes back. The request is synchronous, the body multipart/form-data following the OpenAI Audio API: a file and a model.
curl --silent --show-error --fail-with-body \ --header 'Authorization: Bearer glt_YOUR_KEY' \ 'https://api.gatelum.com/v1/audio/transcriptions' \ --form 'file=@"audio.mp3"' \ --form-string 'model=openai/gpt-4o-transcribe' \ --form-string response_format=json
import requests fields = {"model": "openai/gpt-4o-transcribe", "response_format": "json"} with open("audio.mp3", "rb") as recording: response = requests.post( "https://api.gatelum.com/v1/audio/transcriptions", headers={"Authorization": "Bearer glt_YOUR_KEY"}, data=fields, files={"file": recording}, ) response.raise_for_status() print(response.json()["text"])
Models
Use a transcription model from the catalog. OpenAI has four: GPT-4o Transcribe, GPT Transcribe, GPT-4o Transcribe Diarize, and Whisper 1. Whisper 1 supports word-level timestamps in verbose_json with timestamp_granularities[]=word; a chat model gets 404 model_not_found here. Prices are on the “Models” page.
Form fields
| Field name | Value type | What it is for |
|---|---|---|
filealways needed | file | The file goes in the file field: up to 25 MB, in flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav or webm. A file over the limit gets 413, an unreadable one audio_unreadable. |
modelalways needed | string | The model field names the catalog model that does the transcribing. OpenAI has four transcription models: GPT-4o Transcribe, GPT Transcribe, GPT-4o Transcribe Diarize, and Whisper 1. Whisper 1 supports word-level timestamps in verbose_json. |
language | string | Speech language as an ISO-639-1 code, ru for example. The hint improves accuracy and reaches the provider unchanged. |
prompt | string | A hint with terms, names or style; the provider receives it unchanged. |
response_format | json | text | srt | verbose_json | vtt | diarized_json | json by default. Also text, srt, verbose_json, vtt and diarized_json — the last one only on a model with speaker labels. Any other value is 400 bad_request. |
temperature | number | temperature sets the sampling temperature and reaches the provider unchanged. |
timestamp_granularities[] | string[] | Timestamp detail (word or segment) for verbose_json; the provider receives it unchanged. |
chunking_strategy | string | chunking_strategy sets how long audio is split and reaches the provider as is. |
known_speaker_names[] | string[] | known_speaker_names lists speaker names for a model with labels; the provider receives the list unchanged. |
known_speaker_references[] | string[] | known_speaker_references carries voice samples of known speakers; the provider receives them unchanged. |
include[] | string[] | include adds extra data to the response, logprobs for example; the provider receives the field as is. |
stream | false | Streaming is not supported: stream=true returns 400 bad_request. |
Response
json (the default) is an object with text, as in OpenAI. text, srt and vtt arrive exactly as the provider produced them. verbose_json adds language, duration and segments; with Whisper 1, pass timestamp_granularities[]=word to include word-level timestamps. diarized_json adds speaker turns — and only on a model with labels.
{ "text": "Hello! This is a sample transcript." }
Price
You pay per minute of audio. The gateway reads the duration from the file and rounds seconds up. The amount is held before transcription and charged after it; if the provider never answers, nothing is charged.
Text to speech (TTS)
POST /v1/audio/speech takes text and returns speech synchronously as binary bytes; mp3 by default. Every request is billed per character.
voice is an ElevenLabs voice_id, not an OpenAI voice name. alloy is an OpenAI name and is not an ElevenLabs voice: omitting voice uses the model default, while an explicit voice_id passes through unchanged.
ElevenLabs voices
| Voice | ID | Gender | Style | Default |
|---|---|---|---|---|
| Rachel | 21m00Tcm4TlvDq8ikWAM | Female | Calm, clear narration | ✓ |
| Domi | AZnzlk1XvdvUeBnXmlld | Female | Confident, energetic delivery | — |
| Bella | EXAVITQu4vr4xnSDxMaL | Female | Soft, warm narration | — |
| Adam | pNInz6obpgDQGcFmaJgB | Male | Deep, even narration | — |
| George | JBFqnCBsd6RMkjVDRZzb | Male | Warm, mature storytelling | — |
| Josh | TxGEqnHWrfWFTfGW9XjX | Male | Clear, youthful presentation | — |
| Daniel | onwK4e9ZLuTAKqWW03F9 | Male | Authoritative news-style delivery | — |
| Antoni | ErXwobaYiN019PkySvjV | Male | Smooth, friendly narration | — |
| Elli | MF3mGyEYCl7XYWbV9V6O | Female | Bright, youthful delivery | — |
| Arnold | VR6AewLTigWG4xSOukaG | Male | Firm, dramatic delivery | — |
| Sam | yoZ06aMxZJJ28mfd3POQ | Male | Casual, conversational tone | — |
| Callum | N2lVS1w4EtoT3dr4eOWO | Male | Smooth, measured narration | — |
| Charlie | IKne3meq5aSn9XLyUdCD | Male | Natural, conversational delivery | — |
| Charlotte | XB0fDUnXU5powFXDhCwa | Female | Elegant, expressive narration | — |
| Clyde | 2EiwWnXFnvU5JabPnv8n | Male | Deep, resonant narration | — |
| Ethan | g5CIjZEefAph4nQFvHAz | Male | Soft, intimate delivery | — |
| Finney | D38z5RcWu1voky8WS1ja | Male | Warm, conversational tone | — |
| Freya | jsCqWAovK2LkecY7zXl4 | Female | Bright, expressive narration | — |
| Gigi | jBpfuIE2acCO8z3wKNLl | Female | Playful, animated delivery | — |
| Grace | oWAxZDx7w5VEj9dCyTzz | Female | Gentle, refined narration | — |
| Harry | SOYHLrjzK2X1ezoPC6cr | Male | Energetic, assertive delivery | — |
| James | ZQe5CZNOzWyzPSCn5a3c | Male | Calm, professional narration | — |
| Jeremy | bVMeCyTHy58xNoL34h3p | Male | Warm, natural storytelling | — |
| Jessie | t0jbNlBVZ17f02VDIeMI | Female | Friendly, conversational tone | — |
| Joseph | Zlb1dXrM653N07WRdFW3 | Male | Rich, dramatic narration | — |
| Lily | pFZP5JQG7iQjIQuC4Bku | Female | Soft, soothing delivery | — |
| Matilda | XrExE9yKIg1WjnnlVkGX | Female | Warm, expressive storytelling | — |
| Michael | flq6f7yk4E4fJM5XTYuZ | Male | Clear, measured narration | — |
| Patrick | ODq5zmih8GrVes37Dizd | Male | Energetic, conversational tone | — |
| Thomas | GBv7mTt0atIp3Br8iCZE | Male | Quiet, reflective narration | — |
| Brian | nPczCjzI2devNBz1zQrb | Male | Deep, engaging narration | — |
| Will | bIHbv24MWmeRgasZH58o | Male | Relaxed, conversational delivery | — |
| Jessica | cgSgspJ2msm6clMCkdW9 | Female | Warm, expressive delivery | — |
| Eric | cjVigY5qzO86Huf0OWal | Male | Smooth, professional narration | — |
| Chris | iP95p4xoKVk53GoZ742B | Male | Natural, grounded delivery | — |
| Roger | CwhRBWXzGAHq8TQ4Fs17 | Male | Resonant, confident narration | — |
| Laura | FGY2WhTYpPnrIDTdsKH5 | Female | Bright, engaging delivery | — |
| River | SAz9YHcvj6GT2YYXdXww | Neutral | Neutral, even delivery | — |
The catalog is a recommendation, not an allowlist: any valid ElevenLabs voice_id works, listed or not.
A voice is not tied to one language: the model reads the text you send, so the same voice_id can speak different languages.
Request with a real voice_id
curl -X POST https://api.gatelum.com/v1/audio/speech \ -H "Authorization: Bearer glt_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"elevenlabs/eleven-multilingual-v2","input":"Hi there! This is a speech synthesis sample.","voice":"21m00Tcm4TlvDq8ikWAM","response_format":"mp3"}'
Workspace API: balance, activity and catalog
The read-only API provides a workspace summary, key activity and the model price catalog. Call it from your backend.
The key is the one you already use for model requests: Authorization: Bearer. Only GET is allowed, and the key must be active — a paused or revoked one returns 401. Keys have no place in a URL or in browser-side JavaScript. Statistics are tracked by the key that issued the request; balance and prices are shared for the whole account.
Everything in one answer: the account balance (active holds already deducted), key totals for the window, breakdowns by model and by UTC day, and gateway errors by code.
The key's requests in order: model, operation, status, nested tokens and prices, images_in, charge and latency. Newest on top, the next page comes from next_cursor.
Rates for served models: pricing holds per million tokens, per video second, per transcription minute or per generation; capabilities and the context window sit beside it. The order is stable by id and pages through next_cursor.
Query parameters
Every parameter is optional. A value out of range gives 400 bad_request and the field name arrives in param. Unknown parameters are ignored.
| Field name | Value type | Default | What it is for |
|---|---|---|---|
windowsummary · activity | 1d … 180d | 7d · 30d | History depth as a string like 7d: from 1d to 180d. The summary defaults to 7d, the feed to 30d. |
limitactivity · catalog | 1 … 100 | 50 | How many records to return: 1 to 100, 50 by default. |
cursoractivity · catalog | string | — | An opaque cursor from the previous next_cursor; it also pins the first page's window. Without it you get the first page; null in the answer means the end. |
Request examples
curl "https://api.gatelum.com/v1/workspace?window=7d" \ -H "Authorization: Bearer glt_YOUR_KEY" # {"object":"workspace.summary","balance":{"available_usd":2.640750,"currency":"USD"},"usage":{…},"by_model":[…],"by_day":[…],"errors":{"total":0,"by_code":[]}}
curl "https://api.gatelum.com/v1/workspace/activity?window=7d&limit=20" \ -H "Authorization: Bearer glt_YOUR_KEY"
In the response:
{ "object": "workspace.activity", "window": { "days": 7, "from": "2026-11-11T14:03:27.000Z", "to": "2026-11-18T14:03:27.000Z" }, "items": [ { "id": "c4e7…", "at": "2026-11-18T14:03:27.000Z", "model": "openai/gpt-5.4-mini", "operation": "chat", "status": "success", "tokens": { "input": 900, "cached_input": 0, "output": 640 }, "images_in": 0, "charged_usd": 0.00051, "prices": { "input_usd_per_1m_tokens": 0.122, "cached_input_usd_per_1m_tokens": 0.017, "output_usd_per_1m_tokens": 0.625, "generation_usd": null }, "duration_ms": 644, "peak_multiplier": null } ], "next_cursor": null }
The summary arrives as a single object with these fields:
summary: window · balance · usage · by_model[] · by_day[] · errors.by_code[]
activity: items[] · next_cursor
prompt or response bodies, which makes returning them impossible — through the API or by any other route. IP addresses and customer details remain undisclosed as well.Possible errors
The gateway has one error envelope for everything, described in “Errors and retries”. Here you may see:
401 invalid_api_key · 400 bad_request · 429 too_many_requests
Limits and access
Limits work both ways: they protect the balance and the gateway itself — a looping client must not burn the account in a minute.
| What is limited | Cap |
|---|---|
| Request rate from one key | a burst of 60, then 10 a second |
| Request body: chat and Messages | 4 MB |
Body with images: chat, Messages, Responses, editing | 32 MB |
| Request body: image generation and speech | 384 KB |
| Request body: video generation | 21 MB |
Combined length of all messages and tool definitions | 4 000 000 chars |
| Prompt length for image generation and editing | 15 000 chars |
| Simultaneous image edits per account | 2 |
Output token limit (max_tokens) | 32 000 tokens |
Number of tool definitions per request | 120 |
Number of stop strings per request | 3 |
| Key spend limit over a day, week, month | up to you |
| Days and hours the key is allowed | up to you |
Going over the rate yields 429 too_many_requests: wait, then retry; the key is not blocked or fined. For image editing, chat, /v1/messages and /v1/responses, a body larger than 4 MB requires an active key (the large-body gate checks the key, rate limits, penalty, and concurrent upload slots; balance is checked later in the handler after model and size checks). The server waits at most 30 s for the body; a limited number of heavy uploads run at once, and the next one receives 429 with Retry-After. Spend limits and schedules are yours to configure on the cabinet’s key page. When bad keys keep arriving from a single address, the 429 includes Retry-After — wait exactly that long.
The unit is a character, not a byte: a Cyrillic letter counts once, an emoji usually twice.
This is how long the gateway lets the model take. For chat, the first answer gets up to 120 seconds, and silence inside an answer already under way gets up to 240 seconds. Images get up to 570 seconds. If no answer begins at all, you receive 504 timeout and nothing is billed. Without streaming the whole answer arrives at once; request long answers with stream on. A broken reply, or a connection closed by the client, is logged as interrupted: the processed portion and whatever already arrived are charged. Set your own timeout higher than these values.
Much depends on the provider: a failed route returns provider_error or timeout.
Endpoint reference
Every gateway address. There is one base address — https://api.gatelum.com — and the key travels in the Authorization: Bearer glt_… header.
Models
The model list in OpenAI format; disabled models are left out.
Text
An answer to the conversation, with stream=true (SSE) supported. Request and response follow OpenAI.
With the OpenAI Responses API, both Codex CLI and the official SDK work as they are, no changes needed. The server keeps no state: the client supplies the history. Responses themselves are not retained either — you cannot fetch or delete one by id, and such requests return 404. Live capabilities: text.format (text, json_object, and json_schema with name and JSON object schema on OpenAI-compatible routes), instructions as a string or list of text items, namespace tools (flattened into function tools), built-in web_search (enabled per key in the dashboard), free-form custom tools (text format only; grammar format is refused), and SSE streaming. Fields that need stored state are refused with parameter_not_supported: previous_response_id, conversation, background=true, prompt and item_reference. file_id is not accepted because the gateway stores no files.
The native Anthropic protocol for Claude Code and the Anthropic SDK. The key is accepted in x-api-key and Bearer. SSE and tool calls work, max_tokens is required.
An estimate of input tokens without calling the model. It is not an exact count, and it spends nothing.
Media
Synchronous generation following OpenAI Images rules. The frame comes back in base64.
Edits a ready frame from a description: multipart/form-data in, base64 out.
Creates a video generation job. Priced per second, seconds is required; the response is a job with status processing.
Job state: processing — running, succeeded — ready with the clip url, failed — an error and no charge.
An asynchronous prediction job: a prediction model and its native input go in, a job id comes back. Poll the job for status and the native output.
Prediction state: queued — accepted, running — the supplier is working, succeeded — the native output is in output, failed — the reason is in error and there is no charge.
Takes an audio file as multipart/form-data and returns text, as OpenAI Audio. Fields, formats and limits are in “Audio and transcription”.
Text-to-speech following the OpenAI Audio Speech contract: text, model and voice in, an audio file out.
Enabled ElevenLabs voices with bilingual style notes and the model-default flag; public access without a key.
Account
The read-only Workspace API exposes workspace balance, rates, spend and key details. See the Workspace API section.
"stream": true. Fragments arrive as data: {...} lines, the last one is data: [DONE]. What works: tools and tool_choice in text chat, image input for models that can take it, image creation and editing, and video. JSON output through response_format is accepted too, on OpenAI-compatible routes. Fields such as functions, audio and modalities in chat still answer 400: silently dropping a parameter is not something we will do.Gateway error codes
Errors arrive in an OpenAI-style envelope, which means SDKs handle them on their own:
{ "error": { "message": "No route for openai/gpt-5.4-ultra. See GET /v1/models for the models you can call.", "type": "invalid_request_error", "code": "model_not_found", "param": "model", "trace_id": "3f6c1a52-9d0e-4b7a-8c41-2a5e7d90b1f4", "help_url": "https://gatelum.com/docs#code-model_not_found" } }
Use code for branching: it is stable and machine-readable. The message targets humans and wording may change. When a specific request field is to blame, param names it.
All codes
| HTTP status | code | What triggers it | How to fix it |
|---|---|---|---|
| 400 | bad_request | The request was not accepted: broken JSON, a missing required field, a value outside its range, or the model cannot do what was asked (vision, image editing, image generation). | Check “Request fields”: param names the part that failed. If the model is the issue, pick one whose capability is marked in the catalog or in capabilities from GET /v1/workspace/catalog. Nothing is charged. |
| 400 | parameter_not_supported | The gateway does not support this field. | Remove the field; incompatible ones are listed in “Request fields”. |
| 405 | method_not_allowed | The method is not supported; GET /v1/responses has no list, only POST is accepted. | Use POST /v1/responses; the allowed method is in the Allow header. |
| 413 | body_too_large | The request body exceeds the allowed size. | Trim the conversation or send it in a few separate requests. |
| 408 | body_read_timeout | The body was not read within the allowed time. | The body never arrived complete. Retry-After tells you how long to pause before trying again; on a slow link, send smaller frames. |
| 400 | context_length_exceeded | The model context cannot hold this request: images, the conversation and tool definitions all count toward it. | Shorten the conversation, drop some images or choose a model with a larger context. |
| 400 | document_invalid | The PDF is corrupted or is not a PDF. | Resave the PDF (for example, “Print to PDF”) and try again. No charge. |
| 400 | document_too_large | The PDF is larger than 10 MB. | Compress the file or split it. No charge. |
| 400 | document_too_many_pages | The PDF has more than 100 pages. | Put the needed pages into a separate file. No charge. |
| 400 | document_encrypted | The PDF is password-protected. | Remove the password and retry. No charge. |
| 400 | document_no_text | The PDF has no text layer, and the model receives text only. | Use a model with pdf in capabilities from GET /v1/workspace/catalog, or extract the text in advance. No charge. |
| 400 | document_too_complex | PDF parsing exceeded time, memory or text length. | Split the document or simplify it. No charge. |
| 400 | audio_unreadable | The audio file could not be read: the format is unsupported or the duration cannot be detected. | Send audio in a supported format: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav or webm. |
| 401 | invalid_api_key | No usable key: it is invalid, revoked or absent. | Copy the whole key together with the glt_ prefix, and check that it has not been revoked. |
| 403 | permission_denied | The key cannot be used now: the request is outside its allowed hours. | Adjust the key schedule or use another key. |
| 402 | balance_depleted | The balance is empty. | Top up the account. The hold is calculated from max_tokens, so a smaller value frees more of the balance. |
| 429 | insufficient_quota | The key spend limit for this period is exhausted. | Raise or remove the limit on the key page. |
| 429 | too_many_requests | This key is sending too many requests — wait before retrying. | Wait and retry; the pause should grow with each attempt. |
| 404 | model_not_found | This model is unknown or switched off. | Copy the id in full from GET /v1/models, including everything before “/”. |
| 404 | not_found | Nothing exists at this address or id. | Check the address. For a generation job, match the id with the creation response; keep the history on your side and send the full input every time. |
| 404 | response_not_found | Responses are not stored, so there is no response with this id. | Send the whole history in input; a response is not stored by id. |
| 500 | server_fault | An internal error. | Retry. If it persists, contact support with the id from the response. |
| 502 | server_error | No route to the model provider is available. | Try a different model, then let us know: this kind of answer must not happen again. |
| 502 | provider_error | The provider failed; the request is not billed. | Retry or choose another model; nothing is charged. |
| 504 | timeout | The provider did not answer in time. | Retry the request. Long answers need streaming: a stream is terminated when the provider goes silent for over 240 seconds. |
model, or the model responds with an error, no charge is made and the entire hold comes back.Quick answers
How do I change the model?
Change model in the request — the rest of the code stays put, and the route is picked from the model.
Does the official OpenAI SDK work?
Yes — set base_url to our /v1 address and keep your key; nothing else in your code needs changing.
What is the price made of?
Output and input tokens are charged at the rate that applied to that model. Worked examples and the formula are in “Pricing, cache and reserve”.
Are requests limited?
Yes, a key has a rate limit; the spend limits are yours to set. See “Limits and access”.