API Reference
Complete REST surface: chat, responses, embeddings, reranks, decisions, images, video, 3D, audio, transcription, document OCR, search, detection, batch, jobs
EmpirioLabs speaks OpenAI-, Anthropic-, and Google Gemini-compatible request shapes. Point an OpenAI SDK at https://api.empiriolabs.ai/v1, or an Anthropic or Gemini SDK at https://api.empiriolabs.ai, and authenticate with your EmpirioLabs API key. These OpenAI SDK calls work differently:
- Images.
images.edituploads the image as a file, which is not accepted: sendPOST /v1/images/editsas JSON with the image’s URL.images.generatereturns the finished images, as it does on OpenAI. - Speech.
audio.speech.createreturns the audio bytes, which is what the SDK asks for. - Files. Files are batch files.
files.createtakespurpose: "batch", andfiles.list,files.retrieve,files.content, andfiles.deletework on your batch input, output, and error files. - Responses. Responses are not stored. Send the full conversation with every
responses.createcall;previous_response_id,background: true, and the calls that read a stored response, such asresponses.retrieve, are not available.
Authentication
Requests authenticate with your API key. The catalog endpoints (GET /v1/models, the Gemini model list at GET /v1beta/models, the generation template and Compose recipe lists, and the GPU catalog) also answer without one. Either header is accepted on every endpoint:
Gemini-compatible routes additionally accept the key in the x-goog-api-key header or the ?key= query parameter, matching Gemini client defaults.
Endpoint surface
Chat completions
POST /v1/chat/completions
Pass any chat-capable model from the catalog as model. Streaming uses Server-Sent Events with data: ... lines and a final data: [DONE]. usage arrives at the end of the stream on a chunk that also has choices. Set stream_options.include_usage to true to receive it the way OpenAI sends it, in its own chunk just before [DONE] whose choices is an empty list; some models still report it on a chunk with choices. Read usage from the last chunk that carries it. When web search adds a Sources list to the answer, the list arrives as content before the chunk that carries finish_reason.
Every model’s accepted parameters live on its docs page (e.g. temperature, top_p, enable_thinking, reasoning_effort, web_search_tier). Browse them under Authors and Models.
Responses API
POST /v1/responses
OpenAI Responses-compatible. Models that list POST /v1/responses in supported_endpoints accept the Responses request shape: input, instructions, streaming, tool calling, and structured output via text.format.
Responses are not stored, whatever store is set to. Send the full conversation in input with every request; previous_response_id, conversation, prompt, and item_reference input items return 400 with the code unsupported_parameter. Background responses are not available: background: true returns 400 with the code unsupported_value. A tool type the model does not support returns 400 naming the tool, and a web_search tool turns on the model’s own web search when it has one. The response object repeats the request’s settings (tools, tool_choice, parallel_tool_calls, instructions, max_output_tokens, and the others), with store always false.
A streamed answer cut off by max_output_tokens or a content filter ends with response.incomplete, and a stream that fails after it starts ends with response.failed, whose response.error gives the code and message. A stream ends after its final event, with no [DONE] sentinel.
Model parameters across endpoints
Model-specific parameters advertised on the model page and in GET /v1/models/{id} can be sent to /v1/chat/completions, /v1/responses, and /v1/messages when that model supports the endpoint. The gateway adapts request shapes so the same controls reach the underlying model.
For thinking-capable models, enable_thinking and thinking_budget are accepted on all three text endpoints. On /v1/messages, you can also use Anthropic-style thinking:
That maps to the same enable_thinking=true and thinking_budget=1024 controls used by Chat Completions and Responses. "type": "adaptive" turns thinking on without a budget, and "type": "disabled" turns it off.
Legacy completions
POST /v1/completions
Use this endpoint for OpenAI-compatible clients that still send a raw prompt instead of chat messages. Every model that accepts POST /v1/chat/completions accepts this shape.
Send one text prompt per request: a list with more than one prompt, or a prompt given as token IDs, returns 400 with param set to prompt. echo: true returns the prompt followed by the completion. A non-empty suffix, or a best_of above 1, returns 400 naming the parameter.
Streaming uses Server-Sent Events. usage arrives at the end of the stream on a chunk that also has choices. Set stream_options.include_usage to true to receive it the way OpenAI sends it, in its own chunk just before [DONE] whose choices is an empty list; some models still report it on a chunk with choices. Read usage from the last chunk that carries it.
Anthropic Messages
POST /v1/messages
Drop-in for any Anthropic SDK client: models that list POST /v1/messages in supported_endpoints are reachable here under the Anthropic Messages shape.
tool_use and tool_result blocks round-trip cleanly. Mixed text-plus-tool_use content arrays are preserved. max_tokens is optional. A web_search tool turns on web search on models that offer it; any other server tool, and any content block the model cannot take, returns 400 naming it. A stream that fails after it starts ends with one error event.
POST /v1/messages/count_tokens takes the same body (without max_tokens) and returns {"input_tokens": N}, an estimate of the request’s input size. It requires an API key, is not billed, and returns 404 for a model that is not in the catalog. Errors on both endpoints use the Anthropic error shape.
Gemini-compatible endpoint
POST /v1beta/models/{model}:generateContent
Native Google Gemini request and response shapes for any chat model. POST /v1beta/models/{model}:streamGenerateContent?alt=sse streams Server-Sent Events (each event is a partial GenerateContentResponse; there is no [DONE] sentinel); without alt=sse it returns the same responses as one JSON array. POST /v1beta/models/{model}:countTokens returns {"totalTokens": N}, an estimate of the input size; it requires an API key and is not billed. GET /v1beta/models and GET /v1beta/models/{model} list the chat models in the Gemini Model shape, for the SDK’s models.list() and models.get(); both answer without an API key.
A googleSearch tool turns on web search on models that offer it. A request the API cannot serve as asked returns 400 naming the field: candidateCount above 1, responseModalities other than TEXT, responseLogprobs, cachedContent, or a built-in tool other than googleSearch, such as codeExecution or urlContext.
Authenticate with the x-goog-api-key header or the ?key= query parameter. The google-genai SDKs work by pointing their base URL at https://api.empiriolabs.ai; pricing, parameters, and billing match /v1/chat/completions. Errors use the Google error shape.
Image generation
POST /v1/images/generations
Image generation returns the finished OpenAI-shaped created and data[] response, which is what OpenAI SDK images.generate integrations expect. A generation still running after about 14 minutes answers with the {job_id, poll_url} envelope instead, with the job still running; poll the jobs endpoint for the result. Send Prefer: respond-async (or sync: false) to get the envelope at once.
POST /v1/images/edits applies a text instruction to an existing image. Send JSON with the image URL as image, the instruction as prompt, and an image-edit model such as grok-imagine-image-2-0 as model, which is required. It answers the same way: the finished images, or the job envelope with Prefer: respond-async.
Image-edit flows accept image: ["https://..."] with up to the model’s documented limit (3 for qwen-image-2-0, 9 for wan2-7-image, 14 for seedream-5-0-lite). Image-set modes generate cohesive series; see each model’s page for the toggle.
Returned URLs live on https://media.empiriolabs.ai and expire after 7 days. Save anything you want to keep before the URL expires.
POST /v1/images/analysis answers a question about one image (image_url) with any chat model whose input_modalities include image (qwen3-7-flash when model is omitted), and returns the answer as text in analysis. No image is generated.
Video generation
POST /v1/videos/generations
Always async: the endpoint returns a job_id and a polling URL. model is required unless a template or extend_from is set; see Generation Templates for the model each one runs.
Generation templates
Effect templates apply curated creative treatments to normal image and video generation requests.
GET /v1/templates lists the public template catalog. Use GET /v1/images/templates or GET /v1/videos/templates when you already know the modality.
GET /v1/videos/compose/recipes lists full-production video recipes, caption styles, input requirements, and recommended model options.
POST /v1/videos/compose starts a Compose recipe job:
mode: "plan"returns an editable storyboard from a brief or script.mode: "render"takes a storyboard and produces the final MP4.mode: "edit"takes themanifestfrom a render job’sresultplusedits, each with a zero-basedscene_indexand anaction:regen_visual,edit_caption, orredo_vo(the last two take the new text invalue).
Compose returns the same async job envelope as video generation. Poll GET /v1/jobs/{job_id} until the result is ready. See Generation Templates for the end-to-end plan, render, edit, and usage workflow.
Audio generation
POST /v1/audio/speech synchronous text-to-speech, including multi-speaker podcasts. Returns JSON with a hosted URL by default; pass response_format: "b64_json" for inline audio, or send an Accept header of application/octet-stream or audio/* (as the OpenAI SDK does) to receive the audio file itself.
POST /v1/audio/speech:stream real-time TTS. Returns Server-Sent Events as the model synthesizes, ending with audio.done, which carries the complete file’s url and format. Sub-130ms time-to-first-byte on Inworld TTS Mini, sub-250ms on Max. Use for voice agents and interactive playback. Models that stream list POST /v1/audio/speech:stream in supported_endpoints; other TTS models use the synchronous endpoint. A failure before the first event returns an ordinary error response with its HTTP status.
POST /v1/audio/generations music and sound-effect generation from a prompt, with models such as Stable Audio, ACE-Step, MiniMax Music, and Sonilo. Returns a job to poll.
GET /v1/voices?model=<tts-model> lists a TTS model’s voices as {object, model, total, data}. Pass a voice’s id as voice on either speech endpoint.
On the Qwen Audio TTS models, GET /v1/voices also lists the custom voices your account holds (type=custom lists them alone) and DELETE /v1/voices/{voice_id}?model=<tts-model> deletes one, which frees its place in the account’s limit at once. The Playground offers the same under Voice, when Voice is set to Custom. Gemini 3.8 TTS keeps no list of custom voices: keep the voice_id from the response that created the voice.
voice: "custom" creates a voice from a recording on the TTS models whose voice options include it: pass voice_audio_url, an https URL to the recording, and voice_consent_audio_url on a model that lists it. The model page gives the recording length and formats it takes. A model that keeps the voice also returns voice_id and voice_id_expires_at; pass the voice_id as voice on either speech endpoint to speak with that voice again until it expires.
Transcription
POST /v1/audio/transcriptions
Accepts either a multipart file upload or a JSON payload with file_url.
Every transcription request returns 202 with a job_id and a poll_url, whatever the length of the recording. Poll GET /v1/jobs/<job-id> until status is completed; the transcript is in result.
Document OCR
POST /v1/ocr
Reads a PDF or an image and returns every page as Markdown, with image regions, tables, headers, and footers. document takes a document_url or an image_url, each a public URL or a base64 data URI; pages chooses zero-based pages. A request still running after about four and a half minutes answers 202 with a job_id, and Prefer: respond-async asks for it at once.
See the Document OCR API guide for page selection, image and table options, long documents, and billing.
Long responses
WEBSOCKET /v1/responses
An HTTP request can run for up to 15 minutes. A response that takes longer runs over a WebSocket connection to /v1/responses, for every model that supports POST /v1/responses: send a response.create message and read the same events a streaming POST /v1/responses sends. Nothing is stored, so stay connected until the response ends. See Long Responses.
Realtime voice
WEBSOCKET /v1/realtime
A WebSocket endpoint for full-duplex audio: the model can be interrupted mid-response, and live transcription returns results while the speaker is still talking. stream: true on the HTTP endpoints streams output only and cannot carry microphone audio to the model.
Authenticate with your API key in an Authorization: Bearer header on the handshake. A web page cannot set that header, so it connects with a short-lived client secret that your server creates with POST /v1/realtime/client_secrets; see Connect from a browser.
Speech-to-speech models bill each completed turn from that turn’s token usage; live transcription models bill by the duration of audio sent. Models, per-model voices, the event table and the transcription protocol are on Realtime Voice API.
Search and research
POST /v1/search unified search surface for retrieval-style models. The exact accepted params per model live on each model’s page (e.g. exa-search exposes 27 params including search_type, category, max_age_hours, subpages, summary_query, code_tokens).
POST /v1/research multi-step research with a research model (tavily-research). Answers synchronously with a report with numbered citations in answer and its sources in results; a run can take several minutes.
POST /v1/answer direct question-answering models (exa-answer). Returns a concise answer plus its sources in results (title, url, id, and text when you send text: true). The answer is always one JSON response; stream is ignored.
Agents
Long-running, tool-using agent tasks (currently routed to Manus). Submit once, then poll for status and step-by-step messages, or stop early.
POST /v1/agents/run does double duty:
- With no
task_idit starts a fresh task. - With
task_idit sends a follow-up message to an existing task. The agent picks it up on its next reasoning step.
Either way the response is 202 with a job (job_id and poll_url). Poll GET /v1/jobs/{job_id}; the finished job’s result holds the agent’s output, with the task id in result.task_id. Set stream: true to receive Server-Sent Events instead.
When the agent stops to ask a question or to wait for a confirmation, the finished job’s result.waiting says which (type is question or confirmation) and result.text ends with the question. Reply with a follow-up that sends the same task_id: it answers the question, or continues without the confirmation. A follow-up’s job returns and bills only that turn.
GET /v1/agents/{task_id} retrieve the task’s current details, as {object, model, task_id, result}.
GET /v1/agents/{task_id}/messages list every step the agent has emitted so far. Useful for rendering a live reasoning trace alongside the final answer.
POST /v1/agents/{task_id}/stop stop a running task. Billing settles for the work the agent already completed.
3D Generation
POST /v1/3d/generations
3D generation is async. The inputs depend on the model: a text prompt, one or more images, or both. Each model page lists the parameters the model accepts, with their allowed values and defaults. The endpoint returns a job_id and a polling URL; poll the jobs endpoint until the job is completed, then read the generated files from result.data.
Each file in result.data has a signed url (inline b64_json when response_format is b64_json) and a filename to save it under. Where the model provides them, a file also has a format, for example glb, and a role that says what the file is.
Detection
POST /v1/detect
Specialized text-classification endpoint. Currently powers GPTZero AI-detection. Each model’s scan_type enum picks the scan; see the per-model docs for the full parameter surface.
GPTZero is also reachable via /v1/chat/completions and /v1/responses: pass the text on the message body and the gateway adapts the call. The detection summary comes back as the assistant message; pass disable_formatting: true to receive the raw upstream JSON instead.
Embeddings
POST /v1/embeddings
OpenAI-compatible embeddings. Multilingual text and multimodal (text + image + video) embedders are available. model is required. Text input is a string or a list of strings; token IDs return 400. encoding_format: "base64" works on every model. dimensions sets the vector size on models that offer more than one; a fixed-size model returns 400 for any other value.
Reranks
POST /v1/reranks
Sort candidate documents by semantic relevance to a query. Returns each document’s original index plus a 0-1 relevance score (higher = more relevant). Use this to tighten the output of a vector store / BM25 / hybrid retriever before passing the top hits to a language model, the standard last step in a RAG pipeline.
The optional instruct parameter swaps between Q&A retrieval (default) and pure semantic-similarity sorting; see the qwen3-rerank model page for the full parameter table.
Decisions
POST /v1/decisions
Answer typed questions about a state with calibrated probabilities. Decision models read text, JSON, images, audio, and video, and return a probability distribution and a confidence value for each question instead of generated text. Question types are noul (yes or no), choice (2 to 255 named options), score (2 to 10 ordered levels), and tool (which function to call). Usage counts input tokens only.
See the Decisions API guide for every question type, media input, limits, and billing.
Batch API
Process large request sets asynchronously. Batch runs chat and embeddings requests for batch-eligible models; check the batch_supported field on GET /v1/models (eligible model pages also show a Batch API row). Each line bills at the model’s list price less its batch_discount_pct, which is 0 when the model runs batch at list price. On a model with a batch discount, batch requests cannot use web search or built-in tools; send those requests to the real-time endpoint. Results arrive within the 24-hour completion window.
- Upload a JSONL input file with
POST /v1/files(multipart,purpose=batch). Each line is{"custom_id": "...", "method": "POST", "url": "/v1/chat/completions", "body": {...}};/v1/embeddingslines work the same way, includingencoding_format: "base64". Every line needs acustom_idthat is unique in the file (at most 256 characters). A line’surlmust be the batch’sendpointand itsmethodPOST(a line may also leave both out), or creating the batch returns400 invalid_batch_line. Up to 50,000 requests per file. Files are kept for 7 days. - Create the batch with
POST /v1/batches, passing the returnedinput_file_id.completion_windowis24h.metadatatakes up to 16 string pairs (keys up to 64 characters, values up to 512). - Poll
GET /v1/batches/{batch_id}until the batch reaches a terminal status.GET /v1/batcheslists recent batches, newest first, and pages withlimitandafter(the previous page’slast_id) whilehas_moreistrue.POST /v1/batches/{batch_id}/cancelcancels one. A batch that fails gives the reason inerrors. - Download results with
GET /v1/files/{output_file_id}/contentandGET /v1/files/{error_file_id}/content. The output file has a line for each request that succeeded, and the error file a line for each request that did not.
Each result line is {"id", "custom_id", "response", "error"}. A request that got an HTTP answer has response with its status_code, its request_id (the ID its row in Account Usage carries), and the response body, and error is null; a failed request’s body is an error body in the API’s error shape. A request that never ran, for example because the batch expired or was cancelled first, has response: null and an error with a code (batch_expired, batch_cancelled) and message.
GET /v1/files lists your batch files (filter with purpose: batch or batch_output), GET /v1/files/{file_id} returns one with its expires_at, and DELETE /v1/files/{file_id} deletes one; deleting the input file of a batch that is still running returns 409 file_in_use. A file past its expires_at returns 404 file_expired.
Usage object
Every endpoint that bills usage returns a usage field on the response. A streamed Chat Completions or Completions response carries it at the end of the stream, on a chunk that also has choices or, when the request sets stream_options.include_usage: true, in its own chunk with an empty choices list; read it from the last chunk that carries it. Messages, Responses and Gemini streams report it in message_delta, in response.completed (or response.incomplete) and in the last event’s usageMetadata. Base shape:
cost_usd: what your account was charged for the request, after any discount, plan allowance or add-on. It equalscost.amounton the request’s Account Usage row. A stream carries it on its final usage event. It is omitted when the charge is not final yet; Account Usage then shows it.prompt_tokens/completion_tokens/total_tokens: for chat-style models.- Cache fields (
cache_read_input_tokens,cache_creation_input_tokens): when prompt caching applies.
POST /v1/decisions uses its own shape: input_tokens, output_tokens (always 0), and input_tokens_details by modality, without cost_usd. See Decisions API.
Models with tiered, per-call, or variant pricing stamp extra fields on usage so you can see which rate was applied:
- Tier / variant pricing. A tier discriminator appears on
usagewhen the same dimension has more than one rate. The primary field ispricing_tier_label(human-readable, e.g."Medium context"/"Pro"/"2K"). Some models stamp the raw dimension directly instead (resolution,quality,mode,rate_tier). The dashboard renders the badge from whichever is present. - Per-call pricing. Models that bill per tool invocation (search, fetch, code execution, etc.) report counts under
tool_calls_details.<tool>.invocationortool_usage.<tool>. The dashboard expands these into a per-tool breakdown automatically. - Per-dimension pricing. Models that bill multiple dimensions in one request (e.g. citation tokens + reasoning tokens + search queries on deep-research models) report each dimension as its own field (
citation_tokens,reasoning_tokens,num_search_queries, etc.).
The same fields drive the tier badge and per-tool breakdown on the dashboard usage logs, and they are also returned by the GET /v1/account/usage history endpoint under each event’s metadata.worker_usage, plus a structured top-level tool_breakdown array on events from per-call models. So whether you read live response usage, account-usage history, or your dashboard, the tier and billing breakdown match exactly. See Account Usage API for the full response shape, including the account balance, per-product spend, and page-level cache_hit_rate.
File URLs
EmpirioLabs does not host user uploads. Pass any public URL directly on the input field of the model endpoint:
For audio transcription specifically, the multipart-direct upload on /v1/audio/transcriptions is the supported path for private clips that aren’t on a URL; those bytes flow straight to the speech-to-text model service without persistent storage.
Generated output URLs are signed and expire 7 days after creation. There is no re-sign endpoint. Save anything you need to keep (both the URL and the binary) within that window.
Async jobs
GET /v1/jobs/<job-id> polls the status / final result of any async generation or transcription job. GET /v1/jobs lists your last 100 jobs, filterable by status (processing, completed, failed, or cancelled). Job ids are UUIDs.
Job state is retained for 1 hour after completion.
created_at and completed_at are Unix timestamps in seconds. completed_at appears once the job has finished.
When status is completed, the result field carries the full response in the same shape the synchronous endpoint would have returned.
A request stays open for up to 15 minutes. Requests that return audio or a text file must finish within 5 minutes. Longer generation work runs as an async job: poll it with GET /v1/jobs/<job-id>. A longer text response runs over WebSocket mode.
Models
GET /v1/models lists every available model.
GET /v1/models/<model-id> returns the full schema for one model, including its parameter table.
Both are public: a request without an API key is answered, and a request that sends a key that does not verify returns 401.
Each model returns:
GET /v1/models/<model-id> also returns default_params, the default of every parameter that has one.
disable_formatting flag
Many chat, search, research, and rerank endpoints accept a disable_formatting=true flag. When set on a supporting model, the answer comes back without EmpirioLabs formatting, such as the Sources list that web search adds, citation links, a References block, or reasoning Markdown.
Coverage is per model: a model honors the flag when disable_formatting is in its supported_parameters on GET /v1/models/{id}, and the parameter’s description on the model page says exactly what it changes for that model.
Image, video, audio-generation, transcription, and embedding endpoints do not accept this flag, since there is no formatting layer to disable on those endpoints.
Generated media retention
Generated images, videos, and audio are returned as signed URLs that are valid for 7 days. After that, the URL stops working and the asset is gone; there is no re-sign endpoint. Save anything you want to keep before the 7-day window expires.
Errors
Every OpenAI-compatible endpoint answers an error with the OpenAI envelope. param and code are null when they do not apply, and request_id matches the x-request-id header:
/v1/messages and /v1/messages/count_tokens answer with the Anthropic envelope:
The /v1beta Gemini endpoints answer with the Google envelope, where code is the HTTP status:
See Errors and Status Codes for what each status means and when to retry.
Headers reference
Browse the per-model parameter schemas under Authors and Models. When you click into a specific model, every parameter the model accepts (type, default, range, allowed values, conditional flags) is documented in a table generated from the live database.
