Developer documentation
One key, one bill, every model in the catalogue. The official OpenAI, Anthropic and Google SDKs work as they are — you change the address and the key, nothing else.
Up and running in three steps
- Create an account and add money. Sign up, confirm your email and top up on the Billing page, by card or with crypto. You can also buy a plan instead of paying request by request.
- Create an API key. Open API Keys and create one. Copy it straight away: the full key is shown only once. Keys start with
sk-live-. - Send your first request. Point the official OpenAI SDK at
https://api.flintbeam.com/v1with your key — the examples below are ready to copy. To use another model, change only the model ID.
Code examples
from openai import OpenAI
# Works with the official openai package (pip install openai)
client = OpenAI(
base_url="https://api.flintbeam.com/v1",
api_key="sk-live-your-api-key"
)
response = client.chat.completions.create(
model="openai/gpt-6.1-sol",
messages=[
{"role": "system", "content": "You are an experienced software engineer."},
{"role": "user", "content": "Describe the architecture of a distributed cache."}
],
temperature=0.7,
max_tokens=1500
)
print(response.choices[0].message.content)Connect your SDK or tool
One key works on every endpoint. Use the address that matches the SDK or tool you already have — https://api.flintbeam.com/v1 for anything that speaks OpenAI's API.
- OpenAI SDKs and OpenAI-compatible tools — Cursor, Cline, Continue, Codex CLI, LangChain, LiteLLM and the rest: base URL
https://api.flintbeam.com/v1, key inAuthorization: Bearer sk-live-…. - Anthropic SDKs and Claude Code: base URL
https://api.flintbeam.com, without/v1— the client adds it. The key goes inx-api-keyorAuthorization: Bearer. For Claude Code, setANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKEN. - Google Gen AI SDK: set the SDK's base URL to
https://api.flintbeam.com(the SDK adds/v1beta) and use your key as the API key. What this door serves is under Gemini native API.
wss://api.flintbeam.com only. The older https://flintbeam.com/v1 address still forwards every ordinary request, so code written against it keeps working, but it cannot open a WebSocket.A key is shown in full once, when it is created; afterwards the console shows only its first characters. Keep it on your server. A web page that needs live voice should get a short-lived ticket from your server instead (see Realtime voice).
Models
Every model has an ID of the form maker/model — for example google/gemini-3.5-flash-lite. Copy it exactly from the Model Catalog. GET /v1/models returns the models your key may call, each with its context window, default_max_tokens and pricing: the price of one billed unit, so your code can work out what a request cost from its usage. GET /v1/models/MODEL_ID returns one model. With an anthropic-version header the list comes back in Anthropic's shape.
Each model's page names the official provider that serves it — OpenAI, Anthropic, Google, Alibaba Cloud and others. If one provider fails, the same model is tried again on another; a request is never moved to a different or weaker model.
Prices are on each model's page: per 1M tokens for text, and per picture, second or character for some media models. They are the maker's list prices. Some models also have a daily discount — see Speed lanes and discounts.
Which endpoint a model answers on depends on what it makes. Text and vision models answer on Chat Completions, Responses and Messages alike. Picture models answer on /v1/images, video models on /v1/videos, speech and transcription models on /v1/audio, and embedding models on /v1/embeddings. Realtime voice models answer only over the WebSocket, and a request sent to them anywhere else is refused with a message that names the right endpoint.
All endpoints
Every address the API answers on, grouped by what it makes. Each one is described in detail in its own section below.
Text and agents
OpenAI's chat format, for every text model.
OpenAI's Responses format with tools, MCP and stored responses; GET, DELETE and /cancel on /v1/responses/ID, and /v1/conversations.
Anthropic's format, for Claude Code and every text model.
Counts the input tokens of a Messages request. Free.
Google's Gemini API format: generate, stream, count, embed, caches and files.
Models, key and balance
The models your key may call, with prices.
What this key has spent, its limits and what is left.
Your balance, the money held for running requests, and bonus credits.
One request made with this key: model, status, tokens and cost. Also GET /v1/requests/ID.
Images and video
Draw pictures from a prompt.
Change pictures you upload.
Make a video clip; then ask for its status and download it.
Speech and voice
Speech to text from an audio file.
Speech in any language to English text.
Text to speech.
Live voice conversation over WebSocket.
A short-lived ticket so a web page can open a voice session without your key.
The same ticket under OpenAI's spelling of the address.
Speech translated live over WebSocket.
Live voice sessions with gpt-live-1 over WebSocket.
Phone-style calls over HTTP and WebRTC: not available; use the WebSocket.
Custom voices and voice consents: not available yet; refused without a charge.
Custom voices and voice consents: not available yet; refused without a charge.
Embeddings, moderation and files
Vectors for text.
Safety check of text and pictures. Free.
Upload, list, read and delete your files.
Large files in parts, for OpenAI's hosted tools.
Search stores for file_search.
Containers for code_interpreter.
Chat Completions
POST /v1/chat/completions takes OpenAI's request unchanged and works with every text model in the catalogue — OpenAI, Claude, Gemini, Qwen, DeepSeek and the rest. The request is translated into each maker's own format, and the answer comes back in OpenAI's.
modelandmessagesare required. Roles aresystem,user,assistantandtool. The oldfunctionsandfunction_callfields are converted totoolsandtool_choice.- Send the body as JSON, up to 32 MB including any attachments. A body that is one JSON object is read as JSON even when the
Content-Typeheader is missing or saystext/plain. max_tokens(ormax_completion_tokens) caps the answer and decides how much is held from your balance while the request runs. Leave it out and the key's answer-length setting picks a limit for the model; every answer reports the limit used inx-ceiling-used, and/v1/modelsshows each model's default asdefault_max_tokens. On reasoning models, a limit too small to leave room for an answer is raised and reported inx-ceiling-raised, because the thinking is paid for out of the same limit. Providers occasionally return slightly more tokens thanmax_tokens; you are charged for the tokens the provider reports.toolsandtool_choicework on every maker's models.response_format(JSON mode andjson_schema) reaches the models that support it; on Claude ajson_schemabecomes Anthropic's structured output.- Pictures in: send
image_urlparts — a link or adata:URL — to a model the catalogue marks as seeing images. A stored file can be used withimage_url.file_id. - Documents in: Word, Excel, PowerPoint, OpenDocument, EPUB and plain-text attachments are read as text, on Chat Completions, Responses and Messages. Layout and pictures are left out. Up to 4 MB of text is read per document and 8 MB per request; anything cut is marked, and
x-documents-readnames the files read. PDFs go as they are to models that read PDFs; for other models their text is extracted, up to 16 PDFs a request. A scanned PDF without text, a password-protected or a broken file is refused with a 400. - Links: a web page your message links to is read for the model and billed as the tokens it contains; Gemini models also watch a public YouTube video you link to. A link alone never starts a paid web search, and links inside attached files are not followed.
temperature,top_p,stop,seedand the other tuning fields go through as sent. A field a model cannot use is dropped rather than refused, and named in thex-ignored-paramsresponse header.nabove 1 works on OpenAI models (up to 128) and Gemini models (up to 8); every answer is billed. Claude models, and OpenAI models that run on OpenAI's Responses API, give one answer per request.prediction(Predicted Outputs) reaches the OpenAI models that support it.
Refused with a 400 that names the field: temperature outside 0–2, data_sources, reasoning.mode, hosted file_search and code_interpreter tools, and MCP tools. The last three work on /v1/responses.
A single call may run for up to 600 seconds; past that it ends with request_timeout.
Pro models and reasoning.mode: "pro" may think for up to 30 minutes. Set your client's timeout to at least that — the OpenAI and Anthropic SDKs default to 10 minutes. If your client gives up earlier, the answer is still generated and billed.
Streaming
With stream: true the answer arrives as server-sent events in OpenAI's chunk shape and ends with data: [DONE]. Just before [DONE] comes one chunk with empty choices and the billed usage — it is always sent, whether or not you set stream_options.include_usage. Besides the token counts it carries cost (in dollars) and cost_status: final, or pending when the charge is not settled yet.
While a slow model is still thinking, the stream sends : keep-alive comment lines so that the connection is not closed as idle along the way. The SDKs skip them.
If the provider breaks off in the middle of an answer, an error event is written into the stream and the stream ends: the HTTP status was already 200 and cannot change. Keep the x-request-id header to look the request up later.
Responses API
POST /v1/responses is OpenAI's newer request shape, the one Codex CLI and other agent tools speak. It works with every text model in the catalogue, not only OpenAI's, and is billed exactly like Chat Completions. Streaming, function tools, web_search, MCP servers and OpenAI's agent tools are all served (see MCP and server tools). reasoning.summary returns OpenAI's reasoning summary as a reasoning item on its reasoning models. A reusable prompt is refused.
Stored responses. On OpenAI's own models a response is stored for 30 days unless you send store: false. A stored response can be read with GET /v1/responses/ID (and /input_items), deleted with DELETE, and continued with previous_response_id. background: true returns at once; ask for the response by its id until it finishes, or cancel it with POST /v1/responses/ID/cancel. Conversations work as at OpenAI: /v1/conversations creates, reads, updates and deletes them, and /items manages what is in them.
Other makers’ models are not stored: send the whole conversation every time. On them previous_response_id, conversation, background: true, prompt, truncation: "auto" and most built-in tools are refused with 400 that names the field. store, metadata, prompt_cache_key, safety_identifier and user are dropped and named in x-ignored-params.
Web search. A web_search tool runs the search of the model's own maker, paid from your balance on top of the tokens: $0.01 a search on Claude, up to three a question; $0.014 a search request on OpenAI models, where one search may send several and a question may run up to three searches; $0.014 a Google search query on Gemini 3; $0.035 an answer that searched on Gemini 2.5. Sources come back as web_search_call items and url_citation annotations on the text; a stream also emits response.output_text.annotation.added and response.web_search_call.* events.
service_tier picks a speed lane exactly as on Chat Completions. A request that uses MCP, agent tools or hosted tools runs on the standard lane only, and another lane is refused with a 400.
Audio inside input needs the request header x-api-extensions: responses-audio-chat-v1; without it the request is refused.
MCP and server tools
Beyond your own function tools, /v1/responses can connect the model to remote MCP servers and serve OpenAI's agent tools and hosted tools. MCP and the tools your own program runs carry no extra tool fee — you pay for the model's tokens; web search, file_search, code_interpreter containers and generated pictures are charged on top. Stored responses work as at OpenAI — store: true, previous_response_id, conversation and background — on requests without MCP or agent tools. How long each is kept is under “Data and privacy”.
Remote MCP servers
Add a tool with type: "mcp", a server_label and the server_url of a public HTTPS MCP server. The gateway connects to it, and the answer carries mcp_list_tools and mcp_call items beside the text. allowed_tools limits which of the server's tools the model may use; authorization takes the raw access token (without Bearer) and headers adds your own headers — both are used only to reach your server. Your own function tools can be sent in the same request. With require_approval other than "never", the answer stops at an mcp_approval_request item; send the conversation again with an mcp_approval_response to run or skip the call — nothing is stored in between. Approvals exist only on /v1/responses: on Messages and the Gemini door, anything but "never" is refused with mcp_approvals_unavailable.
Addresses on private or internal networks are refused. One API key may make 120 outbound MCP requests a minute — connecting, listing tools, every call and closing all count; past that the answer is 429 and nothing more is sent to the server until the minute is over. A request with MCP cannot also use store: true, previous_response_id, conversation, background or prompt: keep the conversation yourself.
MCP also works on /v1/responses for Alibaba Cloud and DigitalOcean models that support function calling — Qwen, DeepSeek, Kimi, GLM and gpt-oss among them; on /v1/messages for Claude models, in Anthropic's mcp_servers shape with the anthropic-beta: mcp-client-2025-04-04 or mcp-client-2025-11-20 header; and on the Gemini door, as a type: "mcp" tool in generateContent and streamGenerateContent. Chat Completions does not serve MCP. A model without function calling, such as Gemma, is refused. MCP cannot be combined with a provider's own server tools in one request.
MCP example
curl https://api.flintbeam.com/v1/responses \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.3-codex",
"input": "Which pages mention the refund policy?",
"tools": [{
"type": "mcp",
"server_label": "docs",
"server_url": "https://mcp.example.com/mcp",
"allowed_tools": ["search"],
"require_approval": "never"
}]
}'
# Python (openai package):
# client = OpenAI(base_url="https://api.flintbeam.com/v1", api_key="sk-live-your-api-key")
# r = client.responses.create(model="openai/gpt-5.3-codex", input="…", tools=[{
# "type": "mcp", "server_label": "docs", "server_url": "https://mcp.example.com/mcp",
# "allowed_tools": ["search"], "require_approval": "never"}])
# print(r.output_text)OpenAI agent tools
On OpenAI models these tools are served: custom, apply_patch, shell (local environment only), local_shell, computer and computer_use_preview. The model's call comes back as the item OpenAI defines for that tool, such as custom_tool_call or apply_patch_call; your program runs it and sends the result back as the matching …_output item. Nothing is executed on our side. max_tool_calls is optional, defaults to 256 and cannot be higher.
image_generation draws pictures inside a response on the models that support it; it cannot be used with previous_response_id or a stored conversation, and the pictures are billed at the image model's price. A tool that a model or its provider cannot serve — tool_search among them — is answered with 503 native_tools_unavailable. A request with agent tools cannot also use MCP, store: true, previous_response_id, conversation, background, prompt or truncation: "auto".
If the provider answers 401, 403 or 429 before accepting an agent-tool or MCP request, the same model is tried again automatically and the refused attempt costs nothing. Once an MCP request is accepted, every answer carries x-should-retry: false, so the OpenAI SDKs do not repeat a paid tool loop on their own.
The input is measured in tokens before anything is charged; if it cannot fit the model, the request is refused with a 400 whose message contains exceeds the funded input bound. max_tool_calls defaults to 256 for tools your program runs and to 8 for tools the provider runs in a loop, such as file_search; each file_search call can lead to one more model pass over a larger input, so the request is funded for up to max_tool_calls + 1 passes.
Anthropic tools on Messages
On supported Claude models, /v1/messages serves Anthropic's dated web_search, web_fetch, code_execution and tool search tools; support depends on the model and the tool version. computer_toolset_20260801 and browser_toolset_20260801 are run by your program. Programmatic tool calling lets code execution call your tools when their allowed_callers include code_execution_20260120 or code_execution_20260521.
Send the container id you got back on a later request to reuse the container. Files code execution produced are described at /v1/files/ID and downloaded from /v1/files/ID/content, up to 25 MB. Agent Skills containers are not supported, strict tools cannot be called programmatically, and parallel tool use cannot be turned off together with programmatic tool calling.
Google tools on the Gemini door
On /v1beta/models/…:generateContent, supported Gemini models serve googleSearch and urlContext. codeExecution is served on gemini-2.5-flash-lite, gemini-3.5-flash and gemini-3.1-pro, and enterpriseWebSearch on gemini-3.5-flash. codeExecution cannot be used with several candidates, and urlContext cannot be combined with function declarations, codeExecution or enterpriseWebSearch. googleMaps and fileSearch are not served.
Alibaba Cloud and DigitalOcean tools
Alibaba Cloud serves web_search, web_extractor and code_interpreter on /v1/responses for qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.7-max, qwen3.7-plus, qwen3.7-flash, qwen3.6-plus, qwen3.6-flash, qwen3.6-35b-a3b, qwen3.5-plus and qwen3.5-flash; qwen3.8-omni-flash, kimi-k3, glm-5.3 and deepseek-v4.1-flash serve web_search only. web_extractor needs web_search beside it. web_search costs $0.573411 per 1,000 calls; the other two have no tool fee. max_tool_calls may be up to 20; the answer stops there with status: "incomplete" and incomplete_details.reason: "max_tool_calls".
Limits
- MCP, agent tools and hosted tools are paid from your balance: a key limited to a plan gets a 400.
- Which tools can be combined depends on the model and the endpoint; a combination that is not served is refused by name before anything is charged.
- The MCP
server_urlmust be a public HTTPS host name on port 443. IP addresses,localhost, internal names, another port, a user name or password, or a fragment in the address are refused. - One MCP request may use up to 2 servers, 4 model rounds, 8 remote tool calls and 170 seconds; with MCP, a
max_tool_callsabove 8 is refused. - A request with agent tools may carry at most 16 tools.
The agent loop without stored state
Agent clients such as Codex CLI keep the conversation themselves (store: false). After a tool call, send the whole conversation again: your earlier input, the items the model returned (reasoning included) and the tool's result as the matching function_call_output, custom_tool_call_output, apply_patch_call_output, shell_call_output, local_shell_call_output or computer_call_output item. Ask for include: ["reasoning.encrypted_content"] so the model's reasoning travels with it.
Every item is checked before anything is charged. A 400 names an item type that does not belong in this loop (such as item_reference or compaction), an output without its call, a repeated item id, or a file reference inside a tool output. Encrypted reasoning can be read only by the system that produced it; if a later turn cannot decrypt it, the 400 says so.
Leave max_output_tokens out and the key's answer-length setting decides, capped by the model and shortened for a very large input but never below 4096; the answer then echoes max_output_tokens: null. When balance fitting is on, the limit can also be lowered to what your balance covers, reported in x-ceiling-reduced and x-ceiling-reason: balance.
Agent loop example
# Turn 1: the model answers with an apply_patch_call item.
curl https://api.flintbeam.com/v1/responses \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.3-codex",
"input": [{"role": "user", "content": "Rename greet() to hello() in app.py"}],
"tools": [{"type": "apply_patch"}],
"store": false,
"include": ["reasoning.encrypted_content"],
"max_output_tokens": 8000
}'
# Python (openai package), both turns:
# history = [{"role": "user", "content": "Rename greet() to hello() in app.py"}]
# kwargs = dict(model="openai/gpt-5.3-codex", tools=[{"type": "apply_patch"}], store=False,
# include=["reasoning.encrypted_content"], max_output_tokens=8000)
# first = client.responses.create(input=history, **kwargs)
# history += [item.model_dump(exclude_none=True) for item in first.output]
# call = next(i for i in first.output if i.type == "apply_patch_call")
# …apply call.operation to your files, then send the result back:
# history.append({"type": "apply_patch_call_output", "call_id": call.call_id,
# "status": "completed", "output": "Updated app.py"})
# second = client.responses.create(input=history, **kwargs)
# print(second.output_text)Claude Code and the Messages API
POST /v1/messages takes Anthropic's request shape, for clients that speak only it — Claude Code among them. Set ANTHROPIC_BASE_URL to https://api.flintbeam.com (without /v1) and ANTHROPIC_AUTH_TOKEN to your key. It works with every text model in the catalogue, not only Claude: openai/gpt-5.4 answers here as readily as a Claude model. max_tokens is required, as at Anthropic.
# Claude Code
export ANTHROPIC_BASE_URL="https://api.flintbeam.com"
export ANTHROPIC_AUTH_TOKEN="sk-live-your-api-key"
claude --model anthropic/claude-sonnet-4.6
# Python (anthropic package):
# import anthropic
# client = anthropic.Anthropic(base_url="https://api.flintbeam.com", api_key="sk-live-your-api-key")
# msg = client.messages.create(model="anthropic/claude-sonnet-4.6", max_tokens=1024,
# messages=[{"role": "user", "content": "Hello"}])
# print(msg.content[0].text)Claude's thinking comes back as thinking blocks with their signatures, and the blocks you send back reach Claude unchanged. On other makers' models only your own tools and web_search can be used, and Claude's thinking is ignored and named in x-ignored-params. The anthropic-beta header and context_management are ignored the same way. Answers carry request-id as well as x-request-id, and anthropic-ratelimit-requests-* headers when the key has a request rate.
Errors come back in Anthropic's shape: invalid_request_error (400), authentication_error (401), billing_error (402), permission_error (403), not_found_error (404), request_too_large (413), rate_limit_error (429), overloaded_error (503, or 529 when Anthropic itself said so) and api_error for other server errors.
POST /v1/messages/count_tokens counts a request's input tokens before you send it and costs nothing. On Claude models it is Anthropic's exact count; on other models it is an estimate. The x-count-token-source header says which (anthropic or estimate). Claude Code calls it on every turn; each key may count up to 60 times a minute.
Gemini native API
Code written for Google's Gemini API — the Google Gen AI SDK or plain /v1beta requests — works here as well. Set the SDK's base URL to https://api.flintbeam.com and use your key as the API key. The key can be sent as x-goog-api-key, as Authorization: Bearer, or as ?key= (prefer a header: an address ends up in logs). This door needs a key that pays from the balance; a key limited to a plan is refused.
# Python (google-genai package)
from google import genai
from google.genai import types
client = genai.Client(
api_key="sk-live-your-api-key",
http_options=types.HttpOptions(base_url="https://api.flintbeam.com"),
)
r = client.models.generate_content(model="gemini-3.5-flash-lite", contents="Explain DNS in one paragraph.")
print(r.text)
# cURL
# curl "https://api.flintbeam.com/v1beta/models/gemini-3.5-flash-lite:generateContent" \
# -H "x-goog-api-key: sk-live-your-api-key" -H "Content-Type: application/json" \
# -d '{"contents": [{"parts": [{"text": "Explain DNS in one paragraph."}]}]}'Served: models/MODEL:generateContent, :streamGenerateContent?alt=sse (alt=sse is required), :countTokens (free), :embedContent and :batchEmbedContents (up to 32 texts, gemini-embedding-2), GET /v1beta/models, context caches under /v1beta/cachedContents and file uploads under /upload/v1beta/files.
Models on this door: gemini-2.5-flash-lite, gemini-3.5-flash, gemini-3.5-flash-lite, gemini-3.6-flash, gemini-3.7-flash, gemini-3.8-flash, gemini-4-*, gemini-3.1-pro and gemini-3.1-flash-lite, with or without the models/ or google/ prefix. Every Gemini model in the catalogue, these included, also answers on Chat Completions, Responses and Messages.
contents are refused (the one exception is the screenshots a computerUse tool works with), and answers are text only (responseModalities: ["TEXT"]). To send a Gemini model a picture or a document, use Chat Completions, Responses or Messages.The request is checked strictly: a field this door does not serve is refused with a 400 that names it, never silently dropped. safetySettings, serviceTier, googleMaps and fileSearch are refused. candidateCount may be 1 to 8, and mediaResolution LOW or MEDIUM.
Context caches (cachedContents) hold a long prefix — text, a system instruction, function declarations — for 60 seconds to one hour. Storage is paid in advance for the whole lifetime when the cache is created; x-cache-prepaid-until says until when. A cache can only be used by the account that made it, and only its lifetime can be changed. Files are uploaded with Google's resumable protocol in a single request: up to 25 MB each and 500 MB per account, pictures, audio, video, PDF or plain text, kept for 24 hours.
Prompt caching
OpenAI and Gemini models cache repeated prompts by themselves; you pay the cheaper cached-input rate for what was read from the cache, and nothing needs to change in your code. Claude's cache is driven by the same cache_control field as Anthropic's own API — code written for Anthropic works here unchanged, on /v1/messages, /v1/chat/completions and /v1/responses alike. For every model that is not Claude, cache_control is removed on the way and changes nothing.
One conversation, one place. The requests of one conversation go to the same capacity for at least 5 minutes after the last one, so the cache keeps being read. A conversation is known by its prompt_cache_key when you send one (Codex does), otherwise by its opening messages.
Automatic caching on Claude. Add "cache_control": {"type": "ephemeral"} once, at the top level of the request. The cache point goes on the last block that can hold one and moves forward as the conversation grows — the simplest choice for chats and agents.
Your own breakpoints. Put cache_control on a block: a text, picture or document part, a system block, a tool, a tool call or a tool result. Everything up to and including that block is cached — tools first, then the system prompt, then the messages. At most 4 per request, the automatic one included. Put every 1-hour mark before any 5-minute mark. A last-block mark whose TTL differs from top-level automatic caching is refused with a 400.
If you mark nothing in the system prompt or the tools, the gateway marks their ends for you with a 5-minute TTL, only where there is room and never more than 4 marks in all. If you ask for a 1-hour TTL anywhere, the gateway adds no marks: you manage caching yourself.
Price. Writing to the cache costs 1.25× the model's input rate for 5 minutes, or 2× for one hour. Reading costs the model's cached-input rate, the same for both. Long-context pricing scales these rates just as it scales input.
Lifetime. 5 minutes by default (or "ttl": "5m"); "ttl": "1h" for one hour, exactly as at Anthropic. Every read renews the lifetime at no extra write charge.
Minimum length. A prefix shorter than the model's minimum — roughly one to four thousand tokens, depending on the model — is not cached: the request runs as usual, with no error and no write charge.
The cache matches exactly: change anything before a breakpoint — a tool, the system prompt, a picture, their order — and that part is written again.
What was cached is in the answer's usage. On /v1/messages: cache_creation_input_tokens, cache_creation.ephemeral_5m_input_tokens, cache_creation.ephemeral_1h_input_tokens and cache_read_input_tokens, as Anthropic returns them. On /v1/chat/completions: prompt_tokens_details.cached_tokens (read) and prompt_tokens_details.cache_write_tokens (written), both counted inside prompt_tokens. On /v1/responses: the same two under input_tokens_details.
Example
curl https://api.flintbeam.com/v1/messages \
-H "x-api-key: sk-live-your-api-key" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"max_tokens": 1024,
"cache_control": {"type": "ephemeral", "ttl": "1h"},
"system": "…a long rulebook…",
"messages": [{"role": "user", "content": "What does rule 12 say?"}]
}'
# /v1/chat/completions, a breakpoint on one part:
# {"role": "user", "content": [
# {"type": "text", "text": "…a long contract…", "cache_control": {"type": "ephemeral"}},
# {"type": "text", "text": "Summarise clause 4."}]}Reasoning and parameters
Send max_tokens to every model. Where a provider insists on max_completion_tokens instead, the gateway renames it for you.
If a model refuses a tuning parameter outright, the gateway drops that one parameter and tries again — up to 3 times, one at a time. Reasoning models do this with temperature, which they accept only at their own default. Only these parameters are ever dropped: temperature, top_p, top_k, frequency_penalty, presence_penalty, logit_bias, logprobs, top_logprobs, seed. messages, model and tools are never touched.
reasoning_effort sets how hard a model thinks before it answers. The values are each maker's own, and every model takes only its own: ask for one it does not have and the answer is a 400 that lists the ones it does. Thinking is billed at the output rate. On OpenAI's 5.6 and 6.x models max is also accepted. On Gemini you can instead set a budget, or a level on Gemini 3, in Google's own google.thinking_config.thinking_budget or thinking_level, and see the thought summary with include_thoughts: true — it comes first in the answer, inside <think>. Gemini 3 levels may be written in either case, and minimal is read as low on a model without it.
On Gemini, detail: "low" on every picture, or Google's own google.media_resolution, has the model look at pictures in low resolution for far fewer tokens.
The same rule holds for response_format in transcription: each model returns only its own formats, and asking for one it does not have is a 400 that lists the ones it does.
Speed lanes and discounts
On OpenAI models service_tier picks the lane: flex (slower and cheaper), fast (OpenAI's former priority) and, on gpt-6-astra and gpt-6.1-sol, ultrafast. On Gemini it picks Google's lanes: flex on the Gemini 3 Flash and Flash-Lite models and priority on the Gemini text models. You are billed for the lane the answer says it ran on (service_tier in the answer), never above the lane you asked for. A lane a model has no price for is refused with a 400.
Daily discount. Some models are cheaper on some days: the catalogue and each model's page show a “Discount” badge and the price after it. The standard and fast lanes are 30% off, flex is 20% off, and ultrafast has no discount. On GPT-6 astra, luna, sol and 6.1-sol the discount applies only to requests up to 250K tokens (input plus the maximum output); larger requests are charged the maker's price. The price shown is the price charged.
Images
POST /v1/images/generations with model and prompt draws a picture. size, quality, background, output_format and output_compression reach the models that understand them; a setting that belongs to another maker's models is refused. n is 1 to 10 on OpenAI's models and 1 on the others. On OpenAI's picture models, stream: true with partial_images (0 to 3) sends rough drafts while the picture is drawn; as at OpenAI, each draft is billed as 100 output tokens, and a stream is always one picture.
POST /v1/images/edits changes pictures you send as a multipart form — the address the SDKs call for edits. Source pictures are PNG, JPEG or WebP; how many a model takes depends on the model. A mask must be a PNG with transparency, the same size as the picture, and is refused by name when the model cannot honour it.
The answer is data[].b64_json: each picture as base64, never a link — response_format: "url" is refused. Decode it and store it yourself; the gateway keeps nothing. A model that both talks and draws can also be asked on /v1/chat/completions: the picture then comes back on the message, as choices[0].message.images[0].image_url.url (a data: URL).
A picture is billed at its model's price: by the tokens the provider reports — the prompt and any source pictures in, the picture out — or at the model's price per picture. Plans that list the model can pay for it. The gateway waits up to 300 seconds for a picture.
Example
curl https://api.flintbeam.com/v1/images/generations \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "google/gemini-3-pro-image", "prompt": "a lighthouse at dawn, watercolor"}'
# Python (openai package):
# img = client.images.generate(model="…", prompt="…")
# open("out.png", "wb").write(base64.b64decode(img.data[0].b64_json))Video
POST /v1/videos makes one clip per call with a Veo model (Sora has been withdrawn). Required: model, prompt, seconds as a string ("4", "6" or "8") and aspectRatio (16:9 or 9:16). Optional: resolution, a starting image, a lastFrame, negativePrompt and up to three referenceImages, as base64 PNG, JPEG or WebP. The highest resolutions need 8 seconds.
Without async the request stays open until the clip is ready and the answer is the video file itself. With async: true you get a job id back at once (202); ask GET /v1/videos/ID for its status and download the clip from GET /v1/videos/ID/content when it is done. DELETE /v1/videos/ID asks the maker to stop a clip still being made; a clip that was finished anyway is billed.
# Start a clip and get a job id back at once
curl https://api.flintbeam.com/v1/videos \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "google/veo-3.1-fast-generate-001", "prompt": "a paper boat on a rainy street",
"seconds": "8", "aspectRatio": "16:9", "async": true}'
# Ask for its status, then download it when it is done
curl https://api.flintbeam.com/v1/videos/VIDEO_ID -H "Authorization: Bearer sk-live-your-api-key"
curl https://api.flintbeam.com/v1/videos/VIDEO_ID/content -H "Authorization: Bearer sk-live-your-api-key" -o clip.mp4The price depends on the model, the resolution, the finished seconds and whether sound is generated: generate_audio: false is cheaper, and /v1/models lists both rates.
Asking about a started clip is limited per key: its status 30 times at once, then 1 a second; the clip itself 30 times at once, then 3 a minute. Past that the answer is 429 with Retry-After.
Speech and transcription
POST /v1/audio/transcriptions turns speech into text. Send the file and the fields as a multipart form: model, and optionally language, prompt, temperature, response_format, timestamp_granularities[] (with verbose_json) and include[]=logprobs (with json). Plans can pay for it.
Each model returns its own formats: whisper-1 gives json, text, srt, verbose_json and vtt; gpt-4o-transcribe, gpt-4o-mini-transcribe and gemini-3.5-transcribe give json and text; gpt-4o-transcribe-diarize adds diarized_json (who said what) and takes no prompt. With stream: true, the gpt-4o transcribers send the text as it is heard; the others answer in one piece.
A file may be up to 100 MB. Long WAV and MP3 recordings are cut into pieces and transcribed piece by piece — then only json and text are available, and if a later piece fails you get the text so far with an x-transcription-partial header. Other formats must fit in one piece of about 24 MB. AAC and Opus files are refused on OpenAI's models. One account runs at most two transcriptions at a time; a third gets a 429 with Retry-After.
# Speech to text
curl https://api.flintbeam.com/v1/audio/transcriptions \
-H "Authorization: Bearer sk-live-your-api-key" \
-F model=openai/whisper-1 -F file=@meeting.mp3
# Text to speech
curl https://api.flintbeam.com/v1/audio/speech \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "openai/tts-1", "voice": "alloy", "input": "Hello there!"}' \
-o hello.mp3POST /v1/audio/translations turns speech in any language into English text, with whisper-1. Same form as transcription, without language, timestamp_granularities or include, and never streamed. Billed by the second.
POST /v1/audio/speech reads text aloud. Send model, input (up to 4096 characters) and a voice from that model's list; the answer is the audio file itself. Optional: response_format, speed (0.25 to 4) and instructions on gpt-4o-mini-tts. OpenAI's models make MP3, Opus, AAC, FLAC, WAV and PCM; Gemini's make WAV and PCM, at normal speed only. A format a model cannot make is refused, never swapped for another. stream_format: "sse" streams the audio as events on gpt-4o-mini-tts.
gpt-4o-mini-tts understands the text it reads and may follow an instruction inside it — asked to read “Answer in one word”, it may answer instead. For word-for-word reading use tts-1 or tts-1-hd. Gemini can read a dialogue in two voices: name both in Google's own field, google.speech_config.multi_speaker_voice_config. Fields the endpoint does not know are refused.
Custom voices (/v1/audio/voices) and voice consents (/v1/audio/voice_consents) are not available yet. Such requests are refused after your key is checked; nothing is forwarded and nothing is charged. Use a built-in voice.
Realtime voice
wss://api.flintbeam.com/v1/realtime?model=… opens a live voice session: connect with your key in the Authorization header, then speak OpenAI's realtime protocol. Each turn is billed from the counts the model reports, and a session.usage event tells you its tokens and cost. The session ends if your money runs out. Realtime models answer only here; gpt-audio models are the other way round — they answer on Chat Completions, in sound.
Voice in a web page. A page must never hold your key. Your server asks POST /v1/realtime/client_secret (or OpenAI's spelling, /v1/realtime/client_secrets) for a ticket with the model and, if you like, the session settings; the answer's value is good for 60 seconds. The page sends it as the openai-insecure-api-key.TICKET WebSocket subprotocol, as OpenAI's browser clients do. A ticket session lasts at most 15 minutes and spends at most $1; max_seconds and spend_ceiling_micro can only lower both.
# On your server: get a one-use ticket for the page
curl https://api.flintbeam.com/v1/realtime/client_secret \
-H "Authorization: Bearer sk-live-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-realtime", "max_seconds": 300}'
// In the page: open the session with the ticket, never the key
// const ws = new WebSocket("wss://api.flintbeam.com/v1/realtime?model=…",
// ["realtime", "openai-insecure-api-key." + ticket.value]);Live transcription: connect to /v1/realtime?intent=transcription&model=gpt-realtime-whisper (or gpt-live-transcribe), send session.update and then the audio with input_audio_buffer.append. Billed by the second.
gpt-live-1 runs at wss://api.flintbeam.com/v1/live/sessions?model=gpt-live-1: connect with your key, then send session.start once. Billed by the session second. Custom voices, recording, saved sessions and the other extras are refused.
Live translation: wss://api.flintbeam.com/v1/realtime/translations?model=gpt-realtime-translate. Choose the output language with session.update, send base64 PCM16 mono 24 kHz audio with session.input_audio_buffer.append, and finish with session.close. Billed by input audio seconds, rounded up to a whole second.
Translation from a web page: ask for the ticket with session.type translation and the output language in session.audio.output.language; a model-only translation ticket is refused. Offer the ticket as the subprotocol openai-insecure-api-key.TICKET, alone or beside realtime: the answer names realtime when you offered it, otherwise the ticket (already spent by then), so the browser completes the handshake. An API key offered alone is never named back and the browser aborts: keep keys on your server. The ticket's session is sent for you: wait for session.updated before sending audio. Repeating the same session.update is ignored; a different one ends the session. When the ticket's seconds or spend run out, an error with code ticket_limit_reached arrives, the translation of the audio already sent still follows, then session.closed, and the socket closes with code 1000 and that reason: mint a new ticket to go on.
When the gateway closes a session it says why in the close code: 1008 for a problem with the key, model, limits or money; 1011 when the provider is unavailable; 1012 while the service restarts; 1013 when the key's request rate is reached. Keys with a tokens-per-minute limit cannot open realtime sessions.
Calls over HTTP and WebRTC (/v1/realtime/calls and its accept, reject, refer and hangup actions) are not available: they are refused without starting a call or charging you. Use the WebSocket.
Embeddings and moderation
POST /v1/embeddings turns text into vectors. input is one string or a list of up to 2048 — or, on OpenAI's models, token ids you counted yourself. dimensions works on the models that support it and is refused by name on the others; encoding_format may be float or base64. The answer is OpenAI's list shape. Gemini's own task_type and title work on Google's embedding models.
POST /v1/moderations checks text and pictures against the maker's safety categories and returns its verdict as it came — flags and scores, nothing added. Send one string, a list, or text and image parts as OpenAI takes them. It is free.
Files and storage
POST /v1/files keeps a file so you can point at it instead of uploading it again — up to 25 MB per file and 500 MB per account. purpose is one of batch, user_data, vision. GET /v1/files lists your files, GET /v1/files/ID describes one, GET /v1/files/ID/content downloads it and DELETE removes it. Files expire 30 days after upload (expires_at). Uploading needs a positive balance; at $0 the answer is 402. Somebody else's file answers exactly as a file that does not exist.
In a chat, point at a stored document with a file part (file.file_id) or at a stored picture with image_url.file_id — up to 20 stored files a request. Anthropic's Files API shape (anthropic-beta: files-api-2025-04-14) is served on the same address.
Multipart uploads for files with purpose assistants: create the upload with its filename, MIME type and total size, send the parts, then complete them in the order you choose or cancel. Up to 8 GB in all, 64 MB a part and 1,000 parts; an unfinished upload expires after an hour. Completing returns a file id.
Create, list, read, update and delete document search stores; attach files one by one or in batches, check indexing, cancel a batch and search what is indexed. Storage costs $0.10 per GB per day and hosted file search $2.50 per 1,000 calls. A store expires one day after its last use. Search returns at most 50 results. Fields that are not supported are refused rather than ignored.
Create, list, read and delete containers for code_interpreter, and upload, list, download or remove their files. Memory is 1g, 4g, 16g or 64g; a session costs $0.03, $0.12, $0.48 or $1.92 respectively per 20 minutes and is charged when code runs in it. A container expires 20 minutes after its last use. This endpoint manages containers and their files; it does not run code itself.
API keys and limits
An account can have up to 20 active keys. Each key can carry its own limits, set in the API Keys section and checked on every request:
- Spending limit — per day, week, month, or for the whole life of the key. When it is reached the key stops until the period rolls over (a
429withRetry-After); a lifetime limit stops it for good. Your balance is not touched. - Requests per minute. Past it the key gets a
429withRetry-Afteruntil the next minute. - Tokens per minute. Each request is counted at its largest possible size — the input plus the answer limit — when it starts, and corrected when it ends. Keys with this limit cannot open realtime voice sessions.
- Allowed models. Anything else is refused, and
/v1/modelslists only what the key may use. - Allowed addresses. A request from any other address is refused, even with the right key.
- Answer length. The limit used when a request sends no
max_tokens, for all models or model by model. - Plan only. The key spends a plan's allowance and never the balance; when the allowance is used up, it waits for the next day's ration — or, on a plan that is a sum of money, until the plan renews. A plan-only key cannot use the Gemini door, MCP, agent tools, hosted tools or speed lanes.
Rotating a key keeps the old one working for a grace period, after which it fails with key_expired. Revoking is immediate.
How you are charged
Before a request goes out, its largest possible cost is held from your balance; when the answer is in, the hold is settled against what was really used and the rest is returned. You pay the price shown on the model's page, with any discount of the day. A request refused before it reaches a provider costs nothing.
Text models are priced per million tokens, input and output separately; input the provider served from its cache is cheaper, as each model's page shows. Some speech models are priced per character or per second, and video per second. The hold is an estimate — your prompt plus max_tokens of output — and the charge follows the tokens the provider reports, so it can occasionally be slightly more than the hold when a model returns more than max_tokens.
By default, if your balance plus any bonus that covers the model cannot pay for the longest possible answer, the gateway lowers max_tokens to what they can pay for. Answers report the limit used in x-ceiling-used and the reduction in x-ceiling-reduced / x-ceiling-reason: balance. Send x-fit-balance: 0 (or false) to get a 402 instead. Models that answer in pictures or sound are never shortened this way. Plan-only keys keep their plan's rules.
Bonuses that cover the model pay first, the one that expires soonest first; then a plan that is a sum of money, then the balance. A plan with a daily ration pays on its own. When a plan cannot pay, your account setting decides whether to continue from the balance or stop with allowance_exhausted. A renewing plan is charged to your default card, and after a decline to your other saved cards in turn.
You top up by card or with crypto. Up to 5 cards can be saved, one of them the default. Auto top-up adds money when the balance falls below a level you choose, up to a monthly cap, at most 2 times an hour and 5 times in 24 hours, and switches itself off after 2 declined payments in a row. A receipt comes by email after each payment, and a warning when the balance falls below $10, $5 and $0.
Prices do not include sales tax (VAT or GST). Where it applies, it is worked out from your billing address and added at checkout, and you see it before you pay; a business with a valid VAT number is not charged it. Tax is never credited to your balance and is not part of the top-up fee.
Every request a key sends to a model — served or failed — appears in Usage History with its request id, tokens and price.
Spending from your code
Every answer carries an x-request-id header, streamed or not. Keep it in your logs: it is how you — and we — find that exact request: what it cost, which provider served it and why it failed. The chatcmpl-, msg_ and resp_ ids of the answers contain the same id.
Most answers also say what they cost: usage.cost in the body (and in the last chunk of a stream), or the x-usage-cost header on answers that are files, such as speech and video. When cost_status (or x-usage-cost-status) is pending, the charge is not settled yet — look it up a moment later.
GET /v1/generation?id=ID (or GET /v1/requests/ID) returns one request made with this key: its model, status, token counts, cost and the tags, user and metadata you sent with it. Other keys, even in the same account, cannot read it.
GET /v1/key returns what this key has spent — in all, today, this week and this month — its spending limit and what is left of it, its request and token rates and its expiry. Amounts are in US dollars.
GET /v1/credits returns your balance: what is available, what is held for requests still running, and what has been spent in all. Bonus and pack credits are listed apart, each with what it covers and when it expires.
These three cost nothing, but each counts as a request against the key's per-minute rate.
Limits
Every limit a request can run into, in one table. A request refused for a size or count limit never reaches a provider and costs nothing. For timeouts and what to do next, see Retries, idempotency and holds.
| Limit | Value | When it is passed |
|---|---|---|
| Request body: Chat Completions, Responses, Messages, Gemini | 32 MB | Refused with 413; nothing is charged. |
| Request body: video | 16 MB | Refused with 413; nothing is charged. |
| Request body: other JSON requests, such as images, speech and embeddings | 4 MB | Refused with 413; nothing is charged. |
| One call to a text model, streamed or not, and a background response | 10 min | Ends with request_timeout (504). |
| One call to a Pro model | 30 min | Ends with request_timeout (504). |
| One image or transcription request | 5 min | Ends with request_timeout (504). |
| One speech, embeddings or moderation request | 2 min | Ends with request_timeout (504). |
One video request left open (an async job is not held open) | 30.5 min | Ends with request_timeout (504). |
Answers per request (n): OpenAI chat models / Gemini models | 128 / 8 | Refused with 400 (invalid_request); the message names the limit. |
| Stored files named in one request | 20 | Refused with 400 (invalid_request); the message names the limit. |
One file kept with /v1/files | 25 MB | Refused with 413; nothing is charged. |
| All your stored files together | 500 MB | Refused with 400 (invalid_request); the message names the limit. |
Multipart upload (/v1/uploads): whole upload · one part · number of parts | 8 GB · 64 MB · 1000 | Refused with 400 (invalid_request); the message names the limit. |
| One audio file for transcription (longer recordings are cut into pieces for you) | 100 MB | Refused with 413; nothing is charged. |
| Text for one speech request, in characters | 4096 | Refused with 400 (invalid_request); the message names the limit. |
Items in one embeddings input list | 2048 | Refused with 400 (invalid_request); the message names the limit. |
| Active API keys | 20 | Creating another key is refused until you revoke one. The Playground’s own key counts as one. |
| Stored conversations at one time | 1000 | Refused with 400 (invalid_request); the message names the limit. |
| Items added to a conversation in one call | 20 | Refused with 400 (invalid_request); the message names the limit. |
Prompt-cache marks (cache_control) in one request | 4 | Claude models accept no more, and the automatic mark counts too. Keep to this many. |
tags: how many × characters each | 16 × 64 | Refused with 400 (invalid_request); the message names the limit. |
user: characters | 256 | Refused with 400 (invalid_request); the message names the limit. |
metadata: entries · characters in a key · characters in a value · size of tags, user and metadata together | 16 · 64 · 512 · 16 KiB | Refused with 400 (invalid_request); the message names the limit. |
| Requests per minute and tokens per minute of one key (you choose them for each key) | — | 429 with Retry-After until the next minute. Wait, then send the same request again. |
| Spending limit of one key: per day, week, month or lifetime (you choose it) | — | 429 with Retry-After until the period rolls over (none for a lifetime limit) and x-should-retry: false. Your balance is not touched. |
| Failed attempts with a wrong API key, per IP address | 60 / min | Further requests with a wrong key from that IP address get 429 rate_limit_exceeded until the minute rolls over. It counts failed key attempts only, never your usage. |
tags, user and metadata. Send them as top-level fields of the JSON body, next to model: "tags": ["checkout", "beta"], "user": "customer-42", and metadata as an object whose keys and values are strings. On a multipart request (audio, image edits) send tags and metadata as JSON text in their form fields. They are not sent to the provider. They are kept with the request and come back in GET /v1/generation and in the usage export. Too many, too long or too big, and the request is refused with 400.
Rate headers. Only when a key has a request or token limit, every answer carries x-ratelimit-limit-requests, x-ratelimit-remaining-requests and x-ratelimit-reset-requests (and the same three for tokens). The reset is the time to wait, written like 6s. A key without such a limit sends none of them. Limits are set per key in API Keys.
Retries, idempotency and holds
Retry what is safe to retry, and wait the right time. Keep the x-request-id of the first attempt: it is how you find out what a request really cost.
- 429 with
Retry-After. Wait that many seconds, then send the same request again. The OpenAI and Anthropic SDKs do this by themselves. A key’s per-minute limit and a busy provider both answer like this. - 429 with
x-should-retry: false. A key’s spending limit is used up, or a paid tool loop has started. Another try gets the same answer, so the OpenAI and Anthropic SDKs stop when they see this header. Raise the limit, use another key, or wait for the period to roll over. funds_in_flight(429). Your money is there, but your own requests that are still running are holding it. The gateway already waits up to 30 seconds for one of them to finish; if none does, the answer carriesRetry-After: 5. Retry after a few seconds, with fewer requests at once or a smallermax_tokens.upstream_error(502). The provider failed. Usually safe to retry. If the message says not to resend the request, do not: it may already have been sent and charged.no_upstream_availableandservice_paused(503). Nothing could serve the request right now. Retry later with growing pauses (a few seconds, then longer); retrying at once gets the same answer.request_timeout(504). The provider took longer than the gateway waits. The work may have been done and billed, so look the request up by itsx-request-id, or in Usage History, before sending it again.- Other 4xx.
400,401,402,403,404and413are not worth repeating unchanged. Fix the request, the key or the balance first. For402, see below.
Idempotency-Key
Uploads (/v1/uploads and its parts), containers and vector stores accept an Idempotency-Key header of up to 256 characters. Use the same key when you resend the same request after a dropped connection: you get the first result back instead of a second copy. The same key with a different request is refused with 409 (idempotency_conflict); use a new key for different work.
Chat Completions, Responses and Messages do not read this header. A request you send twice is two requests and is billed twice, so after a dropped connection check Usage History before resending.
If your client disconnects
The gateway cannot take back work a provider has already done, so it charges what was produced. When a stream ends early, most text models and all Claude models are stopped at once, and you pay for the input and for what was already delivered. Reasoning models other than Claude, and answers in pictures or sound, run to the end and are billed in full. A request that is not streamed keeps running and is billed even if you stop waiting.
Holds, in plain words
Before a request goes to the provider, the most it could cost is set aside from your balance: the input plus the whole max_tokens, each at the model’s price. The money is not spent. It shows as on hold, and when the answer is in you are charged the real cost and the unused part returns at once.
Example. A model priced at $10 per 1M input tokens and $50 per 1M output tokens, with 2,000 input tokens and max_tokens: 32000. Input: 2,000 × $10 ÷ 1,000,000 = $0.02. Answer ceiling: 32,000 × $50 ÷ 1,000,000 = $1.60. Hold: $0.02 + $1.60 ≈ $1.62. If the answer turns out to be 500 tokens, you pay $0.02 + 500 × $50 ÷ 1,000,000 = $0.045, and $1.575 goes back. The input is counted on the safe side, so a real hold can be a little higher than this sum.
Requests that run at the same time each hold their own amount: ten like this one hold about $16.20 together. Many large ceilings at once are the usual cause of funds_in_flight and 402.
Avoiding 402. Send the max_tokens you really need: a smaller one holds less. By default the gateway already lowers it to what your balance can pay for (it says so in x-ceiling-reduced). A 402 comes only when no useful answer fits, or when you send x-fit-balance: 0 to keep the full ceiling. Top up, or keep fewer large requests running at once.
Errors
Errors come back in OpenAI's shape — error.code, error.message, error.type — except on /v1/messages, which answers in Anthropic's shape. error.message is written to be read: it says what was wrong and, where it can, what to send instead. The codes worth handling:
| Code | What it means |
|---|---|
401 invalid_api_key | The key is missing, wrong or unknown. Check the header, not the balance. |
401 key_expired | The key is past the expiry date you set, or it is an old key past its 24-hour rotation grace. Switch to the new one. |
401 key_revoked | The key was revoked (also the old key after “Kill the old key now”). A revoked key cannot be brought back; use an active one. |
403 account_disabled | Your access is restricted or not active, so every key is refused. Write to support@flintbeam.com to have it lifted. |
403 ip_not_allowed | The key is pinned to other addresses. Add this one, or use a key without the restriction. |
403 model_not_allowed | This key may not use that model. The model exists — the key is narrowed. |
404 model_not_found | No such model on sale. Check the exact code against /v1/models. |
404 video_not_found | No video with that id, or it belongs to another account. Both answer alike on purpose: a job id travels in a URL, and telling the two apart would tell a stranger they had guessed a real one. |
404 file_not_found | No file with that id, or it belongs to another account. Both answer alike on purpose: the id travels in a URL, and telling the two apart would tell a stranger they had guessed a real one. |
404 resource_not_found | No resource with that id, or it belongs to another account. |
410 resource_expired | This resource has expired. Create a new one before using it again. |
409 idempotency_conflict | This Idempotency-Key was already used for a different request. Use the same key only when retrying the same request; use a new key for different work. |
402 insufficient_credits | Not enough balance for the estimated cost of this request. |
402 allowance_exhausted | A plan covers this model, but its allowance is used up and the account is set to stop rather than spend the balance. |
429 funds_in_flight | Your money is there, but your own requests that are still running are holding it. Wait for the Retry-After header and try again — this one clears by itself. |
429 rate_limit_exceeded | The key's spending limit, request rate or token rate for this period is reached, or the provider is busy for a moment. Wait as long as Retry-After says. |
429 own_capacity_busy | The capacity set aside for this key is busy for a moment. Wait as long as Retry-After says. |
400 invalid_request | The body is malformed, or a field is not served for this model — the message names it. If it includes storage_pricing_unverified, that storage operation cannot run yet. |
503 no_upstream_available | Every provider that could serve this model failed or is unavailable. Retrying later is reasonable; retrying immediately is not. |
503 service_paused | The API is paused for a short while. Retry in a few minutes. |
502 upstream_error | The provider failed in a way that is not your fault. Usually safe to retry; if the message says not to resend the request, don’t — it may already have been sent and charged. |
504 request_timeout | The provider took longer than the gateway waits. |
500 internal_error | Our failure, not yours. Keep the x-request-id and tell us; one retry is reasonable. |
404 unknown_endpoint | No such path on this API. Check the base URL: https://api.flintbeam.com/v1 for OpenAI-style clients, https://api.flintbeam.com for Anthropic and Gemini clients — then the path itself. |
200 tool_result_too_large | Not an HTTP error: it appears inside an MCP tool call in the output when a tool’s result is over 1 MiB. The model reads it and may ask for less; the response itself still succeeds. |
WS client_queue_exceeded | Realtime (WebSocket) only: too much of your input was waiting to be handled, so the session sends this error event and closes. Send at the pace the audio plays, then reconnect. |
429, and refusals caused by a used-up ration, carry a Retry-After header whenever there is a known time to wait. Honour it — retrying sooner only gets the same answer. A body over the size limit is refused with 413. In a stream that has already started, an error arrives as an event instead of a status code. When to retry, and when not: Retries, idempotency and holds. Every size, count and time limit: Limits.
Response headers
Headers the API adds to its answers, besides the ones your SDK already knows:
| Header | What it means |
|---|---|
x-request-id | The id of this request. Keep it; on Messages it also comes as request-id. |
x-usage-cost, x-usage-cost-status | What the request cost, in dollars, and whether that is final or still pending. |
x-ratelimit-* | The key's own per-minute request and token counters — x-ratelimit-limit-requests, -remaining-requests, -reset-requests and the same for tokens — when the key has such a limit. On Messages, anthropic-ratelimit-requests-*. |
Retry-After | How many seconds to wait before trying again. |
x-ceiling-used, -reduced, -raised, -reason | The answer limit really used; whether it was lowered to fit your balance (x-ceiling-reduced) or raised so a reasoning model could answer (x-ceiling-raised); and why (x-ceiling-reason). |
x-ignored-params | Request fields the model could not use and that were dropped instead of refused. |
x-documents-read | The attached files whose text was read for the model. |
x-should-retry | false once a paid tool loop has started: do not repeat the request automatically. |
x-count-token-source | On count_tokens: anthropic for an exact count, estimate for an estimate. |
x-transcription-partial | On transcription: only part of a long recording could be transcribed. |
x-cache-prepaid-until | On a Gemini context cache: the time its storage is paid until. |
What is not supported
So that you can plan around it, here is what this API does not do. If your code depends on one of these, keep that call on the provider directly for now.
- Batches — OpenAI's
/v1/batches, Anthropic's Message Batches and Gemini'sbatchGenerateContent. Send requests one by one. - Fine-tuning and evaluations —
/v1/fine_tuningand/v1/evals; files with purposefine-tuneorevalsare refused. - Older OpenAI endpoints — the legacy
/v1/completions,/v1/images/variationsand the Assistants API. Use Chat Completions or Responses. - Custom voices and voice consents, and realtime calls over HTTP or WebRTC. Built-in voices and the WebSocket work.
- Pictures, audio, video and PDFs on the Gemini native door, and its
safetySettings, Google Maps and File Search — send media to Gemini through Chat Completions, Responses or Messages instead. - Picture links in answers — pictures always come back as base64.
- On Chat Completions: MCP, hosted
file_searchandcode_interpreter, anddata_sources— use Responses. - Stored state with MCP or agent tools — keep the conversation yourself and send it with every request.
- Anthropic Agent Skills and OpenAI's hosted connectors (
connector_id).
Data and privacy
Request and response bodies are not written to our logs. For each request we keep its id, model, token counts, time taken, price and provider, plus the tags, user and metadata you send with it. Each provider processes your request under its own data policy.
What is stored, and for how long. On OpenAI's own models, responses are stored for 30 days unless you send store: false; if you name a conversation, its items are still saved. Conversations stay until you delete them; you can have up to 1,000 at a time. If an answer carries conversation_not_updated, it was billed but its items were not added — check before retrying. Files uploaded to /v1/files are kept at most 30 days (expires_at). Gemini files are kept 24 hours and Gemini caches for the lifetime you set. Stored content is encrypted and readable only by your account, and creating any of it needs a positive balance (402 at $0). Closing your account erases it all.
API keys are stored only as a hash, so not even we can read them back.
Security tips
- Never put your API key in a web page, a mobile app or a public repository. For live voice in a browser, have your server ask for a ticket.
- For production servers, set allowed addresses on the key in the API Keys section.
- Give each server or app its own key, with its own spending limit and allowed models — then one can be revoked without touching the others.
- On the Gemini door, send the key in a header rather than as
?key=: addresses end up in logs.