# reAPI — Full Documentation & Blog > One API for top AI image, video, chat, and audio models. This file is the complete documentation set and blog in markdown; https://reapi.ai/llms.txt is the link index. Pricing freshness: this document includes dated articles and is a content snapshot. For a model's current prices and discounts, fetch https://reapi.ai/models//llms.txt. Live LLM quotes refresh with a five-minute cache and identify their quote timestamp, official comparison source and reference date. Do not treat historical article prices as current offers. Docs pages: 115 Blog posts: 232 # ai-essay-writer (https://reapi.ai/docs/ai-essay-writer) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > The AI Essay Writer API generates a complete, structured essay from a > **topic** plus an **academic level**, **essay type**, and **length**. One > async call returns a task id; poll until the essay is ready. An optional > `humanized` pass rewrites the result to read more human. Pricing is per > essay, scaled by the length tier — see current rates on the > [model page](https://reapi.ai/models/ai-essay-writer). ## Quick example ```bash curl https://reapi.ai/api/v1/essay \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "ai-essay-writer", "type": "Descriptive", "academic_level": "HighSchool", "length": "Short", "input": "Write an essay about the ketogenic diet" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/essay", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "ai-essay-writer", "type": "Descriptive", "academic_level": "HighSchool", "length": "Short", "input": "Write an essay about the ketogenic diet", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/essay", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "ai-essay-writer", type: "Descriptive", academic_level: "HighSchool", length: "Short", input: "Write an essay about the ketogenic diet", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "ai-essay-writer", "type": "Descriptive", "academic_level": "HighSchool", "length": "Short", "input": "Write an essay about the ketogenic diet", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/essay", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "ai-essay-writer", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload carries the generated essay text in the task output. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/essay GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required `string`. Must be `"ai-essay-writer"`. ### `input` — required `string`. The essay topic or instructions the model builds the essay around. ### `type` — required `string`. The rhetorical mode of the essay. | Value | Notes | | ---------------------- | -------------------------- | | `"Descriptive"` | Descriptive essay | | `"Narrative"` | Narrative essay | | `"Persuasive"` | Persuasive / argumentative | | `"Analytical"` | Analytical essay | | `"CompareAndContrast"` | Compare-and-contrast essay | ### `academic_level` — required `string`. The writing level the essay targets (vocabulary, structure, depth). | Value | | -------------- | | `"HighSchool"` | | `"University"` | | `"Doctorate"` | ### `length` — required `string`. Output length tier. **Pricing scales with this tier.** | Value | | ---------- | | `"Short"` | | `"Medium"` | | `"Long"` | ### `humanized` — boolean, default `false` Run the finished essay through a de-AI pass so it reads more human. ### `model_version` — string, default `"v2"` Generation model version. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. The completed `output` carries the generated essay text. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "ai-essay-writer", "status": "completed", "created_at": 1735000000, "output": { "text": "The ketogenic diet, commonly referred to as the keto diet, is a high-fat, low-carbohydrate eating plan…" }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | --------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.text` is the essay | | `error` | object \| null | Populated on `failed` — `{ code, message }` | *** ## Pricing Per essay, scaled by the `length` tier. Each tier is priced at a fixed estimated output-word count × the per-word rate. **Bill formula** (1 credit = $0.001): ``` credits = ceil(per_word_usd × estimated_words(length) × 1000) ``` `length` (Short / Medium / Long) selects the estimated word count. See the current per-tier rates in the pricing table on the [model page](https://reapi.ai/models/ai-essay-writer). Failed jobs refund automatically. *** ## Validation errors All cases below return HTTP 400. Pattern-match on `code`, not `message`. | Trigger | Code | Message (illustrative) | | ---------------------------------- | ------- | ----------------------------------------------- | | `input` missing | `20002` | `input is required` | | `type` missing / invalid | `20003` | `invalid type` | | `academic_level` missing / invalid | `20003` | `invalid academic_level` | | `length` missing / invalid | `20003` | `invalid length` | | Upstream out of credits | `80003` | Upstream provider could not process the request | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors). *** ## Tips * **Length drives the bill.** A Short essay costs less than a Long one; pick the smallest tier that fits the assignment. * **Set the type and level deliberately.** `academic_level` and `type` change the vocabulary, structure, and depth more than the prompt wording does. * **Use `humanized` for a natural read.** Turn it on when the essay needs to read less like AI; leave it off for the fastest result. * **The topic can be detailed.** `input` accepts full instructions, not just a title — constraints and angles in the topic carry into the essay. *** ## Related * [AI Humanizer](/docs/humanize) * [AI Text Detector](/docs/ai-text-detector) * [Errors catalog](/docs/api/errors) * [Quickstart](/docs/api/quickstart) --- # ai-text-detector (https://reapi.ai/docs/ai-text-detector) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > `ai-text-detector` is a single async endpoint that scores text 0–100 for how likely > it is AI-generated, aggregating several third-party detection engines into one > result plus per-engine sub-scores. See current pricing on the > [model page](https://reapi.ai/models/ai-text-detector). ## Quick example ```bash curl https://reapi.ai/api/v1/detect \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "ai-text-detector", "text": "Citizen science involves the public participating in scientific research. This can take many forms, from collecting data on local wildlife populations to analyzing astronomical images." }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/detect", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "ai-text-detector", "text": "Citizen science involves the public participating in scientific research. This can take many forms, from collecting data on local wildlife populations to analyzing astronomical images.", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/detect", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "ai-text-detector", text: "Citizen science involves the public participating in scientific research. This can take many forms, from collecting data on local wildlife populations to analyzing astronomical images.", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "ai-text-detector", "text": "Citizen science involves the public participating in scientific research. This can take many forms, from collecting data on local wildlife populations to analyzing astronomical images.", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/detect", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "ai-text-detector", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` until `status === "completed"`. A check usually finishes in a few seconds. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/detect GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; polling the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required Always `"ai-text-detector"`. ### `text` — required (string) The text to check for AI authorship. * **Maximum:** under **30,000 words** per request. * **Recommended:** at least \~200 words. Short snippets carry less signal, though the detector still returns a result. * Encode line breaks inside the JSON string as `\n`. *** ## Output ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "ai-text-detector", "status": "completed", "created_at": 1735000000, "output": { "detection": { "result": 12.0, "human": 88.0, "detectors": { "scoreGptZero": 50.0, "scoreOpenAI": 0.0, "scoreWriter": 0.0, "scoreCrossPlag": 0.0, "scoreCopyLeaks": 50.0, "scoreSapling": 0.0, "scoreContentAtScale": 0.0, "scoreZeroGPT": 50.0 } } }, "error": null } ``` ### Interpreting the score `result` is the headline **AI-likelihood**, 0–100: | Range | Reading | | -------- | --------------------- | | under 50 | Likely human-written. | | 50 – 60 | Possible AI. | | over 60 | Likely AI-generated. | `human` is the complementary human-likelihood. `detectors` carries each third-party engine's sub-score so you can see whether the engines agree or split. The headline `result` is the most accurate signal; treat the sub-scores as supporting detail. *** ## Pricing Billed **per word** of the `text` you submit, with a **50-word floor**. AI detection is priced at one-tenth the per-word rate of text humanization. Polling does not add any charge. Failed requests are refunded automatically. `1 credit = $0.001 USD`. See the live banner on the [model page](https://reapi.ai/models/ai-text-detector) for the current per-1,000-words rate in credits. *** ## Errors Standard envelope: ```json { "error": { "code": 20002, "message": "text is required", "request_id": "req_..." } } ``` Common cases: | Code | When | | ------- | -------------------------------------------------------------------------- | | `20002` | `text` missing. | | `20003` | `text` empty or at/over the 30,000-word cap. | | `30001` | Insufficient credits for the submitted word count. | | `80001` | Provider rejected the submission — includes insufficient upstream credits. | | `80003` | Provider failed while processing the detection. | *** ## Related * [AI Humanizer](/docs/humanize) — rewrite AI text to read human. Pair it with `ai-text-detector` for a detect → rewrite → detect QA loop. --- # claude-fable-5-1 (https://reapi.ai/docs/claude-fable-5-1) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Use **`claude-fable-5-1`** with either reAPI endpoint. Native Messages exposes Anthropic's parameter names and response events. Existing OpenAI clients retain Chat Completions and can also send native extensions. Current prices are on the [model page](/models/claude-fable-5-1). | Format | Endpoint | Authentication | | ----------------------- | ----------------------------------------------- | ------------------------------------------ | | Anthropic Messages | `POST https://reapi.ai/api/v1/messages` | `x-api-key: YOUR_REAPI_API_KEY` | | OpenAI Chat Completions | `POST https://reapi.ai/api/v1/chat/completions` | `Authorization: Bearer YOUR_REAPI_API_KEY` | Both use your reAPI key and credit balance. reAPI supplies the default Anthropic protocol version automatically; no version header is required. Set `anthropic-beta` on either endpoint when a feature requires it. No automatic retries are performed. ## Native Messages example ```bash curl --no-buffer https://reapi.ai/api/v1/messages \ -H "x-api-key: YOUR_REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-fable-5-1", "max_tokens": 4096, "system": "Explain your answer clearly and concisely.", "messages": [{"role":"user","content":"Review this design and suggest a minimal verification plan."}], "output_config": {"effort":"high"}, "stream": true }' ``` For the Anthropic SDK, set its base URL to `https://reapi.ai/api` (the SDK appends `/v1/messages`) and use a reAPI API key. Set the SDK's retry count to `0` when you require one attempt per application action. ## Native request parameters The request body is forwarded without a field allowlist or schema rewriting. Model-specific validation is performed by the model. Admission checks the model, request size and output ceiling. | Field | Type | Behavior | | ------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | `model` | string, required | `claude-fable-5-1` | | `messages` | array, required | Native user/assistant content, images, documents, tool results and signed thinking; beta per-turn controls are retained | | `max_tokens` | integer, required | 0–128,000, including thinking. Zero is forwarded for cache warmup; behavior depends on the upstream | | `system` | string or text-block array | Top-level instructions; blocks can carry cache markers | | `stream` | boolean | Defaults to false; true returns native SSE | | `output_config` | object | `effort`, `format` and applicable beta options such as `task_budget` | | `thinking` | object | Adaptive thinking and `display`; optional beta `block_binding` | | `tools` | array | Native definitions, `input_schema`, `strict`, cache controls and server tools | | `tool_choice` | object | Use `auto` or `none`. The official model rejects `any` and a named forced `tool`. `disable_parallel_tool_use` is retained | | `stop_sequences` | string array | Stops when a supplied sequence is matched | | `cache_control` | object or null | Automatic cache marker; `type: "ephemeral"`, optional `ttl: "5m"` or `"1h"` | | `temperature`, `top_p`, `top_k` | number | Forwarded on Messages; these models reject non-default sampling settings | | `metadata` | object | Official request metadata | | `container` | string, object or null | Container reuse and applicable skills | | `diagnostics` | object or null | Includes `previous_message_id`; passed through; upstream determines availability | | `context_management` | object | Beta context edits; nested fields are retained | | `mcp_servers` | array | Beta MCP server definitions; requires model/channel support | | `speed` | string | Beta speed selection; passed through; upstream determines availability | | `fallbacks`, `fallback_credit_token` | official beta shapes | Forwarded unchanged; availability depends on the upstream | | `service_tier`, `inference_geo` | string | Requires route support for the requested option | The official model has a 1,000,000-token context and always-on adaptive thinking. Effort values are `low`, `medium`, `high`, `xhigh`, and `max`; the native default is **high**. Manual thinking budgets and `thinking.type: "disabled"` are not supported by this model. Input images/documents must use public HTTP(S) URLs under reAPI's media policy. ## Structured output Use the native format below. The schema is sent unchanged, including validation constraints; reAPI does not silently remove keywords or invent missing `required` entries. ```json { "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": {"answer": {"type":"string"}}, "required": ["answer"], "additionalProperties": false } } } } ``` On Chat Completions, the equivalent field is `response_format: {"type":"json_schema","json_schema":{"name":"answer","schema": ...}}`. Native `output_config.format` takes precedence when both are provided. The legacy `json_object` option remains accepted but does not enforce a JSON schema; use `json_schema` for structured output. ## OpenAI compatibility mapping | Existing field | Native equivalent | | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `messages` with `system` / `developer` | Top-level `system`; native per-turn system controls remain in `messages` | | `max_tokens`, `max_completion_tokens` | `max_tokens`; the smaller value wins when both are set; omission keeps the existing model ceiling | | `reasoning_effort` | `output_config.effort`; explicit native effort takes precedence | | `stop` | `stop_sequences` | | Function `tools` | Native `tools`, including `strict` and the complete `input_schema` | | `tool_choice`, `parallel_tool_calls` | Native selection and `disable_parallel_tool_use` | | Assistant `tool_calls` / tool replies | `tool_use` / `tool_result` | | `response_format.json_schema` | `output_config.format` | | `web_search_options` | Native web-search tool | | `system`, `thinking`, `cache_control`, `context_management`, native tools and beta fields | Retained as native extensions | The existing compatibility handling of `temperature`, `top_p`, `top_k`, `n`, `seed`, `logprobs`, `frequency_penalty`, and `presence_penalty` is unchanged: they do not control this model. `minimal` maps to low effort; `none` is not a portable way to disable this model's thinking. Prefer an official effort value. ## Existing OpenAI clients ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-fable-5-1", "messages": [ { "role": "user", "content": "Port this module to the new API and keep going until the test suite is green." } ], "reasoning_effort": "high", "max_tokens": 16000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="claude-fable-5-1", messages=[{"role": "user", "content": "Port this module to the new API and keep going until the test suite is green."}], reasoning_effort="high", max_tokens=16000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "claude-fable-5-1", messages: [{ role: "user", content: "Port this module to the new API and keep going until the test suite is green." }], reasoning_effort: "high", max_tokens: 16000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-fable-5-1", "messages": []map[string]string{ {"role": "user", "content": "Port this module to the new API and keep going until the test suite is green."}, }, "reasoning_effort": "high", "max_tokens": 16000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Responses, tool loops and streaming Messages returns the native `message` envelope: `id`, `content[]`, `stop_reason`, `stop_sequence`, `stop_details` when present, and `usage`. Preserve signed `thinking`, `redacted_thinking`, tool blocks and their ordering when sending an assistant turn back. Do not substitute a displayed reasoning summary for the original blocks. Your application executes client tools and supplies their results; the playground does not execute them. Native SSE uses `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`, with `ping` or `error` events as applicable. Thinking signatures and partial tool JSON are retained. There is no `[DONE]` event on Messages. Chat Completions keeps `choices[].message.content`, `tool_calls`, `reasoning_content`, `finish_reason` and SSE ending in `[DONE]`. It adds: * Non-streaming `choices[].message.anthropic_content`: the complete native content array. Send it back as the assistant message's `anthropic_content` to preserve signed state; it takes precedence over duplicated text/tool calls. * Streaming `anthropic_event`: the corresponding complete native event on each chunk. Accumulate these using the Messages event rules to reconstruct content for a subsequent turn. * `anthropic`: native message ID and stop details. A refusal is a valid HTTP 200 response (`stop_reason: "refusal"`, compatible `finish_reason: "content_filter"`), potentially with empty visible text. * `usage.anthropic`: native token/cache/server-tool counters. Compatible prompt totals include uncached input, cache creation and cache reads. Native input/cache counts from `message_start` are retained when later usage contains only cumulative output. ## Capability availability Parameter forwarding and actual model behavior are separate checks. Core native/compatible translation, streaming and billing have local contract tests. This change does **not** certify every optional feature against a live provider. Native Messages parameters, including beta fields and unknown extensions, are forwarded unchanged. reAPI does not reject fields because their behavior has not been verified. The upstream decides whether to accept, ignore or reject them; an HTTP 200 response alone does not demonstrate that a parameter took effect. ## Billing and errors Successful delivery is billed using the recorded per-request cost, including applicable caching/tool charges. Input/output rates are shown on the [model page](/models/claude-fable-5-1). Do not infer a cache discount or feature support from HTTP 200 alone. Missing trusted usage/cost, failed delivery, truncation or cancellation follows the existing no-charge settlement path. | Status | Meaning | | --------- | ------------------------------------------------------------ | | 400 | Invalid request or a model-rejected parameter combination | | 401 / 403 | Authentication or permission failure | | 402 | Balance below the admission threshold | | 413 | Request larger than 32 MB | | 429 | Rate/concurrency limit | | 502 / 503 | Service unavailable, invalid response or pricing unavailable | Messages errors use `{"type":"error","error":{"type":"invalid_request_error","message":"..."},"request_id":"..."}`. Compatibility clients retain their existing error envelope. There is one upstream generation attempt per request and no automatic retry after a failure. ## References Reviewed 2026-10-09: [Messages](https://platform.claude.com/docs/en/api/messages/create), [beta Messages](https://platform.claude.com/docs/en/api/beta/messages/create), [model guidance](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide), [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs), [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming). --- # claude-fable-5 (https://reapi.ai/docs/claude-fable-5) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Use **`claude-fable-5`** with either reAPI endpoint. Native Messages exposes Anthropic's parameter names and response events. Existing OpenAI clients retain Chat Completions and can also send native extensions. Current prices are on the [model page](/models/claude-fable-5). | Format | Endpoint | Authentication | | ----------------------- | ----------------------------------------------- | ------------------------------------------ | | Anthropic Messages | `POST https://reapi.ai/api/v1/messages` | `x-api-key: YOUR_REAPI_API_KEY` | | OpenAI Chat Completions | `POST https://reapi.ai/api/v1/chat/completions` | `Authorization: Bearer YOUR_REAPI_API_KEY` | Both use your reAPI key and credit balance. reAPI supplies the default Anthropic protocol version automatically; no version header is required. Set `anthropic-beta` on either endpoint when a feature requires it. No automatic retries are performed. ## Native Messages example ```bash curl --no-buffer https://reapi.ai/api/v1/messages \ -H "x-api-key: YOUR_REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-fable-5", "max_tokens": 4096, "system": "Explain your answer clearly and concisely.", "messages": [{"role":"user","content":"Review this design and suggest a minimal verification plan."}], "output_config": {"effort":"high"}, "stream": true }' ``` For the Anthropic SDK, set its base URL to `https://reapi.ai/api` (the SDK appends `/v1/messages`) and use a reAPI API key. Set the SDK's retry count to `0` when you require one attempt per application action. ## Native request parameters The request body is forwarded without a field allowlist or schema rewriting. Model-specific validation is performed by the model. Admission checks the model, request size and output ceiling. | Field | Type | Behavior | | ------------------------------------ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `model` | string, required | `claude-fable-5` | | `messages` | array, required | Native user/assistant content, images, documents, tool results and signed thinking; beta per-turn controls are retained | | `max_tokens` | integer, required | 0–128,000, including thinking. Zero is forwarded for cache warmup; behavior depends on the upstream | | `system` | string or text-block array | Top-level instructions; blocks can carry cache markers | | `stream` | boolean | Defaults to false; true returns native SSE | | `output_config` | object | `effort`, `format` and applicable beta options such as `task_budget` | | `thinking` | object | Adaptive thinking and `display`; optional beta `block_binding` | | `tools` | array | Native definitions, `input_schema`, `strict`, cache controls and server tools | | `tool_choice` | object | `auto`, `none`, `any`, and a named `tool` are supported by the official model. `disable_parallel_tool_use` is retained | | `stop_sequences` | string array | Stops when a supplied sequence is matched | | `cache_control` | object or null | Automatic cache marker; `type: "ephemeral"`, optional `ttl: "5m"` or `"1h"` | | `temperature`, `top_p`, `top_k` | number | Forwarded on Messages; these models reject non-default sampling settings | | `metadata` | object | Official request metadata | | `container` | string, object or null | Container reuse and applicable skills | | `diagnostics` | object or null | Includes `previous_message_id`; passed through; upstream determines availability | | `context_management` | object | Beta context edits; nested fields are retained | | `mcp_servers` | array | Beta MCP server definitions; requires model/channel support | | `speed` | string | Beta speed selection; passed through; upstream determines availability | | `fallbacks`, `fallback_credit_token` | official beta shapes | Forwarded unchanged; availability depends on the upstream | | `service_tier`, `inference_geo` | string | Requires route support for the requested option | The official model has a 1,000,000-token context and always-on adaptive thinking. Effort values are `low`, `medium`, `high`, `xhigh`, and `max`; the native default is **high**. Manual thinking budgets and `thinking.type: "disabled"` are not supported by this model. Input images/documents must use public HTTP(S) URLs under reAPI's media policy. ## Structured output Use the native format below. The schema is sent unchanged, including validation constraints; reAPI does not silently remove keywords or invent missing `required` entries. ```json { "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": {"answer": {"type":"string"}}, "required": ["answer"], "additionalProperties": false } } } } ``` On Chat Completions, the equivalent field is `response_format: {"type":"json_schema","json_schema":{"name":"answer","schema": ...}}`. Native `output_config.format` takes precedence when both are provided. The legacy `json_object` option remains accepted but does not enforce a JSON schema; use `json_schema` for structured output. ## OpenAI compatibility mapping | Existing field | Native equivalent | | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `messages` with `system` / `developer` | Top-level `system`; native per-turn system controls remain in `messages` | | `max_tokens`, `max_completion_tokens` | `max_tokens`; the smaller value wins when both are set; omission keeps the existing model ceiling | | `reasoning_effort` | `output_config.effort`; explicit native effort takes precedence | | `stop` | `stop_sequences` | | Function `tools` | Native `tools`, including `strict` and the complete `input_schema` | | `tool_choice`, `parallel_tool_calls` | Native selection and `disable_parallel_tool_use` | | Assistant `tool_calls` / tool replies | `tool_use` / `tool_result` | | `response_format.json_schema` | `output_config.format` | | `web_search_options` | Native web-search tool | | `system`, `thinking`, `cache_control`, `context_management`, native tools and beta fields | Retained as native extensions | The existing compatibility handling of `temperature`, `top_p`, `top_k`, `n`, `seed`, `logprobs`, `frequency_penalty`, and `presence_penalty` is unchanged: they do not control this model. `minimal` maps to low effort; `none` is not a portable way to disable this model's thinking. Prefer an official effort value. ## Existing OpenAI clients ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-fable-5", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="claude-fable-5", messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "claude-fable-5", messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-fable-5", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Responses, tool loops and streaming Messages returns the native `message` envelope: `id`, `content[]`, `stop_reason`, `stop_sequence`, `stop_details` when present, and `usage`. Preserve signed `thinking`, `redacted_thinking`, tool blocks and their ordering when sending an assistant turn back. Do not substitute a displayed reasoning summary for the original blocks. Your application executes client tools and supplies their results; the playground does not execute them. Native SSE uses `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`, with `ping` or `error` events as applicable. Thinking signatures and partial tool JSON are retained. There is no `[DONE]` event on Messages. Chat Completions keeps `choices[].message.content`, `tool_calls`, `reasoning_content`, `finish_reason` and SSE ending in `[DONE]`. It adds: * Non-streaming `choices[].message.anthropic_content`: the complete native content array. Send it back as the assistant message's `anthropic_content` to preserve signed state; it takes precedence over duplicated text/tool calls. * Streaming `anthropic_event`: the corresponding complete native event on each chunk. Accumulate these using the Messages event rules to reconstruct content for a subsequent turn. * `anthropic`: native message ID and stop details. A refusal is a valid HTTP 200 response (`stop_reason: "refusal"`, compatible `finish_reason: "content_filter"`), potentially with empty visible text. * `usage.anthropic`: native token/cache/server-tool counters. Compatible prompt totals include uncached input, cache creation and cache reads. Native input/cache counts from `message_start` are retained when later usage contains only cumulative output. ## Capability availability Parameter forwarding and actual model behavior are separate checks. Core native/compatible translation, streaming and billing have local contract tests. This change does **not** certify every optional feature against a live provider. Native Messages parameters, including beta fields and unknown extensions, are forwarded unchanged. reAPI does not reject fields because their behavior has not been verified. The upstream decides whether to accept, ignore or reject them; an HTTP 200 response alone does not demonstrate that a parameter took effect. ## Billing and errors Successful delivery is billed using the recorded per-request cost, including applicable caching/tool charges. Input/output rates are shown on the [model page](/models/claude-fable-5). Do not infer a cache discount or feature support from HTTP 200 alone. Missing trusted usage/cost, failed delivery, truncation or cancellation follows the existing no-charge settlement path. | Status | Meaning | | --------- | ------------------------------------------------------------ | | 400 | Invalid request or a model-rejected parameter combination | | 401 / 403 | Authentication or permission failure | | 402 | Balance below the admission threshold | | 413 | Request larger than 32 MB | | 429 | Rate/concurrency limit | | 502 / 503 | Service unavailable, invalid response or pricing unavailable | Messages errors use `{"type":"error","error":{"type":"invalid_request_error","message":"..."},"request_id":"..."}`. Compatibility clients retain their existing error envelope. There is one upstream generation attempt per request and no automatic retry after a failure. ## References Reviewed 2026-10-09: [Messages](https://platform.claude.com/docs/en/api/messages/create), [beta Messages](https://platform.claude.com/docs/en/api/beta/messages/create), [model guidance](https://platform.claude.com/docs/en/models/fable-5/overview), [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs), [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming). --- # claude-haiku-5-5 (https://reapi.ai/docs/claude-haiku-5-5) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Call **Claude Haiku 5.5** with the native Messages format; see the [model page](/models/claude-haiku-5-5) for current pricing. ## Quick example ```bash curl --no-buffer https://reapi.ai/api/v1/messages \ -H "x-api-key: YOUR_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{"model":"claude-haiku-5-5","max_tokens":4096,"messages":[{"role":"user","content":"Explain the next step clearly."}],"output_config":{"effort":"medium"},"stream":true}' ``` ```python import json import urllib.request payload = { "model": "claude-haiku-5-5", "max_tokens": 4096, "messages": [{"role": "user", "content": "Explain the next step clearly."}], "output_config": {"effort": "medium"}, } request = urllib.request.Request( "https://reapi.ai/api/v1/messages", data=json.dumps(payload).encode(), headers={"x-api-key": "YOUR_API_KEY", "anthropic-version": "2023-06-01", "Content-Type": "application/json"}, method="POST", ) with urllib.request.urlopen(request, timeout=120) as response: message = json.load(response) print(json.dumps(message, indent=2)) ``` ```js const response = await fetch("https://reapi.ai/api/v1/messages", { method: "POST", headers: { "x-api-key": "YOUR_API_KEY", "anthropic-version": "2023-06-01", "Content-Type": "application/json", }, body: JSON.stringify({ model: "claude-haiku-5-5", max_tokens: 4096, messages: [{ role: "user", content: "Explain the next step clearly." }], output_config: { effort: "medium" }, }), }); const body = await response.json(); if (!response.ok) throw new Error(JSON.stringify(body)); console.log(body); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "time" ) func main() { body, err := json.Marshal(map[string]any{ "model": "claude-haiku-5-5", "max_tokens": 4096, "messages": []map[string]string{{"role": "user", "content": "Explain the next step clearly."}}, "output_config": map[string]string{"effort": "medium"}, }) if err != nil { panic(err) } req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/messages", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("x-api-key", "YOUR_API_KEY") req.Header.Set("anthropic-version", "2023-06-01") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 120 * time.Second} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(out)) } fmt.Println(string(out)) } ``` ## Endpoint and headers `POST https://reapi.ai/api/v1/messages` | Header | Requirement | | ------------------- | --------------------------------------------------------------------------------- | | `x-api-key` | Your reAPI key; required unless using the existing Bearer authentication option | | `Content-Type` | `application/json` | | `anthropic-version` | Optional; defaults to `2023-06-01` | | `anthropic-beta` | Optional; forward the exact feature header required by the official documentation | For an Anthropic SDK, use `https://reapi.ai/api` as the base URL; the SDK appends `/v1/messages`. Disable client-side automatic retries when one attempt per action is required. reAPI makes one upstream generation attempt and does not retry automatically. ## Parameters Native Messages fields and unknown extensions pass through unchanged. There is no field allowlist or parameter-count restriction. The upstream determines acceptance and behavior; HTTP 200 alone does not establish that a parameter took effect. Existing authentication, request-size, and billing admission checks still apply. | Field | Type / required | Default and behavior | | ------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string; required | `claude-haiku-5-5` | | `messages` | non-empty array; required | Native conversation content, including tool results and signed thinking blocks | | `max_tokens` | integer; required | 0–128,000 including thinking; zero is forwarded for cache warmup | | `system` | string or text-block array; optional | Top-level instructions; blocks may include cache controls | | `stream` | boolean; optional | `false`; `true` returns native SSE | | `output_config` | object; optional | Effort defaults to `medium`; `low`, `medium`, `high`, `xhigh`, `max`; `format` selects structured JSON; beta extensions remain intact | | `thinking` | object; optional | Adaptive by default; `display: "summarized"` opts into a summary; `type: "disabled"` is documented at low, medium, or high effort | | `tools` | array; optional | Native definitions with `name`, `input_schema`, optional `strict`, and other official fields | | `tool_choice` | object; optional | See the model-specific thinking and tool guidance below | | `stop_sequences` | string array; optional | Stop generation on a matched sequence | | `cache_control` | object or null; optional | `type: "ephemeral"`; TTL `5m` or `1h`; minimum cacheable prefix is 512 tokens | | `temperature`, `top_p`, `top_k` | number; optional | Forwarded; omit sampling settings in new integrations with this model | | `metadata` | object; optional | Request metadata | | `container` | string, object, or null; optional | Applicable container reuse and skill settings | | `context_management` | object or null; optional | Context edits; nested options are preserved | | `compaction` | object or null; optional | Official on-demand compaction uses `type: "summarize"` and the `compact-2026-09-04` beta header; the current probe returned ordinary text, without a signed compaction block | | `output_format` | object or null; optional | Legacy beta field; prefer current `output_config.format` for new integrations | | `mcp_servers` | array; optional | Official MCP definitions and required beta headers; service availability depends on the upstream | | `diagnostics` | object or null; optional | Includes `previous_message_id`; passed through | | `service_tier` | string; optional | Official selection such as `auto` or `standard_only`; availability depends on the model | | `inference_geo` | string or null; optional | Requested inference location; passed through | | `speed` | string or null; optional | Passed through; fast mode is not documented for Claude Haiku 5.5 | | `fallbacks` | string, array, or null; optional | Official beta options are retained; not behavior-tested here | | `fallback_credit_token` | string, object, or null; optional | Retained unchanged; not behavior-tested here | Per-message controls such as `output_config` and `clear_at`, and nested beta thinking options, also pass through. Send the appropriate beta header when required by the official documentation. Inputs with image or PDF content must use public HTTP(S) URLs under reAPI's media policy; base64 and data URIs are not accepted. Plain-text document blocks can contain inline text. ### Thinking and tools Claude Haiku 5.5 defaults to **medium** effort and adaptive thinking. `max_tokens` includes thinking, so leave enough allowance for the final answer. Preserve the original assistant content array when sending a tool result back, including signatures and block ordering. Haiku supports `thinking: {"type":"disabled"}` at low, medium, or high effort. It also supports `tool_choice: {"type":"any"}` and a named `{"type":"tool","name":"..."}`. Forced selection does not produce an initial thinking block. ### Structured JSON ```json { "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": {"answer": {"type": "string"}}, "required": ["answer"], "additionalProperties": false } } } } ``` Send the complete schema; reAPI does not remove constraints or create missing required fields. Document citations and structured JSON are separate features and cannot be combined in the same request under the official contract. ### Observed capabilities Small synthetic probes on October 9, 2026 established the following behavior. They are not a throughput benchmark or a maximum-context test. | Feature | Observation | | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Text and system instructions | Correct response to the synthetic marker and system override | | Native streaming | Native message/content events and cumulative output usage observed | | Structured JSON | Output matched the requested schema even when the prompt requested plain text | | Strict client tools | Tool name and schema-shaped input observed; the next response used the supplied tool result | | Stop sequences | Matched stop reason; output after the marker was absent | | Prompt caching | Nonzero cache-creation usage, then nonzero cache-read usage on repeated input | | Document citations | Text-document answer contained a citation block | | Effort levels | All five official values accepted; relative reasoning depth was not measured | | Thinking mode | Model-specific mode accepted with no thinking block in that response; internal computation was not measured | | URL images | Single-image and two-image requests returned 400 on the tested provider path; image interpretation was not reached | | PDF | Not yet verified with a permitted PDF fixture; the text-document citation test does not establish PDF support | | Web search | Basic `web_search_20250305` returned an actual search call, matching results and a citation | | Web fetch | Basic `web_fetch_20250910` returned 400 on the tested provider path | | Code execution | `code_execution_20260521` returned 400 before execution | | MCP | Both tested official MCP beta versions returned 400; the reachable synthetic server received no provider tool-discovery or tool-call callback | | On-demand compaction | Request accepted with 200, but returned `end_turn` and no signed compaction block; effect unproven | | Signed thinking | A signed block and unchanged-history replay were observed with empty transformation diagnostics. Edited-prefix controls returned explicit drop records, including when `error` was requested; strict error behavior is not established | These are dated observations of the tested path, not universal model limitations. An in-response tool error is distinct from HTTP transport success. Requests and extension fields still pass through; these observations do not introduce a local capability gate. Other settings, including legacy thinking, sampling, and assistant prefill, were recorded as upstream response observations. Acceptance does not certify their effect and is not a reason for local parameter rejection. ## Pricing dimensions and billing Input, output, cache use, and applicable server tools can affect cost. Thinking counts toward output usage. See the [model page](/models/claude-haiku-5-5) for current rates; the response's native `usage` reports token categories separately. For this endpoint, settlement uses the trusted per-request USD cost with the model's configured multiplier: `billed_usd = reported_request_cost_usd × multiplier`. It is token-based LLM billing, not an asynchronous image/video credit estimate. Failed delivery or missing trusted usage/cost follows the existing no-charge settlement path. ## Output and streaming A non-streaming response has the native shape below; values are illustrative. ```json { "id": "msg_example", "type": "message", "role": "assistant", "model": "claude-haiku-5-5", "content": [{"type": "text", "text": "The next step is to verify the input."}], "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 20, "output_tokens": 12, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0 } } ``` Native SSE uses `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, and `message_stop`. Handle `ping` and `error` events too. Thinking signatures and partial tool JSON remain in their native events; Messages does not end with `[DONE]`. A tool loop sends the previous full `content` as an assistant message and the matching `tool_result` as a user content block. Your application executes client tools; the playground does not execute them. Inspect `stop_reason` for incomplete answers, tool calls, and refusals even when HTTP status is 200. ## Existing Chat Completions clients `POST https://reapi.ai/api/v1/chat/completions` remains available with Bearer authentication. It maps `reasoning_effort` to `output_config.effort`, function tools to native definitions, `stop` to `stop_sequences`, and JSON schemas to `output_config.format`. Explicit native options take precedence. Use Messages for the official native request and response format. The compatibility response retains `choices`, tool calls, and `[DONE]` streaming. Full native assistant content is available as `choices[].message.anthropic_content`; send it back unchanged as the assistant's `anthropic_content`. Streams carry `anthropic_event` so clients can reconstruct the original content blocks. Existing compatibility handling of OpenAI-only fields remains unchanged. ## Errors | Status | Meaning | | --------- | ------------------------------------------------------------- | | 400 | Invalid request or an upstream-rejected parameter combination | | 401 / 403 | Authentication or permission failure | | 402 | Balance below admission requirements | | 413 | Request body larger than 32 MiB | | 429 | Rate or concurrency limit | | 502 / 503 | Service, pricing, or response delivery unavailable | Messages errors use `{"type":"error","error":{"type":"invalid_request_error","message":"..."},"request_id":"..."}`. See the [error catalog](/docs/api/errors). Unknown parameters do not trigger a local whitelist error. ## Tips * Start with one task whose result you can check, then add context or tool steps. * Use `output_config.format` for schema-constrained JSON and explicit document citations for source-based answers. * Keep conversation content intact across tool turns; a displayed summary is not a replacement for signed blocks. * Use documented model controls as a starting point and evaluate effects on your own workload. ## Related * [Haiku 5.5 documentation](/docs/claude-haiku-5-5) * [Sonnet 5.5 documentation](/docs/claude-sonnet-5-5) * [Opus 5.5 documentation](/docs/claude-opus-5-5) * [Haiku 5.5 vs Sonnet 5.5](/blog/claude-haiku-5-5-vs-sonnet-5-5) Official references, checked October 9, 2026: [Messages](https://platform.claude.com/docs/en/api/messages/create), [model overview](https://platform.claude.com/docs/en/models/haiku-5-5/overview), [migration guidance](https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide), [structured output](https://platform.claude.com/docs/en/build-with-claude/structured-outputs), [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching). --- # claude-opus-4-7 (https://reapi.ai/docs/claude-opus-4-7) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; This page documents the legacy `api.reapi.ai` workspace and its own API keys. `claude-opus-4-7` is not currently registered on the unified `reapi.ai/api/v1/chat/completions` or `reapi.ai/api/v1/messages` endpoints. Do not substitute a unified reAPI key or assume the newer Claude route's parameters and discounts apply here. For the unified service, see [Claude Opus 5.5](/docs/claude-opus-5-5), [Claude Fable 5](/docs/claude-fable-5), or [Claude Fable 5.1](/docs/claude-fable-5-1). > Claude Opus 4.7 is Anthropic's flagship model, exposed through > api.reapi.ai as a drop-in OpenAI-compatible Chat Completions endpoint > (the native Anthropic `/v1/messages` surface is also available). 1M > token context, 128K max output, vision input, prompt caching, and > tool use. Current rates live on the > [model page](https://reapi.ai/models/claude-opus-4-7) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-4-7", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096, "temperature": 0.7 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="claude-opus-4-7", messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, temperature=0.7, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```python from anthropic import Anthropic client = Anthropic( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai", ) with client.messages.stream( model="claude-opus-4-7", max_tokens=4096, messages=[{"role": "user", "content": "Hello"}], ) as stream: for text in stream.text_stream: print(text, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "claude-opus-4-7", messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, temperature: 0.7, // `group` is an api.reapi.ai-specific extension; pass via extra body. // @ts-expect-error — not part of the OpenAI types }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-opus-4-7", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, "temperature": 0.7, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request needs a Bearer token. The Claude Opus 4.7 chat workspace lives on the `api.reapi.ai` platform — sign in there to create a key and top up tokens. 1. Open [api.reapi.ai](https://api.reapi.ai/) and sign in (or create an account). 2. Generate an API key under **API Keys**. 3. Top up tokens under **Top Up** (pay-as-you-go, billed in USD per 1M tokens — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing)). ```http Authorization: Bearer YOUR_API_KEY ``` The chat surface (api.reapi.ai) is a **separate workspace** from the image/video/audio task gateway at `reapi.ai/api/v1/*`. Keys and balances do not cross over — a key issued on `reapi.ai/settings/apikeys` will not authenticate against `api.reapi.ai/v1/chat/completions`, and vice versa. *** ## Endpoints ```http POST https://api.reapi.ai/v1/chat/completions # OpenAI-compatible POST https://api.reapi.ai/v1/messages # Anthropic-native ``` Both surfaces accept `claude-opus-4-7`. Pick whichever matches your SDK of record: * **`/v1/chat/completions`** — drop-in for the OpenAI SDKs. Same request shape, same SSE wire format. Set `base_url` to `https://api.reapi.ai/v1`. * **`/v1/messages`** — native Anthropic Messages format. Set `base_url` to `https://api.reapi.ai` for the Anthropic Python / TypeScript SDKs. Required for callers that need Anthropic-specific features (`cache_control` blocks for prompt caching, native multi-block content, the full tool-use spec). *** ## Request body — `/v1/chat/completions` ### `model` — string, required Must be `"claude-opus-4-7"`. The value is echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec, plus content-parts for vision: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string OR content-parts array (text + image_url parts)" } ``` Multi-turn history is sent in chronological order — the last message is the one Claude responds to. ### `max_tokens` — integer, default `4096` Upper bound on output tokens. **Anthropic's API requires `max_tokens` on every call, including streamed ones** — even though the OpenAI SDKs treat it as optional. Set it generously (`128000` is the hard cap) for long-form outputs; the model still stops at the natural end of its response. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. ### `temperature` — number, default `1` Range `0.0` – `1.0`. Sampling temperature. Anthropic recommends **either** `temperature` or `top_p`, not both. Lower values produce more deterministic output. ### `top_p` — number, default `1` Range `0.0` – `1.0`. Nucleus sampling cutoff. ### `tools` / `tool_choice` — optional Standard OpenAI tool-calling parameters. Claude Opus 4.7 supports the full OpenAI tool-use spec via this surface; for Anthropic's native tool-use schema (with `cache_control`, `tool_choice_type`, etc.) call `/v1/messages` directly. ### Routing Routing follows the API key configured in the legacy workspace. No `group` request parameter is required. *** ## Vision input (multimodal) Send images alongside text via OpenAI content-parts: ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What does this chart show?" }, { "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } } ] } ] } ``` Supported image formats: PNG, JPEG, GIF, WebP. Base64 URLs work too — prefix `data:image/png;base64,...`. Each image counts toward the input token budget based on its resolution. *** ## Prompt caching Anthropic's prompt caching pays off on stable system prompts, recurring RAG context, and long multi-turn agent histories. The first call pays the cache-write rate on the cacheable region; subsequent calls within the cache window pay only the (much lower) cache-read rate on those tokens. To enable caching, call `/v1/messages` natively and add a `cache_control` block. Example: ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "system": [ { "type": "text", "text": "", "cache_control": { "type": "ephemeral" } } ], "messages": [ { "role": "user", "content": "Question for the assistant" } ] } ``` The cache key is the hash of the cacheable content; the cache TTL is 5 minutes (default ephemeral) or 1 hour (extended ephemeral) depending on how the cache\_control block is configured. See [api.reapi.ai/pricing](https://api.reapi.ai/pricing) for cache-read and cache-write rates. *** ## Response shape — `/v1/chat/completions` ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "claude-opus-4-7", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21, "prompt_tokens_details": { "cached_tokens": 0 } } } ``` `usage.prompt_tokens_details.cached_tokens` reports how many input tokens were served from cache — the part billed at the cache-read rate rather than the standard input rate. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta in the OpenAI chunk format; the final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). *** ## Pricing Claude Opus 4.7 is billed **pay-as-you-go in USD** against your api.reapi.ai token balance. Current rates (input, output, cache-read, cache-write) live on [api.reapi.ai/pricing](https://api.reapi.ai/pricing) and in the pricing card at the top of the [model page](https://reapi.ai/models/claude-opus-4-7). Per-call bill: ``` billable_input = (prompt_tokens - cached_tokens) × input_rate / 1,000,000 cache_read_bill = cached_tokens × cache_read_rate / 1,000,000 output_bill = completion_tokens × output_rate / 1,000,000 ``` Cache-write rate applies on the first call that writes a cache block; subsequent hits within the cache TTL pay only the cache-read rate. Failed requests are not charged. *** ## Limits | Limit | Value | | --------------------- | ----------- | | Context window | 1M tokens | | Max output per call | 128K tokens | | Cache TTL (ephemeral) | 5 minutes | | Cache TTL (extended) | 1 hour | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | ------------------------------------- | ----------------------------------------------------------------------- | | `400` | Missing `max_tokens`, bad shape, etc. | Anthropic requires `max_tokens`; OpenAI SDKs that omit it will 400 here | | `401` | Missing / invalid API key | Re-issue a key at api.reapi.ai | | `402` | Insufficient balance | Top up at api.reapi.ai | | `429` | Per-group rate limit hit | Back off, or move to a different `group` | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | api.reapi.ai does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that's a one-for-one wire failure and a retry from your side is safe; the upstream provider may have already produced output, but the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "messages": [ { "role": "user", "content": "Summarise this in three sentences." } ] } ``` ### Tool use (function calling, OpenAI surface) ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Vision ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Read the error in this screenshot and suggest a fix." }, { "type": "image_url", "image_url": { "url": "https://your-cdn.com/screenshot.png" } } ] } ] } ``` ### Long context with prompt caching (native Anthropic surface) ```json { "model": "claude-opus-4-7", "max_tokens": 4096, "system": [ { "type": "text", "text": "<800K-token reference document>", "cache_control": { "type": "ephemeral" } } ], "messages": [ { "role": "user", "content": "Find every mention of the constraint X and list them with line numbers." } ] } ``` *** ## When to pick Claude Opus 4.7 Pick Claude Opus 4.7 when **output quality** dominates the decision: * **High-stakes coding and refactors** — architecture, multi-file refactor, migration planning, long-form engineering deliverables. * **Agent workflows that must hold state** — multi-step planning, reliable tool use, long agent runs where context drift kills the workflow. * **Large-context analysis** — full codebases, long research packs, multi-document review, audit work. Route lighter traffic (classification, short replies, tight loops) to cheaper Claude or GPT models on the same key. *** ## Tips * **Set `max_tokens` generously.** Anthropic enforces it strictly — the model still stops at the natural end of its response, but a low cap will truncate before the real ending. * **Stream by default for chat UX.** Streaming cuts perceived latency dramatically. * **Cache the stable parts of long prompts.** A 500K-token RAG context on top of a 1KB user question can pay the cache-read rate on every subsequent call instead of the standard input rate. Big savings on multi-turn agents. * **Tune `temperature` *or* `top_p`, not both.** Mixing them produces results that are hard to reason about. * **Use the native `/v1/messages` surface for Anthropic-only features.** `cache_control`, native multi-block content, full tool-use spec — all of those work through `/v1/messages` without needing translation. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # claude-opus-4-8 (https://reapi.ai/docs/claude-opus-4-8) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Claude Opus 4.8 is Anthropic's most capable model for complex reasoning > and long-horizon agentic coding, exposed through reAPI as a > drop-in OpenAI-compatible Chat Completions endpoint. 1M token context, > 128K max output, vision input, prompt caching, and tool use. Current > rates live on the > [model page](https://reapi.ai/models/claude-opus-4-8). This model uses the unified reAPI key and balance through Chat Completions. No group lookup or group parameter is required. Native `/api/v1/messages` currently serves Opus 5.5, Fable 5 and Fable 5.1; it does not accept `claude-opus-4-8`. Current prices and the discount against official input/output pricing are published on the [model page](/models/claude-opus-4-8) and in its [machine-readable reference](/models/claude-opus-4-8/llms.txt), using a five-minute price cache. ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-4-8", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096, "temperature": 0.7 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, temperature=0.7, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "claude-opus-4-8", messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, temperature: 0.7, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-opus-4-8", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, "temperature": 0.7, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. The model id is `claude-opus-4-8`. *** ## Request body ### `model` — string, required Must be `"claude-opus-4-8"`. The value is echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec, plus content-parts for vision: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string OR content-parts array (text + image_url parts)" } ``` Multi-turn history is sent in chronological order — the last message is the one Claude responds to. ### `max_tokens` — optional integer Upper bound on output tokens, up to `128000`. On this Chat Completions endpoint it is optional; omission uses the registered model ceiling. `4096` in the examples is a sample cap, not the API default. `max_completion_tokens` is also accepted; when both fields are present, the smaller value is used. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. ### `temperature` — number, default `1` Range `0.0` – `1.0`. Sampling temperature. Anthropic recommends **either** `temperature` or `top_p`, not both. Lower values produce more deterministic output. ### `top_p` — number, default `1` Range `0.0` – `1.0`. Nucleus sampling cutoff. ### `tools` / `tool_choice` — optional Standard OpenAI tool-calling parameters. Claude Opus 4.8 supports the full OpenAI tool-use spec via this surface and uses tools more efficiently than prior Opus models — fewer steps for the same result. Anthropic's native tool-use schema (`cache_control`, `tool_choice_type`) is not part of the Chat Completions shape and is not exposed on this endpoint. *** ## Vision input (multimodal) Send images alongside text via OpenAI content-parts: ```json { "model": "claude-opus-4-8", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What does this chart show?" }, { "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } } ] } ] } ``` Supported image formats: PNG, JPEG, GIF, WebP. Base64 URLs work too — prefix `data:image/png;base64,...`. Each image counts toward the input token budget based on its resolution. *** ## Prompt caching Anthropic's prompt caching pays off on stable system prompts, recurring RAG context, and long multi-turn agent histories. The first call pays the cache-write rate on the cacheable region; subsequent calls within the cache window pay only the (much lower) cache-read rate on those tokens. Caching is controlled by `cache_control` blocks on Anthropic's native Messages API, which is not part of the Chat Completions shape on this endpoint. Whether a request is served from cache is decided upstream; each request is charged the exact amount the serving gateway settled it at, so any cache effect is already included in the settled charge. Internal cost fields are not returned in the public response. The current catalogue does not publish a separate cache rate for this model, so no cache discount should be inferred from another model or from Anthropic's own rate card. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "claude-opus-4-8", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21, "prompt_tokens_details": { "cached_tokens": 0 } } } ``` `usage.prompt_tokens_details.cached_tokens` reports how many input tokens were served from cache. This usage count alone does not establish a separate reAPI cache rate. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta in the OpenAI chunk format; the final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). *** ## Pricing Claude Opus 4.8 is billed **pay-as-you-go** from your reAPI credit balance (`1 credit = $0.001`). Current input/output rates and the comparison with official pricing are on the [model page](/models/claude-opus-4-8) and in [llms.txt](/models/claude-opus-4-8/llms.txt). Prices refresh from the live catalogue with a five-minute cache; the displayed discount is already included in those rates. Settlement uses the actual request cost, including any applicable cache effects. Do not calculate a charge using unpublished cache or web-search rates. Failed requests are not charged. *** ## Limits | Limit | Value | | ------------------- | ----------- | | Context window | 1M tokens | | Max output per call | 128K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | ------------------------------------- | ----------------------------------------------------------------------- | | `400` | Missing `max_tokens`, bad shape, etc. | Anthropic requires `max_tokens`; OpenAI SDKs that omit it will 400 here | | `401` | Missing / invalid API key | Create a key under API keys in the reAPI dashboard | | `402` | Insufficient balance | Top up your reAPI credits | | `429` | Rate limit hit | Back off and retry | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | reAPI does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that's a one-for-one wire failure and a retry from your side is safe; the upstream provider may have already produced output, but the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "claude-opus-4-8", "max_tokens": 4096, "messages": [ { "role": "user", "content": "Summarise this in three sentences." } ] } ``` ### Tool use (function calling, OpenAI surface) ```json { "model": "claude-opus-4-8", "max_tokens": 4096, "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Vision ```json { "model": "claude-opus-4-8", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Read the error in this screenshot and suggest a fix." }, { "type": "image_url", "image_url": { "url": "https://your-cdn.com/screenshot.png" } } ] } ] } ``` *** ## When to pick Claude Opus 4.8 Pick Claude Opus 4.8 when **output quality and reliability** dominate the decision: * **Long-horizon agentic coding** — multi-service refactors, codebase-scale migrations, and agent runs that must stay on-task across many steps. * **High-stakes reasoning** — work where a confident-but-wrong answer has real downstream cost. Opus 4.8 is more likely to flag uncertainty than to overclaim. * **Large-context analysis** — full codebases, long research packs, multi-document review, audit work. Route lighter traffic (classification, short replies, tight loops) to cheaper Claude or GPT models on the same key. *** ## Tips * **Set `max_tokens` generously.** Anthropic enforces it strictly — the model still stops at the natural end of its response, but a low cap will truncate before the real ending. * **Stream by default for chat UX.** Streaming cuts perceived latency dramatically. * **Cache the stable parts of long prompts.** A 500K-token RAG context on top of a 1KB user question can pay the cache-read rate on every subsequent call instead of the standard input rate — a big saving on multi-turn agents replaying long histories. * **Tune `temperature` *or* `top_p`, not both.** Mixing them produces results that are hard to reason about. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # claude-opus-5-5 (https://reapi.ai/docs/claude-opus-5-5) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Use **`claude-opus-5-5`** with either reAPI endpoint. Native Messages exposes Anthropic's parameter names and response events. Existing OpenAI clients retain Chat Completions and can also send native extensions. Current prices are on the [model page](/models/claude-opus-5-5). | Format | Endpoint | Authentication | | ----------------------- | ----------------------------------------------- | ------------------------------------------ | | Anthropic Messages | `POST https://reapi.ai/api/v1/messages` | `x-api-key: YOUR_REAPI_API_KEY` | | OpenAI Chat Completions | `POST https://reapi.ai/api/v1/chat/completions` | `Authorization: Bearer YOUR_REAPI_API_KEY` | Both use your reAPI key and credit balance. reAPI supplies the default Anthropic protocol version automatically; no version header is required. Set `anthropic-beta` on either endpoint when a feature requires it. No automatic retries are performed. ## Native Messages example ```bash curl --no-buffer https://reapi.ai/api/v1/messages \ -H "x-api-key: YOUR_REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-5-5", "max_tokens": 4096, "system": "Explain your answer clearly and concisely.", "messages": [{"role":"user","content":"Review this design and suggest a minimal verification plan."}], "output_config": {"effort":"medium"}, "stream": true }' ``` For the Anthropic SDK, set its base URL to `https://reapi.ai/api` (the SDK appends `/v1/messages`) and use a reAPI API key. Set the SDK's retry count to `0` when you require one attempt per application action. ## Native request parameters The request body is forwarded without a field allowlist or schema rewriting. Model-specific validation is performed by the model. Admission checks the model, request size and output ceiling. | Field | Type | Behavior | | ------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | `model` | string, required | `claude-opus-5-5` | | `messages` | array, required | Native user/assistant content, images, documents, tool results and signed thinking; beta per-turn controls are retained | | `max_tokens` | integer, required | 0–128,000, including thinking. Zero is forwarded for cache warmup; behavior depends on the upstream | | `system` | string or text-block array | Top-level instructions; blocks can carry cache markers | | `stream` | boolean | Defaults to false; true returns native SSE | | `output_config` | object | `effort`, `format` and applicable beta options such as `task_budget` | | `thinking` | object | Adaptive thinking and `display`; optional beta `block_binding` | | `tools` | array | Native definitions, `input_schema`, `strict`, cache controls and server tools | | `tool_choice` | object | Use `auto` or `none`. The official model rejects `any` and a named forced `tool`. `disable_parallel_tool_use` is retained | | `stop_sequences` | string array | Stops when a supplied sequence is matched | | `cache_control` | object or null | Automatic cache marker; `type: "ephemeral"`, optional `ttl: "5m"` or `"1h"` | | `temperature`, `top_p`, `top_k` | number | Forwarded on Messages; these models reject non-default sampling settings | | `metadata` | object | Official request metadata | | `container` | string, object or null | Container reuse and applicable skills | | `diagnostics` | object or null | Includes `previous_message_id`; passed through; upstream determines availability | | `context_management` | object | Beta context edits; nested fields are retained | | `mcp_servers` | array | Beta MCP server definitions; requires model/channel support | | `speed` | string | Beta speed selection; passed through; upstream determines availability | | `fallbacks`, `fallback_credit_token` | official beta shapes | Forwarded unchanged; availability depends on the upstream | | `service_tier`, `inference_geo` | string | Requires route support for the requested option | The official model has a 1,000,000-token context and always-on adaptive thinking. Effort values are `low`, `medium`, `high`, `xhigh`, and `max`; the native default is **medium**. Manual thinking budgets and `thinking.type: "disabled"` are not supported by this model. Input images/documents must use public HTTP(S) URLs under reAPI's media policy. ## Structured output Use the native format below. The schema is sent unchanged, including validation constraints; reAPI does not silently remove keywords or invent missing `required` entries. ```json { "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": {"answer": {"type":"string"}}, "required": ["answer"], "additionalProperties": false } } } } ``` On Chat Completions, the equivalent field is `response_format: {"type":"json_schema","json_schema":{"name":"answer","schema": ...}}`. Native `output_config.format` takes precedence when both are provided. The legacy `json_object` option remains accepted but does not enforce a JSON schema; use `json_schema` for structured output. ## OpenAI compatibility mapping | Existing field | Native equivalent | | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `messages` with `system` / `developer` | Top-level `system`; native per-turn system controls remain in `messages` | | `max_tokens`, `max_completion_tokens` | `max_tokens`; the smaller value wins when both are set; omission keeps the existing model ceiling | | `reasoning_effort` | `output_config.effort`; explicit native effort takes precedence | | `stop` | `stop_sequences` | | Function `tools` | Native `tools`, including `strict` and the complete `input_schema` | | `tool_choice`, `parallel_tool_calls` | Native selection and `disable_parallel_tool_use` | | Assistant `tool_calls` / tool replies | `tool_use` / `tool_result` | | `response_format.json_schema` | `output_config.format` | | `web_search_options` | Native web-search tool | | `system`, `thinking`, `cache_control`, `context_management`, native tools and beta fields | Retained as native extensions | The existing compatibility handling of `temperature`, `top_p`, `top_k`, `n`, `seed`, `logprobs`, `frequency_penalty`, and `presence_penalty` is unchanged: they do not control this model. `minimal` maps to low effort; `none` is not a portable way to disable this model's thinking. Prefer an official effort value. ## Existing OpenAI clients ```bash curl --no-buffer https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-5-5", "messages": [ { "role": "user", "content": "Review this module and suggest a minimal fix with a verification plan." } ], "reasoning_effort": "medium", "max_tokens": 4096, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="claude-opus-5-5", messages=[{"role": "user", "content": "Review this module and suggest a minimal fix with a verification plan."}], reasoning_effort="medium", max_tokens=4096, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "claude-opus-5-5", messages: [{ role: "user", content: "Review this module and suggest a minimal fix with a verification plan." }], reasoning_effort: "medium", max_tokens: 4096, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-opus-5-5", "messages": []map[string]string{ {"role": "user", "content": "Review this module and suggest a minimal fix with a verification plan."}, }, "reasoning_effort": "medium", "max_tokens": 4096, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Responses, tool loops and streaming Messages returns the native `message` envelope: `id`, `content[]`, `stop_reason`, `stop_sequence`, `stop_details` when present, and `usage`. Preserve signed `thinking`, `redacted_thinking`, tool blocks and their ordering when sending an assistant turn back. Do not substitute a displayed reasoning summary for the original blocks. Your application executes client tools and supplies their results; the playground does not execute them. Native SSE uses `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`, with `ping` or `error` events as applicable. Thinking signatures and partial tool JSON are retained. There is no `[DONE]` event on Messages. Chat Completions keeps `choices[].message.content`, `tool_calls`, `reasoning_content`, `finish_reason` and SSE ending in `[DONE]`. It adds: * Non-streaming `choices[].message.anthropic_content`: the complete native content array. Send it back as the assistant message's `anthropic_content` to preserve signed state; it takes precedence over duplicated text/tool calls. * Streaming `anthropic_event`: the corresponding complete native event on each chunk. Accumulate these using the Messages event rules to reconstruct content for a subsequent turn. * `anthropic`: native message ID and stop details. A refusal is a valid HTTP 200 response (`stop_reason: "refusal"`, compatible `finish_reason: "content_filter"`), potentially with empty visible text. * `usage.anthropic`: native token/cache/server-tool counters. Compatible prompt totals include uncached input, cache creation and cache reads. Native input/cache counts from `message_start` are retained when later usage contains only cumulative output. ## Capability availability Parameter forwarding and actual model behavior are separate checks. Core native/compatible translation, streaming and billing have local contract tests. This change does **not** certify every optional feature against a live provider. Native Messages parameters, including beta fields and unknown extensions, are forwarded unchanged. reAPI does not reject fields because their behavior has not been verified. The upstream decides whether to accept, ignore or reject them; an HTTP 200 response alone does not demonstrate that a parameter took effect. ## Billing and errors Successful delivery is billed using the recorded per-request cost, including applicable caching/tool charges. Input/output rates are shown on the [model page](/models/claude-opus-5-5). Do not infer a cache discount or feature support from HTTP 200 alone. Missing trusted usage/cost, failed delivery, truncation or cancellation follows the existing no-charge settlement path. | Status | Meaning | | --------- | ------------------------------------------------------------ | | 400 | Invalid request or a model-rejected parameter combination | | 401 / 403 | Authentication or permission failure | | 402 | Balance below the admission threshold | | 413 | Request larger than 32 MB | | 429 | Rate/concurrency limit | | 502 / 503 | Service unavailable, invalid response or pricing unavailable | Messages errors use `{"type":"error","error":{"type":"invalid_request_error","message":"..."},"request_id":"..."}`. Compatibility clients retain their existing error envelope. There is one upstream generation attempt per request and no automatic retry after a failure. ## References Reviewed 2026-10-09: [Messages](https://platform.claude.com/docs/en/api/messages/create), [beta Messages](https://platform.claude.com/docs/en/api/beta/messages/create), [model guidance](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide), [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs), [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming). --- # claude-opus-5 (https://reapi.ai/docs/claude-opus-5) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; This page documents the legacy `api.reapi.ai` workspace and its own API keys. `claude-opus-5` is not currently registered on the unified `reapi.ai/api/v1/chat/completions` or `reapi.ai/api/v1/messages` endpoints. Do not substitute a unified reAPI key or assume the newer Claude route's parameters and discounts apply here. For the unified service, see [Claude Opus 5.5](/docs/claude-opus-5-5), [Claude Fable 5](/docs/claude-fable-5), or [Claude Fable 5.1](/docs/claude-fable-5-1). > Anthropic's Claude Opus 5 — "for complex agentic coding and enterprise work" — > exposed through api.reapi.ai as a drop-in OpenAI-compatible Chat Completions > endpoint. A **1M-token** context window, **128k** max output, **adaptive > thinking on by default**, an effort dial from `low` through `max`, plus tool > use, structured outputs, code execution, vision and PDF input. The wire `model` > id is `claude-opus-5` — Anthropic's alias carries no date suffix. Current rates > live on the [model page](https://reapi.ai/models/claude-opus-5) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-5", "messages": [ { "role": "user", "content": "Refactor this module and add tests." } ], "stream": true, "max_tokens": 16000 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="claude-opus-5", messages=[{"role": "user", "content": "Refactor this module and add tests."}], max_tokens=16000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "claude-opus-5", messages: [{ role: "user", content: "Refactor this module and add tests." }], max_tokens: 16000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-opus-5", "messages": []map[string]string{ {"role": "user", "content": "Refactor this module and add tests."}, }, "max_tokens": 16000, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Chat models are served from the `api.reapi.ai` gateway, which has its own console and its own key. Create the key there, then send it as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` The gateway key is **not** the same credential as a media-generation key used against `reapi.ai/api/v1`. Sign in at [api.reapi.ai](https://api.reapi.ai/) to create one. *** ## Endpoint ```http POST /v1/chat/completions ``` Base URL `https://api.reapi.ai`. The wire format is OpenAI-compatible, so the same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once you swap the base URL, the key and the model string. *** ## Request body ### `model` — string, required Must be `claude-opus-5` exactly. Anthropic's alias carries no date suffix, so there is nothing to append. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user` and `assistant`. Text, image and PDF parts are supported — see [Multimodal input](#multimodal-input). ### `max_tokens` — integer Upper bound on output tokens for this response, **thinking tokens included**. Anthropic documents a **128k**-token output ceiling for this model. **Thinking is on by default on this model**, and `max_tokens` caps thinking plus response text together. A budget carried over from a model that ran without thinking can truncate mid-answer. Raise it, or turn thinking off — subject to the effort cap below. ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. Recommended for anything a person watches, and effectively required for large `max_tokens` values — a non-streamed request with a big budget can hit an HTTP timeout. ### `thinking` — object, optional Omit it and the model runs **adaptive thinking**. See [Thinking](#thinking) for the two rules that differ from the previous Opus generation. ### `output_config` — object, optional Carries `effort` and the structured-output format. See [Effort](#effort). ### `tools` / `tool_choice` — optional Tool definitions and the strategy for picking among them. ### Routing Routing follows the API key configured in the legacy workspace. No `group` request parameter is required. *** ## Thinking Two things differ from the previous Opus generation, and both bite code that was carried straight over. **1. Thinking runs when you omit the parameter.** On the previous generation, omitting `thinking` meant no thinking. Here it runs adaptive. That is a silent cost and truncation change on any route that never set the field. **2. Turning thinking off is capped at `high` effort.** `thinking` disabled is accepted only at effort `high` or lower; pairing it with `xhigh` or `max` is rejected. The check runs **per request**, so a later call that raises effort while thinking is still disabled fails even though earlier calls in the same conversation succeeded. **The raw chain of thought is never returned on this model.** The default is omitted; ask for a summary if you surface reasoning to users. Fixed thinking-token budgets are not accepted. Given how well this model performs at `low` and `medium` effort, a latency-sensitive route is usually better served by lowering effort than by disabling thinking. *** ## Effort `output_config.effort` takes five levels — `low`, `medium`, `high`, `xhigh`, `max` — and **defaults to `high`** on the Claude API. | Level | Use it for | | -------- | ------------------------------------------------------------------------------------ | | `max` | The hardest reasoning, where correctness outweighs cost. Can overthink routine work. | | `xhigh` | Coding and agentic workloads — the recommended starting point for those. | | `high` | The default; intelligence-sensitive work generally. | | `medium` | A cost step-down that holds up unusually well on this model. | | `low` | Short, scoped, latency-sensitive tasks. | Effort is the primary cost and latency lever here — start at `xhigh` for coding/agentic work and `high` elsewhere, then sweep downward against your own evals. Defaults carried over from an older model rarely transfer. At `xhigh` or `max`, set a large `max_tokens` so there is room to think and act across tool calls. *** ## Parameters that are no longer accepted These are rejected on this generation. Remove them rather than working around them: | Parameter | Do this instead | | ------------------------------- | ------------------------------------------------------ | | `temperature`, `top_p`, `top_k` | Steer with prompting and the `effort` level | | Fixed thinking-token budget | Use `effort` | | Last-assistant-turn prefill | Use structured outputs, or a system-prompt instruction | *** ## Multimodal input | Modality | Supported | | -------- | :-------: | | Text | ✅ | | Image | ✅ | | PDF | ✅ | Output is **text only**. Vision is strong on charts, diagrams and dense documents — and on this model, giving it tools to crop and re-examine an image is a more cost-effective lever than raising thinking depth alone. *** ## Pricing dimensions Billing is **per token**, in USD, against your `api.reapi.ai` balance, with separate **input** and **output** rates. Three things to keep in mind: * **Thinking tokens bill as output.** Since thinking is on by default here, that is the usual reason a bill exceeds an estimate built from visible response length alone. * **Output dominates.** For most generative workloads the output rate decides the invoice. * **Effort moves the bill.** It changes how much the model thinks and how many tool calls it makes, so it is the lever to tune before anything else. Both token rates sit at **less than half Anthropic's published per-token rate**. Current numbers are on the [model page](https://reapi.ai/models/claude-opus-5) and [api.reapi.ai/pricing](https://api.reapi.ai/pricing) — those tables are the canonical source, not this page. Chat models bill in USD on the gateway balance. They do **not** draw down the integer credits used by the media-generation endpoints on `reapi.ai/api/v1`. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "claude-opus-5", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `usage.completion_tokens` includes thinking tokens, so it is the number to reconcile a bill against. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use the gateway's standard envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ------------------------------------------- | ----------------------------------------------------- | | Missing or invalid bearer token | Create a key in the api.reapi.ai console | | Unknown `model` value | Send `claude-opus-5` exactly — no date suffix | | `temperature` / `top_p` / `top_k` present | Remove them; they are not accepted on this generation | | Thinking disabled at `xhigh` / `max` effort | Lower effort to `high`, or leave thinking on | | `max_tokens` above the model ceiling | Lower it; the documented ceiling is 128k | | Insufficient balance | Top up on the gateway | | Upstream rate limit | Retry with backoff, or route through another model | Anthropic runs elevated safety classifiers on this generation. A declined request can come back as a **successful response whose stop reason is a refusal**, with an empty or partial body rather than an error. Check the stop reason before reading the content — code that indexes the first content block unconditionally will break on a refusal. *** ## Tips * **Give the whole task up front.** This model is built for long-horizon autonomous work; a complete specification in one turn outperforms revealing the task across many short interactive turns. * **Stream anything interactive**, and stream anything with a large `max_tokens`. * **Budget for thinking.** If responses truncate mid-sentence on hard prompts, the reasoning pass consumed the allowance — raise `max_tokens`. * **Sweep effort, don't inherit it.** `low` and `medium` are unusually strong here; the right level is workload-specific. * **Delete "double-check your work" instructions.** This model verifies its own output without being told, and telling it to verify causes redundant work. * **Ask for coverage in code review, then filter.** Instructions like "only report high-severity issues" are followed literally, which depresses measured recall. Have it report everything with confidence and severity, and filter in a separate pass. * **Short prompts cache now.** The minimum cacheable prefix is 512 tokens, half the previous generation's floor — prompts you had written off as uncacheable may qualify. *** ## Related * [Claude Opus 5 model page](https://reapi.ai/models/claude-opus-5) — current rates * [Claude Opus 4.8](/docs/claude-opus-4-8) — the previous generation * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # claude-sonnet-4-6 (https://reapi.ai/docs/claude-sonnet-4-6) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; This page documents the legacy `api.reapi.ai` workspace and its own API keys. `claude-sonnet-4-6` is not currently registered on the unified `reapi.ai/api/v1/chat/completions` or `reapi.ai/api/v1/messages` endpoints. Do not substitute a unified reAPI key or assume the newer Claude route's parameters and discounts apply here. For the unified service, see [Claude Opus 5.5](/docs/claude-opus-5-5), [Claude Fable 5](/docs/claude-fable-5), or [Claude Fable 5.1](/docs/claude-fable-5-1). > Claude Sonnet 4.6 is Anthropic's balanced everyday chat model, exposed > through api.reapi.ai as a drop-in OpenAI-compatible Chat Completions > endpoint (native Anthropic `/v1/messages` also available). 1M token > context, 128K max output, vision input, tool use, and fast production > latency. Current rates live on the > [model page](https://reapi.ai/models/claude-sonnet-4-6) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096, "temperature": 0.7 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, temperature=0.7, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```python from anthropic import Anthropic client = Anthropic( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai", ) with client.messages.stream( model="claude-sonnet-4-6", max_tokens=4096, messages=[{"role": "user", "content": "Hello"}], ) as stream: for text in stream.text_stream: print(text, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "claude-sonnet-4-6", messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, temperature: 0.7, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "claude-sonnet-4-6", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, "temperature": 0.7, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request needs a Bearer token. The Claude Sonnet 4.6 chat workspace lives on the `api.reapi.ai` platform — sign in there to create a key and top up tokens. 1. Open [api.reapi.ai](https://api.reapi.ai/) and sign in (or create an account). 2. Generate an API key under **API Keys**. 3. Top up tokens under **Top Up** (pay-as-you-go, billed in USD per 1M tokens — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing)). ```http Authorization: Bearer YOUR_API_KEY ``` The chat surface (api.reapi.ai) is a **separate workspace** from the image/video/audio task gateway at `reapi.ai/api/v1/*`. Keys and balances do not cross over — a key issued on `reapi.ai/settings/apikeys` will not authenticate against `api.reapi.ai/v1/chat/completions`, and vice versa. *** ## Endpoints ```http POST https://api.reapi.ai/v1/chat/completions # OpenAI-compatible POST https://api.reapi.ai/v1/messages # Anthropic-native ``` Both surfaces accept `claude-sonnet-4-6`. Pick whichever matches your SDK of record: * **`/v1/chat/completions`** — drop-in for the OpenAI SDKs. Same request shape, same SSE wire format. Set `base_url` to `https://api.reapi.ai/v1`. * **`/v1/messages`** — native Anthropic Messages format. Set `base_url` to `https://api.reapi.ai` for the Anthropic Python / TypeScript SDKs. Use this when you want the full Anthropic tool-use spec or native content blocks. *** ## Request body — `/v1/chat/completions` ### `model` — string, required Must be `"claude-sonnet-4-6"`. The value is echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec, plus content-parts for vision: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string OR content-parts array (text + image_url parts)" } ``` ### `max_tokens` — integer, default `4096` Upper bound on output tokens. **Anthropic's API requires `max_tokens` on every call, including streamed ones** — even though the OpenAI SDKs treat it as optional. Set it generously (`128000` is the hard cap); the model still stops at the natural end of its response. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. ### `temperature` — number, default `1` Range `0.0` – `1.0`. Sampling temperature. Anthropic recommends tuning **either** `temperature` or `top_p`, not both. ### `top_p` — number, default `1` Range `0.0` – `1.0`. Nucleus sampling cutoff. ### `tools` / `tool_choice` — optional Standard OpenAI tool-calling parameters. For Anthropic's native tool-use schema, call `/v1/messages` directly. ### Routing Routing follows the API key configured in the legacy workspace. No `group` request parameter is required. *** ## Vision input Send images alongside text via OpenAI content-parts: ```json { "model": "claude-sonnet-4-6", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Summarise the error in this screenshot." }, { "type": "image_url", "image_url": { "url": "https://example.com/screenshot.png" } } ] } ] } ``` Supported formats: PNG, JPEG, GIF, WebP. Base64 URLs work too (`data:image/png;base64,...`). Each image counts toward the input token budget based on its resolution. *** ## Response shape — `/v1/chat/completions` ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "claude-sonnet-4-6", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21 } } ``` ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta in the OpenAI chunk format; the final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). *** ## Pricing Claude Sonnet 4.6 is billed **pay-as-you-go in USD** against your api.reapi.ai token balance. Current rates live on [api.reapi.ai/pricing](https://api.reapi.ai/pricing) and in the pricing card at the top of the [model page](https://reapi.ai/models/claude-sonnet-4-6). Per-call bill: ``` input_cost = prompt_tokens × input_rate / 1,000,000 output_cost = completion_tokens × output_rate / 1,000,000 ``` Failed requests are not charged. *** ## Limits | Limit | Value | | ------------------- | ----------- | | Context window | 1M tokens | | Max output per call | 128K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` | Status | When | Notes | | ------ | ------------------------------------- | ----------------------------------------------------------------------- | | `400` | Missing `max_tokens`, bad shape, etc. | Anthropic requires `max_tokens`; OpenAI SDKs that omit it will 400 here | | `401` | Missing / invalid API key | Re-issue a key at api.reapi.ai | | `402` | Insufficient balance | Top up at api.reapi.ai | | `429` | Per-group rate limit hit | Back off, or move to a different `group` | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | api.reapi.ai does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that's a one-for-one wire failure and a retry from your side is safe; the upstream provider may have already produced output, but the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "claude-sonnet-4-6", "max_tokens": 4096, "messages": [ { "role": "user", "content": "Summarise this in three sentences." } ] } ``` ### Tool use (function calling) ```json { "model": "claude-sonnet-4-6", "max_tokens": 4096, "messages": [ { "role": "user", "content": "What's the weather in Tokyo?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Vision ```json { "model": "claude-sonnet-4-6", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Read the error in this screenshot and suggest a fix." }, { "type": "image_url", "image_url": { "url": "https://your-cdn.com/screenshot.png" } } ] } ] } ``` *** ## When to pick Claude Sonnet 4.6 over Claude Opus 4.7 Both share the same endpoint, the same context window, and the same OpenAI-compatible wire format — switching is a one-line change in the `model` field. Pick Claude Sonnet 4.6 when: * **Production chat traffic** where time-to-first-token shows up in user-experience metrics. * **Code review and PR triage** that runs across high volume. * **Mid-complexity agents** where Claude-grade reasoning is enough and Opus-tier reasoning would be overkill. * **Default routing** — use Sonnet as the everyday model and escalate to Opus for the genuinely hard turns. Pick Claude Opus 4.7 for high-stakes coding, large refactors, complex multi-step agents, and long-context analysis where output quality dominates the decision. *** ## Tips * **Set `max_tokens` generously.** Anthropic enforces it strictly; the model still stops at the natural end of its response, but a low cap will truncate before the real ending. * **Stream by default for chat UX.** Sonnet's lower time-to-first-token makes the perceived latency advantage especially visible in streamed responses. * **Tune `temperature` *or* `top_p`, not both.** Mixing them produces results that are hard to reason about. * **Use Sonnet as the default and escalate to Opus.** The cleanest production pattern: route everything to Sonnet, switch to Opus on the calls where quality matters most. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # claude-sonnet-5-5 (https://reapi.ai/docs/claude-sonnet-5-5) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Call **Claude Sonnet 5.5** with the native Messages format; see the [model page](/models/claude-sonnet-5-5) for current pricing. ## Quick example ```bash curl --no-buffer https://reapi.ai/api/v1/messages \ -H "x-api-key: YOUR_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{"model":"claude-sonnet-5-5","max_tokens":4096,"messages":[{"role":"user","content":"Explain the next step clearly."}],"output_config":{"effort":"high"},"stream":true}' ``` ```python import json import urllib.request payload = { "model": "claude-sonnet-5-5", "max_tokens": 4096, "messages": [{"role": "user", "content": "Explain the next step clearly."}], "output_config": {"effort": "high"}, } request = urllib.request.Request( "https://reapi.ai/api/v1/messages", data=json.dumps(payload).encode(), headers={"x-api-key": "YOUR_API_KEY", "anthropic-version": "2023-06-01", "Content-Type": "application/json"}, method="POST", ) with urllib.request.urlopen(request, timeout=120) as response: message = json.load(response) print(json.dumps(message, indent=2)) ``` ```js const response = await fetch("https://reapi.ai/api/v1/messages", { method: "POST", headers: { "x-api-key": "YOUR_API_KEY", "anthropic-version": "2023-06-01", "Content-Type": "application/json", }, body: JSON.stringify({ model: "claude-sonnet-5-5", max_tokens: 4096, messages: [{ role: "user", content: "Explain the next step clearly." }], output_config: { effort: "high" }, }), }); const body = await response.json(); if (!response.ok) throw new Error(JSON.stringify(body)); console.log(body); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "time" ) func main() { body, err := json.Marshal(map[string]any{ "model": "claude-sonnet-5-5", "max_tokens": 4096, "messages": []map[string]string{{"role": "user", "content": "Explain the next step clearly."}}, "output_config": map[string]string{"effort": "high"}, }) if err != nil { panic(err) } req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/messages", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("x-api-key", "YOUR_API_KEY") req.Header.Set("anthropic-version", "2023-06-01") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 120 * time.Second} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(out)) } fmt.Println(string(out)) } ``` ## Endpoint and headers `POST https://reapi.ai/api/v1/messages` | Header | Requirement | | ------------------- | --------------------------------------------------------------------------------- | | `x-api-key` | Your reAPI key; required unless using the existing Bearer authentication option | | `Content-Type` | `application/json` | | `anthropic-version` | Optional; defaults to `2023-06-01` | | `anthropic-beta` | Optional; forward the exact feature header required by the official documentation | For an Anthropic SDK, use `https://reapi.ai/api` as the base URL; the SDK appends `/v1/messages`. Disable client-side automatic retries when one attempt per action is required. reAPI makes one upstream generation attempt and does not retry automatically. ## Parameters Native Messages fields and unknown extensions pass through unchanged. There is no field allowlist or parameter-count restriction. The upstream determines acceptance and behavior; HTTP 200 alone does not establish that a parameter took effect. Existing authentication, request-size, and billing admission checks still apply. | Field | Type / required | Default and behavior | | ------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string; required | `claude-sonnet-5-5` | | `messages` | non-empty array; required | Native conversation content, including tool results and signed thinking blocks | | `max_tokens` | integer; required | 0–128,000 including thinking; zero is forwarded for cache warmup | | `system` | string or text-block array; optional | Top-level instructions; blocks may include cache controls | | `stream` | boolean; optional | `false`; `true` returns native SSE | | `output_config` | object; optional | Effort defaults to `high`; `low`, `medium`, `high`, `xhigh`, `max`; `format` selects structured JSON; beta extensions remain intact | | `thinking` | object; optional | Adaptive by default; `display: "summarized"` opts into a summary; `type: "between_tools"` is documented at low, medium, or high effort | | `tools` | array; optional | Native definitions with `name`, `input_schema`, optional `strict`, and other official fields | | `tool_choice` | object; optional | See the model-specific thinking and tool guidance below | | `stop_sequences` | string array; optional | Stop generation on a matched sequence | | `cache_control` | object or null; optional | `type: "ephemeral"`; TTL `5m` or `1h`; minimum cacheable prefix is 512 tokens | | `temperature`, `top_p`, `top_k` | number; optional | Forwarded; omit sampling settings in new integrations with this model | | `metadata` | object; optional | Request metadata | | `container` | string, object, or null; optional | Applicable container reuse and skill settings | | `context_management` | object or null; optional | Context edits; nested options are preserved | | `compaction` | object or null; optional | Official on-demand compaction uses `type: "summarize"` and the `compact-2026-09-04` beta header; the current probe returned ordinary text, without a signed compaction block | | `output_format` | object or null; optional | Legacy beta field; prefer current `output_config.format` for new integrations | | `mcp_servers` | array; optional | Official MCP definitions and required beta headers; service availability depends on the upstream | | `diagnostics` | object or null; optional | Includes `previous_message_id`; passed through | | `service_tier` | string; optional | Official selection such as `auto` or `standard_only`; availability depends on the model | | `inference_geo` | string or null; optional | Requested inference location; passed through | | `speed` | string or null; optional | Passed through; fast mode is not documented for Claude Sonnet 5.5 | | `fallbacks` | string, array, or null; optional | Official beta options are retained; not behavior-tested here | | `fallback_credit_token` | string, object, or null; optional | Retained unchanged; not behavior-tested here | Per-message controls such as `output_config` and `clear_at`, and nested beta thinking options, also pass through. Send the appropriate beta header when required by the official documentation. Inputs with image or PDF content must use public HTTP(S) URLs under reAPI's media policy; base64 and data URIs are not accepted. Plain-text document blocks can contain inline text. ### Thinking and tools Claude Sonnet 5.5 defaults to **high** effort and adaptive thinking. `max_tokens` includes thinking, so leave enough allowance for the final answer. Preserve the original assistant content array when sending a tool result back, including signatures and block ordering. Sonnet supports `thinking: {"type":"between_tools"}` at low, medium, or high effort to skip initial thinking. Use `tool_choice: {"type":"auto"}` or `{"type":"none"}`; named forced selection returned an upstream 400 in our probe. The documented mode is not `disabled`. ### Structured JSON ```json { "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": {"answer": {"type": "string"}}, "required": ["answer"], "additionalProperties": false } } } } ``` Send the complete schema; reAPI does not remove constraints or create missing required fields. Document citations and structured JSON are separate features and cannot be combined in the same request under the official contract. ### Observed capabilities Small synthetic probes on October 9, 2026 established the following behavior. They are not a throughput benchmark or a maximum-context test. | Feature | Observation | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Text and system instructions | Correct response to the synthetic marker and system override | | Native streaming | Native message/content events and cumulative output usage observed | | Structured JSON | Output matched the requested schema even when the prompt requested plain text | | Strict client tools | Tool name and schema-shaped input observed; the next response used the supplied tool result | | Stop sequences | Matched stop reason; output after the marker was absent | | Prompt caching | Nonzero cache-creation usage, then nonzero cache-read usage on repeated input | | Document citations | Text-document answer contained a citation block | | Effort levels | All five official values accepted; relative reasoning depth was not measured | | Thinking mode | Model-specific mode accepted with no thinking block in that response; internal computation was not measured | | URL images | Single-image and two-image requests returned 400 on the tested provider path; image interpretation was not reached | | PDF | Not yet verified with a permitted PDF fixture; the text-document citation test does not establish PDF support | | Web search | Basic `web_search_20250305` returned an actual search call, matching results and a citation | | Web fetch | Basic `web_fetch_20250910` returned 400 on the tested provider path | | Code execution | `code_execution_20260521` returned 200 with an embedded `too_many_requests` tool error; no successful execution output | | MCP | Both tested official MCP beta versions returned 400; the reachable synthetic server received no provider tool-discovery or tool-call callback | | On-demand compaction | Request accepted with 200, but returned `end_turn` and no signed compaction block; effect unproven | | Signed thinking | An xhigh synthetic task returned a signed block; exact replay was accepted. Transformation diagnostics were absent in that run, so prefix-binding behavior remains unverified | These are dated observations of the tested path, not universal model limitations. An in-response tool error is distinct from HTTP transport success. Requests and extension fields still pass through; these observations do not introduce a local capability gate. Other settings, including legacy thinking, sampling, and assistant prefill, were recorded as upstream response observations. Acceptance does not certify their effect and is not a reason for local parameter rejection. ## Pricing dimensions and billing Input, output, cache use, and applicable server tools can affect cost. Thinking counts toward output usage. See the [model page](/models/claude-sonnet-5-5) for current rates; the response's native `usage` reports token categories separately. For this endpoint, settlement uses the trusted per-request USD cost with the model's configured multiplier: `billed_usd = reported_request_cost_usd × multiplier`. It is token-based LLM billing, not an asynchronous image/video credit estimate. Failed delivery or missing trusted usage/cost follows the existing no-charge settlement path. ## Output and streaming A non-streaming response has the native shape below; values are illustrative. ```json { "id": "msg_example", "type": "message", "role": "assistant", "model": "claude-sonnet-5-5", "content": [{"type": "text", "text": "The next step is to verify the input."}], "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 20, "output_tokens": 12, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0 } } ``` Native SSE uses `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, and `message_stop`. Handle `ping` and `error` events too. Thinking signatures and partial tool JSON remain in their native events; Messages does not end with `[DONE]`. A tool loop sends the previous full `content` as an assistant message and the matching `tool_result` as a user content block. Your application executes client tools; the playground does not execute them. Inspect `stop_reason` for incomplete answers, tool calls, and refusals even when HTTP status is 200. ## Existing Chat Completions clients `POST https://reapi.ai/api/v1/chat/completions` remains available with Bearer authentication. It maps `reasoning_effort` to `output_config.effort`, function tools to native definitions, `stop` to `stop_sequences`, and JSON schemas to `output_config.format`. Explicit native options take precedence. Use Messages for the official native request and response format. The compatibility response retains `choices`, tool calls, and `[DONE]` streaming. Full native assistant content is available as `choices[].message.anthropic_content`; send it back unchanged as the assistant's `anthropic_content`. Streams carry `anthropic_event` so clients can reconstruct the original content blocks. Existing compatibility handling of OpenAI-only fields remains unchanged. ## Errors | Status | Meaning | | --------- | ------------------------------------------------------------- | | 400 | Invalid request or an upstream-rejected parameter combination | | 401 / 403 | Authentication or permission failure | | 402 | Balance below admission requirements | | 413 | Request body larger than 32 MiB | | 429 | Rate or concurrency limit | | 502 / 503 | Service, pricing, or response delivery unavailable | Messages errors use `{"type":"error","error":{"type":"invalid_request_error","message":"..."},"request_id":"..."}`. See the [error catalog](/docs/api/errors). Unknown parameters do not trigger a local whitelist error. ## Tips * Start with one task whose result you can check, then add context or tool steps. * Use `output_config.format` for schema-constrained JSON and explicit document citations for source-based answers. * Keep conversation content intact across tool turns; a displayed summary is not a replacement for signed blocks. * Use documented model controls as a starting point and evaluate effects on your own workload. ## Related * [Haiku 5.5 documentation](/docs/claude-haiku-5-5) * [Sonnet 5.5 documentation](/docs/claude-sonnet-5-5) * [Opus 5.5 documentation](/docs/claude-opus-5-5) * [Haiku 5.5 vs Sonnet 5.5](/blog/claude-haiku-5-5-vs-sonnet-5-5) Official references, checked October 9, 2026: [Messages](https://platform.claude.com/docs/en/api/messages/create), [model overview](https://platform.claude.com/docs/en/models/sonnet-5-5/overview), [migration guidance](https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide), [structured output](https://platform.claude.com/docs/en/build-with-claude/structured-outputs), [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching). --- # omni-moderation-latest (https://reapi.ai/docs/content-moderation) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > `omni-moderation-latest` is a single async endpoint that checks text, images, > or a mix of both against 13 harm categories and returns a `flagged` verdict > with per-category scores. See current pricing on the > [model page](https://reapi.ai/models/content-moderation). ## Quick example ```bash curl https://reapi.ai/api/v1/moderations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "omni-moderation-latest", "input": [ { "type": "text", "text": "Is this comment safe to publish?" }, { "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } } ] }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/moderations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "omni-moderation-latest", "input": [ {"type": "text", "text": "Is this comment safe to publish?"}, {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}, ], }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/moderations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "omni-moderation-latest", input: [ { type: "text", text: "Is this comment safe to publish?" }, { type: "image_url", image_url: { url: "https://example.com/photo.jpg" } }, ], }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "omni-moderation-latest", "input": []map[string]any{ {"type": "text", "text": "Is this comment safe to publish?"}, {"type": "image_url", "image_url": map[string]string{"url": "https://example.com/photo.jpg"}}, }, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/moderations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_01a04de4f56c77f387b030319362ff46", "model": "omni-moderation-latest", "status": "processing", "created_at": 1788013250 } ``` Poll `GET /api/v1/tasks/{id}` until `status === "completed"`. A check usually finishes within a few seconds. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/moderations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a task `id`; polling the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required Always `"omni-moderation-latest"`. ### `input` — required The content to moderate. Three shapes are accepted: | Shape | Example | Result | | ----------------------- | ------------------------------------------------------------------------------------------------- | --------------------------- | | Single string | `"I want to kill someone"` | One entry in `results` | | Array of strings | `["hello", "I hate you"]` | One entry per string | | Array of content blocks | `[{ "type": "text", "text": "…" }, { "type": "image_url", "image_url": { "url": "https://…" } }]` | One entry for the whole set | Content blocks: | Block | Fields | Notes | | ----------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | `text` | `text` (string, required) | Plain text to check. | | `image_url` | `image_url.url` (string, required) | A **public http(s) URL**. Base64 / `data:` URIs are rejected — reAPI media inputs are URL-only across every model. | Strings and text blocks must be non-empty; arrays must have at least one item. **Limits:** up to **500 items** per request and **30,000 words** (300,000 characters) of text in total, summed across every string / text block. Split larger jobs across requests. ### `stream` — optional (boolean) Only `false` is supported. Omit it (the default) or send `false`; any other value is rejected with `20003`. The task contract already delivers the whole verdict in one poll response, so there is nothing to stream. *** ## Output ```json { "id": "task_01a04de4f56c77f387b030319362ff46", "model": "omni-moderation-latest", "status": "completed", "created_at": 1788013250, "output": { "moderation": { "results": [ { "flagged": true, "categories": { "harassment": true, "harassment/threatening": false, "hate": false, "hate/threatening": false, "illicit": false, "illicit/violent": false, "self-harm": false, "self-harm/instructions": false, "self-harm/intent": false, "sexual": false, "sexual/minors": false, "violence": false, "violence/graphic": false }, "category_scores": { "harassment": 0.8869, "harassment/threatening": 0.0384, "hate": 0.0001, "hate/threatening": 0.0000, "illicit": 0.0000, "illicit/violent": 0.0000, "self-harm": 0.0005, "self-harm/instructions": 0.0000, "self-harm/intent": 0.0001, "sexual": 0.0000, "sexual/minors": 0.0000, "violence": 0.0322, "violence/graphic": 0.0000 }, "category_applied_input_types": { "harassment": ["text"], "harassment/threatening": ["text"], "hate": ["text"], "hate/threatening": ["text"], "illicit": ["text"], "illicit/violent": ["text"], "self-harm": ["text", "image"], "self-harm/instructions": ["text", "image"], "self-harm/intent": ["text", "image"], "sexual": ["text", "image"], "sexual/minors": ["text"], "violence": ["text", "image"], "violence/graphic": ["text", "image"] } } ] } }, "usage": { "credits": 1 }, "error": null } ``` ### Reading a result `output.moderation.results[]` holds one entry per input item (one per string for an array of strings; a single entry for a content-block array). Each entry: | Field | Meaning | | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `flagged` | `true` when the model considers the input harmful in at least one category. | | `categories` | Per-category boolean verdict. | | `category_scores` | Per-category confidence, `0`–`1`. Use these to set your own thresholds when the boolean verdict is too coarse. | | `category_applied_input_types` | Which input types (`text`, `image`) each category was evaluated against for this request. Image checks cover the self-harm, sexual, violence and violence/graphic families; the remaining categories are text-only. | The 13 categories: `harassment`, `harassment/threatening`, `hate`, `hate/threatening`, `illicit`, `illicit/violent`, `self-harm`, `self-harm/instructions`, `self-harm/intent`, `sexual`, `sexual/minors`, `violence`, `violence/graphic`. The category vocabulary and scores are returned exactly as the model produces them; reAPI does not remap or round them. *** ## Pricing Billed **per moderation unit**: * **Text:** one unit per 1,000 words, summed across every text item in the request. Each text item counts as at least 50 words, so a batch of very short strings is not billed as free. * **Images:** one unit per `image_url` block. * Every request bills at least one unit. Units are converted to credits once per request and rounded up, so a large batch is cheaper per item than many single calls. Polling does not add any charge. Failed requests are refunded automatically. `1 credit = $0.001 USD`. See the pricing table on the [model page](https://reapi.ai/models/content-moderation) for the current per-unit rate. *** ## Errors Standard envelope: ```json { "error": { "code": 20003, "message": "input: input is required", "request_id": "req_..." } } ``` Common cases: | Code | When | | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `20003` | `input` missing, empty, malformed, over the item / word limit, an `image_url.url` that is not a public http(s) URL, or `stream` not `false`. | | `20004` | `model` missing or not `omni-moderation-latest`. | | `30001` | Insufficient credits for the submitted unit count. | | `80001` | Provider rejected the submission (rate limit, upstream balance, transient failure). Refunded. | | `80007` | Provider rejected the input as invalid (for example an image URL it could not fetch). Refunded. | Full catalog: [/docs/api/errors](/docs/api/errors). *** ## Tips * Send an array of strings to screen a batch of comments in one task — you get one verdict per string and a single bill. * Pair text and an image in one content-block array when they are published together (a caption plus its photo); the model scores the combination as one item. * Treat `category_scores` as the tunable signal: `flagged` uses the model's default thresholds, which may be stricter or looser than your policy. * Image URLs must be fetchable from the public internet. Signed URLs work as long as they are valid when the task runs. *** ## Related * [AI Text Detector](/docs/ai-text-detector) — score text for AI authorship. * [AI Humanizer](/docs/humanize) — rewrite AI text to read human. --- # deepseek-v4.1-flash (https://reapi.ai/docs/deepseek-v4-1-flash) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > DeepSeek's **V4.1-Flash** weights, exposed through reAPI as a drop-in > OpenAI-compatible Chat Completions endpoint. A **1M-token** context window, a > **384,000**-token output ceiling, `reasoning_effort` across > `low` / `high` / `max` with thinking **on by default**, vision input, JSON > output and tool calls. The wire `model` id is **`deepseek-v4.1-flash`**. > Current rates live on the [model page](https://reapi.ai/models/deepseek-v4-1-flash). DeepSeek names its current model `deepseek-flash` and gives its version as DeepSeek-V4.1-Flash. The legacy name `deepseek-v4-flash` is still accepted by DeepSeek but now served by those same weights. On reAPI the string you send is `deepseek-v4.1-flash`. ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4.1-flash", "messages": [ { "role": "user", "content": "Summarise this contract and list every clause that shifts liability to the supplier." } ], "reasoning_effort": "high", "max_tokens": 8192, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="deepseek-v4.1-flash", messages=[{"role": "user", "content": "Summarise this contract and list every clause that shifts liability to the supplier."}], reasoning_effort="high", max_tokens=8192, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "deepseek-v4.1-flash", messages: [ { role: "user", content: "Summarise this contract and list every clause that shifts liability to the supplier." }, ], reasoning_effort: "high", max_tokens: 8192, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "fmt" "io" "net/http" ) func main() { body := []byte(`{ "model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Summarise this contract."}], "reasoning_effort": "high", "max_tokens": 8192 }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request carries a reAPI key as a bearer token: ``` Authorization: Bearer YOUR_API_KEY Content-Type: application/json ``` Create a key in the dashboard under **API keys**. The same key reaches every model on the platform, so nothing is provisioned per model. *** ## Endpoint ``` POST https://reapi.ai/api/v1/chat/completions ``` OpenAI-compatible Chat Completions. Point an existing OpenAI client at `https://reapi.ai/api/v1` and change the model string; nothing else in the call site changes. *** ## Parameter support on this model Support differs per model on this endpoint. For `deepseek-v4.1-flash`: | Parameter | Status | Notes | | ----------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | | `max_tokens` | Supported | Output cap for this model, reasoning included | | `reasoning_effort` | Supported | `low` / `high` / `max`; other rungs are mapped, not rejected | | `stream` | Supported | Server-sent events | | `response_format` | Supported | DeepSeek documents JSON output for these weights | | `tools` / `tool_choice` | Supported | See **Tool calling** below | | `top_p` | Partially effective | In thinking mode values below `0.95` are raised to `0.95`; in non-thinking mode it is fixed at `1.0` and your value is ignored | | `temperature` | Ignored in thinking mode | Accepted without error, no effect while thinking is on | | `presence_penalty` | Ignored | Accepted without error, no effect | | `frequency_penalty` | Ignored | Accepted without error, no effect | | `n` | Not supported | Absent from the request surface; accepted in silence | | `seed` | Not supported | Absent from the request surface; accepted in silence | The ignored parameters are accepted rather than rejected, so a request that sets `temperature` looks like it worked. If output is not varying the way you expect, this table is the reason — steer with prompting and `reasoning_effort` instead. *** ## Request body ### `model` — string, required Always `deepseek-v4.1-flash`. ### `messages` — array, required Standard OpenAI message array. Each entry has `role` and `content`. `content` is either a plain string or an array of content blocks when you mix text and images. ### `max_tokens` — integer, optional Upper bound on generated tokens for the response, reasoning included. The ceiling on this endpoint is **384,000**. DeepSeek's own parameter reference words this as "384K (393216)" — that is 384 × 1024. This endpoint enforces 384 × 1000. Measured 2026-09-18: `max_tokens: 384000` returns 200, and `max_tokens: 384001` returns 400 `requested output token limit exceeds model maximum`. Use the round number. Left unset, the vendor's default applies rather than the ceiling — 8K in non-thinking mode, 64K in thinking mode, and 128K with `reasoning_effort` at `max`. Long jobs have to raise it explicitly. ### `reasoning_effort` — string, optional, default `high` `low`, `high` or `max`. See **Reasoning effort** below. ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. ### `response_format` — object, optional Request JSON instead of prose. *** ## Reasoning effort Thinking is **enabled by default** at `high` effort. Three rungs are real: | Value | Behavior | | ------ | -------------------------------------------- | | `low` | Shortest chain of thought, lowest latency | | `high` | Default | | `max` | Deepest reasoning, highest output-token cost | DeepSeek publishes a mapping for the other OpenAI rungs rather than rejecting them, so an unsupported value runs quietly as one of the three above: | Requested | Actually runs as | | --------- | ---------------- | | `minimal` | `low` | | `low` | `low` | | `medium` | `high` | | `high` | `high` | | `xhigh` | `high` | | `max` | `max` | | `ultra` | `max` | Reasoning text is returned in `reasoning_content`, at the same level as `content`. Whether you must echo it back on later turns depends on `tools` — see below. *** ## Image input DeepSeek documents vision support for these weights. Images travel in the standard OpenAI content-block form: ```json { "model": "deepseek-v4.1-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Which metric regressed week over week?" }, { "type": "image_url", "image_url": { "url": "https://example.com/dashboard.png" } } ] } ] } ``` * **Formats:** JPEG, PNG, GIF and WebP. The format is detected from the file's actual content, not from its name or declared MIME type. * **By URL:** a public http(s) link, at most 8192 characters, the file at most 32 MiB, and the download must finish within 60 seconds. * **Inline:** a `data:` URL carrying base64, counted against the request body limit of 32 MiB. * **File block:** `{ "type": "file", "file_data": "data:image/png;base64,...", "filename": "a.png" }` is accepted as an inline image. `file_id` references to DeepSeek's Files API are not available on this endpoint. * **Per request:** images fetched by URL may total at most 24 MiB. URLs must use the default port (80 or 443) and resolve to a public address. *** ## Tool calling `tools` and `tool_choice` follow the OpenAI shape. One rule is specific to these weights and easy to miss: When a request carries `tools`, the `reasoning_content` from every previous assistant turn must be passed back in `messages` — it is concatenated into the context. When the request carries no `tools`, `reasoning_content` does not need to be returned and is ignored if you send it. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input**, **output** and **cache read** rates. Three things to keep in mind: * **Reasoning tokens bill as output.** Thinking is on by default, so this is the usual reason a bill exceeds an estimate built from visible answer length. * **The rate is flat across context length.** There is no long-context tier on this model, so a near-full prompt costs the same per token as a short one. * **Cache reads bill at their own rate.** A repeated prefix is charged at the cache rate rather than the input rate. Current numbers are on the [model page](https://reapi.ai/models/deepseek-v4-1-flash) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1789000000, "model": "deepseek-v4.1-flash", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "...", "reasoning_content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 60, "completion_tokens": 244, "total_tokens": 304 } } ``` ### Streaming (`stream: true`) Server-sent events of `object: "chat.completion.chunk"`, each carrying a `delta`. Reasoning arrives as `delta.reasoning_content` and the answer as `delta.content`. The stream ends with `data: [DONE]`. *** ## Errors The envelope is the platform-wide shape: ```json { "error": { "code": 20003, "message": "...", "type": "invalid_request", "request_id": "req_..." } } ``` | Code | HTTP | Meaning | | ------- | --------- | ----------------------------------------------------------------- | | `20003` | 400 / 413 | Invalid parameter value; 413 when the request body exceeds 32 MiB | | `20004` | 400 | Model not supported on this endpoint | | `30001` | 402 | Insufficient credits | | `50001` | 429 | Rate limit or concurrency limit exceeded | | `70001` | 502 / 503 | Upstream or pricing temporarily unavailable | The full catalog is at [/docs/api/errors](/docs/api/errors). *** ## Tips * **Raise `max_tokens` deliberately.** The 384,000 ceiling is a maximum, not a default. Long translation and refactor jobs are the whole reason to pick these weights, and they need the cap lifted explicitly. * **Drop to `low` before looking for a switch.** Reasoning tokens bill as output, so effort is the cost lever on this model. * **Do not tune `temperature`.** It is ignored while thinking is on and no error tells you so. * **Put the stable bulk first.** Cache reads bill below the input rate, so a fixed prefix followed by the varying question is cheaper than the reverse. * **Mislabelled images are fine.** Format comes from file content, so a `.png` that is really a JPEG still works. *** ## Related * [deepseek-v4](/docs/deepseek-v4) — the V4 family page, covering the Pro tier * [gpt-5-6-luna](/docs/gpt-5-6-luna) — the nearest cost-sensitive alternative * [kimi-k3](/docs/kimi-k3) — another 1M-context model with always-on reasoning * [API errors](/docs/api/errors) — the full error-code catalog --- # deepseek-v4 (https://reapi.ai/docs/deepseek-v4) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > The DeepSeek V4 API ships two open-weight models — **`deepseek-v4-flash`** > (fast, low-cost) and **`deepseek-v4-pro`** (frontier reasoning and agentic > coding) — exposed through reAPI as a drop-in OpenAI-compatible Chat > Completions endpoint. Both bring a 1M-token context window, 384K max output, > thinking mode on by default, vision input, tool use, and context caching. > Current rates live on the > [model page](https://reapi.ai/models/deepseek-v4). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-flash", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096, "temperature": 0.7 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="deepseek-v4-flash", # or "deepseek-v4-pro" messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, temperature=0.7, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "deepseek-v4-flash", // or "deepseek-v4-pro" messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, temperature: 0.7, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "deepseek-v4-flash", // or "deepseek-v4-pro" "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, "temperature": 0.7, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Models The DeepSeek V4 family ships two variants. Both share the same endpoint, request shape, 1M context window, and 384K max output — pick the variant with the `model` field. | `model` | Best for | Architecture | | ------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------- | | `deepseek-v4-flash` | Fast, low-cost everyday work — autocomplete, batch analysis, chat backends. Reasoning closely approaches Pro. | 284B total / 13B active (MoE) | | `deepseek-v4-pro` | Frontier reasoning, complex debugging, and agentic coding. Rivals top closed-source models. | 1.6T total / 49B active (MoE) | The legacy ids `deepseek-chat` and `deepseek-reasoner` map to `deepseek-v4-flash` in non-thinking and thinking mode respectively. New integrations should use the explicit `deepseek-v4-flash` / `deepseek-v4-pro` ids. *** ## Endpoint ```http POST https://reapi.ai/api/v1/chat/completions ``` Drop-in for the OpenAI SDKs — same request shape, same SSE wire format. Set `base_url` to `https://reapi.ai/api/v1`. DeepSeek V4 also supports the Anthropic API format natively; this guide documents the OpenAI-compatible Chat Completions surface. *** ## Request body ### `model` — string, required `"deepseek-v4-flash"` or `"deepseek-v4-pro"`. Echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec, plus content-parts for vision: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string OR content-parts array (text + image_url parts)" } ``` Multi-turn history is sent in chronological order — the last message is the one the model responds to. In thinking mode **with `tools`**, keep the returned assistant messages, including historical `reasoning_content` and `tool_calls`, when continuing the conversation. **Without `tools`**, historical reasoning is not required and is ignored if supplied. See DeepSeek's [thinking-mode guide](https://api-docs.deepseek.com/guides/thinking_mode/). ### `max_tokens` — integer Upper bound on output tokens for this response, **including the chain-of-thought when thinking mode is on**. The synchronous API supports up to 384K output tokens, subject to the remaining context capacity. On this reAPI endpoint, omission uses the configured model cap of **384,000**; `4096` in the examples is an explicit request budget, not the default. Set a budget suited to the task and leave room for both reasoning and the final answer. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. ### `reasoning_effort` — string, default `"high"` How hard the model thinks before answering. Three rungs: | Level | Use it for | | ------ | ------------------------------------------------------------------------------------------------------------------ | | `max` | The hardest reasoning, where correctness outweighs latency and cost. | | `high` | **The default.** Reasons thoroughly without reaching for the ceiling. | | `low` | Short, scoped, latency-sensitive work — and the answer to "the thinking is costing more than the answer is worth". | `medium` and `xhigh` are accepted as compatibility aliases and both resolve to `high`, so a request carrying either gets the default rung rather than an error. ### `temperature` — number, default `1` Sampling temperature, up to `2`. Lower values produce more deterministic output. **Ignored while the model is in thinking mode.** ### `top_p` — number, default `1` Nucleus sampling cutoff, up to `1`. Ignored in thinking mode. ### `frequency_penalty` / `presence_penalty` — deprecated **No longer supported.** DeepSeek marks both as deprecated: a request carrying them is accepted, and the value has no effect. Steer repetition with prompting or the `reasoning_effort` rung instead. ### `stop` — string or array, optional Up to four stop sequences. Generation ends when one is produced, and the sequence itself is not returned. ### `logprobs` / `top_logprobs` — optional `logprobs: true` returns a log probability for each output token. `top_logprobs` (0–20) additionally returns that many alternatives per position, and requires `logprobs: true`. ### `tools` / `tool_choice` — optional Standard OpenAI tool-calling parameters. DeepSeek V4 ships dedicated agentic optimizations with reliable function calling and JSON output. ### Fields this model does not have `seed` and `n` are not part of the DeepSeek V4 request surface. Both are accepted without an error and neither changes the result, so a client that relies on either gets silence rather than a failure — send neither. *** ## Thinking mode DeepSeek V4 runs in **thinking mode by default**: before the final answer it produces a chain of thought, returned in a `reasoning_content` field at the same level as `content`. ```json { "choices": [ { "index": 0, "message": { "role": "assistant", "reasoning_content": "Let me work through this step by step...", "content": "The final answer." }, "finish_reason": "stop" } ] } ``` Two controls govern it. `reasoning_effort` picks how hard the model thinks (`low` / `high` / `max`), and the `thinking` object switches the mode outright: ```json { "thinking": { "type": "enabled" } } ``` For latency-sensitive or simple calls, drop to `reasoning_effort: "low"` or turn thinking off for faster, cheaper responses. While thinking is on, `temperature` and `top_p` have no effect — and `frequency_penalty` / `presence_penalty` have none in either mode, being deprecated outright. **Do not strip reasoning from a tool-calling conversation.** With `tools` present in thinking mode, return the historical assistant messages with their `reasoning_content`, followed by the tool results. That history counts toward the context budget. In a conversation without `tools`, previous reasoning is ignored and need not be resent. *** ## Vision input (beta) Send images alongside text via OpenAI content-parts: ```json { "model": "deepseek-v4-pro", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What does this chart show?" }, { "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } } ] } ] } ``` Each image counts toward the input token budget based on its resolution. *** ## Context caching DeepSeek V4 caches stable prompt prefixes automatically. When a request hits the cache, the cached input tokens bill at a small fraction of the standard input rate — a big saving for agent loops and chatbots that replay long system prompts and tool schemas. No configuration is required; reuse the same prefix across calls and the discount applies. The `usage.prompt_tokens_details.cached_tokens` field reports how many input tokens were served from cache. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "deepseek-v4-flash", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21, "prompt_tokens_details": { "cached_tokens": 0 } } } ``` When thinking mode is on, `message.reasoning_content` carries the chain-of-thought alongside `content`. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta in the OpenAI chunk format; the final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). *** ## Pricing DeepSeek V4 is billed **pay-as-you-go** from your reAPI credit balance (`1 credit = $0.001`, `$1 = 1,000 credits`). It bills along three dimensions — input tokens (cache miss), input tokens (cache hit), and output tokens — and `deepseek-v4-pro` costs more per token than `deepseek-v4-flash`. Current rates live in the pricing card at the top of the [model page](https://reapi.ai/models/deepseek-v4). Per-call bill: ``` billable_input = (prompt_tokens - cached_tokens) × input_rate / 1,000,000 cache_read_bill = cached_tokens × cache_hit_rate / 1,000,000 output_bill = completion_tokens × output_rate / 1,000,000 ``` Output tokens include the chain-of-thought when thinking mode is on. Failed requests are not charged. *** ## Limits | Limit | Value | | ------------------- | ----------- | | Context window | 1M tokens | | Max output per call | 384K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | ------------------------------------------ | -------------------------------------------------- | | `400` | Bad request shape, unsupported param combo | Check the `messages` array and `model` id | | `401` | Missing / invalid API key | Create a key under API keys in the reAPI dashboard | | `402` | Insufficient balance | Top up your reAPI credits | | `429` | Rate limit hit | Back off and retry | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | reAPI does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that is a one-for-one wire failure and a retry from your side is safe; the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "deepseek-v4-flash", "max_tokens": 4096, "messages": [ { "role": "user", "content": "Summarise this in three sentences." } ] } ``` ### Tool use (function calling) ```json { "model": "deepseek-v4-pro", "max_tokens": 4096, "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Long-context analysis ```json { "model": "deepseek-v4-pro", "max_tokens": 8192, "messages": [ { "role": "system", "content": "" }, { "role": "user", "content": "List every mention of constraint X with line numbers." } ] } ``` Keep the long reference block stable across calls so the cache-hit rate applies on subsequent requests. *** ## When to pick Flash vs Pro * **`deepseek-v4-flash`** — latency-sensitive, high-throughput, cost-sensitive work: in-IDE autocomplete, inline suggestions, CI code review, bulk summarization, chat backends. Reasoning closely approaches Pro at a fraction of the price. * **`deepseek-v4-pro`** — work where reasoning depth dominates: complex debugging, architecture planning, math/STEM, and long-horizon agentic coding. Both share one key — route per request. *** ## Tips * **Set `max_tokens` generously when thinking is on.** The chain-of-thought counts toward the output budget; a low cap can truncate before the final answer. * **Preserve reasoning in tool loops.** In thinking mode with `tools`, retain historical assistant `reasoning_content` and `tool_calls`. Without `tools`, previous reasoning is ignored and need not be sent. * **Stream by default for chat UX.** Streaming cuts perceived latency. * **Cache stable prefixes.** Reuse the same system prompt and tool schemas across calls to bill repeated input at the low cache-hit rate. * **Route by difficulty.** Send simple, high-volume calls to Flash and reserve Pro for the hardest reasoning, all on one key. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # enhance-video-1.0 (https://reapi.ai/docs/enhance-video-1-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > `enhance-video-1.0` is a single async endpoint that takes a source video URL and > returns a higher-quality MP4 — upscaled, denoised, smart-interpolated, with > optional scene-aware restoration. Two quality tiers (**standard** / > **professional**) and five scene presets cover everything from AI-generated > footage to old-film restoration. See current pricing on the > [model page](https://reapi.ai/models/enhance-video-1-0). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "enhance-video-1.0", "video_url": "https://cdn.example.com/source_720p.mp4", "tool_version": "standard", "scene": "aigc", "resolution": "1080p" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "enhance-video-1.0", "video_url": "https://cdn.example.com/source_720p.mp4", "tool_version": "standard", "scene": "aigc", "resolution": "1080p", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "enhance-video-1.0", video_url: "https://cdn.example.com/source_720p.mp4", tool_version: "standard", scene: "aigc", resolution: "1080p", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "enhance-video-1.0", "video_url": "https://cdn.example.com/source_720p.mp4", "tool_version": "standard", "scene": "aigc", "resolution": "1080p", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "enhance-video-1.0", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` until `status === "completed"`. The completed payload's `output.video_urls` holds the enhanced MP4 URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; polling the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required Always `"enhance-video-1.0"`. ### `video_url` — required (string) Public HTTP/HTTPS URL of the source video. * **Allowed schemes:** `http://`, `https://` only. Base64 / `data:` URIs are rejected. * **Formats:** mp4, flv, ts, avi, mov, wmv, mkv (and most other mainstream containers). * **Size:** up to **10 GB** per file. * **Duration:** up to **2 hours**. * **Input resolution:** up to **2K** (short side ≤ 1440 px). Use `resolution: "4k"` to upscale beyond the source. ### `tool_version` — optional (`"lite"` | `"standard"` | `"professional"`) Default: `"standard"`. * **`lite`** — speed first. A lightweight super-resolution + enhancement pass tuned for latency-sensitive pipelines. Measured at roughly **3 – 6× faster than `standard`** on the same clip, at **\~27% of the credits**. It also applies the most aggressive denoise of the three tiers, so flat areas come out very clean — great for AI-generated footage, less faithful on grain-heavy or heavily textured source. * **`standard`** — balanced quality / speed. Internally runs \~10 frequently used algorithms; covers what most distribution platforms expect. The most conservative of the three: it adds detail without reshaping edges. * **`professional`** — maximum quality. Runs 30+ deep AI algorithms for shot-level enhancement, and preserves the source's own grain rather than smoothing it away. Slowest by a wide margin and **\~10× the credits of `standard`**. `lite` accepts a narrower parameter set — see the notes on `scene`, `enhance_style`, `bit_depth`, `resolution` and `resolution_limit` below. ### `scene` — optional (string) Selects a scene-tuned preset. Default: `"common"`. Takes effect on `tool_version: "standard"` only — it is accepted but ignored on `"professional"`, and **rejected** on `"lite"` (that tier has no scene presets). | Value | Recommended for | | -------------- | -------------------------------------------------------------------------------- | | `common` | General-purpose enhancement (no scene-specific tuning). | | `ugc` | Compressed UGC clips — fixes blocking, color banding, blur. | | `short_series` | Short-drama footage — face / detail enhancement, stylized contrast. | | `aigc` | Low-res AI-generated video — super-resolution + detail repaint. | | `old_film` | Aged film — temporal denoise, scratch removal, deflicker, color cast correction. | ### `resolution` — optional (string) Target output resolution. Mutually exclusive with `resolution_limit`. Allowed values: `240p`, `360p`, `480p`, `540p`, `720p`, `1080p`, `2k`, `4k`, `6k`, `8k`. `tool_version: "lite"` stops at `4k` — `6k` and `8k` are rejected on that tier. If unset, the output keeps the source resolution. ### `resolution_limit` — optional (integer) Lock the output **short-side** to this exact pixel count, then scale the long side to preserve the source ratio. Range `[128, 4320]` (`[128, 2160]` on `tool_version: "lite"`). Mutually exclusive with `resolution`. Use this when you need precise output dimensions (e.g. `resolution_limit: 720` with a 640×480 source produces 960×720). ### `fps` — optional (number) Target output frame rate, range `[15, 120]`. If unset, the output matches the source frame rate. Setting a value higher than the source triggers AI frame interpolation; staying within 4× the source is recommended for natural-looking motion. ### `enhance_style` — optional (`"hd"` | `"natural"`) Default: `"hd"`. Controls how hard the enhancement pushes. * **`hd`** — sharper, more contrast-forward. * **`natural`** — lower enhancement strength, fewer sharpening artifacts, a more natural look. Reach for this when `hd` output looks over-processed. Not supported on `tool_version: "lite"`. ### `bitrate_level` — optional (`"low"` | `"medium"` | `"high"`) Default: `"medium"`. Sets the output's target average bitrate, which drives both perceived quality and file size. **This does not change what you are billed** — pricing depends only on output resolution, frame-rate tier and duration. `"high"` is therefore free quality: in our measurements it raised the output bitrate about 27% over `"medium"` at identical cost. If you care about the result more than the file size, set it. ### `bitrate` — optional (integer) Exact target average bitrate in kbps, range `[10, 150000]`. When both this and `bitrate_level` are set, `bitrate` wins. Like `bitrate_level`, it has no effect on price. ### `bit_depth` — optional (`8` | `10` | `12` | `16`) Output colour depth. **Requires `tool_version: "professional"`** — rejected on the other tiers. | Value | Encoding | Container | | ------------- | -------- | --------- | | `8` (default) | H.264 | MP4 | | `10` | H.265 | MP4 | | `12` | H.265 | MP4 | | `16` | H.265 | **MOV** | At `16` the source must be **≤ 40 seconds**, `bitrate` / `bitrate_level` stop having any effect, and tasks are processed one at a time — expect a noticeably longer wait. ### `client_token` — optional (string) Client-supplied idempotency token. Up to 64 ASCII printable characters. The same token within a short window returns the same `task_id`. ### `callback_args` — optional (string) Opaque blob (≤ 512 bytes) you supply at submit time and receive back when the task completes (via the standard task envelope). Useful for stitching results back to your business records without storing the `task_id`. *** ## Output ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "enhance-video-1.0", "status": "completed", "created_at": 1735000000, "output": { "video_urls": [ "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4" ] }, "error": null } ``` The MP4 lives on our CDN — copy it to your own storage if you need long-term retention. *** ## Pricing Billed by **output duration × tier × resolution × fps tier**. The output duration always matches the source video duration (`enhance-video-1.0` does not change clip length). When you submit, the gateway probes your `video_url` server-side to determine the exact billable seconds and resolution bucket. If the URL is unreachable or returns no metadata, you receive a `400 Could not determine source video metadata for billing` and **no credits are charged**. The bill scales with three knobs: * **`tool_version`** — `lite` is roughly 27% the cost of `standard`; `professional` is roughly 10× the cost of `standard`. * **Output resolution bucket** — `720p` \< `1080p` \< `2k` \< `4k` \< `6k` \< `8k`, judged by the output short side. Each step doubles the cost. * **Output fps tier** — `≤ 30 fps` is the base rate, `30–60 fps` doubles it and `60–120 fps` quadruples it. If you don't pass `fps`, the output keeps the source frame rate, so the gateway bills the frame rate it probes from your `video_url` (a 60 fps upload bills at the `30–60 fps` tier). If the frame rate can't be read, the `30–60 fps` tier is used. See the live banner on the [model page](https://reapi.ai/models/enhance-video-1-0) for the current rate range in credits. *** ## Errors Standard envelope: ```json { "error": { "code": 20003, "message": "resolution and resolution_limit are mutually exclusive", "request_id": "req_..." } } ``` Common cases: | Code | When | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `20002` | `video_url` missing. | | `20003` | Invalid enum (`tool_version`, `scene`, `enhance_style`, `bitrate_level`, `bit_depth`, `resolution`), `resolution` + `resolution_limit` both set, a value outside `resolution_limit` `[128, 4320]` / `fps` `[15, 120]` / `bitrate` `[10, 150000]`, `bit_depth` without `tool_version: "professional"`, a `lite`-unsupported field (`scene` / `enhance_style` / `bit_depth` / `6k` / `8k`), or `video_url` not a public http(s) URL. | | `30002` | Source video metadata couldn't be probed (used for billing). | | `30001` | Insufficient credits for the probed source duration. | | `80003` | Provider rejected or failed the task (e.g. unsupported codec). | --- # Face Swap (https://reapi.ai/docs/face-swap) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Face Swap replaces the face in a **target photo** with the face from a > **source image**, keeping the target's pose, lighting and background. Two > public image URLs in, one image out; pin a seed to repeat a result. Submit > returns a `task_id`; poll until ready. Try it in the playground on the > [model page](https://reapi.ai/models/face-swap), which also shows current > pricing. Content filtering is always off on this model, and there is **no filter parameter**: the request schema has no `content_filter` field, and a request that includes it is rejected with `400`. Use it on people whose likeness you have the right to use; platform terms apply to everything you generate. Generated images are stored in an isolated bucket and their URLs stay valid for **30 days**. Mirror the files to your own storage if you need them longer. ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "face-swap", "image_url": "https://example.com/target-photo.jpg", "face_image_url": "https://example.com/source-face.jpg" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "face-swap", "image_url": "https://example.com/target-photo.jpg", "face_image_url": "https://example.com/source-face.jpg", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "face-swap", image_url: "https://example.com/target-photo.jpg", face_image_url: "https://example.com/source-face.jpg", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "face-swap", "image_url": "https://example.com/target-photo.jpg", "face_image_url": "https://example.com/source-face.jpg", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "face-swap", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the swapped image URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. Face Swap is **image-to-image only** — there is no prompt and no size control; the output keeps the target photo's frame. Each request produces **exactly one image** (no `n` parameter) and handles one still image (no video). *** ## Request body ### `model` — string, required Must be `face-swap`. ### `image_url` — string, required Public `http(s)` URL of the **target** photo: the image whose face will be replaced. Everything else in it — pose, framing, lighting, hair, background — is kept. Base64 and `data:` URIs are rejected. ### `face_image_url` — string, required Public `http(s)` URL of the **source** face: the face that is placed onto the target. A clear, front-facing shot in even light gives the strongest result. Base64 and `data:` URIs are rejected. ### `seed` — integer or null, optional Pin a seed to reproduce a result for the same two images. `0`, `null`, or omitting the field all mean a random seed. No range is enforced beyond it being an integer. *** ## Pricing Face Swap bills a flat rate **per generated image**, independent of the input sizes and of `seed`. Each request produces one image: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. Failed and rejected requests are not charged. The exact per-image credit cost surfaces on the [model page](https://reapi.ai/models/face-swap). *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "face-swap", "status": "completed", "output": { "image_urls": [ "https://...png" ] } } ``` Output URLs are valid for 30 days — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (a missing or non-`http(s)` `image_url` / `face_image_url`, a non-integer `seed`, or an unknown field such as `content_filter`) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. * Upstream could not detect a usable face or failed to generate → the task ends `failed` and the reserved credits are refunded. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * **Source face**: front-facing, evenly lit, unobstructed (no sunglasses, no hand over the mouth). The larger and sharper the face, the better the transfer. * **Target photo**: the face should be clearly visible and not tiny in the frame. Strong side angles and heavy occlusion weaken the swap. * **What stays**: hair, head shape, skin tone of the body, pose and background all come from the target. If you need the whole head replaced, that is a head swap, a different operation. * **Batches**: submit many tasks in parallel and poll the ids; pin `seed` when you want to re-create a specific result later. * Output URLs expire after 30 days — copy the file into your own storage as part of the same job. *** ## Related * [Z-Image Pro](/docs/z-image-pro) — text-to-image on the same API-key-only terms * [Qwen Image 3](/docs/qwen-image-3) — prompt-driven image editing * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # flux-2-pro (https://reapi.ai/docs/flux-2-pro) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Black Forest Labs' FLUX.2 on reAPI — photoreal **text-to-image** and > **multi-reference generation** (up to 8 images), output up to **4MP**, with > exact pixel dimensions when a preset will not do. Three tiers: > `flux-2-pro`, `flux-2-max` and `flux-2-flex-std`. Submit returns a task > `id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/flux-2-pro). Billing has **two terms**: the output resolution *and* every reference image you attach. See [Pricing](#pricing) before you budget for an image-to-image workload. ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-2-pro", "prompt": "a cinematic product photograph of an espresso machine", "resolution": "2MP", "size": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "flux-2-pro", "prompt": "a cinematic product photograph of an espresso machine", "resolution": "2MP", "size": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const resp = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'flux-2-pro', prompt: 'a cinematic product photograph of an espresso machine', resolution: '2MP', size: '16:9', }), }); console.log(await resp.json()); ``` ```go package main import ( "bytes" "fmt" "io" "net/http" ) func main() { body := []byte(`{ "model": "flux-2-pro", "prompt": "a cinematic product photograph of an espresso machine", "resolution": "2MP", "size": "16:9" }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "flux-2-pro", "status": "processing", "created_at": 1785323949 } ``` Poll `GET /api/v1/tasks/{task_id}` until `status` is `completed` or `failed`. *** ## Authentication ``` Authorization: Bearer YOUR_API_KEY ``` Create a key from your [dashboard](https://reapi.ai/settings/apikeys). *** ## Endpoint ``` POST https://reapi.ai/api/v1/images/generations ``` Submission is asynchronous — the call returns a task `id` immediately and the image is retrieved by polling the [Tasks API](/docs/api/tasks). *** ## Tiers | Model id | Positioning | | ----------------- | ------------------------------------------------------------- | | `flux-2-pro` | Balanced quality and speed. The production default. | | `flux-2-max` | Highest quality and detail, for work that gets scrutinised. | | `flux-2-flex-std` | Adds `steps` and `guidance` for direct control over sampling. | All three share one parameter set, except that `steps` and `guidance` are accepted **only** by `flux-2-flex-std`. reAPI also serves FLUX.2 through a second, independent surface under the `flux-2` and `flux-2-flex` model ids. That surface has a different parameter set and different tiers, and bills separately — see [flux-2](/docs/flux-2). The `-std` suffix here exists because the bare `flux-2-flex` id belongs to that other surface. *** ## Modes Mode is implicit in whether you send reference images: | Input | Mode | | ----------------------------- | -------------------------- | | `prompt` only | Text-to-image | | `prompt` + `image_urls` (1–8) | Reference-image generation | *** ## Request body ### `model` — string, required One of `flux-2-pro`, `flux-2-max`, `flux-2-flex-std`. ### `prompt` — string, required Description of the image to generate, or the edit to apply to the reference images. ### `resolution` — string, default `2MP` Output resolution tier: `1MP`, `2MP`, `3MP`, `4MP`. Applies when `size` is an aspect ratio. Legacy aliases are accepted and map onto the four tiers: `512` / `512P` / `1M` → `1MP`, `1K` / `1024` → `2MP`, `2K` / `2048` → `3MP`, `4K` → `4MP`. ### `size` — string, default `1:1` Output aspect ratio: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `3:2`, `2:3`, `21:9`, `9:21`. A pixel string such as `1024x1536` is also accepted and takes priority over `resolution`. ### `width` / `height` — integer, optional Exact output dimensions. **Must be sent as a pair** — one without the other is a `400`. Each side is at least 64 pixels, and `width × height` must not exceed 4 MP (4,194,304 pixels). A complete pair has the highest priority and overrides both `resolution` and `size`. ### `image_urls` — array, optional Up to 8 public `http(s)` image URLs. Base64 and `data:` URIs are rejected across the reAPI platform. Host input images at a publicly reachable URL first. The output plus all reference images must not exceed 9 MP combined. ### `output_format` — string, default `jpeg` `jpeg`, `png`, or `webp`. ### `n` — integer, default `1` `1` is the only supported value; submit concurrent requests for more. ### `seed` — integer, optional Fix the seed to make a generation reproducible. ### `prompt_upsampling` — boolean, default `false` When `true`, the model rewrites and expands your prompt before generating. ### `safety_tolerance` — integer, default `2` Moderation strictness from `0` (strictest) to `5` (most permissive). FLUX.2 caps this at `5`. The FLUX Kontext models allow `6` — the ranges are not interchangeable. ### `steps` — integer, optional — **`flux-2-flex-std` only** Sampling steps, `1`–`50`. Sending this to `flux-2-pro` or `flux-2-max` returns a `400`. ### `guidance` — number, optional — **`flux-2-flex-std` only** Prompt guidance, `1.5`–`10`. Higher values follow the prompt more closely. Sending this to `flux-2-pro` or `flux-2-max` returns a `400`. ### `fallback` — object, optional reAPI may serve a request on either of two upstreams and automatically retries on the second one if the first fails to deliver. Send `{"enabled": false}` to disable that retry and fail fast instead: ```json { "model": "flux-2-pro", "prompt": "A cinematic city at night", "fallback": { "enabled": false } } ``` Your price is unaffected either way — both upstreams bill the same rate for the same request. Turning the retry off trades availability for a faster failure. Some requests are served by a single upstream regardless, because only one of the two can honour them exactly and reAPI never relaxes a parameter to make a request routable: `steps`, `guidance`, `seed`, `width` / `height`, a pixel-string `size`, a `3MP` / `4MP` resolution, `prompt_upsampling: true`, an explicit `output_format`, or a `safety_tolerance` above `2`. *** ## Pricing FLUX.2 bills **two terms per request**: ``` credits = ceil((output_usd(tier, resolution) + n_refs × reference_usd(tier)) × 1000) ``` where `1 credit = $0.001 USD`. In words: 1. **Output** — priced by tier (`pro` / `max` / `flex`) × resolution (`1MP` … `4MP`). Aspect ratio does not change it. 2. **Reference images** — each *distinct* image in `image_urls` adds a per-image charge at the same tier. A request with three references costs meaningfully more than the same prompt with none. Repeating the same URL does not add a charge and does not add a second reference: duplicates collapse before the request is sent, so `[a, a, b]` is billed and generated as two references. Each request produces one image. Failed and rejected requests are not charged. Exact per-tier credit costs surface on the [model page](https://reapi.ai/models/flux-2-pro) and through the playground estimator before submit. *** ## Response ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "flux-2-pro", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...jpg" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (empty prompt, more than 8 `image_urls`, a non-http(s) URL, `width` without `height`, output over 4 MP, `safety_tolerance` outside 0–5, or `steps` / `guidance` on a non-Flex tier) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * Reference images are billed per image. If you are iterating on composition, drop to one reference while you explore and add the rest for the final pass. * Batch jobs that do not need detail should run at `1MP` — the resolution tier is the single biggest lever on cost. * Use `width` + `height` when a layout has fixed dimensions; it saves a downstream crop and guarantees the aspect the design expects. * Put text you want rendered in the image in quotes inside the prompt. * On the Flex tier, raise `guidance` when the render drifts from the prompt and raise `steps` when it looks under-detailed. Change one at a time. *** ## Related * [FLUX Kontext](/docs/flux-kontext) * [FLUX.2 (alternate surface)](/docs/flux-2) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # flux-2 (https://reapi.ai/docs/flux-2) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Black Forest Labs' FLUX.2 on reAPI — photoreal **text-to-image** and > **multi-reference editing** (up to 8 images), with accurate in-image text. > Two tiers: `flux-2` (Pro) and `flux-2-flex` (Flex). Submit returns a > `task_id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/flux-2). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-2", "prompt": "an infographic poster titled OPENING SOON, clean layout", "aspect_ratio": "3:4", "resolution": "2K" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "flux-2", "prompt": "an infographic poster titled OPENING SOON, clean layout", "aspect_ratio": "3:4", "resolution": "2K", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "flux-2", prompt: "an infographic poster titled OPENING SOON, clean layout", aspect_ratio: "3:4", resolution: "2K", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "flux-2", "prompt": "an infographic poster titled OPENING SOON, clean layout", "aspect_ratio": "3:4", "resolution": "2K", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "flux-2", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the generated image URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Tiers Two customer model ids share one parameter shape: | Model id | Tier | Notes | | ------------- | ---- | ------------------------------------------------------ | | `flux-2` | Pro | Production-ready, fast, lower price. The default tier. | | `flux-2-flex` | Flex | Maximum quality / detail, higher price. | ## Modes There is no `mode` field — the modality is implicit in the request shape: * **Text-to-image** — no `input_urls`. * **Image-to-image / multi-reference editing** — pass `input_urls` (1–8 reference images). FLUX.2 keeps characters, products, and styles consistent across the result. *** ## Request body ### `model` — string, required One of `flux-2` (Pro) or `flux-2-flex` (Flex). ### `prompt` — string, required **3–5,000 characters.** Put any text you want rendered in the image in quotes. ### `input_urls` — array, optional 1–8 reference images for image-to-image / multi-reference editing. **Public HTTPS URLs only** — base64 / `data:` URIs are rejected at the gateway. Passing any image switches the request to editing mode. ### `aspect_ratio` — string, default `1:1` One of `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `3:2`, `2:3`. The value `auto` (match the first reference image) is available **only for image-to-image**. `aspect_ratio: "auto"` requires `input_urls`. Using it without reference images (text-to-image) is rejected with `400`. ### `resolution` — string, default `1K` `1K` or `2K`. The `2K` tier renders up to 4MP. ### `content_filter` — boolean, optional, default `false` Enables upstream content moderation. Off by default. *** ## Pricing FLUX.2 bills a flat rate **per generated image**, by tier (`flux-2` / `flux-2-flex`) and resolution (`1K` / `2K`). Text-to-image and image-to-image cost the same within a tier: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. Each request produces one image. Failed and rejected requests are not charged. The exact per-image credit cost for each tier/resolution surfaces on the [model page](https://reapi.ai/models/flux-2) and through the playground estimator before submit. *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "flux-2", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...jpg" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (prompt outside 3–5000 chars, more than 8 `input_urls`, `auto` aspect without reference images, a non-HTTPS URL) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * Put the literal text you want rendered **in the prompt, in quotes** — FLUX.2 is tuned for legible typography, ad headlines, and infographics. * For consistency across a campaign, pass the same reference image(s) in `input_urls` and let FLUX.2 keep the character/style on-model. * Use `flux-2` (Pro) for fast, cost-efficient production and `flux-2-flex` (Flex) when a hero shot needs maximum quality. * Reach for `resolution: "2K"` (up to 4MP) only when the asset needs the detail. *** ## Related * [Image generation models](/docs/gpt-image-2) * [Qwen Image 2](/docs/qwen-image-2) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # FLUX 3 Image (https://reapi.ai/docs/flux-3-image) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; **FLUX 3 Image** creates or edits one image from a prompt and optional references. Use `model: "flux-3-image"` with `POST /api/v1/images/generations`, then poll `GET /api/v1/tasks/:id` until the task completes or fails. For moving images, use the separate [FLUX 3 Video reference](/docs/flux-3). See the [model page for current pricing](/models/flux-3-image#pricing). ## Quickstart ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-3-image", "prompt": "A studio photograph of a small amber glass vase on an ivory ceramic pedestal, soft daylight, no text.", "resolution": "768sq", "aspect_ratio": "1:1", "grounding": false }' ``` ```python import json import os import urllib.request payload = { "model": "flux-3-image", "prompt": "A studio photograph of an amber glass vase, soft daylight.", "resolution": "768sq", "aspect_ratio": "1:1", "grounding": False, } request = urllib.request.Request( "https://reapi.ai/api/v1/images/generations", data=json.dumps(payload).encode(), headers={"Authorization": "Bearer " + os.environ["REAPI_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=120) as response: task = json.load(response) print(task["id"]) ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: `Bearer ${process.env.REAPI_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'flux-3-image', prompt: 'A studio photograph of an amber glass vase, soft daylight.', resolution: '768sq', aspect_ratio: '1:1', grounding: false, }), }); const task = await response.json(); if (!response.ok) throw new Error(JSON.stringify(task.error)); console.log(task.id); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "time" ) func main() { body, err := json.Marshal(map[string]any{ "model": "flux-3-image", "prompt": "A studio photograph of an amber glass vase, soft daylight.", "resolution": "768sq", "aspect_ratio": "1:1", "grounding": false, }) if err != nil { panic(err) } req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + os.Getenv("REAPI_API_KEY")) req.Header.Set("Content-Type", "application/json") resp, err := (&http.Client{Timeout: 120 * time.Second}).Do(req) if err != nil { panic(err) } defer resp.Body.Close() result, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(result)) } fmt.Println(string(result)) } ``` ## Endpoint `POST https://reapi.ai/api/v1/images/generations` Send `Authorization: Bearer YOUR_API_KEY` and `Content-Type: application/json`. The response is JSON. ## Parameters | Field | Type | Required | Default | Accepted values | | ------------------ | --------- | -------- | ------- | ---------------------------------------------------------------------------- | | `model` | string | Yes | — | `flux-3-image` | | `prompt` | string | Yes | — | Non-empty scene or editing instruction; optional box table inside the string | | `image_urls` | string\[] | No | None | Up to 10 public HTTP(S) image URLs; order is significant | | `aspect_ratio` | string | No | `auto` | See the ratio list below; `16x9` notation also accepted | | `size` | string | No | — | Compatibility alias for `aspect_ratio`, not pixel dimensions | | `resolution` | string | No | `1k` | `768sq`, `1k`, `1.5k`, `2k`, `4k`; case-insensitive; `768` aliases `768sq` | | `safety_tolerance` | integer | No | `2` | `0`–`4`; higher values are more permissive | | `grounding` | boolean | No | `true` | Enable web and image search context; `false` disables it | | `n` | integer | No | `1` | Only `1` | The website playground allows `safety_tolerance` values `0`–`1`, with a default of `1`. Values `2`–`4` require an API key; API requests keep the documented default of `2`. Supported aspect ratios: `auto`, `21:9`, `2:1`, `16:9`, `3:2`, `7:5`, `4:3`, `5:4`, `1:1`, `4:5`, `3:4`, `5:7`, `2:3`, `9:16`, `1:2`, `9:21`. With references, `auto` uses the first reference's ratio; without them, it uses the prompt to infer a ratio and falls back to square. Prefer either `aspect_ratio` or `size`. When both are supplied, their normalized values must match. For example, `aspect_ratio: "16:9"` with `size: "16x9"` is valid; `size: "1024x1024"` is not. Resolution names describe tiers, so do not assume a fixed width and height for every aspect ratio. No base64 or data URLs are accepted. This endpoint does not expose `seed`, `width`, `height`, `steps`, `guidance`, `output_format`, `negative_prompt`, `prompt_upsampling`, `mask_url`, or `nsfw_check`. Unknown fields are rejected. ## Reference editing Supply one or more URLs and describe what should change and what should stay. References are indexed from zero: `ref_image_0` is the first URL, `ref_image_1` is the second. Keep their order stable, including repeated images. ```json { "model": "flux-3-image", "prompt": "Use ref_image_0 as the room. Replace the chair beside the window with the chair from ref_image_1. Keep the window, floor, and camera angle unchanged.", "image_urls": ["https://example.com/room.jpg", "https://example.com/chair.jpg"], "resolution": "1k", "grounding": false } ``` Replace the illustrative URLs with publicly accessible images you can use. Inspect the output; preservation of every untouched pixel is not guaranteed. ## Bounding-box prompts There is no separate `bbox` request field. Add named elements and the JSON table **inside the prompt string**. Coordinates are normalized `[top, left, bottom, right]` on a 0–1000 grid, not pixel coordinates. Boxes guide placement; they are not strict masks. For text-to-image layout, each entry has `id`, `bbox`, and `desc`: ```text An ivory product poster with a small amber bottle in the lower-right area and generous empty space on the left. [{"id":"bottle","bbox":[350,600,900,900],"desc":"small amber glass bottle"}] ``` For editing, entries have `id`, `from`, `src_bbox`, `tgt_bbox`, and `desc`. `from` identifies a reference, or is `null` for a new element. `src_bbox` is `null` when `from` is `null`: ```text Keep the scene from ref_image_0. Add a small amber bottle on the right. [{"id":"bottle","from":null,"src_bbox":null,"tgt_bbox":[350,600,900,900],"desc":"small amber glass bottle"}] ``` These are format illustrations, not guarantees of exact placement. For reference roles, source-to-target edits, and practical inspection steps, read the [FLUX 3 Image editing guide](/blog/flux-3-image-editing-guide). ## Polling and output Submission returns a task ID. Poll that same task; do not submit a second request just because the first is still processing. ```bash curl https://reapi.ai/api/v1/tasks/task_your_id \ -H "Authorization: Bearer $REAPI_API_KEY" ``` A completed task contains one URL in `output.image_urls` and its charge in `usage.credits`. A failed task contains `error.code` and `error.message`. Only use output after `status` is `completed`. 4K work can take several minutes; allow a ten-minute polling window, then check the existing task again rather than blindly resubmitting. Polling is not billed. ## Pricing Billing is **per completed image, by resolution**. The five tiers are 768SQ, 1K, 1.5K, 2K, and 4K. Reference-image count, aspect ratio, and grounding do not add separate charges for this model. The billing shape is: ```text credits = ceil(current per-image USD rate for the resolution × 1,000) ``` Account pricing or membership discounts may affect the current rate. See the [live pricing table and playground estimate](/models/flux-3-image#pricing) for your current quote. Failed generations are refunded. A new submission creates a new task and can incur a new charge, even if the prompt is identical. ## Errors and troubleshooting Errors use the shared envelope `{ error: { code, message, request_id } }`. Check [error codes](/docs/api/errors) for the complete catalog. | Code | Meaning | | --------------- | ----------------------------------------------- | | `10001`–`10004` | Missing, malformed, invalid, or revoked API key | | `20002` | Required parameter missing | | `20003` | Invalid parameter value, range, or type | | `20004` | Unsupported model on this endpoint | | `30001` | Insufficient credits | | `80001` | Submission failed | | `80002` | Task polling deadline reached | | `80003` | Terminal generation failure | | `80004` | Completed task has no output URL | ## Tips * Validation errors: check model ID, field names, ratio aliases, resolution, reference count, and real boolean values rather than quoted strings. * Unreadable references: use public HTTP(S) URLs that do not need cookies or authentication, and confirm that they return an image. * Moderation or generation failure: inspect the task error; do not repeatedly submit the same failing request. * Slow 4K work: keep polling the same task ID. A client polling timeout alone does not establish that the generation failed. ## Related * [FLUX 3 Image playground](/models/flux-3-image) * [Reference editing and bounding boxes](/blog/flux-3-image-editing-guide) * [FLUX.2 Pro](/docs/flux-2-pro) * [FLUX 3 Video](/docs/flux-3) --- # FLUX 3 (https://reapi.ai/docs/flux-3) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; **This reference covers video.** Use `model: "flux-3-video"` for motion and audio. Still-image generation and editing use the separate [FLUX 3 Image endpoint](/docs/flux-3-image), with `model: "flux-3-image"`. Action prediction and the open-weight backbone are not part of this endpoint. > FLUX 3 is Black Forest Labs' multimodal foundation model: images, video and > audio learned jointly inside one architecture built on Self-Flow. It > generates video with native audio — up to 20 seconds in a single generation — > follows keyframes, reference images, reference clips and existing > video-audio, speaks multilingual dialogue, and synthesizes and edits images > from the same backbone. ## Status Black Forest Labs' published rollout order, and what reAPI exposes today: | Stage | Capability | Access | | ----- | --------------------------------------------------- | --------------------------------------------- | | 1 | FLUX 3 Video — video + audio generation and editing | **Live on reAPI** as `flux-3-video` | | 2 | FLUX 3 Action / FLUX-mimic — action prediction | Selected research + commercial partners | | 3 | FLUX 3 Image — image synthesis and editing | Separate [image endpoint](/docs/flux-3-image) | | 4 | FLUX 3 Dev — open-weight multimodal backbone | After the phases above | Everything documented below applies to the video endpoint. Image generation has its own parameters and per-image billing in the [image reference](/docs/flux-3-image). ## Capabilities Published by Black Forest Labs for FLUX 3 Video. All outputs carry native audio generation. * **Text-to-video** — prompt in, video with sound out. * **Image-to-video** — continue from a starting frame ("animation"), or use images as visual references. * **Video continuation** — pick a source clip up where it stopped, carrying its audio forward with it. * **Video-audio continuation** — extend an existing video *and* its audio. * **Keyframe-to-video** — controlled transitions between defined moments. * **Multilingual dialogue** — spoken dialogue across languages. * **Typography** — strong text rendering and animated designs inside the frame. * **Draft then finalize** — render a cheap low-quality preview, then re-render that exact draft at full quality. Duration is an integer **5-20 seconds**. There is no multi-shot sequencing parameter on this endpoint — 20 seconds is a hard per-request ceiling. FLUX 3 Image adds synthesis and editing across styles, aspect ratios and resolutions, with high-accuracy text in multiple languages. ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-3-video", "prompt": "A rain-soaked cafe terrace at dusk, a tram rolls past", "duration": 10 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "flux-3-video", "prompt": "A rain-soaked cafe terrace at dusk, a tram rolls past", "duration": 10, }, timeout=30, ) task = resp.json() print(task["id"]) ``` ```js const resp = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'flux-3-video', prompt: 'A rain-soaked cafe terrace at dusk, a tram rolls past', duration: 10, }), }); const task = await resp.json(); console.log(task.id); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "flux-3-video", "prompt": "A rain-soaked cafe terrace at dusk, a tram rolls past", "duration": 10, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() var task map[string]any json.NewDecoder(resp.Body).Decode(&task) fmt.Println(task["id"]) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. ## Request body Mode is inferred from the media fields you set — prompt only is text-to-video, `image_urls` is keyframes, a video field is continuation — or you can state it with `mode`. An explicit `mode` wins over inference. | Field | Type | Default | Notes | | -------------------- | ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `flux-3-video`. **Required.** | | `prompt` | string | — | **Required**, except when finalizing a draft, where sending one is an error. | | `duration` | integer or fallback value | `5` | Integer seconds, `5`-`20`. Omission, `"auto"`, and other non-integer values use exactly 5 seconds for generation and billing; this is not automatic duration selection. Out-of-range integers are rejected. Omit this field when finalizing a draft. | | `resolution` | string | `hd` | `hd` or `fhd`; `720p` / `1080p` are accepted aliases. Draft renders at `hd` only. | | `aspect_ratio` | string | `auto` | `21:9`, `2:1`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, or `auto`. | | `image_urls` | string\[] | — | 1-10 keyframes. **Order is semantic**: one image is the start frame, two are start and end, three or more add evenly-spaced middles. Not sorted or deduped. | | `video_url` | string | — | Public MP4 URL to continue. | | `video_urls` | string\[] | — | Accepted alias for `video_url`; the first item is used. | | `audio` | boolean | `true` | Generated audio. `false` yields a silent clip and is **not** cheaper. | | `draft` | boolean | `false` | Cheap low-quality preview. `hd` only; mutually exclusive with `draft_from_task_id`. | | `draft_from_task_id` | string | — | Your reAPI task id for a **completed draft**. Only `resolution` may differ from that draft — prompt, duration and media are rejected. | | `safety_tolerance` | integer | `2` | `0`-`4`; higher is more permissive. The playground caps its control at `2`; `3` and `4` are API-only. | | `content_filter` | boolean | `false` for API calls | Enable pre-submit prompt and input-image moderation. `nsfw_check` is accepted as an alias, as is the legacy `nsfw_checker` name. Website requests keep moderation enabled. | | `mode` | string | inferred | `t2v`, `i2v`, `v2v`, `draft_enhance`, or the long forms `text-to-video`, `image-continuation`, `video-continuation`. Note `image-continuation` means image-to-video. | Send only one moderation field. If several are supplied, precedence is `content_filter`, then `nsfw_checker`, then `nsfw_check`. Values must be JSON booleans, not strings. API output generated with the filter disabled (including the default) uses separate storage with a 30-day retention period. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "flux-3-video", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/.../0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. `output.video_urls` holds the generated MP4 URL — audio is muxed into that file, not returned separately. ## Pricing FLUX 3 bills per second, and the per-second rate depends on three things together — the mode, the resolution, and whether it is a draft: | Tier | What triggers it | | ------------------ | ----------------------------------- | | Base | Text-to-video or keyframes at `hd` | | Base, fhd | Text-to-video or keyframes at `fhd` | | Draft | `draft: true` (always `hd`) | | Continuation | A video field is set, at `hd` | | Continuation, fhd | A video field is set, at `fhd` | | Continuation draft | `draft: true` with a video field | Continuation costs materially more than text-to-video at the same resolution, because the model has to process your source footage. Current rates for every tier are on the [model page](https://reapi.ai/models/flux-3) — that table is dynamic and always reflects the live price. The bill is: ``` credits = ceil(per_second_usd × billable_seconds × 1000) ``` where `1 credit = $0.001`. Failed jobs are refunded automatically. ## Errors FLUX 3 returns the platform's standard envelope: ```json { "error": { "code": "INVALID_REQUEST", "message": "duration must be at most 20", "request_id": "req_01hq2k..." } } ``` See the [errors catalog](/docs/api/errors) for the full code list and retry guidance. ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [FLUX.2 — available now](/docs/flux-2) * [Seedance 2.0 — available now](/docs/seedance-2-0) --- # flux-kontext (https://reapi.ai/docs/flux-kontext) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Black Forest Labs' FLUX Kontext on reAPI — **prompt-only image editing** > (no masks) and **text-to-image** generation from one endpoint, with strong > character consistency across iterative edits. Two tiers: > `flux-kontext-pro` and `flux-kontext-max`. Submit returns a task id in `id`; > poll until ready. See current pricing on the > [model page](https://reapi.ai/models/flux-kontext). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-kontext-pro", "prompt": "Replace the background with a rainy Tokyo street at night", "image_urls": ["https://example.com/portrait.jpg"], "size": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "flux-kontext-pro", "prompt": "Replace the background with a rainy Tokyo street at night", "image_urls": ["https://example.com/portrait.jpg"], "size": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const resp = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'flux-kontext-pro', prompt: 'Replace the background with a rainy Tokyo street at night', image_urls: ['https://example.com/portrait.jpg'], size: '16:9', }), }); console.log(await resp.json()); ``` ```go package main import ( "bytes" "fmt" "io" "net/http" ) func main() { body := []byte(`{ "model": "flux-kontext-pro", "prompt": "Replace the background with a rainy Tokyo street at night", "image_urls": ["https://example.com/portrait.jpg"], "size": "16:9" }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "flux-kontext-pro", "status": "processing", "created_at": 1785323949 } ``` Poll `GET /api/v1/tasks/{task_id}` until `status` is `completed` or `failed`. *** ## Authentication Every request needs a bearer token: ``` Authorization: Bearer YOUR_API_KEY ``` Create a key from your [dashboard](https://reapi.ai/settings/apikeys). *** ## Endpoint ``` POST https://reapi.ai/api/v1/images/generations ``` Submission is asynchronous — the call returns a task `id` immediately and the image is retrieved by polling the [Tasks API](/docs/api/tasks). *** ## Tiers | Model id | Positioning | | ------------------ | ----------------------------------------------------------------------------------------------------------- | | `flux-kontext-pro` | Fast and production-ready. Best balance of speed and quality; the sensible default for high-volume editing. | | `flux-kontext-max` | Highest output quality, with stronger typography and prompt adherence. | Both tiers accept an identical parameter set — switching is a one-field change. *** ## Modes The mode is implicit in whether you send reference images. There is no mode field and no second endpoint: | Input | Mode | | ----------------------------- | ------------- | | `prompt` only | Text-to-image | | `prompt` + `image_urls` (1–4) | Image editing | *** ## Request body ### `model` — string, required One of `flux-kontext-pro`, `flux-kontext-max`. ### `prompt` — string, required Description of the image to create, or the edit to apply to the reference images. ### `image_urls` — array, optional Up to 4 public `http(s)` image URLs. Presence switches the request into editing mode. Base64 and `data:` URIs are rejected across the reAPI platform. Host input images at a publicly reachable URL first. ### `size` — string, default `1:1` Output aspect ratio. Supported: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `3:2`, `2:3`, `21:9`, `9:21`. A pixel string such as `1300x800` is also accepted, but Kontext snaps it to the nearest supported ratio instead of producing those exact dimensions — so it gives you nothing the ratio list does not. Prefer the ratio. Every ratio renders at approximately 1 MP, so `size` changes shape but never resolution or price. `width` and `height` are **not** accepted by this model and are rejected with a `400`. `resolution` is accepted but has no effect — Kontext always renders at approximately 1 MP — so it is safe to leave in a request ported over from FLUX.2, but it will not change the output. ### `output_format` — string, default `png` Encoding of the returned image: `png`, `jpeg`, or `webp`. Omit it to take the model's own default, which is also `png`. ### `response_format` — string, optional OpenAI-compatibility field, accepting `url` or `b64_json`. It does not change the image encoding — `output_format` controls that and wins when both are sent. reAPI always returns the image as a URL in `output.image_urls`. ### `n` — integer, default `1` Images per request. `1` is the only supported value; submit concurrent requests when you need more. ### `seed` — integer, optional Fix the seed to make a generation reproducible. Omit for a random seed. ### `prompt_upsampling` — boolean, default `false` When `true`, the model rewrites and expands your prompt before generating. Leave it off when your wording is deliberate. ### `safety_tolerance` — integer, default `2` Moderation strictness from `0` (strictest) to `6` (most permissive), applied to both the input and the generated output. ### `fallback` — object, optional reAPI may serve a request on either of two upstreams and automatically retries on the second one if the first fails to deliver. Send `{"enabled": false}` to disable that retry and fail fast instead: ```json { "model": "flux-kontext-pro", "prompt": "Change the hair color to blue", "fallback": { "enabled": false } } ``` Your price is unaffected either way — both upstreams bill the same rate for the same request. Turning the retry off trades availability for a faster failure. *** ## Pricing FLUX Kontext bills a flat rate **per generated image**, by tier (`flux-kontext-pro` / `flux-kontext-max`). Aspect ratio is not a billing dimension — every ratio renders at \~1 MP — and editing costs the same as generating: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. Each request produces one image. Failed and rejected requests are not charged. The exact per-image credit cost for each tier surfaces on the [model page](https://reapi.ai/models/flux-kontext) and through the playground estimator before submit. *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "flux-kontext-pro", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...png" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (empty prompt, more than 4 `image_urls`, a non-http(s) URL, `safety_tolerance` outside 0–6, or sending `width` / `height`) → `400`. `resolution` is *not* in this list — it is accepted and ignored, as described under [`size`](#size--string-default-11). * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * For text replacement, use the explicit grammar the model is tuned for: `Replace 'old text' with 'new text'`. Capitalisation carries through, so write the replacement exactly as it should appear. * State what must **not** change ("keep the person and their lighting unchanged"). Naming the invariant is the most reliable way to keep an edit surgical. * Editing runs iteratively — feed a result back in as `image_urls` for the next change. Character identity is designed to survive that chain. * Pick `flux-kontext-pro` for volume and latency; reach for `flux-kontext-max` when in-image typography has to be exactly right. * Output is always \~1 MP. If you need larger assets, upscale downstream or use a model that renders at higher resolution natively. *** ## Related * [FLUX.2](/docs/flux-2) * [Image generation models](/docs/gpt-image-2) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # gemini-2.5-flash-image-preview (https://reapi.ai/docs/gemini-2-5-flash-image-preview) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Async image generation tuned for speed. One endpoint covers > text-to-image and image-to-image with up to 14 reference images. > Two channels share the same parameter shape: > > * `gemini-2.5-flash-image-preview` — default channel. > * `gemini-2.5-flash-image-preview-official` — Google's official endpoint. * Async processing — `POST` returns a `task_id`, poll `GET /api/v1/tasks/{id}` for the result. * standard `/api/v1/images/generations` envelope (text-to-image / image-to-image). * 10 ratios via `size`; only **1K** resolution on this model. * Up to **14** reference images via `image_urls` — public HTTP(S) URLs only. * One image per request (`n` is fixed at `1`). * Failed / moderated requests are not charged. *** ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "moonlight on a bamboo path, ink wash painting", "size": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gemini-2.5-flash-image-preview", "prompt": "moonlight on a bamboo path, ink wash painting", "size": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gemini-2.5-flash-image-preview", prompt: "moonlight on a bamboo path, ink wash painting", size: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-2.5-flash-image-preview", "prompt": "moonlight on a bamboo path, ink wash painting", "size": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-2.5-flash-image-preview", "status": "processing", "created_at": 1735000000 } ``` Hold onto `id` and poll `GET /api/v1/tasks/{id}` until completion. *** ## Endpoint ```http POST /api/v1/images/generations # submit a job GET /api/v1/tasks/{id} # poll for the result ``` Async — submit returns a `task_id` immediately; the actual image arrives via the polling endpoint. Polling is free. *** ## Authentication Bearer token, minted at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Body ### `model` `string` · **required** One of: * `"gemini-2.5-flash-image-preview"` — default channel. * `"gemini-2.5-flash-image-preview-official"` — Google's official endpoint. ### `prompt` `string` · **required** Up to **32,000 characters**. English and Chinese both supported. Don't restate the ratio in the prompt — pass it via `size`. Image-to-image is no exception — the prompt describes what to do with the reference. Sending `image_urls` without a `prompt` returns `400`. ### `size` `string` · default `"1:1"` (text-to-image) / inherited (image-to-image) Output ratio. One of these 10 values: ``` 1:1 2:3 3:2 3:4 4:3 4:5 5:4 9:16 16:9 21:9 ``` Anything outside the list is rejected with `400`. When `image_urls` is provided **without** `size`, the output inherits the first reference image's resolution (image-to-image mode). Pass `size` to force a specific ratio. ### `resolution` `string` · default `"1K"` Only `1K` is supported on this model. Sending `2K` / `4K` returns `400`. Switch to [`gemini-3-pro-image-preview`](/docs/gemini-3-pro-image-preview) or [`gemini-3.1-flash-image-preview`](/docs/gemini-3-1-flash-image-preview) when you need higher resolutions. ### `n` `integer` · default `1` Fixed at `1` — this model returns a single image per request. Must be a number, not a string. ### `image_urls` `string[]` · optional Reference images for image-to-image. Up to **14** entries. Each entry must be a public HTTP(S) URL — `data:` / base64 payloads are rejected at the gateway. Upload to your own object storage (S3 / R2 / OSS) and pass the URL. *** ## Use cases ### 1. Text-to-image (minimal) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "moonlight on a bamboo path, ink wash painting" }' ``` ### 2. Text-to-image, widescreen ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "a corgi astronaut on the moon, cinematic", "size": "16:9" }' ``` ### 3. Multiple variations This model returns exactly one image per request — `n` is fixed at `1`. For several variations, send separate requests; each is billed independently. ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "vintage botanical illustration, hibiscus", "size": "4:5" }' ``` ### 4. Image-to-image (single reference) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "turn this photo into a watercolor painting", "image_urls": ["https://your-cdn.com/photo.jpg"] }' ``` ### 5. Multi-reference fusion ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview", "prompt": "blend these two photos into a poster", "size": "4:3", "image_urls": [ "https://your-cdn.com/photo-a.jpg", "https://your-cdn.com/photo-b.jpg" ] }' ``` ### 6. Force the official channel ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-2.5-flash-image-preview-official", "prompt": "studio portrait of a tabby cat, soft light", "size": "1:1" }' ``` *** ## Response `POST` returns immediately with `status: "processing"`; poll `GET /api/v1/tasks/{id}` until `status` is `completed` or `failed`. Both responses share the same envelope — the `output` field is `null` until the task finishes. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-2.5-flash-image-preview", "status": "processing", "created_at": 1735000000 } ``` ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-2.5-flash-image-preview", "status": "completed", "created_at": 1735000000, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png"] }, "error": null } ``` URLs are stable for **7 days**. Download to your own storage if you need them longer. ```json { "error": { "code": 20003, "message": "gemini-2.5-flash-image-preview: only resolution=1K is supported", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 10003, "message": "API key invalid", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 30001, "message": "Insufficient credits", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 50001, "message": "Rate limit exceeded", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 60099, "message": "Internal error — please retry", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ### Upstream errors (502 / 503) reAPI does not surface raw upstream `5xx` codes to the caller. When the upstream provider returns `502 Bad Gateway`, `503 Service Unavailable`, or a connection failure, the worker retries up to 5 attempts with exponential backoff (\~30s total budget). If all retries fail, the task ends with one of these reapi-specific error codes (returned via `GET /api/v1/tasks/{id}` as `error.code`): | reapi code | Meaning | Origin | | ---------- | -------------------------- | ------------------------------------ | | `80001` | `provider_submit_failed` | Upstream `5xx` / network on submit | | `80002` | `provider_polling_timeout` | Wall-clock cap reached while polling | | `80003` | `provider_failed` | Upstream returned a terminal failure | See [Errors catalog](/docs/api/errors) for the full code list. *** ## Polling | `status` | Meaning | | ------------ | ----------------------------- | | `processing` | Submitted, still generating | | `completed` | `output.image_urls` is ready | | `failed` | See `error.code`; not charged | Recommended cadence: ``` 0–10s: wait before the first poll 10s–60s: poll every 2–3s 60s+: back off to 5s; cap at 15s ``` A 1K image typically completes in 5 – 20 seconds. *** ## Related * [`gemini-3-pro-image-preview`](/docs/gemini-3-pro-image-preview) — higher-quality variant with 1K / 2K / 4K resolutions. * [`gemini-3.1-flash-image-preview`](/docs/gemini-3-1-flash-image-preview) — newer variant with extreme ratios and Google search grounding. * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Pricing — gemini-2.5-flash-image-preview](https://reapi.ai/models/gemini-2-5-flash-image-preview#pricing) --- # gemini-3.1-flash-image-preview (https://reapi.ai/docs/gemini-3-1-flash-image-preview) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Async image generation with a wide ratio surface (down to > 1:8 / 8:1) and optional Google search grounding. One endpoint covers > text-to-image and image-to-image with up to 14 reference images. Two > channels share the same parameter shape: > > * `gemini-3.1-flash-image-preview` — default channel. > * `gemini-3.1-flash-image-preview-official` — Google's official endpoint. * Async processing — `POST` returns a `task_id`, poll `GET /api/v1/tasks/{id}` for the result. * standard `/api/v1/images/generations` envelope (text-to-image / image-to-image). * 14 ratios via `size`, including extreme `1:4` / `4:1` / `1:8` / `8:1`. * Four resolution tiers via `resolution`: `0.5K` / `1K` / `2K` / `4K`. * Up to **14** reference images via `image_urls` — public HTTP(S) URLs only. * Up to **4** images per request via `n`. * Optional Google search grounding via `google_search` and `google_image_search`. *** ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "neon-lit cyberpunk skyline at midnight", "size": "16:9", "resolution": "2K" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gemini-3.1-flash-image-preview", "prompt": "neon-lit cyberpunk skyline at midnight", "size": "16:9", "resolution": "2K", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gemini-3.1-flash-image-preview", prompt: "neon-lit cyberpunk skyline at midnight", size: "16:9", resolution: "2K", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-3.1-flash-image-preview", "prompt": "neon-lit cyberpunk skyline at midnight", "size": "16:9", "resolution": "2K", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3.1-flash-image-preview", "status": "processing", "created_at": 1735000000 } ``` Hold onto `id` and poll `GET /api/v1/tasks/{id}` until completion. *** ## Endpoint ```http POST /api/v1/images/generations # submit a job GET /api/v1/tasks/{id} # poll for the result ``` Async — submit returns a `task_id` immediately; the actual image arrives via the polling endpoint. Polling is free. *** ## Authentication Bearer token, minted at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Body ### `model` `string` · **required** One of: * `"gemini-3.1-flash-image-preview"` — default channel. * `"gemini-3.1-flash-image-preview-official"` — Google's official endpoint. ### `prompt` `string` · **required** Up to **32,000 characters**. Detailed prompts produce better results. English and Chinese both supported. Don't restate the ratio in the prompt — pass it via `size`. Image-to-image is no exception — the prompt describes what to do with the reference. Sending `image_urls` without a `prompt` returns `400`. ### `size` `string` · default `"1:1"` (text-to-image) / inherited (image-to-image) Output ratio. One of these 14 values: ``` 1:1 2:3 3:2 3:4 4:3 4:5 5:4 9:16 16:9 21:9 1:4 4:1 1:8 8:1 ``` `1:4` / `4:1` / `1:8` / `8:1` are useful for tall posters, banner ads, and long-strip social formats. Anything outside the list is rejected with `400`. ### `resolution` `string` · default `"1K"` `0.5K` / `1K` / `2K` / `4K`. Case-insensitive — `"2K"` and `"2k"` are equivalent. ### `n` `integer` · default `1` 1 – 4 images per request. Must be a number, not a string. ### `image_urls` `string[]` · optional Reference images for image-to-image. Up to **14** entries. Each entry must be a public HTTP(S) URL — `data:` / base64 payloads are rejected at the gateway. Recommended split: ≤ 10 object references + ≤ 4 character references for best consistency. ### `google_search` `boolean` · default `false` When `true`, the model first searches the web for textual context to ground the generated image in real-world facts. Useful for prompts that reference recent events, named entities, or specific places. Adds an extra search round-trip — budget extra polling time. ### `google_image_search` `boolean` · default `false` When `true`, the model also searches the web for **image** references in addition to text. **Requires `google_search: true`** — sending `google_image_search: true` with `google_search: false` (or omitted) returns `400`. *** ## Use cases ### 1. Text-to-image (minimal) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "neon-lit cyberpunk skyline at midnight" }' ``` ### 2. Long-banner poster (extreme ratio) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "long horizontal banner of a serene lakeside at sunrise", "size": "8:1", "resolution": "2K" }' ``` ### 3. Tall mobile-first poster ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "vertical movie poster, lone astronaut on a frozen moon", "size": "1:4", "resolution": "2K" }' ``` ### 4. Search-grounded generation ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "the Eiffel Tower lit up for Bastille Day fireworks", "size": "16:9", "resolution": "2K", "google_search": true, "google_image_search": true }' ``` ### 5. Image-to-image with reference ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "stylize this product photo as a vintage magazine cover", "image_urls": ["https://your-cdn.com/product.jpg"], "size": "4:5", "resolution": "2K" }' ``` ### 6. Multi-reference fusion ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "place subject from reference 1 into the scene of reference 2", "size": "16:9", "resolution": "4K", "image_urls": [ "https://your-cdn.com/subject.jpg", "https://your-cdn.com/scene.jpg" ] }' ``` ### 7. Low-cost preview at 0.5K ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3.1-flash-image-preview", "prompt": "concept thumbnail of a forest temple", "size": "1:1", "resolution": "0.5K", "n": 4 }' ``` *** ## Response `POST` returns immediately with `status: "processing"`; poll `GET /api/v1/tasks/{id}` until `status` is `completed` or `failed`. Both responses share the same envelope — the `output` field is `null` until the task finishes. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3.1-flash-image-preview", "status": "processing", "created_at": 1735000000 } ``` ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3.1-flash-image-preview", "status": "completed", "created_at": 1735000000, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png"] }, "error": null } ``` URLs are stable for **7 days**. Download to your own storage if you need them longer. ```json { "error": { "code": 20003, "message": "gemini-3.1-flash-image-preview: google_image_search requires google_search:true", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 10003, "message": "API key invalid", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 30001, "message": "Insufficient credits", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 50001, "message": "Rate limit exceeded", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 60099, "message": "Internal error — please retry", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ### Upstream errors (502 / 503) reAPI does not surface raw upstream `5xx` codes to the caller. When the upstream provider returns `502 Bad Gateway`, `503 Service Unavailable`, or a connection failure, the worker retries up to 5 attempts with exponential backoff (\~30s total budget). If all retries fail, the task ends with one of these reapi-specific error codes (returned via `GET /api/v1/tasks/{id}` as `error.code`): | reapi code | Meaning | Origin | | ---------- | -------------------------- | ------------------------------------ | | `80001` | `provider_submit_failed` | Upstream `5xx` / network on submit | | `80002` | `provider_polling_timeout` | Wall-clock cap reached while polling | | `80003` | `provider_failed` | Upstream returned a terminal failure | See [Errors catalog](/docs/api/errors) for the full code list. *** ## Polling | `status` | Meaning | | ------------ | ----------------------------- | | `processing` | Submitted, still generating | | `completed` | `output.image_urls` is ready | | `failed` | See `error.code`; not charged | Recommended cadence: ``` 0–15s: wait before the first poll 15s–2m: poll every 3–5s 2m+: back off to 10s; cap at 30s ``` A 1K image typically completes in 10 – 30 seconds; 4K and Google search grounding both add latency. *** ## Related * [`gemini-2.5-flash-image-preview`](/docs/gemini-2-5-flash-image-preview) — earlier variant (1K only). * [`gemini-3-pro-image-preview`](/docs/gemini-3-pro-image-preview) — higher-fidelity variant without search grounding. * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Pricing — gemini-3.1-flash-image-preview](https://reapi.ai/models/gemini-3-1-flash-image-preview#pricing) --- # gemini-3-6-flash (https://reapi.ai/docs/gemini-3-6-flash) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Google's Gemini 3.6 Flash is a multimodal model with a **1,048,576-token** > input window and a documented **65,536-token** model output ceiling. The > current reAPI endpoint exposes a deliberately smaller, pure-text Chat > Completions surface: `system`, `user`, and `assistant` messages with string > content, optional streaming, and an **8,192-token** billing-safety output cap. > Google's model supports image, video, audio, and PDF input plus function > calling and other tools, but those capabilities are not currently exposed by > this reAPI endpoint. Output is text only; this is not an image-generation > model. The wire `model` id is `gemini-3.6-flash`. Current rates live on the > [model page](https://reapi.ai/models/gemini-3-6-flash). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-3.6-flash", "messages": [ { "role": "user", "content": "Summarise the benefits of API rate limiting in five bullets." } ], "stream": true, "max_tokens": 8192 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gemini-3.6-flash", messages=[{"role": "user", "content": "Summarise the benefits of API rate limiting in five bullets."}], max_tokens=8192, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gemini-3.6-flash", messages: [ { role: "user", content: "Summarise the benefits of API rate limiting in five bullets." }, ], max_tokens: 8192, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-3.6-flash", "messages": []map[string]string{ {"role": "user", "content": "Summarise the benefits of API rate limiting in five bullets."}, }, "max_tokens": 8192, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use an API key from your current reAPI account and send it as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create and manage the key from your reAPI workspace. The request is billed to the reAPI account that owns that key. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Public URL `https://reapi.ai/api/v1/chat/completions`. For OpenAI SDKs, set the base URL to `https://reapi.ai/api/v1`. The current wire format is compatible with the exposed pure-text subset of Chat Completions, so the same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once you set the base URL, your reAPI key, and the model string. *** ## Parameter support on this model The request body is forwarded as written, so any Chat Completions field reaches the model. These are the ones this model answers differently — each verified by calling it on 2026-08-25: | Field | Result | | --------------------------------------------------------------- | ------------------------------------------------------------------ | | `temperature`, `top_p`, `seed`, `n`, `tools`, `response_format` | Applied | | `reasoning_effort` | Accepts `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` | | `frequency_penalty`, `presence_penalty`, `stop` | Applied | | `max_tokens` / `max_completion_tokens` | Up to 8,192 | Nothing in the Chat Completions format is rejected by this model; every field tested was accepted. ## Request body ### `model` — string, required Must be `gemini-3.6-flash` exactly. The dotted form is the wire id; the `/models/gemini-3-6-flash` landing page uses a hyphenated slug for the URL. ### `messages` — array, required Conversation history in the standard Chat Completions shape. The gateway requires only that the array is present and non-empty; the entries themselves are forwarded as written, so message fields, roles, and content-part arrays follow the upstream model's contract rather than a separate gateway rule. ### `max_tokens` / `max_completion_tokens` — integer Upper bound on output tokens for this response, **thinking tokens included**. The current reAPI billing-safety cap is **8,192**, even though Google's model ceiling is higher. A value above 8,192 is **rejected with a 400** — the gateway never silently rewrites a request into a different cost than the one you asked for. `max_tokens` is deprecated in the OpenAI spec in favour of `max_completion_tokens`; both are accepted here, and when both are present the smaller one wins. ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. Recommended for anything a person watches. ### Every other field The request body is forwarded as written. Send any field the Chat Completions format defines — `temperature`, `top_p`, `frequency_penalty`, `presence_penalty`, `seed`, `stop`, `reasoning_effort`, `logit_bias`, `logprobs`, `response_format`, `tools`, `tool_choice`, `n`, and so on — with the types and ranges that format defines. The gateway does not keep a field whitelist, so a parameter added to the format later works here without waiting for a gateway release. Two consequences worth stating plainly: * omit a field and the model's own default applies — nothing is substituted for you; * send a value the model does not accept and you get the model's error, not a reworded gateway one. Verified working through this endpoint: function calling (`tools` returns `tool_calls` with `finish_reason: "tool_calls"`) and JSON mode (`response_format: { "type": "json_object" }`). ### `stream_options` Accepted but always overridden: the endpoint sends `stream_options: { include_usage: true }` upstream, because the usage frame is what the request is billed from. A request that suppressed it could not be billed at all. *** ## Official multimodal capability vs current endpoint Google documents the following model-level inputs. The gateway forwards content parts as written, so what reaches the model is what you sent: | Modality | Google model | Through this endpoint | | -------- | :----------: | :---------------------: | | Text | Supported | Verified working | | Image | Supported | Forwarded, not verified | | Video | Supported | Forwarded, not verified | | Audio | Supported | Forwarded, not verified | | PDF | Supported | Forwarded, not verified | Output is **text only**. Image generation is not supported by this model; use a dedicated image model when the result itself must be an image. *** ## Thinking Thinking is a Google model capability. `reasoning_effort` is forwarded like every other field, and the model may also reason internally without being asked to. **Thinking tokens are billed as output tokens** and count toward `max_tokens`. A reasoning pass therefore competes with the visible answer inside the current 8,192-token cap. *** ## Official tools vs current endpoint | Capability | Google model | Through this endpoint | | -------------------------- | ------------------- | ------------------------------------ | | Function calling | Supported | Verified working (`tools`) | | Structured outputs | Supported | Verified working (`response_format`) | | Code execution | Supported | Forwarded, not verified | | File search | Supported | Forwarded, not verified | | Context caching | Supported | Forwarded, not verified | | URL context | Supported | Forwarded, not verified | | Search grounding | Supported | Forwarded, not verified | | Grounding with Google Maps | Supported | Forwarded, not verified | | Computer use | Supported (preview) | Forwarded, not verified | "Forwarded, not verified" means the request reaches the model untouched — the gateway blocks nothing — but we have not tested that capability end to end, so treat the model's own response as the answer on whether it works. These rows describe Google's underlying model, not callable features on the current reAPI route. Requests to this endpoint should contain only the documented pure-text chat fields above. *** ## Pricing dimensions Billing is **per token** against your current reAPI account, with separate **input** and **output** rates. Two things to keep in mind: * **Thinking tokens bill as output.** They are the usual reason a bill exceeds an estimate built from visible response length alone. * **Output can dominate.** For generative workloads, response length and any thinking tokens can materially affect the final charge. Current rates are on the [model page](https://reapi.ai/models/gemini-3-6-flash). That live table is the canonical pricing source; this page intentionally does not duplicate a fixed price. Charges are applied to the reAPI account that owns the API key used for the request. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "gemini-3.6-flash", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 812, "completion_tokens": 240, "total_tokens": 1052 } } ``` `usage.completion_tokens` includes thinking tokens, so it is the number to reconcile a bill against. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use reAPI's standard error envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ------------------------------- | ------------------------------------------------------------- | | Missing or invalid bearer token | Use a valid API key from your reAPI workspace | | Unknown `model` value | Send `gemini-3.6-flash` exactly, dots included | | Non-string message content | Send pure text in each message's `content` field | | Unsupported request field | Remove fields outside the documented current endpoint surface | | Insufficient account balance | Top up the reAPI account that owns the API key | | Upstream rate limit | Retry with backoff, or route through another model | *** ## Tips * **Stream anything interactive.** Time-to-first-token is what users perceive; a non-streamed long answer reads as a hang. * **Budget for thinking.** If responses truncate on hard prompts, use a `max_tokens` value up to the current 8,192-token cap and ask for a more concise answer when necessary. * **Send source text directly.** The current endpoint does not accept image, audio, video, or PDF content parts. * **Keep requests to the documented subset.** The current route is a pure-text Chat Completions surface rather than the full Google model API. * **Pin the Stable string.** `gemini-3.6-flash` is Google's Stable channel id; `latest`-style aliases can be hot-swapped underneath you. *** ## Related * [Gemini 3.6 Flash model page](https://reapi.ai/models/gemini-3-6-flash) — current rates * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gemini-3-pro-image-preview (https://reapi.ai/docs/gemini-3-pro-image-preview) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Async high-quality image generation. One endpoint covers > text-to-image and image-to-image with up to 14 reference images. > Two channels share the same parameter shape: > > * `gemini-3-pro-image-preview` — default channel. > * `gemini-3-pro-image-preview-official` — Google's official endpoint. * Async processing — `POST` returns a `task_id`, poll `GET /api/v1/tasks/{id}` for the result. * standard `/api/v1/images/generations` envelope (text-to-image / image-to-image). * 10 ratios via `size`; three resolution tiers (`1K` / `2K` / `4K`) via `resolution`. * Up to **14** reference images via `image_urls` — public HTTP(S) URLs only. * One image per request (`n` is fixed at `1`). * Failed / moderated requests are not charged. *** ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "ancient castle beneath a starry sky, cinematic", "size": "16:9", "resolution": "2K" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gemini-3-pro-image-preview", "prompt": "ancient castle beneath a starry sky, cinematic", "size": "16:9", "resolution": "2K", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gemini-3-pro-image-preview", prompt: "ancient castle beneath a starry sky, cinematic", size: "16:9", resolution: "2K", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-3-pro-image-preview", "prompt": "ancient castle beneath a starry sky, cinematic", "size": "16:9", "resolution": "2K", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3-pro-image-preview", "status": "processing", "created_at": 1735000000 } ``` Hold onto `id` and poll `GET /api/v1/tasks/{id}` until completion. *** ## Endpoint ```http POST /api/v1/images/generations # submit a job GET /api/v1/tasks/{id} # poll for the result ``` Async — submit returns a `task_id` immediately; the actual image arrives via the polling endpoint. Polling is free. *** ## Authentication Bearer token, minted at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Body ### `model` `string` · **required** One of: * `"gemini-3-pro-image-preview"` — default channel. * `"gemini-3-pro-image-preview-official"` — Google's official endpoint. ### `prompt` `string` · **required** Up to **32,000 characters**. Detailed prompts produce better results. English and Chinese both supported. Don't restate the ratio in the prompt — pass it via `size`. Image-to-image is no exception — the prompt describes what to do with the reference. Sending `image_urls` without a `prompt` returns `400`. ### `size` `string` · default `"1:1"` (text-to-image) / inherited (image-to-image) Output ratio. One of these 10 values: ``` 1:1 2:3 3:2 3:4 4:3 4:5 5:4 9:16 16:9 21:9 ``` Anything outside the list is rejected with `400`. When `image_urls` is provided **without** `size`, the output inherits the first reference image's resolution (image-to-image mode). Pass `size` to force a specific ratio. ### `resolution` `string` · default `"1K"` `1K` / `2K` / `4K`. Case-insensitive — `"2K"` and `"2k"` are equivalent. ### `n` `integer` · default `1` Fixed at `1` — this model returns a single image per request. Must be a number, not a string. ### `image_urls` `string[]` · optional Reference images for image-to-image. Up to **14** entries. Each entry must be a public HTTP(S) URL — `data:` / base64 payloads are rejected at the gateway. Upload to your own object storage (S3 / R2 / OSS) and pass the URL. *** ## Use cases ### 1. Text-to-image (minimal) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "ancient castle beneath a starry sky, cinematic" }' ``` ### 2. Text-to-image at 2K ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "neon-lit Tokyo street in the rain, cyberpunk", "size": "16:9", "resolution": "2K" }' ``` ### 3. Text-to-image at 4K ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "cinematic mountain valley at golden hour", "size": "21:9", "resolution": "4K" }' ``` ### 4. Image-to-image (single reference) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "convert this snapshot into a film-grain editorial shot", "image_urls": ["https://your-cdn.com/photo.jpg"], "resolution": "2K" }' ``` ### 5. Multi-reference fusion ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview", "prompt": "blend the subject from photo A with the lighting of photo B", "size": "4:3", "resolution": "2K", "image_urls": [ "https://your-cdn.com/photo-a.jpg", "https://your-cdn.com/photo-b.jpg" ] }' ``` ### 6. Force the official channel ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gemini-3-pro-image-preview-official", "prompt": "marble bust of a philosopher, dramatic side lighting", "size": "1:1", "resolution": "2K" }' ``` *** ## Response `POST` returns immediately with `status: "processing"`; poll `GET /api/v1/tasks/{id}` until `status` is `completed` or `failed`. Both responses share the same envelope — the `output` field is `null` until the task finishes. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3-pro-image-preview", "status": "processing", "created_at": 1735000000 } ``` ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-3-pro-image-preview", "status": "completed", "created_at": 1735000000, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png"] }, "error": null } ``` URLs are stable for **7 days**. Download to your own storage if you need them longer. ```json { "error": { "code": 20003, "message": "gemini-3-pro-image-preview: invalid resolution \"8K\"", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 10003, "message": "API key invalid", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 30001, "message": "Insufficient credits", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 50001, "message": "Rate limit exceeded", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 60099, "message": "Internal error — please retry", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ### Upstream errors (502 / 503) reAPI does not surface raw upstream `5xx` codes to the caller. When the upstream provider returns `502 Bad Gateway`, `503 Service Unavailable`, or a connection failure, the worker retries up to 5 attempts with exponential backoff (\~30s total budget). If all retries fail, the task ends with one of these reapi-specific error codes (returned via `GET /api/v1/tasks/{id}` as `error.code`): | reapi code | Meaning | Origin | | ---------- | -------------------------- | ------------------------------------ | | `80001` | `provider_submit_failed` | Upstream `5xx` / network on submit | | `80002` | `provider_polling_timeout` | Wall-clock cap reached while polling | | `80003` | `provider_failed` | Upstream returned a terminal failure | See [Errors catalog](/docs/api/errors) for the full code list. *** ## Polling | `status` | Meaning | | ------------ | ----------------------------- | | `processing` | Submitted, still generating | | `completed` | `output.image_urls` is ready | | `failed` | See `error.code`; not charged | Recommended cadence: ``` 0–30s: wait before the first poll 30s–3m: poll every 3–5s 3m+: back off to 10s; cap at 30s ``` A 1K image typically completes in 30 – 60 seconds; 2K adds \~30s; 4K can take 90 – 120 seconds. *** ## Related * [`gemini-2.5-flash-image-preview`](/docs/gemini-2-5-flash-image-preview) — faster, cheaper variant (1K only). * [`gemini-3.1-flash-image-preview`](/docs/gemini-3-1-flash-image-preview) — newer variant with extreme ratios and Google search grounding. * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Pricing — gemini-3-pro-image-preview](https://reapi.ai/models/gemini-3-pro-image-preview#pricing) --- # gemini-4-argon (https://reapi.ai/docs/gemini-4-argon) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Use `gemini-4-argon` with reAPI's native Google GenerateContent endpoints; see the [model page](/models/gemini-4-argon) for current availability and pricing. ## Quick example These examples make one non-streaming request without automatic retries or continuation. Your reAPI key belongs in `x-goog-api-key`; a Google account key is not required. Python uses the standard library. The JavaScript example uses `@google/genai` 2.29.1 with explicit retry and continuation controls. ```bash curl https://reapi.ai/api/v1beta/models/gemini-4-argon:generateContent \ -H "x-goog-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [{"role":"user","parts":[{"text":"Review this design and suggest a minimal verification plan."}]}], "generationConfig": { "maxOutputTokens": 4096, "thinkingConfig": {"thinkingLevel":"medium"} } }' ``` ```python import json from urllib.request import Request, urlopen body = { "contents": [{"role": "user", "parts": [{"text": "Review this design and suggest a minimal verification plan."}]}], "generationConfig": { "maxOutputTokens": 4096, "thinkingConfig": {"thinkingLevel": "medium"}, }, } request = Request( "https://reapi.ai/api/v1beta/models/gemini-4-argon:generateContent", data=json.dumps(body).encode("utf-8"), headers={"x-goog-api-key": "YOUR_API_KEY", "Content-Type": "application/json"}, method="POST", ) with urlopen(request, timeout=120) as response: result = json.load(response) print(json.dumps(result, indent=2)) ``` ```js import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY", httpOptions: { baseUrl: "https://reapi.ai/api", apiVersion: "v1beta", retryOptions: { attempts: 1 }, }, }); const response = await ai.models.generateContent({ model: "gemini-4-argon", contents: "Review this design and suggest a minimal verification plan.", config: { maxOutputTokens: 4096, thinkingConfig: { thinkingLevel: "medium" }, automaticContinuation: false, }, }); console.log(response.text); ``` ```go package main import ( "bytes" "fmt" "io" "net/http" ) func main() { body := []byte(`{ "contents":[{"role":"user","parts":[{"text":"Review this design and suggest a minimal verification plan."}]}], "generationConfig":{"maxOutputTokens":4096,"thinkingConfig":{"thinkingLevel":"medium"}} }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1beta/models/gemini-4-argon:generateContent", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("x-goog-api-key", "YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out)) } ``` ## Endpoints and authentication | Method | URL | Response | | ------ | --------------------------------------------------------------------------------- | ----------- | | `POST` | `https://reapi.ai/api/v1beta/models/gemini-4-argon:generateContent` | Native JSON | | `POST` | `https://reapi.ai/api/v1beta/models/gemini-4-argon:streamGenerateContent?alt=sse` | Native SSE | Send `Content-Type: application/json` and `x-goog-api-key: YOUR_API_KEY`. `Authorization: Bearer YOUR_API_KEY` and the Google-compatible `?key=YOUR_API_KEY` parameter are also accepted. Prefer the header examples. An explicitly supplied Google key takes precedence over bearer or browser-session credentials. Create your key in [API Keys](/settings/apikeys). The JavaScript Google SDK base URL is **`https://reapi.ai/api`**, with **`apiVersion: "v1beta"`**. The SDK adds `/v1beta/models/gemini-4-argon:generateContent`, or its streaming equivalent. Do not put `/v1beta` in both the base URL and API version. Direct HTTP clients use the complete endpoint shown above. Choose streaming by endpoint, not a `stream` body field. `generateContent` returns JSON; `streamGenerateContent?alt=sse` returns `text/event-stream`. There is no asynchronous task ID or task polling. This integration exposes these generation methods, not Google's Files, cache-management, Interactions, or token-counting APIs. ## Request parameters The native JSON body is forwarded unchanged, including unknown fields and nested schemas. This inventory describes Google's request format; it is not a field allowlist. The model service determines parameter acceptance and behavior. Authentication, billing admission, request size, and the platform media policy remain separate checks. The model is selected in the URL. Do not replace `contents` with OpenAI `messages` or put `reasoning_effort` in a native request. | Field | Type | Required / default | Meaning | | ------------------- | -------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `contents` | Content array | Required | Conversation history plus the current input; each content has `role` (`user` or `model`) and `parts` | | `tools` | Tool array | Optional; omitted | Native function declarations and supported built-in tools | | `toolConfig` | object | Optional; omitted | Native function-calling and other tool configuration | | `safetySettings` | array | Optional; model defaults | Per-category thresholds; Google permits at most one setting per category | | `continuationToken` | string | Optional; omitted | Opaque checkpoint token returned by a candidate; reuse the original contents when continuing | | `labels` | string-valued object | Optional; omitted | Request metadata; Google specifies lowercase letters, digits, underscores and dashes, at most 63 characters per key/value, with keys beginning with a letter | | `systemInstruction` | Content object | Optional; omitted | Top-level text instructions, such as `{"parts":[{"text":"Be concise."}]}` | | `generationConfig` | object | Optional; model defaults | Output budget, thinking, stop sequences, schemas and other generation settings | | `cachedContent` | string | Optional; omitted | Explicit cache resource; Google documents explicit caching as unsupported on Argon. The field still passes through | | `serviceTier` | string enum | Optional; standard | `unspecified`, `standard`, `flex`, `priority`; availability depends on the model service | | `store` | boolean | Optional; omitted | Google request-logging control; reAPI does not add a default | For media, use native `fileData` parts with a public HTTP(S) `fileUri` and the correct `mimeType`. `inlineData`, base64 media and `data:` media URIs are not accepted. Opaque thought signatures and continuation tokens are protocol state, not media inputs; preserve them exactly. Google documents image, audio, video and PDF inputs for Argon and text output. A format's presence in the generic API does not establish model-specific availability. ### generationConfig All fields below are optional. Unless stated, omission leaves the model default in effect; reAPI does not fill in a sampling setting or rewrite a schema. | Field | Type | Documented behavior | | ----------------------------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `maxOutputTokens` | integer | Thinking plus output budget; REST defaults/per-request caps are 32,768 for JSON and 65,536 for SSE. Larger budgets can require continuation. Input, thinking and output share 1,048,576 tokens | | `thinkingConfig` | object | `thinkingLevel`: `low`, `medium` (Argon default), `high`; `includeThoughts` requests available thought summaries. `thinkingBudget` is deprecated; Google rejects combining budget and level | | `stopSequences` | string array | Up to five sequences; the matched sequence is excluded from output | | `responseMimeType` | string | `text/plain` by default; `application/json` and `text/x.enum` are documented alternatives | | `responseJsonSchema` | JSON value | JSON Schema output constraint; forward the complete schema, with support determined by Google | | `responseSchema` | object | Legacy output schema, deprecated in the current reference; do not combine with `responseJsonSchema` | | `_responseJsonSchema` | JSON value | Deprecated compatibility field; prefer the documented public output-format fields | | `responseFormat` | object | Current Google reference's per-modality format configuration; model support varies | | `responseModalities` | string array | Omitted/empty requests text; Argon is a text-output model | | `candidateCount` | integer | Generic reference default 1; model-specific behavior is determined upstream | | `temperature`, `topP`, `topK` | number, number, integer | The current Google reference says these are ignored on Gemini 3.6 Flash and newer models; they still pass through | | `seed` | integer | Optional decoding seed; omission leaves selection to the service | | `presencePenalty`, `frequencyPenalty` | number | Native repetition settings; model behavior varies | | `responseLogprobs` | boolean | Requests candidate log probabilities where supported | | `logprobs` | integer | 0–20 alternatives in the generic reference; requires `responseLogprobs` | | `mediaResolution` | string enum | `MEDIA_RESOLUTION_UNSPECIFIED`, `MEDIA_RESOLUTION_LOW`, `MEDIA_RESOLUTION_MEDIUM`, `MEDIA_RESOLUTION_HIGH`; support depends on media and model | | `enableEnhancedCivicAnswers`, `enableAffectiveDialog` | boolean | Generic Google options; model availability varies | | `speechConfig`, `imageConfig` | object | Generic output configurations; their presence does not mean Argon generates audio or images | | `translationConfig`, `audioTranscriptionConfig` | object | Generic task configurations; model availability varies | The [Google GenerateContent reference](https://ai.google.dev/api/generate-content) defines nested content, tool, safety and configuration objects. All nested and additional fields remain accessible through the request JSON. ### Structured output This native configuration requests an object matching a JSON Schema: ```json { "generationConfig": { "responseMimeType": "application/json", "responseJsonSchema": { "type": "object", "properties": {"answer": {"type": "string"}}, "required": ["answer"], "additionalProperties": false } } } ``` ### OpenAI-compatible requests Existing OpenAI clients can use `POST https://reapi.ai/api/v1/chat/completions`, an OpenAI SDK base URL of `https://reapi.ai/api/v1`, and bearer authentication. That body uses `model`, `messages`, `stream` and the OpenAI parameter names. Keep it separate from the native body above. Google documents the compatibility mapping `reasoning_effort: minimal → low`, `low → low`, `medium → medium`, and `high → high`. Prefer the native `generationConfig.thinkingConfig` format when working directly with Gemini-specific settings and signed parts. A parameter being accepted does not prove its effect. [Google OpenAI compatibility](https://ai.google.dev/gemini-api/docs/openai#thinking). OpenAI compatibility is partial on reAPI for this model. The current `reasoning_effort` compatibility requests can fail; use the native Gemini endpoints and `thinkingConfig` for the verified integration. ## Pricing dimensions SaaS calculates the charge from the response's `usageMetadata` and the configured token rates frozen when the request starts. JSON and SSE use the same billing path. Rates and current availability are shown on the [model page](/models/gemini-4-argon). Explicit caching is not supported on Argon; do not assume that a repeated prompt produced an implicit cache hit unless usage reports it. Each continuation is a separate HTTP request with its own usage and charge. reAPI performs one generation attempt per request, with no automatic retries or continuation loop. Your application's SDK can otherwise issue additional requests, which is why the examples disable both behaviors. ### Bill formula Input usage is `promptTokenCount + toolUsePromptTokenCount`; output usage is `candidatesTokenCount + thoughtsTokenCount`. Cached input is already included in the prompt count. With rates expressed per token, `billed_usd = (input_tokens − cached_tokens) × input_rate + cached_tokens × cache_read_rate + output_tokens × output_rate`. Use the applicable reAPI rates, including the configured price group. If no separate cache-read rate is configured, cached input uses the normal input rate. A configured long-context tier applies when its input threshold condition is met. This token calculation adds no separate flat tool fee. For SSE, the final cumulative usage is settled once after complete delivery; usage counts from successive chunks are not added together. Thinking tokens are included once, even when thought summaries are hidden. A separate fee field or fee event is not required. The final billed USD amount is rounded upward to micro-units: `micro_units = ceil(billed_usd × 1,000,000)`, then `credits = micro_units / 1,000`. One credit equals $0.001; token requests are not rounded up to a whole credit individually. Failed delivery, cancellation, incomplete streams, or missing trusted usage follow the no-charge settlement path. ## Responses, tools and continuation | Field | Meaning | | --------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | `candidates[]` | Native response candidates; inspect each candidate's `content`, `finishReason` and optional `continuationToken` | | `content.parts[]` | Text, thought summaries, signed parts, function calls and other native output parts | | `usageMetadata` | Prompt, candidate, thinking, cached-content and applicable tool-use token counters | | `promptFeedback` | Prompt blocking/safety feedback when returned | | `groundingMetadata`, `citationMetadata` | Candidate-level grounding or citation data when returned | | `modelVersion`, `responseId` | Model and response identifiers when supplied | Text comes from candidate parts with `text`; parts marked `thought: true` are thought summaries. Preserve the complete model `content` for later turns, including `thoughtSignature`, part ordering and `functionCall` objects. Do not reconstruct a signed turn from the displayed text alone. Your application executes client functions and sends `functionResponse` parts in a subsequent `user` content. reAPI does not execute those functions. When supplying Python callables to the Google SDK, set `automatic_function_calling=types.AutomaticFunctionCallingConfig(disable=True)` if your application must control each tool round trip explicitly. For streaming, change the curl URL to `:streamGenerateContent?alt=sse` and add `--no-buffer`. Each SSE `data:` frame contains a native JSON response fragment. The stream ends at EOF, with **no OpenAI `[DONE]` sentinel**. Read in-stream error frames and `finishReason`; do not interpret any received text as proof that the stream completed. `CONTINUATION` means the per-request cap was reached before generation finished. The candidate supplies an opaque `continuationToken`; it can have no visible text if the hop was spent thinking. To continue, make another request with the original contents unchanged and that token. If resuming after `MAX_TOKENS`, raise `maxOutputTokens`. Keep the token intact; do not generate or decode it yourself. [Google's Argon and long-output guidance](https://ai.google.dev/gemini-api/docs/generate-content/latest-model). ## Errors Native errors use Google's shape, with an HTTP status code and status name: ```json { "error": { "code": 400, "message": "Request body must be a JSON object.", "status": "INVALID_ARGUMENT" } } ``` The response includes a `request-id` header for support. Native model error details are preserved where returned. OpenAI-compatible errors retain that endpoint's separate format. | HTTP status | Native status | Meaning | | ----------- | --------------------- | -------------------------------------------------------------- | | 400 | `INVALID_ARGUMENT` | Invalid JSON/request or a model-rejected parameter combination | | 401 | `UNAUTHENTICATED` | Missing or invalid reAPI key | | 402 | `FAILED_PRECONDITION` | Insufficient balance for admission | | 403 | `PERMISSION_DENIED` | Access denied | | 404 | `NOT_FOUND` | Unknown model or method | | 413 | `INVALID_ARGUMENT` | Request body exceeds 32 MB | | 429 | `RESOURCE_EXHAUSTED` | Rate or concurrency limit | | 502 | `INTERNAL` | Invalid response or incomplete delivery | | 503 | `UNAVAILABLE` | Service or pricing unavailable | | 504 | `DEADLINE_EXCEEDED` | Request deadline exceeded | An error can arrive inside an already-open SSE stream. Handle it before treating the result as complete. See the [platform error catalog](/docs/api/errors) for the other reAPI surfaces. ## Tips * Start with medium thinking and an explicit output budget appropriate to the task. Thinking consumes that budget even when summaries are not requested. * Keep original signed parts for tool turns and keep the original request separately for continuation. * Use native JSON for Gemini-specific tools and generation settings. Do not paste OpenAI field names into a native request. * Use public media URLs and their actual MIME types; this API does not upload files to Google for you. * Inspect usage and finish reasons. HTTP 200 alone does not verify grounding, caching, schema adherence, or a particular parameter's effect. ## Related * [Gemini 4 Argon model page](/models/gemini-4-argon) * [Gemini 3.6 Flash](/docs/gemini-3-6-flash) * [Authentication](/docs/api/authentication) * [Machine-readable OpenAPI](/openapi.json) Official references reviewed 2026-10-14: [GenerateContent](https://ai.google.dev/api/generate-content), [Argon model](https://ai.google.dev/gemini-api/docs/models/gemini-4-argon), [thinking](https://ai.google.dev/gemini-api/docs/generate-content/thinking), [JavaScript HTTP options](https://googleapis.github.io/js-genai/release_docs/interfaces/types.HttpOptions.html), [JavaScript retry options](https://googleapis.github.io/js-genai/release_docs/interfaces/types.HttpRetryOptions.html), [JavaScript continuation](https://googleapis.github.io/js-genai/release_docs/interfaces/types.GenerateContentConfig.html#automaticcontinuation), [Python SDK types](https://googleapis.github.io/python-genai/genai.html). --- # gemini-omni-1-1 (https://reapi.ai/docs/gemini-omni-1-1) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Gemini Omni 1.1 — the versioned successor of [`gemini-omni`](/docs/gemini-omni), > exposed through reapi as a single async endpoint. Mode is implicit: the > counts of `image_urls` / `video_urls` pick **text-to-video**, > **image-to-video**, **three-image fusion**, or **reference-to-video**. > What 1.1 adds: a **360p draft tier**, a `generation_type` switch that > decides whether one image is a locked first frame or a reference, and a > `content_filter` control. 4 to 10 second outputs at 360p, 720p, 1080p, or > 4K. Flat per-generation pricing across every mode — see the > [model page](https://reapi.ai/models/gemini-omni-1-1). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-omni-1-1", "prompt": "A ginger cat hops onto a sunlit kitchen counter, slow dolly-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gemini-omni-1-1", "prompt": "A ginger cat hops onto a sunlit kitchen counter, slow dolly-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gemini-omni-1-1", prompt: "A ginger cat hops onto a sunlit kitchen counter, slow dolly-in", duration: 6, resolution: "1080p", aspect_ratio: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-omni-1-1", "prompt": "A ginger cat hops onto a sunlit kitchen counter, slow dolly-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_01a04cbf7c25765daf9e00404ce84dc6", "model": "gemini-omni-1-1", "status": "processing", "created_at": 1787994015 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL, valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## What changed from `gemini-omni` Same endpoint, same request shape, same task polling. Switching is a one-line change in the `model` field. The differences: | Area | `gemini-omni` | `gemini-omni-1-1` | | ----------------- | --------------------------------------- | ------------------------------------------------------------------------ | | `resolution` | `720p` / `1080p` / `4k` | `360p` / `720p` / `1080p` / `4k` — 360p is a draft tier priced like 720p | | `generation_type` | not available (one image = first frame) | `frame` or `reference` — you choose how images are used | | `content_filter` | not available | boolean, pre-submit moderation of prompt + images | | Price | see its model page | lower at every resolution × duration tier | Google's announcement also lists scene extension and first-plus-last-frame interpolation; neither is exposed on this endpoint yet. *** ## Mode routing `gemini-omni-1-1` picks its mode from the **counts of `image_urls` and `video_urls`** you send — there is no `mode` parameter. `generation_type` then decides what the images mean: | `image_urls` | `video_urls` | `generation_type` | Mode | What it does | | ------------ | ------------ | ------------------------ | ---------------------- | ------------------------------------------------------------------------ | | `0` | `0` | — | **Text-to-video** | Generate from a prompt. | | `1` | `0` | `frame` (or omitted) | **Image-to-video** | The image is the locked first frame; animate from it. | | `1` | `0` | `reference` | **Reference image** | The image guides subject / style without pinning frame 1. | | `3` | `0` | `reference` (or omitted) | **Three-image fusion** | Combine three references into one motion shot. | | `0` / `1` | `1` | omitted or `reference` | **Reference-to-video** | Reference a source clip (≤ 30s) for motion / style. Flat per generation. | **Unsupported combinations.** * `image_urls = 2` is **rejected** with `400 image_urls cardinality 2 is not supported`. Submit 0, 1, or 3 — there is no first/last-frame pair on `gemini-omni-1-1`. * `image_urls = 4` or more is also rejected. * `generation_type = "frame"` needs **exactly one** image, and cannot be combined with `video_urls`. * `generation_type = "reference"` needs **1 or 3** images. * `video_urls = 2` or more is **rejected** with `400 video_urls accepts at most 1 entry`. * `duration` and `video_urls` cannot both be set. Reference-to-video mode reads the source clip's length; passing `duration` alongside is rejected with `400 duration and video_urls cannot both be set`. *** ## Request body ### `model` — required `string`. Must be `"gemini-omni-1-1"`. ### `prompt` — string, required Up to **2,000 characters**. Required in every mode. Empty / whitespace-only prompts are treated as missing. **Failure modes.** * Empty / missing → `400 prompt is required` (code `20002`). * Longer than 2,000 chars → `400 prompt exceeds 2000 characters` (code `20007`). ### `duration` — integer, default `6` One of `4`, `6`, `8`, `10` seconds. Other values are rejected with `400 duration must be one of 4, 6, 8, 10`. **Reference-to-video mode ignores `duration`.** When `video_urls` is set, the output follows the source clip's length and `duration` must be omitted. Passing both is rejected with `400 duration and video_urls cannot both be set`. ### `resolution` — string, default `"720p"` `360p` / `720p` / `1080p` / `4k`. Lowercase is canonical; uppercase forms (`"4K"`) are accepted and normalized. Drives the per-generation rate — 360p, 720p and 1080p share the same price; only 4K is uplifted. **360p is the draft tier.** Use it to iterate on prompts, framing and motion, then resend the same request at `1080p` or `4k` for the keeper. Drafts are billed as completed generations at the 720p rate. ### `aspect_ratio` — string, default `"16:9"` Output framing. One of: | Value | Shape | | ------ | --------- | | `16:9` | Landscape | | `9:16` | Portrait | Unknown ratios are rejected with `400 invalid aspect_ratio`. ### `size` — string, alias for `aspect_ratio` Accepted for parity with `gemini-omni`. If both are sent, they must match; otherwise `400 aspect_ratio and size disagree`. The reapi playground does not surface `size`; the JSON body still accepts it. ### `generation_type` — string, optional How `image_urls` are used. Omit to keep the upstream default. | Value | Images accepted | Meaning | | ----------- | --------------- | --------------------------------------------------------------------- | | `frame` | exactly `1` | The image is the **first frame**; the clip animates from it. | | `reference` | `1` or `3` | The images are **subject / style references**; frame 1 is not pinned. | `frame` cannot be combined with `video_urls`. Other values are rejected with `400 invalid generation_type`. ### `image_urls` — string\[] Array of public HTTP(S) URLs. **Allowed counts: 0, 1, or 3**. * **0 entries** — text-to-video. * **1 entry** — image-to-video (`frame`) or single reference (`reference`). * **3 entries** — three-image fusion (`reference`). ### `video_urls` — string\[] Array of public HTTP(S) URLs. **Allowed counts: 0 or 1**. * **0 entries** — non-reference modes (text / image / fusion). * **1 entry** — reference-to-video. The source clip drives the output; it must be **≤ 30 seconds** (longer is rejected with `400`). Billed at a **flat per-generation rate** (not per second). `duration` MUST be omitted in this mode; `generation_type = "frame"` is not allowed. ### `content_filter` — boolean, optional Pre-submit moderation of the prompt and input images. Omit to keep the upstream default. When `true`, a request that trips the filter is refused before any generation runs and nothing is charged. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field on this endpoint must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_01a04cbf7c25765daf9e00404ce84dc6", "model": "gemini-omni-1-1", "status": "completed", "created_at": 1787994015, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/task_01a04cbf7c25765daf9e00404ce84dc6/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ---------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Always `"gemini-omni-1-1"` (echo of the submitted `model`) | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days**. Re-host to your own storage if you need them longer. *** ## Validation errors All cases below return HTTP 400 with code `20003` unless noted. Pattern-match on `code`, not `message` — message strings carry request-specific context and are not a stable contract. | Trigger | Code | Message (illustrative) | | ------------------------------------------------------ | ------- | -------------------------------------------------------------------------------- | | `prompt` missing or blank | `20002` | `prompt is required` | | `prompt` longer than 2,000 chars | `20007` | `prompt exceeds 2000 characters` | | `image_urls` length `2` | `20003` | `image_urls cardinality 2 is not supported` | | `image_urls` length > `3` | `20003` | `image_urls accepts at most 3 entries` | | `generation_type = "frame"` with 0 or 3 images | `20003` | `generation_type=frame requires exactly 1 image_urls entry` | | `generation_type = "reference"` with 0 images | `20003` | `generation_type=reference requires 1 or 3 image_urls entries` | | `generation_type = "frame"` together with `video_urls` | `20003` | `generation_type=frame cannot be combined with video_urls` | | `duration` not one of 4/6/8/10 | `20003` | `duration must be one of 4, 6, 8, 10` | | Unknown `resolution` | `20003` | `invalid resolution "X" (allowed: 360p / 720p / 1080p / 4k)` | | Unknown `aspect_ratio` | `20003` | `invalid aspect_ratio "X" (allowed: 16:9 / 9:16)` | | `aspect_ratio` and `size` disagree | `20003` | `aspect_ratio and size disagree; pass one or set them to the same value` | | `duration` together with `video_urls` | `20003` | `duration and video_urls cannot both be set` | | `image_urls` carrying a `data:` URI or non-http(s) | `20003` | `image_urls entries must be public http(s) URLs` | | `video_urls` source clip longer than 30 seconds | `20003` | `Reference video must be at most 30s (got Ns); trim the clip before submitting.` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### 360p draft, then the 4K keeper Send the draft first: ```json { "model": "gemini-omni-1-1", "prompt": "Macro shot of a butterfly landing on a pale pink blossom, golden backlight", "duration": 6, "resolution": "360p", "aspect_ratio": "16:9" } ``` When the take works, change one field: ```json { "model": "gemini-omni-1-1", "prompt": "Macro shot of a butterfly landing on a pale pink blossom, golden backlight", "duration": 6, "resolution": "4k", "aspect_ratio": "16:9" } ``` ### Image-to-video — lock the first frame ```json { "model": "gemini-omni-1-1", "prompt": "A ginger cat hops onto the counter and sniffs the plate, slow dolly-in", "generation_type": "frame", "image_urls": ["https://your-cdn.com/first_frame.jpg"], "duration": 6, "resolution": "1080p" } ``` ### Single reference image — guide the subject, free the framing ```json { "model": "gemini-omni-1-1", "prompt": "The same character walking through a rainy neon street, tracking shot", "generation_type": "reference", "image_urls": ["https://your-cdn.com/character.jpg"], "duration": 8, "resolution": "1080p" } ``` ### Three-image fusion ```json { "model": "gemini-omni-1-1", "prompt": "A man rides a wooden bicycle through the village market, handheld tracking shot", "generation_type": "reference", "image_urls": [ "https://your-cdn.com/village.jpg", "https://your-cdn.com/character.jpg", "https://your-cdn.com/bicycle.jpg" ], "duration": 10, "resolution": "1080p", "aspect_ratio": "16:9" } ``` ### Reference-to-video — match a source clip ```json { "model": "gemini-omni-1-1", "prompt": "the same scene but at night with neon lights", "resolution": "720p", "aspect_ratio": "16:9", "video_urls": ["https://your-cdn.com/source.mp4"] } ``` The output tracks the source clip (which must be **≤ 30s**); **omit `duration`** and do not set `generation_type = "frame"`. Billing is a flat per-generation rate (see [Pricing](#pricing) below). ### With the content filter on ```json { "model": "gemini-omni-1-1", "prompt": "A product spot for a ceramic mug on a wooden table, soft daylight", "content_filter": true, "duration": 4, "resolution": "720p" } ``` *** ## Choosing a mode | Need | Send | | ---------------------------------------- | ---------------------------------------------------------------- | | Generate from text | `prompt` only | | Animate a still from its first frame | `prompt + image_urls` (1 entry) + `generation_type: "frame"` | | Keep a subject but reframe the shot | `prompt + image_urls` (1 entry) + `generation_type: "reference"` | | Compose scene + character + product | `prompt + image_urls` (3 entries) | | Match an existing clip's motion / length | `prompt + video_urls` (1 entry, no `duration`) | | Iterate cheaply | `resolution: "360p"` and `duration: 4` | | Hero shot | `resolution: "4k"` at `4–10s` | *** ## Polling pattern The task endpoint behaves identically to other video tasks — the only difference is the completed `output` shape (`video_urls` instead of `image_urls`). A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in about two minutes. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Pricing Two billing modes — picked by request shape. ### Per generation — text / image / fusion Charged once per submitted job. 360p, 720p and 1080p share the same rate at every duration; only 4K is uplifted. Duration tiers are `4s` / `6s` / `8s` / `10s`. See current per-tier rates on the [Gemini Omni 1.1 model page](https://reapi.ai/models/gemini-omni-1-1). ### Flat per generation — reference-to-video Triggered when `video_urls` is set. Charged once per job at a flat rate by resolution — independent of clip length. 360p, 720p and 1080p share the same rate; 4K is uplifted. The source clip must be **≤ 30 seconds**: the gateway probes its decoded length server-side and rejects longer clips with `400`. See current rates on the [Gemini Omni 1.1 model page](https://reapi.ai/models/gemini-omni-1-1). ### Bill formula `1 credit = $0.001`. Integer credits = `ceil(usd × 1000)`. Failed jobs refund automatically. *** ## Tips * **Draft at 360p, ship at 1080p or 4K.** Same price as 720p, faster to render; the request body does not change between draft and final. * **Say what the image is for.** `frame` when the still must be frame 1 (product shots, storyboards); `reference` when you want the subject but a new framing. * **Prompt motion, not just scene.** "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen. * **Three-image fusion needs cohesive references.** Pick three images that share lighting and composition cues. * **Keep reference clips ≤ 30s** and omit `duration` — the server rejects requests that pass both. *** ## Related * [Gemini Omni (1.0)](/docs/gemini-omni) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gemini-omni-1-2 (https://reapi.ai/docs/gemini-omni-1-2) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Google's Gemini Omni 1.2 Flash, live on reAPI. One model id, > `gemini-omni-1-2`, covers text to video, image to video, first and last > frame interpolation, subject references, editing a clip and extending one. > Every clip has sound and renders at `360p`, `720p`, `1080p` or `4k`; a new > clip runs 3–15 seconds, and an extension returns its source followed by up > to 10 new seconds. See current pricing on the > [model page](https://reapi.ai/models/gemini-omni-1-2). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-omni-1-2", "prompt": "A glass marble rolls fast along a wooden chain-reaction track through a sunlit workshop, one continuous smooth tracking shot. No text, no logos.", "resolution": "720p", "duration": 8, "aspect_ratio": "16:9" }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gemini-omni-1-2", "prompt": "A glass marble rolls fast along a wooden chain-reaction track through a sunlit workshop, one continuous smooth tracking shot. No text, no logos.", "resolution": "720p", "duration": 8, "aspect_ratio": "16:9", }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'gemini-omni-1-2', prompt: 'A glass marble rolls fast along a wooden chain-reaction track through a sunlit workshop, one continuous smooth tracking shot. No text, no logos.', resolution: '720p', duration: 8, aspect_ratio: '16:9', }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "gemini-omni-1-2", "prompt": "A glass marble rolls fast along a wooden chain-reaction track through a sunlit workshop, one continuous smooth tracking shot. No text, no logos.", "resolution": "720p", "duration": 8, "aspect_ratio": "16:9" }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | — | `gemini-omni-1-2`. **Required.** | | `prompt` | string | — | **Required in every mode**: the shot, the change for an edit, or what happens next for an extension. Describe the sound too; put negative instructions here. | | `duration` | integer | `10` | `3`–`15` seconds. At most `10` with first and last frames and for an extension (the added part). Ignored by an edit, which keeps the source length. | | `resolution` | string | `720p` | `360p` / `720p` / `1080p` / `4k` (`2160p` means `4k`), case-insensitive. `1080p` and `4k` are upsampled. | | `aspect_ratio` | string | `16:9` | `16:9` or `9:16`. | | `image_urls` | string\[] | — | One image is the start frame; several are subject references. Up to 10 images in total, frames and role images included. | | `first_frame_image` | string | — | The clip opens on this image; with `last_frame_image` the model interpolates between the two. | | `last_frame_image` | string | — | The clip ends on this image. Needs a first frame. | | `image_with_roles` | object\[] | — | `{"url", "role"}` with role `first_frame`, `last_frame`, or any other role for a reference. Give frames this way or with the two frame fields, not both. | | `video_urls` | string\[] | — | One clip of at most 15 seconds to edit or extend. | | `omni_reference_task_type` | string | `auto` | `auto` / `edit` / `extend` / `reference` / `text_to_video` / `image_to_video` / `reference_to_video`. | | `extend_from_task_id` | string | — | The id of one of your completed `gemini-omni-1-2` tasks, to edit or extend its video without uploading it. | Every clip comes with sound; there is no sound switch. There is no `negative_prompt`, `seed` or audio input. Unknown fields are refused rather than ignored. Checked by reAPI before anything is charged: * every media field is a public HTTP(S) URL — base64 and `data:` URIs are rejected * `resolution` is one of the four values, and `duration` is a positive whole number * the video to edit or extend can be measured (its length sets the bill — see [Pricing](#pricing)) * `extend_from_task_id` names a completed `gemini-omni-1-2` task of yours Every other rule on this page — image counts, frame combinations, mode limits, source length — is checked by the model when the task starts. A request that breaks one ends as a failed task with code `80007` and the exact reason, and is refunded in full. ## Modes | Mode | How to select it | | -------------------- | ----------------------------------------------------------------------------------------------------------- | | Text to video | No images and no video. | | Image to video | One image in `image_urls`, or a first frame. | | First and last frame | `first_frame_image` and `last_frame_image`, or the two roles. At most 10 seconds. | | References | Several images in `image_urls`, or reference roles; `omni_reference_task_type: "reference"` to be explicit. | | Edit | A video in `video_urls` or `extend_from_task_id`; `auto` or `edit`. | | Extend | A video as above and `omni_reference_task_type: "extend"`. Adds up to 10 seconds. | A video input edits unless you ask for `extend`; with a video, `reference`, `text_to_video`, `image_to_video` and `reference_to_video` are refused. Google's guide documents up to 6 subject reference images (up to 3 per character, for up to 2 characters). ### First and last frame ```json { "model": "gemini-omni-1-2", "prompt": "Smooth transition, the camera slowly pushes in.", "first_frame_image": "https://example.com/start.jpg", "last_frame_image": "https://example.com/end.jpg", "duration": 8 } ``` ### Edit ```json { "model": "gemini-omni-1-2", "prompt": "Make the violin invisible. Keep everything else the same.", "video_urls": ["https://example.com/clip.mp4"] } ``` The edit keeps the source length; `duration` has no effect. Short, specific instructions work best; for a local change add "Keep everything else the same". ### Extend an earlier task ```json { "model": "gemini-omni-1-2", "prompt": "The camera keeps panning across the mountains.", "extend_from_task_id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "omni_reference_task_type": "extend", "duration": 8 } ``` The result contains the original followed by the new part. Only your own completed `gemini-omni-1-2` tasks can be named, and a task created from the website playground can be named only from the playground. To extend your own clip, send it in `video_urls` instead. ## Troubleshooting | Failure | What it means | What to do | | -------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | Synchronous `400` (code `30002`) | `resolution` or `duration` is not a priced value, or the input video's length could not be read | Use one of the four resolutions and a whole number of seconds; pass a public MP4 or MOV URL. Nothing was charged | | Synchronous `404` (code `40001`) | `extend_from_task_id` is not one of your tasks | Check the task id. Nothing was charged | | Synchronous `400` (code `20003`) | The source task is not a completed `gemini-omni-1-2` task | Wait until it completes, or pick another task. Nothing was charged | | Task fails with code `80007` | A model rule was broken: two frames over 10 seconds, a source over 15 seconds, too many images, an unknown field, … | The message names the field. Fully refunded | | Task fails with code `80006` | The prompt or media was rejected by content review | Fully refunded. Revise the prompt or inputs | | `402` on submit | Not enough credits for the reserve | Top up, or lower `duration` or `resolution` | | Task stays `processing` | Generation takes a minute or more | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-omni-1-2", "status": "completed", "created_at": 1789689600, "output": { "video_urls": ["https://.../0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.video_urls`. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). Every video carries Google's invisible SynthID watermark. ## Pricing Gemini Omni 1.2 bills **per second**, at a rate set by the resolution: ``` credits = ceil(per_second_rate × billable_seconds × 1000) 1 credit = $0.001 ``` | Request | `billable_seconds` | | ------------------------------- | ---------------------------- | | Text, image, frames, references | `duration` (default 10) | | Edit | `source + source / 8` | | Extend | `added seconds + source / 8` | `source` is the input video's picture length, measured by reAPI when the request is accepted and rounded up to whole seconds; the eighth covers reading the input video. At any resolution, editing a 6.2-second clip bills 7 + 7/8 = 7.875 seconds, and extending an 8-second clip by 4 seconds bills 4 + 1 = 5 seconds. Failed tasks are refunded in full. Live per-second rates for each resolution are on the [model page](https://reapi.ai/models/gemini-omni-1-2). ## Tips * Describe subject, place, camera move, light and sound; the clip's audio follows the prompt. * The model likes to cut between shots; ask for "a single continuous shot" when you need one. * Draft at `360p`, then render the shot you keep at `1080p` or `4k` with the same request. * For an edit, change one thing at a time and say what must stay the same. * English prompts are fully supported; other languages are not evaluated by Google. ## Related * [Gemini Omni 1.2 playground and pricing](https://reapi.ai/models/gemini-omni-1-2) * [Gemini Omni 1.1](/docs/gemini-omni-1-1) * [Veo 3.1](/docs/veo3-1) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gemini-omni (https://reapi.ai/docs/gemini-omni) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Gemini Omni — Google's any-to-any video model, exposed through reapi as > a single async endpoint. Mode is implicit: the counts of `image_urls` / > `video_urls` pick **text-to-video**, **image-to-video**, > **three-image fusion**, or **reference-to-video**. 4 to 10 second outputs > at 720p, 1080p, or 4K. Flat per-generation pricing across every mode — see > the [model page](https://reapi.ai/models/gemini-omni). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-omni", "prompt": "A kitten playing piano, slow camera push-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gemini-omni", "prompt": "A kitten playing piano, slow camera push-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gemini-omni", prompt: "A kitten playing piano, slow camera push-in", duration: 6, resolution: "1080p", aspect_ratio: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gemini-omni", "prompt": "A kitten playing piano, slow camera push-in", "duration": 6, "resolution": "1080p", "aspect_ratio": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-omni", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL, valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Mode routing `gemini-omni` picks its mode from the **counts of `image_urls` and `video_urls`** you send — there is no `mode` parameter: | `image_urls` | `video_urls` | Mode | What it does | | ------------ | ------------ | ---------------------- | ------------------------------------------------------------------------ | | `0` | `0` | **Text-to-video** | Generate from a prompt. | | `1` | `0` | **Image-to-video** | Animate from a single starting frame. | | `3` | `0` | **Three-image fusion** | Combine three references into one motion shot. | | `0` / `1` | `1` | **Reference-to-video** | Reference a source clip (≤ 30s) for motion / style. Flat per generation. | **Unsupported counts.** * `image_urls = 2` is **rejected** with `400 image_urls cardinality 2 is not supported`. Submit 0, 1, or 3 — there is no first/last-frame mode on `gemini-omni`. * `image_urls = 4` or more is also rejected. * `video_urls = 2` or more is **rejected** with `400 video_urls accepts at most 1 entry`. * `duration` and `video_urls` cannot both be set. Reference-to-video mode reads the source clip's length; passing `duration` alongside is rejected with `400 duration and video_urls cannot both be set`. *** ## Request body ### `model` — required `string`. Must be `"gemini-omni"`. ### `prompt` — string, required Up to **2,000 characters**. Required in every mode (text-to-video, image-to-video, three-image fusion, reference-to-video). Empty / whitespace-only prompts are treated as missing. **Failure modes.** * Empty / missing → `400 prompt is required` (code `20002`). * Longer than 2,000 chars → `400 prompt exceeds 2000 characters (got N)` (code `20007`). ### `duration` — integer, default `6` One of `4`, `6`, `8`, `10` seconds. Other values are rejected with `400 duration must be 4, 6, 8, or 10 seconds, got N`. **Reference-to-video mode ignores `duration`.** When `video_urls` is set, the vendor reads the source clip's length to drive the output, and `duration` must be omitted. Passing both is rejected with `400 duration and video_urls cannot both be set`. ### `resolution` — string, default `"720p"` `720p` / `1080p` / `4k`. Lowercase is canonical; uppercase forms (`"4K"`) are accepted and normalized. Drives the per-generation rate — 720p and 1080p share the same price; only 4K is uplifted. ### `aspect_ratio` — string, default `"16:9"` Output framing. One of: | Value | Shape | | ------ | --------- | | `16:9` | Landscape | | `9:16` | Portrait | Unknown ratios are rejected with `400 invalid aspect_ratio`. ### `size` — string, alias for `aspect_ratio` The same value the supplier doc lists as a separate field. If both are sent, they must match; otherwise `400 aspect_ratio and size disagree`. The reapi playground does not surface `size`; the JSON body still accepts it for parity. ### `image_urls` — string\[] Array of public HTTP(S) URLs. **Allowed counts: 0, 1, or 3**. * **0 entries** — text-to-video. * **1 entry** — image-to-video; the image is treated as the starting frame. * **3 entries** — three-image fusion. The model combines all three references into one motion shot. ### `video_urls` — string\[] Array of public HTTP(S) URLs. **Allowed counts: 0 or 1**. * **0 entries** — non-reference modes (text / image / fusion). * **1 entry** — reference-to-video. The source clip drives the output; it must be **≤ 30 seconds** (longer is rejected with `400`), and the first ≤ 10 seconds are used as the reference. Billed at a **flat per-generation rate** (not per second). `duration` MUST be omitted in this mode. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field on this endpoint must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gemini-omni", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Always `"gemini-omni"` (echo of the submitted `model`) | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days**. Re-host to your own storage if you need them longer. *** ## Validation errors All cases below return HTTP 400 with code `20003` unless noted. Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values, etc.) and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------------------- | ------- | -------------------------------------------------------------------------------- | | `prompt` missing or blank | `20002` | `gemini-omni: prompt is required` | | `prompt` longer than 2,000 chars | `20007` | `gemini-omni: prompt exceeds 2000 characters (got N)` | | `image_urls` length `2` | `20003` | `gemini-omni: image_urls cardinality 2 is not supported` | | `image_urls` length > `3` | `20003` | `gemini-omni: image_urls accepts at most 3 entries, got N` | | `duration` not one of 4/6/8/10 | `20003` | `gemini-omni: duration must be 4, 6, 8, or 10 seconds, got N` | | Unknown `resolution` | `20003` | `gemini-omni: invalid resolution "X" (allowed: 720p / 1080p / 4k)` | | Unknown `aspect_ratio` | `20003` | `gemini-omni: invalid aspect_ratio "X" (allowed: 16:9 / 9:16)` | | `aspect_ratio` and `size` disagree | `20003` | `gemini-omni: aspect_ratio "X" and size "Y" disagree` | | `image_urls` carrying a `data:` URI or non-http(s) | `20003` | `gemini-omni: image_urls entries must be public http(s) URLs` | | `video_urls` source clip longer than 30 seconds | `20003` | `Reference video must be at most 30s (got Ns); trim the clip before submitting.` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Text-to-video — minimum request ```json { "model": "gemini-omni", "prompt": "A little girl walking down a sunset coastal road" } ``` ### Text-to-video — full parameters ```json { "model": "gemini-omni", "prompt": "A kitten playing piano, slow camera push-in, cinematic warm tones", "duration": 8, "resolution": "1080p", "aspect_ratio": "16:9" } ``` ### Image-to-video — animate a single frame ```json { "model": "gemini-omni", "prompt": "Bring the scene to life with a gentle camera dolly forward", "image_urls": ["https://your-cdn.com/first_frame.jpg"], "duration": 6, "resolution": "1080p" } ``` ### Three-image fusion ```json { "model": "gemini-omni", "prompt": "Compose a 10-second product spot mixing scene, character, and product", "image_urls": [ "https://your-cdn.com/scene.jpg", "https://your-cdn.com/character.jpg", "https://your-cdn.com/product.jpg" ], "duration": 10, "resolution": "1080p", "aspect_ratio": "9:16" } ``` ### 4K hero shot ```json { "model": "gemini-omni", "prompt": "A neon city street in the rain, slow camera pan, reflections on the asphalt", "duration": 4, "resolution": "4k", "aspect_ratio": "16:9" } ``` ### Reference-to-video — match a source clip ```json { "model": "gemini-omni", "prompt": "the same scene but at night with neon lights", "resolution": "720p", "aspect_ratio": "16:9", "video_urls": ["https://your-cdn.com/source.mp4"] } ``` The output tracks the source clip (which must be **≤ 30s**; the first ≤ 10s are used as the reference); **omit `duration`**. Billing is a flat per-generation rate (see [Pricing](#pricing) below). *** ## Choosing a mode | Need | Send | | ---------------------------------------- | ------------------------------------------------- | | Generate from text | `prompt` only | | Animate a still | `prompt + image_urls` (1 entry) | | Compose scene + character + product | `prompt + image_urls` (3 entries) | | Match an existing clip's motion / length | `prompt + video_urls` (1 entry, no `duration`) | | Cut spend | Drop `resolution` to `720p` and `duration` to `4` | | Hero shot | Pick `4k` at `4-10s` | *** ## Polling pattern The task endpoint behaves identically to other video tasks — the only difference is the completed `output` shape (`video_urls` instead of `image_urls`). A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in a few minutes. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Pricing Two billing modes — picked by request shape. ### Per generation — text / image / fusion Charged once per submitted job. 720p and 1080p share the same rate at every duration; only 4K is uplifted. Duration tiers are `4s` / `6s` / `8s` / `10s`. See current per-tier rates on the [Gemini Omni model page](https://reapi.ai/models/gemini-omni). ### Flat per generation — reference-to-video Triggered when `video_urls` is set. Charged once per job at a flat rate by resolution — independent of clip length. 720p and 1080p share the same rate; 4K is uplifted. The source clip must be **≤ 30 seconds**: the gateway probes its decoded length server-side and rejects longer clips with `400`; the first ≤ 10 seconds are used as the reference. See current rates on the [Gemini Omni model page](https://reapi.ai/models/gemini-omni). ### Bill formula `1 credit = $0.001`. Integer credits = `ceil(usd × 1000)`. Failed jobs refund automatically. *** ## Tips * **Prompt motion, not just scene.** "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen. * **Pick 720p first if you're iterating.** It's the same per-generation price as 1080p, but renders faster and lets you change your mind on the final tier without re-doing the bill math. * **Three-image fusion needs cohesive references.** Pick three images that share lighting and composition cues — the model fuses them more cleanly than three random shots. * **Pick 4K only when shipping.** A 4K render is roughly 2× the cost of 720p / 1080p; reserve it for the final keeper. * **Keep reference clips ≤ 30s.** Reference-to-video requires a source clip of **≤ 30 seconds** (the server probes its length via ffmpeg and rejects anything longer with `400`); only the first ≤ 10 seconds are used as the reference. Billing is a flat per-generation rate regardless of length. Omit `duration` — the server rejects requests that pass both. *** ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # glm-5.2 (https://reapi.ai/docs/glm-5-2) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Z.AI's GLM-5.2 — a flagship foundation model built for long-horizon tasks — > exposed through api.reapi.ai as a drop-in OpenAI-compatible Chat Completions > endpoint. A **1M-token** context window Z.AI describes as *solid and lossless*, > **128K** max output, thinking **on by default but switchable off**, a > `reasoning_effort` dial that no other model in the GLM family accepts, genuinely > tunable `temperature` / `top_p`, function calling with streamed tool arguments, > JSON mode and context caching. Text in, text out. The wire `model` id is > **`glm-5.2`** — with the dot. Current rates live on the > [model page](https://reapi.ai/models/glm-5-2) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). **The URL and the model id differ.** This page and the model page spell the slug `glm-5-2` because a URL cannot carry the dot. The string your request body needs is `glm-5.2`. Sending `glm-5-2` as the model is the first thing to check on an unknown-model error. ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "glm-5.2", "messages": [ { "role": "user", "content": "Refactor this module and add tests." } ], "thinking": { "type": "enabled" }, "reasoning_effort": "max", "max_tokens": 8192, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="glm-5.2", messages=[{"role": "user", "content": "Refactor this module and add tests."}], max_tokens=8192, stream=True, extra_body={ "thinking": {"type": "enabled"}, "reasoning_effort": "max", }, ) for chunk in stream: delta = chunk.choices[0].delta reasoning = getattr(delta, "reasoning_content", None) if reasoning: print(reasoning, end="") if delta.content: print(delta.content, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "glm-5.2", messages: [{ role: "user", content: "Refactor this module and add tests." }], max_tokens: 8192, stream: true, // @ts-expect-error vendor-specific fields pass through thinking: { type: "enabled" }, reasoning_effort: "max", }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "glm-5.2", "messages": []map[string]string{ {"role": "user", "content": "Refactor this module and add tests."}, }, "thinking": map[string]string{"type": "enabled"}, "reasoning_effort": "max", "max_tokens": 8192, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Chat models are served from the `api.reapi.ai` gateway, which has its own console and its own key. Create the key there, then send it as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` The gateway key is **not** the same credential as a media-generation key used against `reapi.ai/api/v1`. Sign in at [api.reapi.ai](https://api.reapi.ai/) to create one. *** ## Endpoint ```http POST /v1/chat/completions ``` Base URL `https://api.reapi.ai`. The wire format is OpenAI-compatible, so the same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once you swap the base URL, the key and the model string. Vendor-specific fields such as `thinking` go through the SDK's pass-through mechanism — `extra_body` in Python. *** ## Request body ### `model` — string, required Must be `glm-5.2` exactly, dot included. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. **Text only** — see [Modality](#modality). ### `max_tokens` — integer Upper bound on output tokens for this response. This model supports a **128K** maximum output and the schema accepts values up to **131,072**. Reasoning is generated before the answer and draws on the same allowance. ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. Reasoning and answer arrive as **separate deltas** — `reasoning_content` and `content`. ### `thinking` — object, default `{"type": "enabled"}` Chain-of-thought control. See [Reasoning](#reasoning). ### `reasoning_effort` — string, default `"max"` How hard the model thinks; applies only while thinking is enabled. See [Reasoning](#reasoning) for the value-collapsing behaviour, which is the one surprise on this model. ### `temperature` / `top_p` — numbers Actually tunable here. See [Sampling parameters](#sampling-parameters). ### `tools` / `tool_choice` / `tool_stream` — optional Function definitions, selection strategy and streamed arguments. See [Tool calling](#tool-calling). ### `response_format` — object, optional `{"type": "text"}` (default) or `{"type": "json_object"}`. See [Structured output](#structured-output). ### `stop` — array, optional Stop words. **Only one is supported** despite the array shape. ### `group` — string, default `"default"` Token group on the gateway. Leave it at `default` unless your account has been given another group to route through. *** ## Reasoning Two things are unusual here, and both cut in the developer's favour. **1. Thinking is on by default, and can be turned off.** `thinking` defaults to `{"type": "enabled"}`, and `{"type": "disabled"}` is accepted — a switch several models in this class no longer offer. **2. With thinking on, the model decides per request whether to think.** Z.AI contrasts this explicitly with the previous generation, which reasoned unconditionally. Leaving thinking enabled therefore does not mean paying for reasoning on every trivial turn. ### The effort ladder collapses `reasoning_effort` accepts seven values for cross-provider compatibility, but they map onto **three** behaviours: | You send | What actually happens | | --------- | --------------------------------------------- | | `max` | **Default.** Deep reasoning. | | `xhigh` | Mapped to `max`. | | `high` | Enhanced reasoning — the real middle setting. | | `medium` | Mapped to `high`. | | `low` | Mapped to `high`. | | `minimal` | Skips thinking. | | `none` | Skips thinking. | **A middling value does not buy a middling cost.** `low` and `medium` both behave as `high`, so a client that drops to `low` expecting a cheap pass gets the same work as `high`. The only ways down are `high`, or skipping thinking entirely with `minimal` / `none`. ### Prior-turn reasoning is dropped by default `thinking.clear_thinking` defaults to **`true`**: the model ignores `reasoning_content` from earlier turns and keeps only visible text, tool calls and tool results. That keeps multi-turn context short and cheap, and it is why this model needs no special history handling out of the box. Set it to `false` for Preserved Thinking — and then the full, unmodified, correctly ordered `reasoning_content` history must be forwarded. Missing, truncated, rewritten or reordered blocks degrade the result. *** ## Sampling parameters Unlike several open-weight peers that pin these, both work: | Parameter | Range | Default | | ------------- | ----------------- | ------- | | `temperature` | `0.0` – **`1.0`** | `1.0` | | `top_p` | `0.01` – `1.0` | `0.95` | **`temperature` is capped at 1.0.** Code carried over from a provider that allows up to 2.0 will be rejected. Z.AI also advises tuning **one** of the two rather than both — `temperature` for creative latitude, `top_p` for convergence. A separate `do_sample` flag defaults to `true`; setting it `false` makes both sampling parameters stop taking effect. *** ## Tool calling * `tools` accepts up to **128** functions. * `tool_choice` accepts **`auto` only** — the model decides when a call is warranted. There is no `required` or per-function forcing on this model. * `tool_stream: true` streams tool-call arguments as they are generated instead of delivering the complete call at once. Concatenate `delta.tool_calls[*].function.arguments` across chunks. After executing calls, append one `tool` message per call with the matching `tool_call_id` before asking for the next completion. *** ## Structured output ```json { "response_format": { "type": "json_object" } } ``` This is **JSON mode, not JSON Schema** — you do not supply a schema and the model does not validate against one. Ask for the shape you want in the prompt as well, which Z.AI recommends explicitly. If you need schema-guaranteed fields, validate on your side after parsing. *** ## Modality | Modality | Supported | | -------- | :-------: | | Text in | ✅ | | Text out | ✅ | | Image in | ❌ | | Video in | ❌ | Z.AI's model card lists input and output modalities for this model as **text**. Vision is a different model in their lineup. If a step in your workflow needs a screenshot read, route that step elsewhere — this model is a strong choice for the code around it, not for looking at it. *** ## Context caching Caching is part of this model's capability set and rewards the obvious shape: keep a long stable prefix — system prompt, knowledge document, tool definitions — in front of a changing question, and let repeat requests reuse it. No cache id and no TTL to manage. Z.AI prices cached input as its own dimension. **reAPI does not publish a separate cached-input rate for this model**, so treat caching as a latency and context-length benefit here, and bill against the input and output rates in the pricing table. *** ## Pricing dimensions Billing is **per token**, in USD, against your `api.reapi.ai` balance, with separate **input** and **output** rates. Three things to keep in mind: * **Reasoning tokens bill as output.** Thinking is on by default at the deepest effort setting, which is the usual reason a bill exceeds an estimate built from visible answer length. * **Effort is the first lever.** Because the ladder collapses, the meaningful choices are deep (`max`), enhanced (`high`) or none at all. * **Output dominates.** For most generative workloads the output rate decides the invoice. Both token rates sit at **about a third below Z.AI's published per-token rate**. Current numbers are on the [model page](https://reapi.ai/models/glm-5-2) and [api.reapi.ai/pricing](https://api.reapi.ai/pricing) — those tables are the canonical source, not this page. Chat models bill in USD on the gateway balance. They do **not** draw down the integer credits used by the media-generation endpoints on `reapi.ai/api/v1`. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "glm-5.2", "choices": [ { "index": 0, "message": { "role": "assistant", "reasoning_content": "...", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `reasoning_content` is a sibling of `content`. Unless you have turned off `clear_thinking`, you do not need to send it back. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk`. Reasoning arrives in `choices[0].delta.reasoning_content` and the answer in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use the gateway's standard envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | --------------------------------------------------- | ----------------------------------------------------- | | Missing or invalid bearer token | Create a key in the api.reapi.ai console | | Unknown `model` value | Send `glm-5.2` with the dot — not the hyphenated slug | | `temperature` above `1.0` | Lower it; the ceiling is 1.0 on this model | | `tool_choice` set to `required` or a named function | Only `auto` is supported | | An image part in `messages` | Not a multimodal model — route vision elsewhere | | More than one entry in `stop` | Only one stop word is supported | | `max_tokens` above the ceiling | Lower it; the documented ceiling is 131,072 | | `reasoning_effort` sent with thinking disabled | It only takes effect while thinking is enabled | | Insufficient balance | Top up on the gateway | | Upstream rate limit | Retry with backoff, or route through another model | *** ## Tips * **Send the whole project, then ask for the audit first.** Z.AI's own recommended opening move is an architecture map, module responsibilities, API contracts, data flows and technical debt — before any edit. * **Bound long tasks explicitly.** State what must not change (business logic, API signatures, runtime behaviour) and ask for the plan, impact scope, risk boundaries and verification method up front. * **Give it your real engineering standards.** Lint rules, build commands, test requirements, commit conventions and prohibited actions belong in the prompt; adherence under long context is what this generation improved. * **Pick an effort behaviour, not a number.** Deep, enhanced, or none — the values in between are aliases. * **Mind the `temperature` ceiling** of 1.0, and tune one sampling parameter rather than both. * **Stream anything interactive**, and render `reasoning_content` separately from the answer rather than concatenating them. * **Front-load the stable bulk** of your prompt so caching can do its job. *** ## Related * [GLM-5.2 model page](https://reapi.ai/models/glm-5-2) — current rates * [Kimi K3](/docs/kimi-k3) — the other open-weight 1M-context coding flagship * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-5.4 (https://reapi.ai/docs/gpt-5-4) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > GPT-5.4 is OpenAI's established reasoning model, exposed through > api.reapi.ai as a drop-in OpenAI-compatible Chat Completions endpoint. > 1M token context, 128K max output, function calling, and JSON-mode > responses. The cost-efficient route in the GPT family — current rates > live on the [model page](https://reapi.ai/models/gpt-5-4) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4", "group": "default", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="gpt-5.4", messages=[{"role": "user", "content": "Hello"}], stream=True, temperature=0.7, top_p=1, frequency_penalty=0, presence_penalty=0, extra_body={"group": "default"}, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "gpt-5.4", messages: [{ role: "user", content: "Hello" }], stream: true, temperature: 0.7, top_p: 1, frequency_penalty: 0, presence_penalty: 0, // `group` is an api.reapi.ai-specific extension; pass it via extra body. // @ts-expect-error — not part of the OpenAI types group: "default", }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-5.4", "group": "default", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request needs a Bearer token. The GPT-5.4 chat workspace lives on the `api.reapi.ai` platform — sign in there to create a key and top up tokens. 1. Open [api.reapi.ai](https://api.reapi.ai/) and sign in (or create an account). 2. Generate an API key under **API Keys**. 3. Top up tokens under **Top Up** (pay-as-you-go, billed in USD per 1M tokens — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing)). ```http Authorization: Bearer YOUR_API_KEY ``` The chat surface (api.reapi.ai) is a **separate workspace** from the image/video/audio task gateway at `reapi.ai/api/v1/*`. Keys and balances do not cross over — a key issued on `reapi.ai/settings/apikeys` will not authenticate against `api.reapi.ai/v1/chat/completions`, and vice versa. *** ## Endpoint ```http POST https://api.reapi.ai/v1/chat/completions ``` OpenAI-compatible. The same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once the base URL is set to `https://api.reapi.ai/v1`. *** ## Request body ### `model` — string, required Must be `"gpt-5.4"`. The value is echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string or content-parts array" } ``` Multi-turn history is sent in chronological order — the last message is the one the model responds to. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. When `false`, the full response body is returned in one HTTP response. ### `temperature` — number, default `1` Range `0.0` – `2.0`. Sampling temperature. Lower values make output more deterministic; higher values increase randomness. OpenAI recommends tuning either `temperature` or `top_p`, not both. ### `top_p` — number, default `1` Range `0.0` – `1.0`. Nucleus sampling cutoff — restricts sampling to the smallest set of tokens whose cumulative probability mass exceeds `top_p`. ### `frequency_penalty` — number, default `0` Range `-2.0` – `2.0`. Penalises tokens by how often they've already appeared in the response so far. Positive values discourage literal repetition. ### `presence_penalty` — number, default `0` Range `-2.0` – `2.0`. Penalises tokens that have appeared at all, regardless of frequency. Positive values encourage the model to talk about new topics. ### `group` — string, default `"default"` api.reapi.ai-specific extension. Selects a token group on the gateway, which routes the request to a specific upstream channel pool. `"default"` is the standard pool and covers nearly every workload — omit the field if you don't need custom routing. ### Other OpenAI parameters Every other field on the OpenAI Chat Completions spec — `max_tokens`, `stop`, `n`, `seed`, `tools`, `tool_choice`, `response_format`, `logprobs`, `top_logprobs`, `user`, `parallel_tool_calls` — passes through unchanged. The OpenAI SDKs do not need a reAPI-specific shim. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "gpt-5.4", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21 } } ``` `usage.prompt_tokens` and `usage.completion_tokens` are the inputs to the bill — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing) for the live rate card. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta: ``` data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.4","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.4","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]} data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.4","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} data: [DONE] ``` The final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). Usage stats are omitted from the stream — call again with `stream: false` if you need exact token counts per turn. *** ## Pricing GPT-5.4 is billed **pay-as-you-go in USD** against your api.reapi.ai token balance. Current rates live on the model page and on [api.reapi.ai/pricing](https://api.reapi.ai/pricing); the table at the top of the [model page](https://reapi.ai/models/gpt-5-4) is the authoritative number for what you'll be charged today. Long-context billing: when the input portion of a single request exceeds **272K tokens**, the whole call is billed at **2× input and 1.5× output**. Requests at or below 272K input use the standard rate. Failed requests are not charged. *** ## Limits | Limit | Value | | ------------------- | ------------- | | Context window | 1M tokens | | Max output per call | 128K tokens | | Standard-rate input | ≤ 272K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | -------------------------------------- | -------------------------------------------- | | `400` | Bad request shape, unknown field, etc. | Same shape OpenAI returns | | `401` | Missing / invalid API key | Re-issue a key at api.reapi.ai | | `402` | Insufficient balance | Top up at api.reapi.ai | | `429` | Per-group rate limit hit | Back off, or move to a different `group` | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | api.reapi.ai does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that's a one-for-one wire failure and a retry from your side is safe; the upstream provider may have already produced output, but the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "gpt-5.4", "messages": [ { "role": "user", "content": "Summarise the OpenAI Chat Completions spec in three sentences." } ] } ``` ### Full parameter set ```json { "model": "gpt-5.4", "group": "default", "messages": [ { "role": "system", "content": "You are a senior staff engineer." }, { "role": "user", "content": "Walk me through a 1M-token codebase review strategy." } ], "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0 } ``` ### Tool use (function calling) ```json { "model": "gpt-5.4", "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### JSON mode ```json { "model": "gpt-5.4", "response_format": { "type": "json_object" }, "messages": [ { "role": "system", "content": "Return a JSON object with keys: title, summary, tags." }, { "role": "user", "content": "Article: ..." } ] } ``` *** ## When to pick GPT-5.4 over GPT-5.5 GPT-5.4 and GPT-5.5 share the same endpoint, the same context window, and the same OpenAI-compatible wire format — switching between them is a one-line change in the `model` field. Pick GPT-5.4 when: * **High-volume production traffic** where per-call cost dominates the decision. * **Established workflows** (classification, extraction, summarisation, routine support replies) that don't benefit from GPT-5.5's newest reasoning gains or Tool Search. * **Latency-sensitive surfaces** where a slightly less expensive model also tends to respond faster on identical inputs. Pick GPT-5.5 when you need its strongest reasoning, Tool Search for large agent ecosystems, or `reasoning_effort` controls. *** ## Tips * **Stream by default for chat UX.** Streaming responses cut perceived latency dramatically and let your UI render tokens as they're produced. * **Watch the long-context boundary.** Splitting a 300K-token prompt into a 270K turn and a follow-up keeps you on the standard rate rather than the long-context tier. * **Tune `temperature` *or* `top_p`, not both.** Mixing them tends to produce results that are hard to reason about. * **Use `response_format: { type: "json_object" }` for structured output.** Much more reliable than parsing free-text JSON that the model writes inside backticks. * **Drop `frequency_penalty` and `presence_penalty` first when debugging weird output.** Non-zero values can introduce artefacts that look like model bugs. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # gpt-5.5 (https://reapi.ai/docs/gpt-5-5) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > GPT-5.5 is OpenAI's frontier reasoning model, exposed through reAPI as a > drop-in OpenAI-compatible Chat Completions endpoint. 1M token context, > 128K max output, advanced reasoning with adjustable effort, and Tool > Search for large agent workflows. Current rates live on the > [model page](https://reapi.ai/models/gpt-5-5) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "group": "default", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="gpt-5.5", messages=[{"role": "user", "content": "Hello"}], stream=True, temperature=0.7, top_p=1, frequency_penalty=0, presence_penalty=0, extra_body={"group": "default"}, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "gpt-5.5", messages: [{ role: "user", content: "Hello" }], stream: true, temperature: 0.7, top_p: 1, frequency_penalty: 0, presence_penalty: 0, // `group` is a reAPI-specific extension; pass it via extra body. // @ts-expect-error — not part of the OpenAI types group: "default", }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-5.5", "group": "default", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request needs a Bearer token. The GPT-5.5 chat workspace lives on the `api.reapi.ai` platform — sign in there to create a key and top up tokens. 1. Open [api.reapi.ai](https://api.reapi.ai/) and sign in (or create an account). 2. Generate an API key under **API Keys**. 3. Top up tokens under **Top Up** (pay-as-you-go, billed in USD per 1M tokens — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing)). ```http Authorization: Bearer YOUR_API_KEY ``` The chat surface (api.reapi.ai) is a **separate workspace** from the image/video/audio task gateway at `reapi.ai/api/v1/*`. Keys and balances do not cross over — a key issued on `reapi.ai/settings/apikeys` will not authenticate against `api.reapi.ai/v1/chat/completions`, and vice versa. *** ## Endpoint ```http POST https://api.reapi.ai/v1/chat/completions ``` OpenAI-compatible. The same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once the base URL is set to `https://api.reapi.ai/v1`. *** ## Request body ### `model` — string, required Must be `"gpt-5.5"`. The value is echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string or content-parts array" } ``` Multi-turn history is sent in chronological order — the last message is the one the model responds to. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. When `false`, the full response body is returned in one HTTP response. ### `temperature` — number, default `1` Range `0.0` – `2.0`. Sampling temperature. Lower values make output more deterministic; higher values increase randomness. OpenAI recommends tuning either `temperature` or `top_p`, not both. ### `top_p` — number, default `1` Range `0.0` – `1.0`. Nucleus sampling cutoff — restricts sampling to the smallest set of tokens whose cumulative probability mass exceeds `top_p`. ### `frequency_penalty` — number, default `0` Range `-2.0` – `2.0`. Penalises tokens by how often they've already appeared in the response so far. Positive values discourage literal repetition. ### `presence_penalty` — number, default `0` Range `-2.0` – `2.0`. Penalises tokens that have appeared at all, regardless of frequency. Positive values encourage the model to talk about new topics. ### `group` — string, default `"default"` reAPI-specific extension. Selects a token group on the gateway, which routes the request to a specific upstream channel pool. `"default"` is the standard pool and covers nearly every workload — you can omit the field if you don't need custom routing. ### Other OpenAI parameters Every other field on the OpenAI Chat Completions spec — `max_tokens`, `stop`, `n`, `seed`, `tools`, `tool_choice`, `response_format`, `logprobs`, `top_logprobs`, `user`, `parallel_tool_calls`, `reasoning_effort` (`none` / `low` / `medium` / `high` / `xhigh`) — passes through unchanged. The OpenAI SDKs do not need a reAPI-specific shim. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "gpt-5.5", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21 } } ``` `usage.prompt_tokens` and `usage.completion_tokens` are the inputs to the bill — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing) for the live rate card. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta: ``` data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.5","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.5","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]} data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1735000000,"model":"gpt-5.5","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} data: [DONE] ``` The final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). Usage stats are omitted from the stream — call again with `stream: false` if you need exact token counts per turn. *** ## Pricing GPT-5.5 is billed **pay-as-you-go in USD** against your api.reapi.ai token balance. The live per-1M-token rate card lives on [api.reapi.ai/pricing](https://api.reapi.ai/pricing); top up tokens at [api.reapi.ai](https://api.reapi.ai/). The bill for a single call is: ``` input_cost = prompt_tokens × input_rate / 1,000,000 output_cost = completion_tokens × output_rate / 1,000,000 ``` Failed requests are not charged. ### Long-context tier (>272K input tokens) When the input portion of a single request exceeds 272K tokens, the entire request is billed at **2× the input rate** and **1.5× the output rate**. A request with 270K input tokens stays at the standard rate; a request with 280K input tokens shifts the whole call (input *and* output) to the long-context rate. See [api.reapi.ai/pricing](https://api.reapi.ai/pricing) for the resolved per-1M-token numbers in both tiers. *** ## Limits | Limit | Value | | ------------------- | ------------- | | Context window | 1M tokens | | Max output per call | 128K tokens | | Standard-rate input | ≤ 272K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | -------------------------------------- | -------------------------------------------- | | `400` | Bad request shape, unknown field, etc. | Same shape OpenAI returns | | `401` | Missing / invalid API key | Re-issue a key at api.reapi.ai | | `402` | Insufficient balance | Top up at api.reapi.ai | | `429` | Per-group rate limit hit | Back off, or move to a different `group` | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | api.reapi.ai does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that's a one-for-one wire failure and a retry from your side is safe; the upstream provider may have already produced output, but the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "gpt-5.5", "messages": [ { "role": "user", "content": "Summarise the OpenAI Chat Completions spec in three sentences." } ] } ``` ### Full parameter set ```json { "model": "gpt-5.5", "group": "default", "messages": [ { "role": "system", "content": "You are a senior staff engineer." }, { "role": "user", "content": "Walk me through a 1M-token codebase review strategy." } ], "stream": true, "temperature": 0.7, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0 } ``` ### Tool use (function calling) ```json { "model": "gpt-5.5", "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Reasoning effort ```json { "model": "gpt-5.5", "reasoning_effort": "high", "messages": [ { "role": "user", "content": "Prove that the sum of the first n odd numbers is n^2." } ] } ``` `reasoning_effort` accepts `none` / `low` / `medium` / `high` / `xhigh` — pick the lowest level that still produces correct output for the workload to keep latency and token spend down. *** ## Tips * **Stream by default for chat UX.** Streaming responses cut perceived latency dramatically and let your UI render tokens as they're produced. * **Watch the long-context boundary.** Splitting a 300K-token prompt into a 270K turn and a follow-up keeps you on the standard rate rather than paying the 2× / 1.5× long-context premium. * **Tune `temperature` *or* `top_p`, not both.** Mixing them tends to produce results that are hard to reason about. * **`reasoning_effort: high` is the right default for agents.** Reserve `xhigh` for the genuinely hard turns — it adds latency and token spend. * **Drop `frequency_penalty` and `presence_penalty` first when debugging weird output.** Non-zero values can introduce artefacts that look like model bugs. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # gpt-5.6-luna (https://reapi.ai/docs/gpt-5-6-luna) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-5.6 Luna — the tier optimised for cost-sensitive, high-volume workloads — exposed through reAPI as a drop-in > OpenAI-compatible Chat Completions endpoint. A **1,050,000-token** context > window, **128,000** max output tokens, six `reasoning_effort` rungs from > `none` to `max` defaulting to **`medium`**, text and image input, and > functions, web search, file search and computer use. OpenAI rates its reasoning **High** and its speed Fast. The wire > `model` id is **`gpt-5.6-luna`**. Current rates live on the > [model page](https://reapi.ai/models/gpt-5-6-luna). **The URL and the model id differ.** This page and the model page spell the slug `gpt-5-6-luna` because a URL cannot carry dots. The string your request body needs is `gpt-5.6-luna`. ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-luna", "messages": [ { "role": "user", "content": "Classify this ticket. Return only the category id." } ], "reasoning_effort": "none", "max_completion_tokens": 4096, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-5.6-luna", messages=[{"role": "user", "content": "Classify this ticket. Return only the category id."}], reasoning_effort="none", max_completion_tokens=4096, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-5.6-luna", messages: [{ role: "user", content: "Classify this ticket. Return only the category id." }], reasoning_effort: "none", max_completion_tokens: 4096, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-5.6-luna", "messages": []map[string]string{ {"role": "user", "content": "Classify this ticket. Return only the category id."}, }, "reasoning_effort": "none", "max_completion_tokens": 4096, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI states that its reasoning models "work better with the Responses API", and that "while the Chat Completions API is still supported, you'll get improved model intelligence and performance by using Responses." The GPT-5.6 release entry lists `v1/responses`, `v1/chat/completions` and `v1/batch` as this family's endpoints — so Chat Completions is a documented, supported surface, and this is a vendor preference rather than a restriction. *** ## Parameter support on this model Every field in OpenAI's Chat Completions reference (37 request-body fields as of 2026-09-07) was sent to this endpoint one at a time on that date. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `none`, `low`, `medium`, `high`, `xhigh`, `max`. `minimal` returns `400` | | `temperature` | Only the default value is accepted; any other value returns `400` | | `top_p` | Not supported by this model — any value returns `400` | | `n` | Only `1`; a larger value returns `400` | | `tools`, `tool_choice`, `parallel_tool_calls` | Applied — function calling works, including `strict` schemas | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted (returns `200`). `max_completion_tokens` is the field OpenAI documents — prefer it in new code | | `response_format` | Applied, including `json_schema` with `strict` | | `frequency_penalty`, `presence_penalty` | Accepted (`200`), but OpenAI documents neither for this model — do not rely on them | | `web_search_options` | Enables web search for the request. Each such request carries roughly 4,400 extra input tokens of tool context, billed at the input rate | | `stop`, `seed`, `logprobs`, `top_logprobs`, `logit_bias`, `prediction`, `verbosity`, `audio`, `modalities`, `service_tier`, `safety_identifier`, `moderation`, `prompt_cache_options`, `prompt_cache_retention` | Accepted (`200`) and ignored — no effect on the response | | legacy `functions` / `function_call` | `function_call` together with `tool_choice` returns `400`; use `tools` / `tool_choice` | The sampling restrictions (`temperature`, `top_p`) are what OpenAI states for its reasoning models; the rest was found by testing. There is no `minimal` on this family. ## Request body ### `model` — string, required Must be `gpt-5.6-luna` exactly. There is no alias for this tier — the bare `gpt-5.6` id routes to the frontier model instead. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt, and it is the usual reason an invoice exceeds an estimate built from answer length. ### `reasoning_effort` — string, default `"medium"` How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. On a volume route the useful reason to stream is early cancellation: you can abandon a response that has already gone wrong instead of paying for the rest of it. ### `tools` / `tool_choice` — optional Function definitions and the selection strategy. Functions, web search, file search and computer use are all available on this family, and this generation adds programmatic tool calling. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema for machine-consumed output. *** ## Reasoning effort Six rungs, and unlike some families these do not collapse into one another — each is a distinct behaviour. The default is **`medium`**: OpenAI's docs state that "if you omit reasoning.effort, GPT-5.6 defaults to medium in both modes." | Effort | OpenAI's stated best-for | | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `none` | Latency-critical tasks that do not benefit from reasoning or multi-chained tool calls — voice, fast retrieval, classification | | `low` | Efficient reasoning with modest added latency: tool use, planning, search, multi-step decisions | | `medium` | **Default.** Quality and reliability where the task involves planning and judgement — agentic coding, research, spreadsheets and slides, delegated long-horizon work | | `high` | Hard reasoning, complex debugging, deep planning, high-value tasks where quality beats latency | | `xhigh` | Deep research and long asynchronous runs — security and code review, enterprise productivity. "Only use when your evals show a clear benefit" | | `max` | "Maximum reasoning for your most complex tasks. If you are currently using xhigh, evaluate if max results in stronger performance" | There is **no `minimal`** on this family. All six rungs reach the model through this endpoint (measured 2026-09-07); `minimal` is rejected with a `400`. The table above is OpenAI's own description of the family; the parameter table earlier on this page is what this endpoint answers. This is the tier the bottom of that ladder exists for. **Set effort explicitly** — the default is `medium`, so a request that omits the field is paying for a reasoning pass a classification route probably does not want. OpenAI also documents a **Pro reasoning mode** for GPT-5.6 (`reasoning.mode`, independent of effort), and **multi-agent orchestration** in beta. Both are features of OpenAI's Responses API, so neither is part of a Chat Completions request through this endpoint. *** ## Image input | Modality | Supported | | -------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | This generation accepts images **at their original dimensions**, with `original` or `auto` image detail — no resizing step required before a screenshot or scan goes in. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input** and **output** rates. Three things to keep in mind: * **Reasoning tokens bill as output.** The default effort is `medium`, so a request that omits the field is paying for a reasoning pass. * **Effort is the first lever**, and on this family every rung is real — a middle setting buys a middle cost. * **The tier is the second lever.** All three GPT-5.6 tiers share this context window, this output ceiling, this effort ladder and this endpoint, so moving between them changes reasoning depth and price, not capability surface. Both token rates sit **below OpenAI's published per-token rate**, on input and output alike; the model page reads them live. Current numbers are on the [model page](https://reapi.ai/models/gpt-5-6-luna) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`; a request's cost is its input and output tokens at the per-million rates, converted at that ratio. OpenAI prices cached input as a separate dimension. **reAPI does not publish a cached-input rate for this model**, so bill against the input and output rates in the pricing table. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "gpt-5.6-luna", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `usage.completion_tokens` includes reasoning tokens, so it is the number to reconcile a bill against. On OpenAI's own Responses API the split is reported under `output_tokens_details.reasoning_tokens`. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use reAPI's standard error envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ---------------------------------------------------- | -------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-5.6-luna` with the dots — not the hyphenated slug | | `reasoning_effort` set to `minimal` | Not on this family — use `none`, `low`, `medium`, `high`, `xhigh` or `max` | | `temperature` other than the default, or any `top_p` | Remove the field; the model rejects it | | `n` greater than 1 | Send one request per completion | | `reasoning.mode` or multi-agent fields | Responses-API features; not part of a Chat Completions request | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | | Upstream rate limit | Retry with backoff, or route through another tier | *** ## Tips * **Set effort explicitly.** The default is `medium`; on this tier `none` or `low` is usually what you actually mean. * **Cap `max_completion_tokens` tight.** On volume work it is a cost ceiling, not just a length limit. * **Constrain the output with a schema.** A machine-parsed route turns a bad answer into a validation error you can see. * **Do not pair `none` with a long tool loop.** OpenAI ties the no-reasoning rung to routes without multi-chained tool calls; raise the effort instead. * **Use it as the first stage.** Cheap triage here, escalation to a dearer tier by model string, is the biggest cost lever on a chat workload. * **The window is the frontier tier's.** Dropping to this tier does not force you to split long inputs. *** ## Related * [GPT-5.6 Luna model page](https://reapi.ai/models/gpt-5-6-luna) — current rates * [GPT-5.6 Terra](/docs/gpt-5-6-terra) — the balanced tier above it * [GPT-5.6 Sol](/docs/gpt-5-6-sol) — the frontier tier * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-5.6-sol (https://reapi.ai/docs/gpt-5-6-sol) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-5.6 Sol — the frontier model for complex professional work — exposed through reAPI as a drop-in > OpenAI-compatible Chat Completions endpoint. A **1,050,000-token** context > window, **128,000** max output tokens, six `reasoning_effort` rungs from > `none` to `max` defaulting to **`medium`**, text and image input, and > functions, web search, file search and computer use. OpenAI rates its reasoning **Highest** in this family and its speed Fast. The wire > `model` id is **`gpt-5.6-sol`**. Current rates live on the > [model page](https://reapi.ai/models/gpt-5-6-sol). **The URL and the model id differ.** This page and the model page spell the slug `gpt-5-6-sol` because a URL cannot carry dots. The string your request body needs is `gpt-5.6-sol`. ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-sol", "messages": [ { "role": "user", "content": "Review this migration plan and identify the failure modes." } ], "reasoning_effort": "high", "max_completion_tokens": 16000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-5.6-sol", messages=[{"role": "user", "content": "Review this migration plan and identify the failure modes."}], reasoning_effort="high", max_completion_tokens=16000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-5.6-sol", messages: [{ role: "user", content: "Review this migration plan and identify the failure modes." }], reasoning_effort: "high", max_completion_tokens: 16000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-5.6-sol", "messages": []map[string]string{ {"role": "user", "content": "Review this migration plan and identify the failure modes."}, }, "reasoning_effort": "high", "max_completion_tokens": 16000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI states that its reasoning models "work better with the Responses API", and that "while the Chat Completions API is still supported, you'll get improved model intelligence and performance by using Responses." The GPT-5.6 release entry lists `v1/responses`, `v1/chat/completions` and `v1/batch` as this family's endpoints — so Chat Completions is a documented, supported surface, and this is a vendor preference rather than a restriction. *** ## Parameter support on this model Every field in OpenAI's Chat Completions reference (37 request-body fields as of 2026-09-07) was sent to this endpoint one at a time on that date. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `none`, `low`, `medium`, `high`, `xhigh`, `max`. `minimal` returns `400` | | `temperature` | Only the default value is accepted; any other value returns `400` | | `top_p` | Not supported by this model — any value returns `400` | | `n` | Only `1`; a larger value returns `400` | | `tools`, `tool_choice`, `parallel_tool_calls` | Applied — function calling works, including `strict` schemas | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted (returns `200`). `max_completion_tokens` is the field OpenAI documents — prefer it in new code | | `response_format` | Applied, including `json_schema` with `strict` | | `frequency_penalty`, `presence_penalty` | Accepted (`200`), but OpenAI documents neither for this model — do not rely on them | | `web_search_options` | Enables web search for the request. Each such request carries roughly 4,400 extra input tokens of tool context, billed at the input rate | | `stop`, `seed`, `logprobs`, `top_logprobs`, `logit_bias`, `prediction`, `verbosity`, `audio`, `modalities`, `service_tier`, `safety_identifier`, `moderation`, `prompt_cache_options`, `prompt_cache_retention` | Accepted (`200`) and ignored — no effect on the response | | legacy `functions` / `function_call` | `function_call` together with `tool_choice` returns `400`; use `tools` / `tool_choice` | The sampling restrictions (`temperature`, `top_p`) are what OpenAI states for its reasoning models; the rest was found by testing. There is no `minimal` on this family. ## Request body ### `model` — string, required Must be `gpt-5.6-sol` exactly. The bare `gpt-5.6` alias also routes here; sending the suffixed id pins the tier you are paying for. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt, and it is the usual reason an invoice exceeds an estimate built from answer length. ### `reasoning_effort` — string, default `"medium"` How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. Worth enabling on this tier in particular: at high effort the model can think for a long time before the first visible token, and a non-streamed request with a large budget can reach an HTTP timeout. ### `tools` / `tool_choice` — optional Function definitions and the selection strategy. Functions, web search, file search and computer use are all available on this family, and this generation adds programmatic tool calling. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema for machine-consumed output. *** ## Reasoning effort Six rungs, and unlike some families these do not collapse into one another — each is a distinct behaviour. The default is **`medium`**: OpenAI's docs state that "if you omit reasoning.effort, GPT-5.6 defaults to medium in both modes." | Effort | OpenAI's stated best-for | | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `none` | Latency-critical tasks that do not benefit from reasoning or multi-chained tool calls — voice, fast retrieval, classification | | `low` | Efficient reasoning with modest added latency: tool use, planning, search, multi-step decisions | | `medium` | **Default.** Quality and reliability where the task involves planning and judgement — agentic coding, research, spreadsheets and slides, delegated long-horizon work | | `high` | Hard reasoning, complex debugging, deep planning, high-value tasks where quality beats latency | | `xhigh` | Deep research and long asynchronous runs — security and code review, enterprise productivity. "Only use when your evals show a clear benefit" | | `max` | "Maximum reasoning for your most complex tasks. If you are currently using xhigh, evaluate if max results in stronger performance" | There is **no `minimal`** on this family. All six rungs reach the model through this endpoint (measured 2026-09-07); `minimal` is rejected with a `400`. The table above is OpenAI's own description of the family; the parameter table earlier on this page is what this endpoint answers. This is the tier the top of that ladder exists for. Starting at `high` and evaluating `xhigh` and `max` against your own cases is the usual approach; the `medium` default will under-use what you are paying for. OpenAI also documents a **Pro reasoning mode** for GPT-5.6 (`reasoning.mode`, independent of effort), and **multi-agent orchestration** in beta. Both are features of OpenAI's Responses API, so neither is part of a Chat Completions request through this endpoint. *** ## Image input | Modality | Supported | | -------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | This generation accepts images **at their original dimensions**, with `original` or `auto` image detail — no resizing step required before a screenshot or scan goes in. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input** and **output** rates. Three things to keep in mind: * **Reasoning tokens bill as output.** The default effort is `medium`, so a request that omits the field is paying for a reasoning pass. * **Effort is the first lever**, and on this family every rung is real — a middle setting buys a middle cost. * **The tier is the second lever.** All three GPT-5.6 tiers share this context window, this output ceiling, this effort ladder and this endpoint, so moving between them changes reasoning depth and price, not capability surface. Both token rates sit **below OpenAI's published per-token rate**, on input and output alike; the model page reads them live. Current numbers are on the [model page](https://reapi.ai/models/gpt-5-6-sol) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`; a request's cost is its input and output tokens at the per-million rates, converted at that ratio. OpenAI prices cached input as a separate dimension. **reAPI does not publish a cached-input rate for this model**, so bill against the input and output rates in the pricing table. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "gpt-5.6-sol", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `usage.completion_tokens` includes reasoning tokens, so it is the number to reconcile a bill against. On OpenAI's own Responses API the split is reported under `output_tokens_details.reasoning_tokens`. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use reAPI's standard error envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ---------------------------------------------------- | -------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-5.6-sol` with the dots — not the hyphenated slug | | `reasoning_effort` set to `minimal` | Not on this family — use `none`, `low`, `medium`, `high`, `xhigh` or `max` | | `temperature` other than the default, or any `top_p` | Remove the field; the model rejects it | | `n` greater than 1 | Send one request per completion | | `reasoning.mode` or multi-agent fields | Responses-API features; not part of a Chat Completions request | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | | Upstream rate limit | Retry with backoff, or route through another tier | *** ## Tips * **Start at `high`, not the default.** The default is `medium`; if a route is on this tier it is usually because it needs more than that. * **Evaluate `max` only against `xhigh`.** OpenAI's own framing is to compare the two rather than jump straight to the top. * **Stream, and set a generous `max_completion_tokens`** so a deep pass has room to finish. * **Send the suffixed id in production.** `gpt-5.6` works, but it follows whatever OpenAI points the alias at later. * **Keep the routine turns on a cheaper tier.** Same key, same endpoint, one model string apart — escalation is a field, not an integration. * **Give it the whole system.** A 1.05M-token window is only useful if you actually put the repository, the tests and the history in it. *** ## Related * [GPT-5.6 Sol model page](https://reapi.ai/models/gpt-5-6-sol) — current rates * [GPT-5.6 Terra](/docs/gpt-5-6-terra) — the balanced tier below it * [GPT-5.6 Luna](/docs/gpt-5-6-luna) — the volume tier * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-5.6-terra (https://reapi.ai/docs/gpt-5-6-terra) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-5.6 Terra — the tier that balances intelligence and cost — exposed through reAPI as a drop-in > OpenAI-compatible Chat Completions endpoint. A **1,050,000-token** context > window, **128,000** max output tokens, six `reasoning_effort` rungs from > `none` to `max` defaulting to **`medium`**, text and image input, and > functions, web search, file search and computer use. OpenAI rates its reasoning **Higher** and its speed Fast. The wire > `model` id is **`gpt-5.6-terra`**. Current rates live on the > [model page](https://reapi.ai/models/gpt-5-6-terra). **The URL and the model id differ.** This page and the model page spell the slug `gpt-5-6-terra` because a URL cannot carry dots. The string your request body needs is `gpt-5.6-terra`. ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-terra", "messages": [ { "role": "user", "content": "Implement the change in the linked issue, with tests." } ], "reasoning_effort": "medium", "max_completion_tokens": 8192, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-5.6-terra", messages=[{"role": "user", "content": "Implement the change in the linked issue, with tests."}], reasoning_effort="medium", max_completion_tokens=8192, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-5.6-terra", messages: [{ role: "user", content: "Implement the change in the linked issue, with tests." }], reasoning_effort: "medium", max_completion_tokens: 8192, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-5.6-terra", "messages": []map[string]string{ {"role": "user", "content": "Implement the change in the linked issue, with tests."}, }, "reasoning_effort": "medium", "max_completion_tokens": 8192, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI states that its reasoning models "work better with the Responses API", and that "while the Chat Completions API is still supported, you'll get improved model intelligence and performance by using Responses." The GPT-5.6 release entry lists `v1/responses`, `v1/chat/completions` and `v1/batch` as this family's endpoints — so Chat Completions is a documented, supported surface, and this is a vendor preference rather than a restriction. *** ## Parameter support on this model Every field in OpenAI's Chat Completions reference (37 request-body fields as of 2026-09-07) was sent to this endpoint one at a time on that date. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `none`, `low`, `medium`, `high`, `xhigh`, `max`. `minimal` returns `400` | | `temperature` | Only the default value is accepted; any other value returns `400` | | `top_p` | Not supported by this model — any value returns `400` | | `n` | Only `1`; a larger value returns `400` | | `tools`, `tool_choice`, `parallel_tool_calls` | Applied — function calling works, including `strict` schemas | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted (returns `200`). `max_completion_tokens` is the field OpenAI documents — prefer it in new code | | `response_format` | Applied, including `json_schema` with `strict` | | `frequency_penalty`, `presence_penalty` | Accepted (`200`), but OpenAI documents neither for this model — do not rely on them | | `web_search_options` | Enables web search for the request. Each such request carries roughly 4,400 extra input tokens of tool context, billed at the input rate | | `stop`, `seed`, `logprobs`, `top_logprobs`, `logit_bias`, `prediction`, `verbosity`, `audio`, `modalities`, `service_tier`, `safety_identifier`, `moderation`, `prompt_cache_options`, `prompt_cache_retention` | Accepted (`200`) and ignored — no effect on the response | | legacy `functions` / `function_call` | `function_call` together with `tool_choice` returns `400`; use `tools` / `tool_choice` | The sampling restrictions (`temperature`, `top_p`) are what OpenAI states for its reasoning models; the rest was found by testing. There is no `minimal` on this family. ## Request body ### `model` — string, required Must be `gpt-5.6-terra` exactly. There is no alias for this tier — the bare `gpt-5.6` id routes to the frontier model instead. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt, and it is the usual reason an invoice exceeds an estimate built from answer length. ### `reasoning_effort` — string, default `"medium"` How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. At the default effort the model thinks before it answers, so streaming is what keeps an interactive surface from looking stalled. ### `tools` / `tool_choice` — optional Function definitions and the selection strategy. Functions, web search, file search and computer use are all available on this family, and this generation adds programmatic tool calling. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema for machine-consumed output. *** ## Reasoning effort Six rungs, and unlike some families these do not collapse into one another — each is a distinct behaviour. The default is **`medium`**: OpenAI's docs state that "if you omit reasoning.effort, GPT-5.6 defaults to medium in both modes." | Effort | OpenAI's stated best-for | | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `none` | Latency-critical tasks that do not benefit from reasoning or multi-chained tool calls — voice, fast retrieval, classification | | `low` | Efficient reasoning with modest added latency: tool use, planning, search, multi-step decisions | | `medium` | **Default.** Quality and reliability where the task involves planning and judgement — agentic coding, research, spreadsheets and slides, delegated long-horizon work | | `high` | Hard reasoning, complex debugging, deep planning, high-value tasks where quality beats latency | | `xhigh` | Deep research and long asynchronous runs — security and code review, enterprise productivity. "Only use when your evals show a clear benefit" | | `max` | "Maximum reasoning for your most complex tasks. If you are currently using xhigh, evaluate if max results in stronger performance" | There is **no `minimal`** on this family. All six rungs reach the model through this endpoint (measured 2026-09-07); `minimal` is rejected with a `400`. The table above is OpenAI's own description of the family; the parameter table earlier on this page is what this endpoint answers. This tier is where the default is genuinely the right starting point. Sweep `low` for speed on planning-shaped work and `high` when a route needs complex debugging; if your evals keep choosing `xhigh` or `max`, that route belongs on the frontier tier instead. OpenAI also documents a **Pro reasoning mode** for GPT-5.6 (`reasoning.mode`, independent of effort), and **multi-agent orchestration** in beta. Both are features of OpenAI's Responses API, so neither is part of a Chat Completions request through this endpoint. *** ## Image input | Modality | Supported | | -------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | This generation accepts images **at their original dimensions**, with `original` or `auto` image detail — no resizing step required before a screenshot or scan goes in. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input** and **output** rates. Three things to keep in mind: * **Reasoning tokens bill as output.** The default effort is `medium`, so a request that omits the field is paying for a reasoning pass. * **Effort is the first lever**, and on this family every rung is real — a middle setting buys a middle cost. * **The tier is the second lever.** All three GPT-5.6 tiers share this context window, this output ceiling, this effort ladder and this endpoint, so moving between them changes reasoning depth and price, not capability surface. Both token rates sit **below OpenAI's published per-token rate**, on input and output alike; the model page reads them live. Current numbers are on the [model page](https://reapi.ai/models/gpt-5-6-terra) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`; a request's cost is its input and output tokens at the per-million rates, converted at that ratio. OpenAI prices cached input as a separate dimension. **reAPI does not publish a cached-input rate for this model**, so bill against the input and output rates in the pricing table. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "gpt-5.6-terra", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `usage.completion_tokens` includes reasoning tokens, so it is the number to reconcile a bill against. On OpenAI's own Responses API the split is reported under `output_tokens_details.reasoning_tokens`. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use reAPI's standard error envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ---------------------------------------------------- | -------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-5.6-terra` with the dots — not the hyphenated slug | | `reasoning_effort` set to `minimal` | Not on this family — use `none`, `low`, `medium`, `high`, `xhigh` or `max` | | `temperature` other than the default, or any `top_p` | Remove the field; the model rejects it | | `n` greater than 1 | Send one request per completion | | `reasoning.mode` or multi-agent fields | Responses-API features; not part of a Chat Completions request | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | | Upstream rate limit | Retry with backoff, or route through another tier | *** ## Tips * **Leave the default alone first.** `medium` is what OpenAI calls the well-balanced point, and this tier is priced for it. * **Then sweep in both directions** on a real route — `low` for speed, `high` for hard debugging — and keep whichever your evals prefer. * **Escalate on evidence, not instinct.** A route that always wants `xhigh` or `max` is telling you it belongs one tier up. * **Use a JSON schema for agent steps** whose output another step consumes. * **Budget for the reasoning pass** in `max_completion_tokens`, not just the answer. * **The window is the frontier tier's.** Choosing this tier does not shrink what the model can see. *** ## Related * [GPT-5.6 Terra model page](https://reapi.ai/models/gpt-5-6-terra) — current rates * [GPT-5.6 Sol](/docs/gpt-5-6-sol) — the frontier tier above it * [GPT-5.6 Luna](/docs/gpt-5-6-luna) — the volume tier below it * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-6.1-sol (https://reapi.ai/docs/gpt-6-1-sol) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-6.1 Sol — "near-Astra performance for complex work at a lower > cost", for complex coding, computer use and professional work — exposed > through reAPI as an OpenAI-compatible Chat Completions endpoint. A > **1,050,000-token** context window (up to **922,000** input tokens), > **128,000** max output tokens, `reasoning_effort` from `low` to `xhigh` on > this endpoint with `medium` as the default, text and image input, structured > outputs and streaming. The wire `model` id is **`gpt-6.1-sol`**. Current > rates live on the [model page](https://reapi.ai/models/gpt-6-1-sol). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6.1-sol", "messages": [ { "role": "user", "content": "Review this Python function and return the bug and the fix: def avg(xs): return sum(xs) / len(xs) if xs else 0 — callers pass generators as well as lists." } ], "reasoning_effort": "medium", "max_completion_tokens": 2000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-6.1-sol", messages=[{"role": "user", "content": "Review this Python function and return the bug and the fix: def avg(xs): return sum(xs) / len(xs) if xs else 0 — callers pass generators as well as lists."}], reasoning_effort="medium", max_completion_tokens=2000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-6.1-sol", messages: [{ role: "user", content: "Review this Python function and return the bug and the fix: def avg(xs): return sum(xs) / len(xs) if xs else 0 — callers pass generators as well as lists." }], reasoning_effort: "medium", max_completion_tokens: 2000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-6.1-sol", "messages": []map[string]string{ {"role": "user", "content": "Review this Python function and return the bug and the fix: def avg(xs): return sum(xs) / len(xs) if xs else 0 — callers pass generators as well as lists."}, }, "reasoning_effort": "medium", "max_completion_tokens": 2000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI lists both `v1/responses` and `v1/chat/completions` for GPT-6.1 Sol and states that "tool calling requires the Responses API". reAPI serves this model through Chat Completions; see [Tool calling](#tool-calling). ## Request body The table follows OpenAI's Chat Completions reference (37 request-body fields). **Default** is OpenAI's documented default. **Notes** say what reAPI does with the field and what sending it produced on 2026-10-28, one field per request unless the row names a combination. Every field is forwarded unchanged unless its row says otherwise; where the model rejected a value, its error message comes back inside reAPI's error envelope. An accepted field (`200`) is not proof that it changed the answer. | Field | Type | Default | Notes | | -------------------------------------------------------------------- | --------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | — | Must be `gpt-6.1-sol` exactly. **Required.** | | `messages` | array | — | Conversation history: `system`, `developer`, `user`, `assistant`, `tool` roles. Text and image parts — see [Image input](#image-input). **Required.** | | `reasoning_effort` | enum | `medium` | `low`, `medium`, `high`, `xhigh` on this endpoint. OpenAI also lists `max`; here it currently returns `400` — see [`reasoning_effort`](#reasoning_effort--enum-default-medium). | | `max_completion_tokens` | integer | model limit | Upper bound on generated tokens, **reasoning included**, up to 128,000. Enforced: a 40-token cap stopped at exactly 40 tokens with `finish_reason: "length"` — all 40 were reasoning tokens, so the visible answer was empty. Omitted → 128,000. | | `max_tokens` | integer | — | Deprecated by OpenAI in favour of `max_completion_tokens`. Accepted: reAPI sends its value as `max_completion_tokens` (when both are set, the smaller one) and does not forward `max_tokens` itself. | | `stream` | boolean | `false` | Server-sent events ending with `data: [DONE]`. | | `stream_options` | object | — | On streamed requests reAPI replaces it with `{ "include_usage": true }`, so the last data chunk carries `usage`. | | `response_format` | object | text | `json_schema` (with `strict`) and `json_object` both applied. | | `n` | integer | `1` | Applied: `n: 2` returned two choices. Every choice is billed. | | `temperature` | number | `1` | Only `1` is accepted; any other value returns `400` ("Only the default (1) value is supported"). | | `top_p` | number | `1` | Returns `400` ("Unsupported parameter"). | | `frequency_penalty`, `presence_penalty` | number | `0` | Return `400` ("Unsupported parameter"). | | `stop` | string or array | — | Returns `400` ("Unsupported parameter"). | | `logprobs`, `top_logprobs` | boolean, integer | `false`, — | Sent together, they returned `400` ("Unsupported parameter") naming `logprobs`; `top_logprobs` was not sent alone. | | `logit_bias` | object | — | Returns `400` ("Unsupported parameter"). | | `prediction` | object | — | OpenAI lists predicted outputs as unsupported for this model; returns `400`. | | `seed` | integer | — | Accepted; determinism not demonstrated. | | `verbosity` | enum | `medium` | `low`, `medium`, `high`. Accepted; no measured effect. | | `tools`, `tool_choice`, `parallel_tool_calls` | array, enum/object, boolean | —, `auto`, — | `tools` alone, and `tools` with `tool_choice: "required"` and `parallel_tool_calls: false`, returned `400`. `tool_choice` and `parallel_tool_calls` were not sent without `tools`. See [Tool calling](#tool-calling). | | `functions`, `function_call` | array, enum/object | — | Deprecated by OpenAI in favour of `tools`. `functions` returned the same `400`; `function_call` was not tested. | | `web_search_options` | object | — | Returns `400` ("Unknown parameter"). | | `audio`, `modalities` | object, array | `["text"]` | GPT-6.1 Sol outputs text only. `modalities` returns `400` ("Unknown parameter"). | | `service_tier` | enum | `auto` | Accepted. `flex` and `priority` were answered at the `default` tier and billed at the standard rate. | | `prompt_cache_key`, `prompt_cache_options`, `prompt_cache_retention` | string, object, enum | — | Accepted. Caching itself works — see [Pricing](#pricing). | | `store`, `metadata` | boolean, object | — | Accepted. `metadata` requires `store: true`; with `store: false` it returns `400`. | | `moderation` | object | — | Accepted; no moderation result is returned. | | `safety_identifier`, `user` | string | — | Accepted. | Checked before anything is forwarded or charged: * the body is a JSON object of at most 33,554,432 bytes (`413` above that) * `model` is exactly `gpt-6.1-sol` (surrounding whitespace is ignored) * `messages` is a non-empty array, and every entry is an object with a non-empty `role` * `stream`, when present, is a boolean * `max_completion_tokens` / `max_tokens`, when present and not `null`, is a positive integer no larger than 128,000 * `n`, when present and not `null`, is a positive integer Everything else, including fields not in the table, is passed through for the model to accept or reject. ### `reasoning_effort` — enum, default `medium` OpenAI's model page: "`reasoning.effort` supports `low`, `medium` (default), `high`, `xhigh`, and `max`." OpenAI's GPT-6 guide: "GPT-6 Astra and GPT-6.1 Sol do not support the `none` reasoning effort." On this endpoint, `low`, `medium`, `high` and `xhigh` are applied. `max` currently returns `400` with "Supported values are: 'low', 'medium', 'high', and 'xhigh'" (checked 2026-10-28); the request is forwarded unchanged and nothing is charged. `none` and `minimal` return the same error. | Effort | When to use it | | -------- | ------------------------------------------------------------- | | `low` | Short reasoning: clear extraction, small fixes, routine edits | | `medium` | The default | | `high` | Multi-file changes, long documents, conflicting requirements | | `xhigh` | The hardest cases offered on this endpoint | Reasoning tokens bill as output. `max_completion_tokens` caps them together with the visible answer. ### Tool calling OpenAI's model page: "Tool calling requires the Responses API." Its GPT-6 guide: "GPT-6 Astra, GPT-6.1 Sol, and GPT-6.1 Terra support Chat Completions, but tool calling requires Responses." On this endpoint, requests with `tools` or `functions` return `400` at every effort level offered. Structured outputs and streaming are documented for Chat Completions and work here. ## Image input | Modality | Supported | | -------------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | | Audio in / out | ❌ | | Video in | ❌ | Images go in as `image_url` content parts with a public HTTP(S) URL. Image tokens count as input. Output is text only. ## Troubleshooting | Failure | What it means | What to do | | --------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------ | | `400` naming a field | A check in the list above failed | Fix the field; nothing was charged | | `400` "Unsupported model" | `model` is not `gpt-6.1-sol` | Send the id exactly — `gpt-6-sol` is the older Sol | | `400` "does not support 'max'" | `max` is not accepted on this endpoint | Use `xhigh` | | `400` "Unsupported parameter" / "Only the default (1) value" | A sampling field the model rejects | Remove `temperature`, `top_p`, the penalties, `stop` or `logprobs` | | `400` "Function tools with reasoning\_effort are not supported" | Tools on Chat Completions | Call GPT-6.1 Sol without tools on this endpoint | | `401` | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | `402` | Insufficient balance | Top up your reAPI credits | | `413` | Body larger than 33,554,432 bytes | Shorten the conversation or send images by URL | Failures use the standard envelope: `error.code`, `error.message`, `error.type` and `error.request_id`. See the [errors catalog](/docs/api/errors). ## Response envelope ### Non-streaming (`stream: false`) ```json { "id": "req_...", "object": "chat.completion", "created": 1793150000, "model": "gpt-6.1-sol", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 120, "completion_tokens": 48, "total_tokens": 168, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } } } ``` `id` is the reAPI request id (`req_…`), the same value as `error.request_id` on a failure — quote it to support. `usage.completion_tokens` includes reasoning tokens, and `usage.prompt_tokens_details.cached_tokens` is the part of the prompt billed at the cache-read rate. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`. The last chunk before `data: [DONE]` carries `usage`; a chunk with an empty `choices` array is normal and should be skipped. ## Pricing GPT-6.1 Sol bills **per token**, from your reAPI credit balance: ``` cost = input × input_rate + cache_read × cache_read_rate + cache_write × cache_write_rate + output × output_rate 1 credit = $0.001 $1 = 1,000 credits ``` ### 1. Cache reads and writes have their own rates Prompt tokens served from cache (`usage.prompt_tokens_details.cached_tokens`) bill at the cache-read rate, 5% of the input rate. The first request that writes a prefix to the cache bills those tokens at the cache-write rate. Keep a stable prefix — system message, instructions, reference documents — at the start of the conversation so repeat requests hit the cache. Checked on 2026-10-28: a 2,683-token prompt sent twice reported `cache_write_tokens: 2680` the first time and `cached_tokens: 2680` the second; the second request was billed at about 7% of the first. ### 2. Reasoning tokens are output `usage.completion_tokens` includes reasoning tokens. `reasoning_effort` and `max_completion_tokens` are the levers on cost. ### 3. Prompts over 272K input tokens re-price the whole request OpenAI's rule for this model: "Prompts with more than 272K input tokens are priced at 2x input and cache rates and 1.5x output for the full request." The long-context rates are listed separately on the model page. reAPI bills GPT-6.1 Sol at OpenAI's standard per-token rate. Current numbers are on the [model page](https://reapi.ai/models/gpt-6-1-sol) — that table is the canonical source, not this page. ## Related * [GPT-6.1 Sol model page](https://reapi.ai/models/gpt-6-1-sol) — current rates and playground * [GPT-6 Astra](/docs/gpt-6-astra) — OpenAI's most capable GPT-6 model * [GPT-6.1 Terra](/docs/gpt-6-1-terra) — the faster, lower-priced GPT-6.1 model * [GPT-6 Sol](/docs/gpt-6-sol) — the previous Sol * [GPT-6 Luna](/docs/gpt-6-luna) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) --- # gpt-6.1-terra (https://reapi.ai/docs/gpt-6-1-terra) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-6.1 Terra — "a fast, efficient model for visual reasoning, > precise computer use, and clear, natural writing" — exposed through reAPI as > an OpenAI-compatible Chat Completions endpoint. A **1,050,000-token** context > window (up to **922,000** input tokens), **128,000** max output tokens, > `reasoning_effort` from `none` to `max` with `medium` as the default, text and > image input, structured outputs and streaming. The wire `model` id is > **`gpt-6.1-terra`**. Current rates live on the > [model page](https://reapi.ai/models/gpt-6-1-terra). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6.1-terra", "messages": [ { "role": "user", "content": "Rewrite this release note for a non-technical customer in under 80 words: v4.2 adds SSO via SAML and raises the export limit to 50k rows." } ], "reasoning_effort": "medium", "max_completion_tokens": 2000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-6.1-terra", messages=[{"role": "user", "content": "Rewrite this release note for a non-technical customer in under 80 words: v4.2 adds SSO via SAML and raises the export limit to 50k rows."}], reasoning_effort="medium", max_completion_tokens=2000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-6.1-terra", messages: [{ role: "user", content: "Rewrite this release note for a non-technical customer in under 80 words: v4.2 adds SSO via SAML and raises the export limit to 50k rows." }], reasoning_effort: "medium", max_completion_tokens: 2000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-6.1-terra", "messages": []map[string]string{ {"role": "user", "content": "Rewrite this release note for a non-technical customer in under 80 words: v4.2 adds SSO via SAML and raises the export limit to 50k rows."}, }, "reasoning_effort": "medium", "max_completion_tokens": 2000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI lists both `v1/responses` and `v1/chat/completions` for GPT-6.1 Terra and states that "tool calling requires the Responses API". reAPI serves this model through Chat Completions; see [Tool calling](#tool-calling). ## Request body The table follows OpenAI's Chat Completions reference (37 request-body fields). **Default** is OpenAI's documented default. **On this endpoint** is what reAPI does with the field and what sending it produced on 2026-10-27, one field per request. An accepted field (`200`) is not proof that it changed the answer; where the response showed no effect, the row says so. Every field is forwarded unchanged unless the row says otherwise. | Field | Type | Default | Notes | | -------------------------------------------------------------------- | --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | Must be `gpt-6.1-terra` exactly. **Required.** | | `messages` | array | — | Conversation history: `system`, `developer`, `user`, `assistant`, `tool` roles. Text and image parts — see [Image input](#image-input). **Required.** | | `reasoning_effort` | enum | `medium` | `none`, `low`, `medium`, `high`, `xhigh`, `max` — see [`reasoning_effort`](#reasoning_effort--enum-default-medium). | | `max_completion_tokens` | integer | model limit | Upper bound on generated tokens, **reasoning included**, up to 128,000. reAPI sends it upstream (omitted → 128,000), but on this model it is **currently not enforced**: on 2026-10-27 a 40-token cap returned about 480 tokens. You are billed for the tokens actually generated, as reported in `usage`. | | `max_tokens` | integer | — | Deprecated by OpenAI in favour of `max_completion_tokens`. Accepted: reAPI sends its value as `max_completion_tokens` (when both are set, the smaller one). Not enforced either, as above. | | `stream` | boolean | `false` | Server-sent events ending with `data: [DONE]`. | | `stream_options` | object | — | reAPI always sets `include_usage: true` on streamed requests, so the last data chunk carries `usage`. | | `response_format` | object | text | `json_schema` (with `strict`) and `json_object` both applied. | | `n` | integer | `1` | Only one choice comes back: `n: 2` answered `200` with a single choice. Send one request per completion. | | `temperature` | number | `1` | `0`–`2`. Accepted and forwarded; OpenAI's model page documents no sampling controls for this model and no effect was visible. | | `top_p` | number | `1` | Accepted and forwarded; no visible effect, as above. | | `frequency_penalty`, `presence_penalty` | number | `0` | `-2`–`2`. Accepted; no visible effect. | | `stop` | string or array | — | Accepted but **not applied**: the stop word still appeared in the answer. | | `logprobs`, `top_logprobs` | boolean, integer | `false`, — | Accepted; **no log probabilities are returned**. | | `seed` | integer | — | Accepted; determinism not demonstrated. | | `verbosity` | enum | `medium` | `low`, `medium`, `high`. Accepted; no measured effect. | | `tools`, `tool_choice`, `parallel_tool_calls` | array, enum/object, boolean | —, `auto`, — | Not documented by OpenAI for this model on Chat Completions — not promised here. See [Tool calling](#tool-calling). | | `functions`, `function_call` | array, enum/object | — | Deprecated by OpenAI in favour of `tools`; same status as `tools`. | | `web_search_options` | object | — | Accepted, but **no search ran**: the answer said it could not verify current events and no search-context tokens were billed. | | `audio`, `modalities` | object, array | `["text"]` | GPT-6.1 Terra outputs text only. A request for audio answered `200` with text and no audio. | | `prediction` | object | — | OpenAI lists predicted outputs as unsupported for this model. Accepted; no effect expected. | | `logit_bias` | object | — | Accepted; no effect demonstrated. | | `service_tier` | enum | `auto` | Accepted. `flex` and `priority` were billed at the standard rate. | | `prompt_cache_key`, `prompt_cache_options`, `prompt_cache_retention` | string, object, enum | — | Accepted. Caching itself works — see [Pricing](#pricing). | | `store`, `metadata` | boolean, object | — | Accepted. | | `moderation` | object | — | Accepted; no moderation result is returned. | | `safety_identifier`, `user` | string | — | Accepted. | Checked before anything is forwarded or charged: * the body is a JSON object of at most 33,554,432 bytes (`413` above that) * `model` is exactly `gpt-6.1-terra` (surrounding whitespace is ignored) * `messages` is a non-empty array, and every entry is an object with a non-empty `role` * `stream`, when present, is a boolean * `max_completion_tokens` / `max_tokens`, when present and not `null`, is a positive integer no larger than 128,000 * `n`, when present and not `null`, is a positive integer Everything else, including fields not in the table, is passed through for the model to accept or reject. ### `reasoning_effort` — enum, default `medium` OpenAI's model page: "`reasoning.effort` supports `none`, `low`, `medium` (default), `high`, `xhigh`, and `max`." OpenAI's guide: "Start with `medium` and increase it if the improvement in quality is worth the added time and tokens." GPT-6.1 Sol has no `none` level; GPT-6.1 Terra does. Effort is applied on this endpoint. On a multi-step arithmetic question, `none` answered in 19 tokens and got it wrong; `xhigh` used 80 reasoning tokens and `max` 199, and both answered correctly. | Effort | When to use it | | -------- | ------------------------------------------------------------------------- | | `none` | Simple rewrites, tagging and extraction where no reasoning pass is needed | | `low` | Short reasoning: field extraction from a clear image, light edits | | `medium` | The default and OpenAI's suggested starting point | | `high` | Comparing drawings or screens, conflicting instructions | | `xhigh` | Hard cases where a longer reasoning pass pays for itself | | `max` | The most reasoning the model offers | Reasoning tokens bill as output. Because the output cap is not enforced on this model at the moment, `reasoning_effort` and the prompt are the levers that bound output length and cost. ### Tool calling OpenAI's model page: "Tool calling requires the Responses API." Its GPT-6 guide: "GPT-6 Astra, GPT-6.1 Sol, and GPT-6.1 Terra support Chat Completions, but tool calling requires Responses." This endpoint therefore does not promise tool calling on GPT-6.1 Terra. Requests with `tools` are forwarded unchanged — on 2026-10-27 they returned `tool_calls` — but only the documented surface is guaranteed and that behaviour can change without notice. Structured outputs and streaming are documented for Chat Completions and work here. ## Image input | Modality | Supported | | -------------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | | Audio in / out | ❌ | | Video in | ❌ | Images go in as `image_url` content parts with a public HTTP(S) URL. Output is text only. OpenAI suggests the model for matching product photos to catalog entries, interpreting technical drawings and reading application screens. ## Troubleshooting | Failure | What it means | What to do | | ------------------------------------------ | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `400` naming a field | A check in the list above failed | Fix the field; nothing was charged | | `400` "Unsupported model" | `model` is not `gpt-6.1-terra` | Send the id exactly — `gpt-6-terra` does not exist | | `401` | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | `402` | Insufficient balance | Top up your reAPI credits | | `413` | Body larger than 33,554,432 bytes | Shorten the conversation or send images by URL | | Answer longer than `max_completion_tokens` | The cap is not enforced on this model at the moment; usage is billed as generated | Ask for the length you want in the prompt and lower `reasoning_effort` | | Only one choice with `n` > 1 | This endpoint returns one choice | Send one request per completion | Failures use the standard envelope: `error.code`, `error.message`, `error.type` and `error.request_id`. See the [errors catalog](/docs/api/errors). ## Response envelope ### Non-streaming (`stream: false`) ```json { "id": "req_...", "object": "chat.completion", "created": 1793050000, "model": "gpt-6.1-terra", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 120, "completion_tokens": 48, "total_tokens": 168, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } } } ``` `id` is the reAPI request id (`req_…`), the same value as `error.request_id` on a failure — quote it to support. `usage.completion_tokens` includes reasoning tokens, and `usage.prompt_tokens_details.cached_tokens` is the part of the prompt billed at the cache-read rate. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`. The last chunk before `data: [DONE]` carries `usage`; a chunk with an empty `choices` array is normal and should be skipped. ## Pricing GPT-6.1 Terra bills **per token**, from your reAPI credit balance: ``` cost = input × input_rate + cache_read × cache_read_rate + cache_write × cache_write_rate + output × output_rate 1 credit = $0.001 $1 = 1,000 credits ``` ### 1. Cache reads and writes have their own rates Prompt tokens served from cache (`usage.prompt_tokens_details.cached_tokens`) bill at the cache-read rate, far below the input rate. Keep a stable prefix — system message, instructions, reference documents — at the start of the conversation so repeat requests hit the cache. ### 2. Reasoning tokens are output `usage.completion_tokens` includes reasoning tokens. `reasoning_effort` is the first lever on cost. ### 3. Prompts over 272K input tokens re-price the whole request OpenAI's rule for this model: "Prompts with more than 272K input tokens are priced at 2x input and cache rates and 1.5x output for the full request." On reAPI the 272K line is measured on uncached input tokens: cache reads and cache writes do not count toward it. The long-context rates are listed separately on the model page. Every rate sits **below OpenAI's published per-token rate**. Current numbers are on the [model page](https://reapi.ai/models/gpt-6-1-terra) — that table is the canonical source, not this page. ## Related * [GPT-6.1 Terra model page](https://reapi.ai/models/gpt-6-1-terra) — current rates and playground * [GPT-6 Luna](/docs/gpt-6-luna) — OpenAI's most efficient GPT-6 model * [GPT-6 Sol](/docs/gpt-6-sol) * [GPT-6 Astra](/docs/gpt-6-astra) * [GPT-5.6 Terra](/docs/gpt-5-6-terra) — the previous Terra * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) --- # gpt-6-astra (https://reapi.ai/docs/gpt-6-astra) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-6 Astra — "our most capable model, built for the hardest > end-to-end work" — exposed through reAPI as a drop-in OpenAI-compatible Chat > Completions endpoint. A **1,050,000-token** context window, **128,000** max > output tokens, `reasoning_effort` from `low` to `max`, text and image > input, structured outputs and streaming. OpenAI rates its reasoning > **Highest** and its speed Fast. The wire `model` id is **`gpt-6-astra`**. > Current rates live on the [model page](https://reapi.ai/models/gpt-6-astra). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-astra", "messages": [ { "role": "user", "content": "Review this migration plan and list every step that can fail, with its rollback." } ], "reasoning_effort": "high", "max_completion_tokens": 16000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-6-astra", messages=[{"role": "user", "content": "Review this migration plan and list every step that can fail, with its rollback."}], reasoning_effort="high", max_completion_tokens=16000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-6-astra", messages: [{ role: "user", content: "Review this migration plan and list every step that can fail, with its rollback." }], reasoning_effort: "high", max_completion_tokens: 16000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-6-astra", "messages": []map[string]string{ {"role": "user", "content": "Review this migration plan and list every step that can fail, with its rollback."}, }, "reasoning_effort": "high", "max_completion_tokens": 16000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI states that its reasoning models "work better with the Responses API", and that "while the Chat Completions API is still supported, you'll get improved model intelligence and performance by using Responses." The GPT-6 Astra release entry lists `v1/responses` and `v1/chat/completions` among its endpoints, so Chat Completions is a documented, supported surface — with one real caveat, covered under [Tool calling](#tool-calling). ## Parameter support on this model Every field in OpenAI's Chat Completions reference (37 request-body fields as of 2026-09-07) was sent to this endpoint one at a time on that date. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `low`, `medium`, `high`, `xhigh`, `max`. `none` and `minimal` return `400` | | `temperature` | Only the default value is accepted; any other value returns `400` | | `top_p` | Not supported by this model — any value returns `400` | | `n` | Only `1`; a larger value returns `400` | | `tools`, `tool_choice`, `parallel_tool_calls` | Not documented by OpenAI for Chat Completions on this model — not promised on this endpoint, see below | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted (returns `200`). `max_completion_tokens` is the field OpenAI documents for this model — prefer it in new code | | `response_format` | Applied, including `json_schema` with `strict` | | `frequency_penalty`, `presence_penalty` | Accepted (`200`), but OpenAI documents neither for this model — do not rely on them | | `web_search_options` | Enables web search for the request. Each such request carries roughly 4,400 extra input tokens of tool context, billed at the input rate, and `reasoning_effort: "minimal"` is then rejected | | `stop`, `seed`, `logprobs`, `top_logprobs`, `logit_bias`, `prediction`, `verbosity`, `audio`, `modalities`, `service_tier`, `safety_identifier`, `moderation`, `prompt_cache_options`, `prompt_cache_retention` | Accepted (`200`) and ignored — no effect on the response | | legacy `functions` / `function_call` | `function_call` together with `tool_choice` returns `400`; use `tools` / `tool_choice` | The sampling restrictions (`temperature`, `top_p`) and the effort values are also stated in OpenAI's release notes; the rest was found by testing. The playground on the model page offers only the fields this model accepts. ## Request body ### `model` — string, required Must be `gpt-6-astra` exactly. OpenAI lists `gpt-6-astra` as the only snapshot of this model, so there is no dated alias to pin. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user` and `assistant`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Omitted, the request runs under the model's ceiling. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt — a budget of a few dozen tokens on a non-streamed request comes back as a `400` "model output limit was reached" rather than a partial answer. ### `reasoning_effort` — string How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). OpenAI states no default for GPT-6 Astra; set it explicitly. ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`, with a final chunk carrying `usage`. Worth enabling on this model: at high effort it can think for a long time before the first visible token, and a non-streamed request with a large budget can reach an HTTP timeout. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema for machine-consumed output. Structured outputs are supported on GPT-6 Astra. *** ## Reasoning effort OpenAI's model page: "reasoning.effort supports low, medium, high, xhigh, and max." Its release notes add that GPT-6 Astra **does not support `none`**, and its reasoning guide says defaults are model-dependent without naming one for this model. | Effort | OpenAI's stated best-for | | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `low` | Efficient reasoning with modest added latency: tool use, planning, search, multi-step decisions | | `medium` | Quality and reliability where the task involves planning and judgement — agentic coding, research, delegated long-horizon work | | `high` | Hard reasoning, complex debugging, deep planning, high-value tasks where quality beats latency | | `xhigh` | Deep research and long asynchronous runs — security and code review, enterprise productivity. "Only use when your evals show a clear benefit" | | `max` | "Maximum reasoning for your most complex tasks" | All five rungs reach the model through this endpoint (measured 2026-09-07); `none` and `minimal` are rejected with a `400`. The table above is OpenAI's own description; the parameter table earlier on this page is what this endpoint answers. OpenAI also documents, for GPT-6 Astra on its Responses API only: changing the reasoning effort mid-conversation (`configuration_update`), async tool calling, mid-turn steering over WebSockets, and misalignment monitoring. None of these is part of a Chat Completions request through this endpoint. *** ## Tool calling OpenAI's release notes for GPT-6 Astra: "Tool calling requires the Responses API. If you use tools with Chat Completions, follow the Responses migration guide." Its reasoning guide says the same in one line: "Chat Completions does not support function calling with GPT-6 Astra." This endpoint therefore does not promise tool calling on GPT-6 Astra: what the model accepts today can change with the vendor's routing, and only the documented surface is guaranteed. Structured outputs (`response_format`) and streaming are documented for Chat Completions and work here. Route agentic work that depends on a tool loop to a model that documents tools on Chat Completions, such as [GPT-5.6 Sol](/docs/gpt-5-6-sol). *** ## Image input | Modality | Supported | | -------------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | | Audio in / out | ❌ | | Video in | ❌ | Images go in as `image_url` content parts and are accepted at their original dimensions. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input** and **output** rates and a second tier for long prompts: * **Reasoning tokens bill as output.** Effort is the first lever on cost. * **Prompts over 272K tokens re-price the whole request** at the long-context tier — OpenAI's own rule for this model, mirrored here. * **Tier is the second lever.** GPT-6 Astra shares its context window, output ceiling and endpoint with the GPT-5.6 family, so moving down a tier changes reasoning depth and price, not capability surface. Every rate sits **below OpenAI's published per-token rate**, on both tiers and both dimensions; the model page reads them live. Current numbers are on the [model page](https://reapi.ai/models/gpt-6-astra) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`; a request's cost is its input and output tokens at the per-million rates, converted at that ratio. Prompt caching is priced separately, on **both** tiers. A **cache read** costs a fraction of plain input and a **cache write** costs more than it, and all four rates have their own rows in the pricing table. Each request is charged the exact amount the serving gateway settled it at, so a cache-heavy request is billed on those rates rather than on the plain input rate. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1788600000, "model": "gpt-6-astra", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `usage.completion_tokens` includes reasoning tokens, so it is the number to reconcile a bill against. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`. The last chunk before `data: [DONE]` carries `usage`; a chunk with an empty `choices` array is normal and should be skipped. *** ## Errors Failures use the standard envelope: `error.code`, `error.message` and `error.request_id`. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-6-astra` exactly | | `reasoning_effort` set to `none` or `minimal` | Use `low`, `medium`, `high`, `xhigh` or `max` | | `n` greater than 1 | Send one request per completion | | `tools` in the request | Not documented by OpenAI for this model on Chat Completions — not guaranteed here; prefer a model that documents tools on Chat Completions | | `temperature` other than the default, or any `top_p` | Remove the field; the model rejects it | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | | Upstream rate limit | Retry with backoff, or route through another tier | *** ## Tips * **Set the effort on every request.** OpenAI names no default for this model; `high` is the usual starting point for the work it is priced for. * **Stream, and set a generous `max_completion_tokens`** so a deep pass has room to finish. * **Keep the routine turns on a cheaper tier.** Same key, same endpoint, one model string apart — escalation is a field, not an integration. * **Give it the whole system.** A 1.05M-token window is only useful if you actually put the repository, the tests and the history in it — and watch the 272K line, where the long-context tier starts. * **Need a guaranteed tool loop?** Use [GPT-5.6 Sol](/docs/gpt-5-6-sol) on this endpoint, or OpenAI's Responses API directly. *** ## Related * [GPT-6 Astra model page](https://reapi.ai/models/gpt-6-astra) — current rates * [GPT-5.6 Sol](/docs/gpt-5-6-sol) — the tier below, with tool calling on this endpoint * [GPT-5.6 Terra](/docs/gpt-5-6-terra) — the balanced tier * [GPT-5.6 Luna](/docs/gpt-5-6-luna) — the volume tier * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-6-luna (https://reapi.ai/docs/gpt-6-luna) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-6 Luna — its most efficient GPT-6 model, built for focused, > high-volume tasks — exposed through reAPI as an OpenAI-compatible Chat > Completions endpoint. A **1,050,000-token** context window (up to **922,000** > input tokens), **128,000** max output tokens, `reasoning_effort` from `none` > to `max` with `medium` as the default, text and image input, structured > outputs and streaming. The wire `model` id is **`gpt-6-luna`**. Current rates > live on the [model page](https://reapi.ai/models/gpt-6-luna). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-luna", "messages": [ { "role": "user", "content": "Classify this support ticket as billing, bug, feature request or account access: I was charged twice this month." } ], "reasoning_effort": "low", "max_completion_tokens": 1000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-6-luna", messages=[{"role": "user", "content": "Classify this support ticket as billing, bug, feature request or account access: I was charged twice this month."}], reasoning_effort="low", max_completion_tokens=1000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-6-luna", messages: [{ role: "user", content: "Classify this support ticket as billing, bug, feature request or account access: I was charged twice this month." }], reasoning_effort: "low", max_completion_tokens: 1000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-6-luna", "messages": []map[string]string{ {"role": "user", "content": "Classify this support ticket as billing, bug, feature request or account access: I was charged twice this month."}, }, "reasoning_effort": "low", "max_completion_tokens": 1000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI's model page lists both `v1/responses` and `v1/chat/completions` for GPT-6 Luna and recommends the Responses API for built-in tools and function calling. reAPI serves this model through Chat Completions; see [Tool calling](#tool-calling) for how function calling behaves here. ## Parameter support on this model Measured on this endpoint on 2026-09-24. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `none`, `low`, `medium`, `high`, `xhigh`, `max`; `medium` when omitted | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted. `max_completion_tokens` is the field OpenAI documents — prefer it in new code | | `tools`, `tool_choice` | Returns `tool_calls`, at `medium` effort as well as `none` — see [Tool calling](#tool-calling) | | `response_format` | Applied, including `json_schema` with `strict` | | `stream` | Server-sent events ending with `data: [DONE]`; the last data chunk carries `usage` | | `n` | Only `1`; a larger value returns `400` | | `temperature`, `top_p`, `frequency_penalty`, `presence_penalty` | Not supported by this model — sending any of them returns `400`. Leave them out of the request | | `seed`, `stop`, `logprobs`, `verbosity` | Accepted (`200`) but have no effect — for example `stop` does not cut the answer and no `logprobs` come back. Do not rely on them | The playground on the model page offers every field above that works; `stream` starts off and the output cap starts blank, matching OpenAI's defaults. Any other Chat Completions field can be added as JSON under "other fields". ## Request body ### `model` — string, required Must be `gpt-6-luna` exactly. It is a different model from `gpt-5.6-luna` and from `gpt-6-sol`. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt. ### `reasoning_effort` — string, default `medium` How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema with `strict: true` for machine-consumed output. Structured outputs are supported on GPT-6 Luna. *** ## Reasoning effort OpenAI's model page: "`reasoning.effort` supports `none`, `low`, `medium` (default), `high`, `xhigh`, and `max`." On Chat Completions the same values go in the top-level `reasoning_effort` field. All six are accepted by this endpoint. | Effort | When to use it | | -------- | ------------------------------------------------------------------------------------------------- | | `none` | No reasoning pass. The fastest choice for simple function-calling routes and plain classification | | `low` | Extraction and tagging where a short reasoning pass is enough | | `medium` | The default — a balance of accuracy and cost | | `high` | Harder judgement calls where accuracy matters more than cost | | `xhigh` | Hard cases where a longer reasoning pass pays for itself | | `max` | The most reasoning the model offers — rarely worth it for high-volume work | For high-volume work, measure accuracy on a labelled sample at each setting and pick the lowest one that holds your target — reasoning tokens bill as output. *** ## Tool calling OpenAI's model page: "Use the Responses API for built-in tools and function calling. Chat Completions supports function calling only with `reasoning_effort` set to `none`." That restriction describes OpenAI's own Chat Completions endpoint. On this endpoint, requests with `tools` returned `tool_calls` at `medium` effort as well as at `none` (measured 2026-09-24), so choose the effort the task needs. Your application executes the returned `tool_calls` and sends each result back as a `tool` message in the next request. This pattern suits routing: give GPT-6 Luna a short list of functions and let it pick one — `none` keeps each decision fastest. *** ## Image input | Modality | Supported | | -------------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | | Audio in / out | ❌ | | Video in | ❌ | Images go in as `image_url` content parts with a public HTTP(S) URL. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance: * **Input, output, cache read and cache write** each have their own rate. * **Reasoning tokens bill as output.** Effort is the first lever on cost. * **Prompts over 272K input tokens re-price the whole request** at the long-context rates — OpenAI's own rule for this model, mirrored here. Every standard-context rate sits **below OpenAI's published per-token rate**. Current numbers are on the [model page](https://reapi.ai/models/gpt-6-luna) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1790230000, "model": "gpt-6-luna", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 45, "completion_tokens": 30, "total_tokens": 75, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 9 } } } ``` `usage.completion_tokens` includes reasoning tokens, and `usage.prompt_tokens_details.cached_tokens` is the part of the prompt billed at the cache-read rate. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`. The last chunk before `data: [DONE]` carries `usage`; a chunk with an empty `choices` array is normal and should be skipped. *** ## Errors Failures use the standard envelope: `error.code`, `error.message` and `error.request_id`. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-6-luna` exactly | | `n` greater than 1 | Send one request per completion | | `temperature`, `top_p`, `frequency_penalty` or `presence_penalty` in the request | Remove the field — this model returns `400` for it | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | *** ## Related * [GPT-6 Luna model page](https://reapi.ai/models/gpt-6-luna) — current rates and playground * [GPT-6 Sol](/docs/gpt-6-sol) — for complex coding and agent workflows * [GPT-5.6 Luna](/docs/gpt-5-6-luna) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # gpt-6-sol (https://reapi.ai/docs/gpt-6-sol) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's GPT-6 Sol — built for complex coding and agentic workflows — exposed > through reAPI as an OpenAI-compatible Chat Completions endpoint. A > **1,050,000-token** context window (up to **922,000** input tokens), > **128,000** max output tokens, `reasoning_effort` from `none` to `max` with > `medium` as the default, text and image input, structured outputs and > streaming. The wire `model` id is **`gpt-6-sol`**. Current rates live on the > [model page](https://reapi.ai/models/gpt-6-sol). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-sol", "messages": [ { "role": "user", "content": "Review this migration plan for risks and propose a test checklist." } ], "reasoning_effort": "medium", "max_completion_tokens": 16000, "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="gpt-6-sol", messages=[{"role": "user", "content": "Review this migration plan for risks and propose a test checklist."}], reasoning_effort="medium", max_completion_tokens=16000, stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if chunk.choices else None if delta: print(delta, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "gpt-6-sol", messages: [{ role: "user", content: "Review this migration plan for risks and propose a test checklist." }], reasoning_effort: "medium", max_completion_tokens: 16000, stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-6-sol", "messages": []map[string]string{ {"role": "user", "content": "Review this migration plan for risks and propose a test checklist."}, }, "reasoning_effort": "medium", "max_completion_tokens": 16000, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs work once you swap the base URL, the key and the model string. OpenAI's model page lists both `v1/responses` and `v1/chat/completions` for GPT-6 Sol and recommends the Responses API for built-in tools and function calling. reAPI serves this model through Chat Completions; see [Tool calling](#tool-calling) for how function calling behaves here. ## Parameter support on this model Measured on this endpoint on 2026-09-24. Fields not listed below behave as documented by OpenAI. | Field | Result | | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `reasoning_effort` | Accepts `none`, `low`, `medium`, `high`, `xhigh`, `max`; `medium` when omitted | | `max_completion_tokens` | Applied, up to 128,000 | | `max_tokens` | Accepted. `max_completion_tokens` is the field OpenAI documents — prefer it in new code | | `tools`, `tool_choice` | Returns `tool_calls`, at `medium` effort as well as `none` — see [Tool calling](#tool-calling) | | `response_format` | Applied, including `json_schema` with `strict` | | `stream` | Server-sent events ending with `data: [DONE]`; the last data chunk carries `usage` | | `temperature`, `top_p`, `frequency_penalty`, `presence_penalty` | Not supported by this model — sending any of them returns `400`. Leave them out of the request | | `seed`, `stop`, `logprobs`, `verbosity` | Accepted (`200`) but have no effect — for example `stop` does not cut the answer and no `logprobs` come back. Do not rely on them | | `n` | Only `1`; a larger value returns `400` | The playground on the model page offers every field above that has a control; `stream` starts off and the output cap starts blank, matching OpenAI's defaults. Any other Chat Completions field can be added as JSON under "other fields". ## Request body ### `model` — string, required Must be `gpt-6-sol` exactly. It is a different model from `gpt-5.6-sol`. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Roles are `system`, `user`, `assistant` and `tool`. Text and image parts are supported — see [Image input](#image-input). ### `max_completion_tokens` — integer Upper bound on generated tokens for this response, **reasoning tokens included**. The documented maximum output is **128,000** tokens. Reasoning tokens bill as **output** tokens and occupy the context window. A budget sized only for the visible answer can truncate on a harder prompt. ### `reasoning_effort` — string, default `medium` How much the model thinks before answering. See [Reasoning effort](#reasoning-effort). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events terminated by `data: [DONE]`. Worth enabling at higher effort, where the model can think for a long time before the first visible token. ### `response_format` — object, optional Constrains the answer's shape, including a JSON schema for machine-consumed output. Structured outputs are supported on GPT-6 Sol. *** ## Reasoning effort OpenAI's model page: "`reasoning.effort` supports `none`, `low`, `medium` (default), `high`, `xhigh`, and `max`." On Chat Completions the same values go in the top-level `reasoning_effort` field. All six are accepted by this endpoint. | Effort | When to use it | | -------- | ------------------------------------------------------------------------------------ | | `none` | No reasoning pass. The fastest choice, for example on simple function-calling routes | | `low` | Quick answers where a short reasoning pass is enough | | `medium` | The default — a balance of depth and latency | | `high` | Hard debugging and planning where quality matters more than latency | | `xhigh` | Long, deep runs such as security or code review | | `max` | The most reasoning the model offers, for the hardest tasks | *** ## Tool calling OpenAI's model page: "Use the Responses API for built-in tools and function calling. Chat Completions supports function calling only with `reasoning_effort` set to `none`." That restriction describes OpenAI's own Chat Completions endpoint. On this endpoint, requests with `tools` returned `tool_calls` at `medium` effort as well as at `none` (measured 2026-09-24), so choose the effort the task needs. Your application executes the returned `tool_calls` and sends each result back as a `tool` message in the next request. *** ## Image input | Modality | Supported | | -------------- | :-------: | | Text in | ✅ | | Image in | ✅ | | Text out | ✅ | | Audio in / out | ❌ | | Video in | ❌ | Images go in as `image_url` content parts. Output is text only. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance: * **Input, output, cache read and cache write** each have their own rate. * **Reasoning tokens bill as output.** Effort is the first lever on cost. * **Prompts over 272K input tokens re-price the whole request** at the long-context rates — OpenAI's own rule for this model, mirrored here. Every rate sits **below OpenAI's published per-token rate**. Current numbers are on the [model page](https://reapi.ai/models/gpt-6-sol) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1790230000, "model": "gpt-6-sol", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064, "prompt_tokens_details": { "cached_tokens": 1024 } } } ``` `usage.completion_tokens` includes reasoning tokens, and `usage.prompt_tokens_details.cached_tokens` is the part of the prompt billed at the cache-read rate. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk` with the incremental text in `choices[0].delta.content`. The last chunk before `data: [DONE]` carries `usage`; a chunk with an empty `choices` array is normal and should be skipped. *** ## Errors Failures use the standard envelope: `error.code`, `error.message` and `error.request_id`. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `gpt-6-sol` exactly | | `temperature`, `top_p`, `frequency_penalty` or `presence_penalty` in the request | Remove the field — this model returns `400` for it | | `n` greater than 1 | Send one request per completion | | `max_completion_tokens` above the ceiling | Lower it; the documented maximum output is 128,000 | | Truncated answer on a hard prompt | The reasoning pass consumed the allowance — raise `max_completion_tokens` | | Insufficient balance | Top up your reAPI credits | *** ## Related * [GPT-6 Sol model page](https://reapi.ai/models/gpt-6-sol) — current rates and playground * [GPT-6 Astra](/docs/gpt-6-astra) * [GPT-5.6 Sol](/docs/gpt-5-6-sol) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # GPT Image 2.5 (https://reapi.ai/docs/gpt-image-2-5) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's image generation and editing model. GPT Image 2.5 > renders more natural lighting and richer texture, preserves the subjects of > reference photos more reliably, edits only the element you name, and holds > that consistency across a long chain of edits. Two ids ship: **Flare** for > everyday work and **Sunburst** when edit precision matters most. See pricing > on the [model page](https://reapi.ai/models/gpt-image-2-5). ## The two models | Model id | Positioning | Speed | | ------------------------ | ------------------------------------------ | --------- | | `gpt-image-2.5-flare` | The default choice for most applications | Very fast | | `gpt-image-2.5-sunburst` | Most capable; tighter control across edits | Medium | Both accept text and image input, return images, read the same parameters, and meter on the same token rate card. The number of tokens an image consumes differs between them, so equal rates do not mean equal cost per image. ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.5-flare", "prompt": "An editorial poster for a ceramic kettle, soft window light", "size": "1536x1024", "quality": "high" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gpt-image-2.5-flare", "prompt": "An editorial poster for a ceramic kettle, soft window light", "size": "1536x1024", "quality": "high", }, ) task_id = resp.json()["id"] ``` ```javascript const res = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'gpt-image-2.5-flare', prompt: 'An editorial poster for a ceramic kettle, soft window light', size: '1536x1024', quality: 'high', }), }); const { id } = await res.json(); ``` ```go body := strings.NewReader(`{ "model": "gpt-image-2.5-flare", "prompt": "An editorial poster for a ceramic kettle, soft window light", "size": "1536x1024", "quality": "high" }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", body) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` ## Endpoint ``` POST https://reapi.ai/api/v1/images/generations ``` Headers: | Header | Value | | --------------- | --------------------- | | `Authorization` | `Bearer YOUR_API_KEY` | | `Content-Type` | `application/json` | The call returns a task id immediately. Poll `GET https://reapi.ai/api/v1/tasks/:id` until `status` is `completed` or `failed`. ## Parameters | Name | Type | Required | Default | Notes | | -------------------- | --------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | `gpt-image-2.5-flare` or `gpt-image-2.5-sunburst`; append `-official` for the official channel | | `prompt` | string | yes | — | Up to 32,000 characters | | `image_urls` | string\[] | no | — | Up to 16 public image URLs; switches the request to editing | | `mask_url` | string | no | — | Public URL whose transparent area marks the region to regenerate | | `size` | string | no | `auto` | `auto`, `1024x1024`, `1536x1024`, `1024x1536`, or a custom `WIDTHxHEIGHT` | | `quality` | enum | no | `auto` | `auto`, `low`, `medium`, `high`, `xhigh`, `max` | | `background` | enum | no | `auto` | `auto`, `opaque`, `transparent` | | `output_format` | enum | no | `png` | `png`, `jpeg`, `webp` | | `output_compression` | integer | no | `100` | 0-100. Applies to `jpeg` and `webp` only | | `n` | integer | no | `1` | 1-10 images per request, official channel ids only. Each delivered image is billed. The standard ids deliver one image per request | | `moderation` | enum | no | `auto` | `auto` or `low` (less restrictive filtering). Accepted on every model id; generated images still pass the provider's safety check at either level. The website playground always sends `auto` | ### Size rules Beyond the three standard sizes, a custom `WIDTHxHEIGHT` is accepted when all of the following hold: * Both edges are divisible by 16. * The aspect ratio is between 1:3 and 3:1. * Neither edge exceeds 3840 pixels. * Total pixel count is between 655,360 and 8,294,400. Resolutions above `2560x1440` are marked experimental by the model creator. ### Quality tiers `xhigh` and `max` are new in this generation; earlier GPT Image models stop at `high`. Higher tiers take longer to render. On the standard channel, `high`, `xhigh`, and `max` each have their own per-request price; `auto`, `low`, `medium`, and an omitted quality share the regular price. On the official channel each step costs more, but not by a uniform multiple: measured at 1024x1024, one render consumes 196, 439, 1,756, 3,122 and 7,024 output tokens across the five steps, so `medium` to `high` roughly quadruples while `high` to `xhigh` does not quite double. Use `low` for drafts and compare tiers before settling on one for production output. ### Transparent backgrounds `background: "transparent"` returns a real alpha channel and requires `output_format` of `png` or `webp`. JPEG carries no alpha channel and cannot hold a transparent background regardless of the setting. ## Modes There is no `mode` parameter. Which fields you send is the mode: | Mode | Fields | | ----------------- | ------------------------------------ | | Text to image | `prompt` | | Reference edit | `prompt` + `image_urls` | | Masked inpainting | `prompt` + `image_urls` + `mask_url` | ## Media inputs Every media input is a **public HTTP(S) URL**. Base64 payloads and `data:` URIs are rejected on every reAPI endpoint, on every model. Upload your source somewhere reachable and pass the link. ## Channels Both tiers are available on two channels. The parameters are identical except `n`: the standard ids deliver one image per request. The billing model also differs. | Channel | Model ids | Billing | | -------- | ----------------------------------------------------------------- | ------------------------ | | Standard | `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst` | Flat per delivered image | | Official | `gpt-image-2.5-flare-official`, `gpt-image-2.5-sunburst-official` | Metered per token | ## Pricing dimensions **Standard** is billed per request, and each request delivers one image. Each model has separate regular, `high`, `xhigh`, and `max` prices. `auto`, `low`, `medium`, and an omitted `quality` use the regular price. Within each tier, size and reference-image count do not change the charge. **Official** is metered against the model creator's published token rates. The charge moves with: * **Quality** — the dominant term, and it does not scale by a fixed multiple. A 1024x1024 render consumes 196 output tokens at `low`, 439 at `medium`, 1,756 at `high`, 3,122 at `xhigh` and 7,024 at `max`. * **Size** — more pixels means more output tokens. * **Reference images** — each input image contributes input tokens. * **`n`** — every delivered image is billed. The reservation taken at submit time is an estimate; the final charge uses the token counts the upstream actually reports. ### What one image costs Current rates for both channels are on the [model page](https://reapi.ai/models/gpt-image-2-5) — it always carries the live price, so this section describes how each channel bills rather than quoting numbers that can go stale. **Standard** — Flare and Sunburst are priced separately, each with regular, `high`, `xhigh`, and `max` tiers. Within a tier, 1024x1024 and 3840x2160 cost the same, and a request carrying 16 reference images costs the same as one carrying none. Check the selected tier's live estimate before submitting. **Official** — metered, so `quality` moves the bill. The rows below were measured on `gpt-image-2.5-flare` for one 1024x1024 image with no reference images. `gpt-image-2.5-sunburst` reads the same rate card, but as noted above it does not necessarily consume the same number of tokens for the same request, so treat these as the Flare figures rather than as both: | `quality` | Image output tokens | | --------- | ------------------: | | `low` | 196 | | `medium` | 439 | | `high` | 1,756 | | `xhigh` | 3,122 | | `max` | 7,024 | Your prompt adds text input tokens and every reference image adds image input tokens, both on top of the rows above. A larger frame raises the output token count, a smaller one lowers it, and `n` multiplies the whole thing. Which channel is cheaper depends on quality and size: the metered bill climbs steeply with quality (the output tokens above grow about 36× from `low` to `max`), while Standard uses a fixed price within each tier. Compare the two on the model page for the size and quality you actually use. ### Bill formula Standard: ``` credits = ceil(selected_quality_tier_price_usd × 1000) ``` Official: ``` credits = ceil(metered_usd × n × 1000) ``` `1 credit = $0.001 USD`, and `$1` buys 1,000 credits. Credits never expire. Failed generations are refunded automatically, so you are only charged for images you receive. ## Output schema ```json { "id": "task_...", "status": "completed", "output": { "image_urls": ["https://..."] }, "usage": { "credits": 0 } } ``` Generated links expire. Mirror them to your own storage if you need them long term. ## Errors | Code | Meaning | | -------------------------- | ----------------------------------------------------------- | | `INVALID_REQUEST` | A parameter is missing, malformed, or out of range | | `INSUFFICIENT_CREDITS` | Balance is below the reserve for this request | | `CONTENT_POLICY_VIOLATION` | The prompt or an input image was rejected by content review | | `UPSTREAM_ERROR` | The generation failed upstream; the reserve is refunded | | `RATE_LIMITED` | Too many requests; retry with backoff | The full catalog lives at [/docs/api/errors](/docs/api/errors). ## Tips * Spell out layout, materials and lighting. This model rewards long, specific briefs and holds the requested direction as instructions get more detailed. * For an edit, name what must NOT change as well as what must. Preservation is the model's strong suit and stating it makes the result more predictable. * Pick Sunburst when a long chain of edits has to stay coherent; pick Flare when throughput matters more than the last few percent of edit precision. * `jpeg` encodes faster than `png`. Use it when latency matters and you do not need transparency. ## Related * [GPT Image 2](/docs/gpt-image-2) — the shipping previous generation * [Images API overview](/docs/api/images) * [Task polling](/docs/api/tasks) --- # gpt-image-2.6-flare-official (https://reapi.ai/docs/gpt-image-2-6) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > OpenAI's image generation and editing model, released November 4, 2026. > GPT Image 2.6 adds animated GIF output, SVG output and a `complexity` > setting to the Image API, and supports markup-guided edits. Two models > ship: **Flare** for fast iteration and **Sunburst** for detailed work that > stays consistent across edits. On reAPI both run on a standard channel at > one flat price per image, or on the official channel, billed by the tokens > each request uses. See pricing on the > [model page](https://reapi.ai/models/gpt-image-2-6). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.6-flare-official", "prompt": "A red paper crane flapping its wings in a seamless loop", "output_format": "gif", "size": "512x512", "quality": "low", "frame_count": 4 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gpt-image-2.6-flare-official", "prompt": "A red paper crane flapping its wings in a seamless loop", "output_format": "gif", "size": "512x512", "quality": "low", "frame_count": 4, }, ) task_id = resp.json()["id"] ``` ```javascript const res = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'gpt-image-2.6-flare-official', prompt: 'A red paper crane flapping its wings in a seamless loop', output_format: 'gif', size: '512x512', quality: 'low', frame_count: 4, }), }); const { id } = await res.json(); ``` ```go body := strings.NewReader(`{ "model": "gpt-image-2.6-flare-official", "prompt": "A red paper crane flapping its wings in a seamless loop", "output_format": "gif", "size": "512x512", "quality": "low", "frame_count": 4 }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", body) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id immediately; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Variants Two variants on two channels, one parameter shape. Pick via `model`: | Model id | Channel | Positioning | | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ | | `gpt-image-2.6-flare` | Standard | Fast iteration; per OpenAI, as little as six seconds at `low` quality, and better layout for posters and product imagery | | `gpt-image-2.6-sunburst` | Standard | Detailed work; more consistent characters, products and brand details across edits at `medium` or `high` quality | | `gpt-image-2.6-flare-official` | Official | Flare, billed by token | | `gpt-image-2.6-sunburst-official` | Official | Sunburst, billed by token | The standard ids bill one flat price per image. The official ids meter on one token rate card; equal rates do not mean equal cost per image, because the token count depends on the request. See [Pricing](#pricing). ## Request body There is no `mode` parameter: the fields you send decide the job. | Field | Type | Default | Notes | | -------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `gpt-image-2.6-flare`, `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare-official` or `gpt-image-2.6-sunburst-official`. **Required.** | | `prompt` | string | — | 1–32,000 characters. **Required.** For a GIF, describe the subject, the motion and the loop. | | `image_urls` | string\[] | — | 1–16 public image URLs (png / jpeg / webp, up to 50 MB each). Turns the request into an edit. Not with `gif` or `svg` output. | | `mask_url` | string | — | Public PNG URL whose transparent area marks the region to regenerate. Needs `image_urls`; not with `markup_url`. | | `markup_url` | string | — | Public PNG URL with your marks on a transparent layer, the same size as the first reference image. Needs `image_urls`; not with `mask_url`. See [Markup-guided edits](#markup-guided-edits). | | `size` | string | `auto` | `auto` or `WIDTHxHEIGHT`. See [Size rules](#size-rules). | | `quality` | enum | `auto` | `auto`, `low`, `medium`, `high`, `xhigh`, `max`. Moves the bill — see [Pricing](#pricing). | | `complexity` | enum | `high` | `low`, `medium`, `high`: how much the model plans before rendering. Low suits quick, focused edits; higher levels help dense text and busy layouts but can add latency and unwanted changes. No separate fee. | | `background` | enum | `auto` | `auto`, `opaque`, `transparent`. Transparent needs `png`, `gif` or `svg`. | | `output_format` | enum | `png` | `png`, `jpeg`, `gif`, `svg`. | | `output_compression` | integer | `100` | 0–100, applied to `jpeg` only and ignored for other formats. | | `frame_count` | integer | `9` | `gif` only. 2–16 frames. | | `frame_duration_ms` | integer | `200` | `gif` only. At least 20 ms per frame, no maximum. | | `n` | integer | `1` | 1–10 results per request, each billed. Must be `1` for `svg`. | | `moderation` | enum | `auto` | `auto` or `low` (less restrictive filtering). The website playground always sends `auto`. | Checked before anything is submitted or charged: * `mask_url` and `markup_url` each need at least one `image_urls` entry, and cannot be combined * `gif` and `svg` output are for new generations: no `image_urls`, `mask_url` or `markup_url` * `svg` returns one file: `n` must be `1` * `frame_count` and `frame_duration_ms` need `output_format: "gif"` * `background: "transparent"` cannot be combined with `jpeg` * image URLs must be public HTTP(S) and carry no credentials (`user:pass@`) * `size` follows the rules below ### Size rules For `png`, `jpeg` and `svg`, a custom `WIDTHxHEIGHT` is accepted when: * both edges are divisible by 16 * the aspect ratio is between 1:3 and 3:1 * neither edge exceeds 3840 pixels * the total pixel count is between 655,360 and 8,294,400 For `gif`, both edges must be divisible by 16 and the minimum pixel count does not apply, so `512x512` is valid. The frames are laid out on one sheet (see [GIF output](#gif-output)), and that sheet must also fit within 3840 pixels per edge: two 1024x1024 frames are refused because their sheet would be 4096x2048. The refusal comes after submission and is refunded in full. ## GIF output Set `output_format: "gif"` and the task returns one animated GIF. The frames are rendered as a single sheet: up to 8 frames on a 4 × 2 grid, 9 frames on 3 × 3, and 16 frames on 4 × 4. `size: "auto"` renders 512x512 frames. ```json { "model": "gpt-image-2.6-flare-official", "prompt": "A round orange fox mascot waving one paw in a seamless loop", "output_format": "gif", "size": "512x512", "frame_count": 9, "frame_duration_ms": 200 } ``` OpenAI's image generation guide gives 2–64 frames and 20–2,000 ms, while its Images API reference gives 2–16 frames and no duration maximum. The upstream follows the reference: 17 frames are rejected and a 3,000 ms frame is accepted. It also follows the guide in one respect: GIF is generation-only, and a GIF requested with reference images is rejected. ## SVG output Set `output_format: "svg"` and the task returns a static SVG file with editable paths, shapes and colors — for icons, logos and flat illustrations. SVG takes no reference images, mask or markup, and returns one file per request. A second model writes the SVG; its tokens are billed on top of the image tokens (see [Pricing](#pricing)). ## Markup-guided edits Draw your marks on a transparent PNG the same size as the first reference image, pass it as `markup_url`, and describe the change in the prompt. ```json { "model": "gpt-image-2.6-sunburst-official", "prompt": "Recolor the circled vase blue, keep everything else", "image_urls": ["https://example.com/kitchen.png"], "markup_url": "https://example.com/vase-circle.png", "complexity": "low" } ``` Markup applies to the first reference image; further images act as references. It cannot be combined with a mask. ## Troubleshooting | Failure | What it means | What to do | | -------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | | Synchronous 400 on submit | A field breaks a rule above (gif with `image_urls`, `n` above 1 with svg, frame fields without gif, a bad size) | The error names the field — fix and resubmit; nothing was charged | | Task fails mentioning a GIF sheet size | The frames do not fit on a sheet within 3840 pixels per edge | Use smaller frames (for example `512x512`) or fewer frames; the reserve is refunded | | Task fails citing content policy | The prompt or an input image was rejected | Fully refunded; revise the prompt or inputs | | `402` on submit | Not enough credits for the reserve | Top up; `max` quality and SVG output reserve the most | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_...", "model": "gpt-image-2.6-flare-official", "status": "completed", "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/.../0.gif"] }, "usage": { "credits": 0 } } ``` `output.image_urls` holds one URL per result; the extension follows the format (`.png`, `.jpg`, `.gif` or `.svg`). Download a GIF from its URL to keep every frame. Generated links expire, so mirror them if you need them long term. ## Pricing The standard ids, `gpt-image-2.6-flare` and `gpt-image-2.6-sunburst`, bill **one flat price per image**, the same for every size, quality and format; `n` images cost `n` times that price. The current price is on the [model page](https://reapi.ai/models/gpt-image-2-6), and failed jobs are refunded in full. The official ids bill **per token**, at OpenAI's published rates for the model: ``` credits = ceil(metered_usd × 1000) 1 credit = $0.001 ``` `metered_usd` covers the text input, image input and image output tokens the upstream reports for the task, plus the SVG author's tokens on `svg` output. Live rates are on the [model page](https://reapi.ai/models/gpt-image-2-6). The amount reserved at submit is an estimate; the final charge uses the reported tokens, and failed jobs are refunded in full. The parts worth reading are what moves the token count. ### 1. Quality is the dominant term Measured for one 1024x1024 image on `gpt-image-2.6-flare-official`: | `quality` | Image output tokens | | --------- | ------------------------: | | `low` | 824 | | `medium` | 1,449 | | `high` | 1,758 | | `xhigh` | 3,122 (OpenAI calculator) | | `max` | 7,024 (OpenAI calculator) | The frame changes the count too, and not always upward: at `low`, 1536x1024 measured 664 output tokens against 824 for 1024x1024. `complexity` does not change it: `low`, `medium` and `high` all measured 824 at 1024x1024 `low`. `n` multiplies the whole request. ### 2. A GIF is billed as one frame sheet, not per frame The frames are rendered on one sheet and billed as one image the size of that sheet. With 512x512 frames at `low`: | `frame_count` | Sheet | Image output tokens | | ------------- | ----- | ------------------: | | 2–8 | 4 × 2 | 555 | | 9 (default) | 3 × 3 | 1,172 | | 16 | 4 × 4 | 1,668 | ### 3. SVG adds the author model's tokens An SVG is billed for its image tokens plus the input and output tokens of the model that writes the vector file, at that model's own rates. One measured SVG used about 2,200 input and 2,100 output tokens for the vector step. ### 4. Reference images add input tokens Each reference image adds image input tokens: one 1024x1024 reference measured 1,024. ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [GPT Image 2.5](/docs/gpt-image-2-5) — the previous generation --- # gpt-image-2-official (https://reapi.ai/docs/gpt-image-2-stable) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > The **stable channel** of GPT Image 2 on reAPI — async > `/api/v1/images/generations` with the full feature surface: quality tiers > (`auto` / `low` / `medium` / `high`), batches up to 10 images, and > mask-based inpainting. The channel always > returns PNG. See current pricing on the > [model page](https://reapi.ai/models/gpt-image-2). **Wire id is `gpt-image-2-official`.** The doc / pricing page / playground all label this variant as **"Stable"** for clarity, but the request body must set `"model": "gpt-image-2-official"`. The shorter `gpt-image-2` is a separate variant — see [Differences from `gpt-image-2`](#differences-from-gpt-image-2). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2-official", "prompt": "ancient castle beneath a starry sky", "size": "16:9", "resolution": "2k", "quality": "high", "n": 1 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gpt-image-2-official", "prompt": "ancient castle beneath a starry sky", "size": "16:9", "resolution": "2k", "quality": "high", "n": 1, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gpt-image-2-official", prompt: "ancient castle beneath a starry sky", size: "16:9", resolution: "2k", quality: "high", n: 1, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-image-2-official", "prompt": "ancient castle beneath a starry sky", "size": "16:9", "resolution": "2k", "quality": "high", "n": 1, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2-official", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the generated image URLs (length = `n`), valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with an `id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body The API and the model-page Playground use the same public field names, values, and validation whenever a field is shown in the Playground. The Playground does not silently add a different `quality`, `background`, or billing mode. It initializes `size` to `"1:1"`; API image-to-image requests may instead omit `size` to inherit the first reference image's ratio. The API additionally accepts explicit `WIDTHxHEIGHT` strings; use the API directly when that custom-size input is not shown in the UI. ### `model` — required `string`. Must be `"gpt-image-2-official"`. ### `prompt` — required `string`, **1–32,000 characters**. English and Chinese both supported. Detailed prompts produce better results. Every prompt goes through pre-submission moderation; rejected prompts return `400` at no charge. Don't restate the ratio in the prompt — pass it via `size`. Repeating it confuses the upstream. **Failure modes.** * Missing / empty → `400 prompt is required` (code `20002`). * Longer than 32,000 chars → `400 prompt must be at most 32000 characters` (code `20007`). ### `size` — string, default `"1:1"` Output ratio. One of these 16 values (or `auto` to let the upstream pick from the prompt / first reference image): ``` auto 1:1 16:9 9:16 4:3 3:4 3:2 2:3 5:4 4:5 2:1 1:2 21:9 9:21 3:1 1:3 ``` This channel additionally accepts a pixel string `WIDTHxHEIGHT` (e.g. `1024x1024`, `1536x864`, `3840x2160`), returned at exactly those dimensions. **Width and height must both be multiples of 16** — the upstream rejects anything else with `400 pixel dimensions must be multiples of 16`. The aspect ratio must be between `1:3` and `3:1`, and the longest edge must not exceed `3840`. Anything outside the list and not a pixel string is rejected with `400`. When `size` is omitted: * **T2I** (no `image_urls`) → defaults to `"1:1"`. * **I2I** (`image_urls` set) → output mirrors the first reference image's ratio (upstream-side derivation; gateway omits the field). #### 4K constraint `resolution: "4k"` works with every ratio below. **`size` is required** when `resolution: "4k"` — `auto` is the one value the upstream cannot resolve at this tier, so 4K without an explicit ratio is rejected before the request leaves the gateway. | `size` | `1k` | `2k` | `4k` | | --------------- | ------------ | ------------ | ------------- | | `1:1` | 1024×1024 | 2048×2048 | **2880×2880** | | `3:2` / `2:3` | 1536×1024 | 2048×1360 | **3520×2336** | | `4:3` / `3:4` | 1024×768 | 2048×1536 | **3312×2480** | | `5:4` / `4:5` | 1280×1024 | 2560×2048 | **3216×2576** | | `16:9` / `9:16` | 1536×864 | 2048×1152 | **3840×2160** | | `2:1` / `1:2` | 2048×1024 | 2688×1344 | **3840×1920** | | `21:9` / `9:21` | 2016×864 | 2688×1152 | **3840×1648** | | `3:1` / `1:3` | 1536×512 | 3072×1024 | **3840×1280** | | `auto` | server picks | server picks | ❌ | > `3:2` / `2:3` at 2K resolves to 2048×1360 — 1360 is the nearest > 16-aligned approximation of 3:2 (under 0.5% off). Other cells are > exact. **4K needs an explicit ratio.** Every ratio in the table above is valid at `resolution: "4k"` — the model maps each one to a size that respects its limits (longest edge ≤ 3840, ≤ 8,294,400 px total), so `1:1` becomes 2880×2880 rather than being rejected. Only `auto` is unsupported at 4K, because the server cannot pick a ratio and a 4K size at the same time; sending 4K with `auto` or with no `size` returns `400` (code `20003`). ### `resolution` — string, default `"1k"` `1k` / `2k` / `4k`. Case-insensitive — `"2K"` and `"2k"` are equivalent. It drives output dimensions and the pre-submit estimate; final billing uses actual token usage. ### `quality` — string, default `"auto"` `auto` / `low` / `medium` / `high`. Higher tiers are slower and typically produce more output tokens; final billing uses actual usage. **`auto` is decided by the model.** reAPI forwards `auto` (and uses it when `quality` is omitted). The final charge is calculated from the actual image output tokens reported for that request. The temporary admission reservation uses the calculator's `medium` estimate and is replaced at completion, so do not assume that `auto` always has the same cost as `low`. Set a quality explicitly when you need predictable quality behavior. ### `background` — string, default `"auto"` `auto` / `opaque` / `transparent`. Controls whether the returned PNG carries an alpha channel. * `auto` — the model decides (default). * `opaque` — flat, fully opaque background. * `transparent` — returns a real alpha channel, so the subject can be composited directly. Best paired with a prompt that asks for an isolated subject (e.g. *"a cartoon cat sticker, isolated on a fully transparent background"*). `background` does not add a pricing multiplier. In particular, `background: "transparent"` is not the reason a token-metered request costs more or less; its final price still comes from the reported text-input, image-input, and image-output usage. ### `moderation` — string, default `"auto"` `auto` / `low`. OpenAI's content-moderation level for the request. * `auto` — the standard filter (default). * `low` — less restrictive filtering. Generated images still go through the provider's safety check, so a request can be rejected at either level. Stable channel only, through the API. The website playground always submits `auto`. ### `n` — integer, default `1` Number of images per request. Range `1`–`10`. Output tokens grow with the number of generated images, while shared prompt/reference input is metered from the actual request usage. `output.image_urls` length matches `n`. ### `image_urls` — string\[] Reference images for image-to-image. Up to **16** entries. Triggers I2I when set. Public HTTP(S) URLs only. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide. Upload to your own object storage (S3 / R2 / OSS) and pass the URL. ### `mask_url` — string PNG mask URL for inpainting. **Requires `image_urls` with at least one entry.** The mask must: * carry an alpha channel where the model should paint, and * share dimensions with the **first** entry in `image_urls`. Public HTTP(S) URL only. Mismatched dimensions or a fully opaque mask return `400` from upstream. *** ## Response envelope The submit response contains `id`, `model`, `status`, and `created_at`. Poll `GET /api/v1/tasks/{id}` for `output`, `usage`, and `error`. The example below uses `GET /api/v1/tasks/{id}?include=billing`. Omit the query parameter to preserve the legacy response field set; this does not change the underlying token-metered charge. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2-official", "status": "completed", "created_at": 1735000000, "output": { "image_urls": [ "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png", "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/1.png" ] }, "usage": { "credits": 39 }, "billing": { "source": "openai_token_usage", "credits_exact": 38.966, "cost_usd": 0.038966, "text_input_tokens": 396, "image_input_tokens": 2482, "image_output_tokens": 571 }, "error": null } ``` | Field | Type | Notes | | -------------------------- | -------------- | ------------------------------------------------------------------------------------------------------ | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion | | `output.image_urls` | string\[] | Generated image URLs — length = `n`, valid for 7 days | | `usage` | object | Backward-compatible settlement summary | | `usage.credits` | integer | Whole-credit compatibility value, rounded up | | `billing` | object | Settlement evidence; returned only with `?include=billing` | | `billing.source` | string | `openai_token_usage` for exact token settlement, or `reservation_estimate` for the documented fallback | | `billing.credits_exact` | number | Full formula-derived amount in credits; exact-token source only | | `billing.cost_usd` | number | Full formula-derived amount in USD; exact-token source only | | `billing.credits_charged` | integer | Final reservation charge; reservation-estimate source only | | `billing.cost_usd_charged` | number | Final reservation charge in USD; reservation-estimate source only | | `error` | object \| null | Populated on `failed` — `{ code, message }` | ### Upstream errors (502 / 503) reAPI does not surface raw upstream `5xx` codes to the caller. When the upstream provider returns `502 Bad Gateway`, `503 Service Unavailable`, or a connection failure, the worker retries up to 5 attempts with exponential backoff (\~30s total budget). If all retries fail, the task ends with one of these reAPI-specific codes (returned via `GET /api/v1/tasks/{id}` as `error.code`): | reAPI code | Meaning | Origin | | ---------- | -------------------------- | ------------------------------------ | | `80001` | `provider_submit_failed` | Upstream `5xx` / network on submit | | `80002` | `provider_polling_timeout` | Wall-clock cap reached while polling | | `80003` | `provider_failed` | Upstream returned a terminal failure | See [Errors catalog](/docs/api/errors) for the full code list. *** ## Validation errors All cases below return HTTP 400 with the noted code. Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values) and are not a stable contract. | Trigger | Code | Message | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `prompt` missing / empty | `20002` | `prompt is required` | | `prompt` longer than 32,000 chars | `20007` | `prompt must be at most 32000 characters` | | Unknown `size` value | `20003` | `invalid size "..." (allowed: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 2:1, 1:2, 21:9, 9:21, 3:1, 1:3, auto, or WxH pixels)` | | Unknown `resolution` value | `20003` | `invalid resolution "..." (allowed: 1k, 2k, 4k)` | | `4k` with `auto` or no `size` | `20003` | `4K requires one of the 15 documented ratios (listed under size) or a WxH pixel size` | | `n` outside `1`–`10` | `20003` | `n must be between 1 and 10` | | `n` > 4 with `image_urls` or `moderation: low`, together with any of: `image_urls` with `size` omitted or `auto` at `2k`; a reference or mask URL containing credentials (`user:pass@`); a `WxH` size that is not a multiple of 16, has an edge above 3840, a ratio beyond 3:1, or fewer than 655,360 / more than 8,294,400 pixels | `20003` | `n must be 4 or fewer for image-to-image, transparent background, or moderation=low requests on gpt-image-2-official` | | `image_urls` > 16 | `20003` | `image_urls accepts at most 16 entries` | | `mask_url` without `image_urls` | `20003` | `mask_url requires at least one entry in image_urls` | | Any URL field carrying a `data:` URI | `20003` | `image URL must be a public http(s) URL — data: URIs are rejected` (or `mask_url must be a public URL …`) | | Unknown `background` | `20003` | `invalid "..." (allowed: …)` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation. *** ## Recipes ### Text-to-image — minimal ```json { "model": "gpt-image-2-official", "prompt": "ancient castle beneath a starry sky" } ``` ### 2K poster ```json { "model": "gpt-image-2-official", "prompt": "cyberpunk night cityscape", "size": "16:9", "resolution": "2k", "quality": "high" } ``` ### 4K wallpaper ```json { "model": "gpt-image-2-official", "prompt": "panoramic snow-capped mountains at sunrise", "size": "16:9", "resolution": "4k", "quality": "high" } ``` ### Multi-reference fusion (image-to-image) ```json { "model": "gpt-image-2-official", "prompt": "blend the two references into one cohesive illustrated poster", "size": "1:1", "quality": "high", "image_urls": [ "https://your-cdn.com/input-a.png", "https://your-cdn.com/input-b.png" ] } ``` ### Mask-based inpainting The mask must match the dimensions of the first `image_urls` entry and carry an alpha channel where the model should paint. ```json { "model": "gpt-image-2-official", "prompt": "replace the background with a desert sunset", "size": "1:1", "quality": "medium", "image_urls": ["https://your-cdn.com/photo.png"], "mask_url": "https://your-cdn.com/mask.png" } ``` ### Batch of 4 variations ```json { "model": "gpt-image-2-official", "prompt": "four minimalist poster variations of a red fox", "size": "1:1", "quality": "low", "n": 4 } ``` *** ## Polling pattern Latency depends heavily on `quality` and `resolution`: | `quality` × `resolution` | Typical end-to-end | | ------------------------ | ------------------ | | `low` × `1k` | 20 – 40 s | | `medium` × `1k` | 30 – 60 s | | `high` × `2k` | 60 – 120 s | | `high` × `4k` | 120 – 180 s | Recommended cadence: ``` 0–30s: wait before the first poll 30s–3m: poll every 3–5s 3m+: back off to 10s; cap at 30s ``` Set client-side request timeouts to **≥ 180 seconds** when using `quality: "high"` with `2k` / `4k`. The worker's wall-clock cap is **1 hour** (image tasks), comfortably above any realistic queue. *** ## Pricing The submit response uses the model page / Playground estimate as a temporary credit reservation. Successful completion replaces that estimate with the actual token-metered amount and atomically refunds or deducts the difference. **Final bill formula** (OpenAI standard rates; 1 credit = $0.001): ``` official_usd = text_input_tokens × $5 / 1,000,000 + image_input_tokens × $8 / 1,000,000 + image_output_tokens × $30 / 1,000,000 official_micro_usd = text_input_tokens × 5 + image_input_tokens × 8 + image_output_tokens × 30 final_micro_usd = ceil(official_micro_usd × factor_basis_points / 10,000) billing.cost_usd = final_micro_usd / 1,000,000 billing.credits_exact = final_micro_usd / 1,000 charged_micro_usd = final_micro_usd - shortfall_micro_usd usage.credits = ceil(charged_micro_usd / 1,000) ``` The factor applies to the product as a whole, not to a different rate for each size, quality, background, or provider route. Billing is retained to micro-USD precision and rounds upward only once at that boundary (less than one micro-USD), so integer-credit rounding does not distort small image charges. The integer `usage.credits` / `credits_actual` field remains a rounded-up summary of the amount collected so existing strongly typed clients keep both the same wire type and the same field meaning. Reconcile the full formula-derived amount against `billing.credits_exact` or `billing.cost_usd`. If the winning provider returns images but omits a required usage meter, reAPI still completes the task and makes the admission reservation the final whole-credit charge. The same fallback applies when a provider returns at least one usable image but fewer than `n`, or when aggregate token usage cannot be attributed to the retained images. A partial batch is delivered as a successful task and does not trigger a second paid provider attempt. With `?include=billing`, these cases return `source: "reservation_estimate"`, `credits_charged`, and `cost_usd_charged`; they do not return `credits_exact` or token counts. Because this fallback is an estimate rather than actual usage, the exact-token error bound applies only when `source` is `openai_token_usage`. `cached_tokens` is retained as usage metadata but does not change the sell formula. Reported text and image input totals use the configured standard input rates; reAPI does not apply a separate cache discount. If the actual amount is greater than the reservation and the remaining balance cannot cover the difference, the generated task still completes, the balance is reduced to zero, and reAPI records the remainder internally as a shortfall. The opt-in `billing` object continues to show the full formula-derived actual amount, while `usage.credits` shows the rounded amount collected from the balance. Failed tasks refund the reservation. Moderated prompts rejected before submit have no balance impact. **Completed-task evidence.** `GET /api/v1/tasks/{id}?include=billing` always identifies the settlement source. With complete usage it returns `billing.credits_exact`, `billing.cost_usd`, and the reported text/image input and image-output token counts. Without trustworthy usage it returns the final reservation charge under `credits_charged` / `cost_usd_charged`. The model page and Playground remain estimates because actual usage does not exist before generation. *** ## Tips * **Specify ratio in `size`, not in the prompt.** Repeating "16:9 wide shot" inside the prompt confuses the upstream. Use `size` for shape and the prompt for content / style. * **Set `quality` explicitly for predictability.** `auto` is selected by the model and is settled from actual output tokens. * **Batches use actual usage.** Output work scales with `n`; shared prompt and reference input is not blindly multiplied a second time by reAPI. * **Mask alpha matters.** The mask's transparent regions are where the model paints; opaque regions are preserved. A fully opaque mask returns `400` from upstream. * **Pre-cache reference images.** The upstream fetches each `image_urls` entry once per submit; if your CDN is slow, latency shows up as polling time, not as billing. *** ## Differences from `gpt-image-2` | Feature | [`gpt-image-2`](/docs/gpt-image-2) | `gpt-image-2-official` (this page) | | ------------------------------------------- | :--------------------------------: | :--------------------------------------------------------------: | | Endpoint | `/api/v1/images/generations` | `/api/v1/images/generations` | | Async / task model | ✅ | ✅ | | `size` aspect-ratio enums (15, plus `auto`) | ✅ | ✅ | | Resolution tiers (`1k` / `2k` / `4k`) | ✅ | ✅ | | Image-to-image (`image_urls`) | ✅ | ✅ | | Pricing | flat per resolution | actual text/image input and image output tokens × product factor | | Batch (`n` > 1) | ❌ | ✅ up to 10 | | Quality tiers | ❌ | ✅ `auto` / `low` / `medium` / `high` | | Mask inpainting (`mask_url`) | ❌ | ✅ | | Background control (`background`) | ❌ | ✅ `auto` / `opaque` / `transparent` (real alpha) | | Moderation (`moderation`) | ❌ | ✅ `auto` / `low` | *** ## Related * [`gpt-image-2`](/docs/gpt-image-2) — cheaper variant, single image, flat per-resolution pricing * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Pricing — gpt-image-2](https://reapi.ai/models/gpt-image-2#pricing) --- # gpt-image-2 (https://reapi.ai/docs/gpt-image-2) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Async image generation through reAPI's cheap channel. One endpoint > covers text-to-image and image-to-image. Flat per-resolution > pricing — the cheapest variant in the family. For batches, masks, > or quality tiers, switch to > [`gpt-image-2 stable`](/docs/gpt-image-2-stable). * Async processing — `POST` returns a `task_id`, poll `GET /api/v1/tasks/{id}` for the result. * standard `/api/v1/images/generations` envelope (text-to-image / image-to-image). * 16 ratios via `size`; three resolution tiers (`1k` / `2k` / `4k`) via `resolution`. * Up to 16 reference images via `image_urls` — public HTTP(S) URLs only. * Single image per request — `n` is fixed at 1. * Flat per-resolution price; failed / moderated requests are not charged. *** ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a ginger cat on a windowsill at sunset, watercolor", "size": "16:9", "resolution": "2k" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "gpt-image-2", "prompt": "a ginger cat on a windowsill at sunset, watercolor", "size": "16:9", "resolution": "2k", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "gpt-image-2", prompt: "a ginger cat on a windowsill at sunset, watercolor", size: "16:9", resolution: "2k", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "gpt-image-2", "prompt": "a ginger cat on a windowsill at sunset, watercolor", "size": "16:9", "resolution": "2k", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "processing", "created_at": 1735000000 } ``` Hold onto `id` and poll `GET /api/v1/tasks/{id}` until completion. *** ## Endpoint ```http POST /api/v1/images/generations # submit a job GET /api/v1/tasks/{id} # poll for the result ``` Async — submit returns a `task_id` immediately; the actual image arrives via the polling endpoint. Polling is free. *** ## Authentication Bearer token, minted at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Body ### `model` `string` · **required** · default `"gpt-image-2"` Must be `"gpt-image-2"`. ### `prompt` `string` · **required** 1 – 32000 characters. English and Chinese both supported. Detailed prompts produce better results. Every prompt goes through pre-submission moderation; rejected prompts return `400` at no charge. Don't restate the ratio in the prompt — pass it via `size`. Repeating it in the prompt confuses the upstream. ### `size` `string` · default `"1:1"` (text-to-image) / inherited (image-to-image) Output ratio. One of these 16 values: ``` auto 1:1 16:9 9:16 4:3 3:4 3:2 2:3 5:4 4:5 2:1 1:2 21:9 9:21 3:1 1:3 ``` `auto` lets the upstream pick from the prompt or first reference image. Pixel strings (e.g. `1024x1024`) are not accepted — combine `size` with `resolution` to control output pixels. Anything outside the list is rejected with `400`. When `image_urls` is provided **without** `size`, the output inherits the first reference image's resolution (image-to-image mode). Pass `size` to force a specific ratio. ### `resolution` `string` · default `"1k"` `1k` / `2k` / `4k`. Case-insensitive — `"2K"` and `"2k"` are equivalent. `4k` works with every ratio below — the model maps each one to a size within its limits (longest edge ≤ 3840, ≤ 8,294,400 px total), so `1:1` becomes 2880×2880. Only `auto` is unsupported at 4K and is rejected with `400`. | `size` | `1k` | `2k` | `4k` | | --------------- | ------------ | ------------ | ------------- | | `1:1` | 1024×1024 | 2048×2048 | **2880×2880** | | `3:2` / `2:3` | 1536×1024 | 2048×1360 | **3520×2336** | | `4:3` / `3:4` | 1024×768 | 2048×1536 | **3312×2480** | | `5:4` / `4:5` | 1280×1024 | 2560×2048 | **3216×2576** | | `3:1` / `1:3` | 1536×512 | 3072×1024 | **3840×1280** | | `16:9` / `9:16` | 1536×864 | 2048×1152 | **3840×2160** | | `2:1` / `1:2` | 2048×1024 | 2688×1344 | **3840×1920** | | `21:9` / `9:21` | 2016×864 | 2688×1152 | **3840×1648** | | `auto` | server picks | server picks | ❌ | ### `n` `integer` · default `1` · **must be `1`** Single image per request. This variant produces one image per call; sending any other value returns `400`. For batches up to 4, use [`gpt-image-2 stable`](/docs/gpt-image-2-stable). ### `image_urls` `string[]` · optional Reference images for image-to-image. Up to **16** entries. Each entry must be a public HTTP(S) URL — `data:` / base64 payloads are rejected. Upload to your own object storage (S3 / R2 / OSS) and pass the URL. **No batch / quality / mask on this variant.** Sending `n > 1`, `quality`, `mask_url`, `output_format`, or `output_compression` against `gpt-image-2` returns `400`. Switch to [`gpt-image-2 stable`](/docs/gpt-image-2-stable) — set `"model": "gpt-image-2-official"` — when you need those features. *** ## Use cases ### 1. Text-to-image (minimal) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "a ginger cat on a windowsill at sunset, watercolor" }' ``` ### 2. Text-to-image at 2K widescreen ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "a corgi astronaut on the moon, cinematic", "size": "16:9", "resolution": "2k" }' ``` ### 3. Text-to-image at 4K ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "ancient castle beneath a starry sky", "size": "16:9", "resolution": "4k" }' ``` ### 4. Image-to-image (single reference) ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "turn this photo into a watercolor painting", "image_urls": ["https://your-cdn.com/photo.jpg"] }' ``` ### 5. Multi-reference fusion ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "blend these two photos into a poster", "size": "4:3", "resolution": "2k", "image_urls": [ "https://your-cdn.com/photo-a.jpg", "https://your-cdn.com/photo-b.jpg" ] }' ``` ### 6. Force a ratio for image-to-image When the reference is portrait but you need a landscape output: ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "extend the scene horizontally into a moonlit forest", "size": "21:9", "resolution": "2k", "image_urls": ["https://your-cdn.com/portrait.jpg"] }' ``` *** ## Response `POST` returns immediately with `status: "processing"`; poll `GET /api/v1/tasks/{id}` until `status` is `completed` or `failed`. Both responses share the same envelope — the `output` field is `null` until the task finishes. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "processing", "created_at": 1735000000 } ``` ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "completed", "created_at": 1735000000, "output": { "image_urls": [ "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png" ] }, "error": null } ``` URLs are stable for **7 days**. Download to your own storage if you need them longer. ```json { "error": { "code": 20003, "message": "gpt-image-2: field 'quality' is only supported on gpt-image-2-official", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 10003, "message": "API key invalid", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 30001, "message": "Insufficient credits", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 50001, "message": "Rate limit exceeded", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ```json { "error": { "code": 60099, "message": "Internal error — please retry", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` ### Upstream errors (502 / 503) reAPI does not surface raw upstream `5xx` codes to the caller. When the upstream provider returns `502 Bad Gateway`, `503 Service Unavailable`, or a connection failure, the worker retries up to 5 attempts with exponential backoff (\~30s total budget). If all retries fail, the task ends with one of these reapi-specific error codes (returned via `GET /api/v1/tasks/{id}` as `error.code`): | reapi code | Meaning | Origin | | ---------- | -------------------------- | ------------------------------------ | | `80001` | `provider_submit_failed` | Upstream `5xx` / network on submit | | `80002` | `provider_polling_timeout` | Wall-clock cap reached while polling | | `80003` | `provider_failed` | Upstream returned a terminal failure | See [Errors catalog](/docs/api/errors) for the full code list. *** ## Polling | `status` | Meaning | | ------------ | -------------------------------- | | `processing` | Submitted, still generating | | `completed` | `output.image_urls` is ready | | `failed` | See `error.message`; not charged | Recommended cadence: ``` 0–30s: wait before the first poll 30s–3m: poll every 3–5s 3m+: back off to 10s; cap at 30s ``` A 1K image typically completes in 30–60s; 2K adds \~30s; 4K can take 90–120s. *** ## Differences from the stable channel | Feature | `gpt-image-2` (this page) | [`gpt-image-2 stable`](/docs/gpt-image-2-stable) | | ------------------------------- | :--------------------------: | :--------------------------------------------------------------------------: | | Endpoint | `/api/v1/images/generations` | `/api/v1/images/generations` | | `size` enum (14) | ✅ | ✅ | | Resolution tiers (1k / 2k / 4k) | ✅ | ✅ | | Image-to-image (`image_urls`) | ✅ | ✅ | | Pricing | flat per resolution | varies by parameters — see [model page](https://reapi.ai/models/gpt-image-2) | | Batch (`n` > 1) | ❌ | ✅ up to 4 | | Quality tiers | ❌ | ✅ `auto` / `low` / `medium` / `high` | | Mask inpainting (`mask_url`) | ❌ | ✅ | | Background control | ❌ | ✅ (`transparent` is silently downgraded by upstream) | | Output format / compression | ❌ (always PNG) | ✅ `png` / `jpeg` / `webp` + compression | | Moderation knob | ❌ (default) | ✅ `auto` / `low` | *** ## Related * [`gpt-image-2 stable`](/docs/gpt-image-2-stable) — full feature surface (batch, mask, quality tiers). * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Pricing — gpt-image-2](https://reapi.ai/models/gpt-image-2#pricing) --- # grok-imagine-1.0-video (https://reapi.ai/docs/grok-imagine-1-0-video) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Grok Imagine 1.0 Video — async video generation. **One model id** > (`grok-imagine-1.0-video`) covers both **text-to-video** and > **image-to-video**. Mode is implicit: zero `image_urls` runs T2V; 1 to 7 > reference images run I2V. 6 to 30 second outputs at 480p / 720p, five > aspect ratios. See current pricing on the > [model page](https://reapi.ai/models/grok-imagine-1-0-video). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-1.0-video", "prompt": "A dog running on a sunlit beach, slow-motion", "size": "16:9", "duration": 6, "quality": "720p" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "grok-imagine-1.0-video", "prompt": "A dog running on a sunlit beach, slow-motion", "size": "16:9", "duration": 6, "quality": "720p", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-imagine-1.0-video", prompt: "A dog running on a sunlit beach, slow-motion", size: "16:9", duration: 6, quality: "720p", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "grok-imagine-1.0-video", "prompt": "A dog running on a sunlit beach, slow-motion", "size": "16:9", "duration": 6, "quality": "720p", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-1.0-video", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL, valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Mode routing `grok-imagine-1.0-video` picks its mode from the **count of `image_urls`** you send — there is no `mode` parameter: | `image_urls` count | Mode | What it does | | ------------------ | ------- | ---------------------------------------------------------------- | | `0` (or omitted) | **T2V** | Generate from text. `size` controls output ratio. | | `1` – `7` | **I2V** | Use the references as visual guidance. Output ratio follows ref. | **Mutex rules.** * In T2V (no `image_urls`), `prompt` is **required**. * When `image_urls` is set (1 to 7 entries), `size` is forwarded but ignored upstream — the source frame's ratio decides the output ratio. * More than 7 `image_urls` is rejected with `400 image_urls accepts at most 7 entries`. *** ## Request body ### `model` — required `string`. Must be `"grok-imagine-1.0-video"`. ### `prompt` — string, conditional Up to **4,000 characters**. Required in T2V (when `image_urls` is empty); optional in I2V when at least one image is provided. Empty / whitespace-only prompts are treated as missing. **Failure modes.** * Empty / missing in T2V → `400 prompt is required when image_urls is empty (text-to-video)` (code `20002`). * Longer than 10,000 chars → `400 prompt exceeds 10000 characters (got N)` (code `20007`). ### `size` — string, default `"16:9"` Output aspect ratio in T2V mode. One of: | Value | Shape | | ------ | ------------------- | | `16:9` | Landscape (default) | | `9:16` | Portrait | | `1:1` | Square | | `3:2` | Landscape | | `2:3` | Portrait | In I2V mode the upstream derives the ratio from the reference image, so this field is ignored. ### `duration` — integer, default `6` Output length in seconds. Any integer in `[6, 30]`. Out-of-range → `400`. Drives pricing linearly: `ceil(per_second_usd × duration × 1000)` credits (1 credit = $0.001). **Send a number, not a string.** `"duration": "6"` is rejected with `400`. ### `quality` — string, default `"480p"` `480p` (SD) or `720p` (HD). Lowercase is canonical. Quality does **not** change the per-second rate. ### `image_urls` — string\[] Array of public HTTP(S) URLs. **0 to 7 entries**: * **0 entries** — pure text-to-video. * **1 to 7 entries** — image-to-video; references guide subject and style. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field on this endpoint must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-1.0-video", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days**. Re-host to your own storage if you need them longer. *** ## Validation errors All cases below return HTTP 400 with code `20003` unless noted. Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values, etc.) and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------------------- | ------- | --------------------------------------------------------------------------- | | `prompt` missing in T2V | `20002` | `grok-imagine: prompt is required when image_urls is empty (text-to-video)` | | `prompt` longer than 10,000 chars | `20007` | `grok-imagine: prompt exceeds 10000 characters (got N)` | | `image_urls` length > 7 | `20003` | `grok-imagine: image_urls accepts at most 7 entries, got N` | | `duration` outside `[6, 30]` | `20003` | `grok-imagine: duration must be 6-30 seconds, got N` | | Unknown `size` | `20003` | `grok-imagine: invalid size "X" (allowed: 16:9 / 9:16 / 1:1 / 3:2 / 2:3)` | | Unknown `quality` | `20003` | `grok-imagine: invalid quality "X" (allowed: 480p / 720p)` | | `image_urls` carrying a `data:` URI or non-http(s) | `20003` | `grok-imagine: image_urls entries must be public http(s) URLs` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### T2V — minimum request ```json { "model": "grok-imagine-1.0-video", "prompt": "A little girl walking down a sunset coastal road" } ``` ### T2V — full parameters ```json { "model": "grok-imagine-1.0-video", "prompt": "A dog running on a sunlit beach, slow-motion, cinematic warm tones", "size": "16:9", "duration": 10, "quality": "720p" } ``` ### I2V — animate from references ```json { "model": "grok-imagine-1.0-video", "prompt": "Bring the scene to life with a gentle camera dolly forward", "image_urls": ["https://your-cdn.com/reference.jpg"], "duration": 8, "quality": "720p" } ``` ### I2V — multi-reference ```json { "model": "grok-imagine-1.0-video", "prompt": "Smooth cinematic motion across the reference subjects", "image_urls": [ "https://your-cdn.com/ref-1.jpg", "https://your-cdn.com/ref-2.jpg", "https://your-cdn.com/ref-3.jpg" ], "duration": 12 } ``` *** ## Polling pattern The task endpoint behaves identically to other video tasks — the only difference is the completed `output` shape (`video_urls` instead of `image_urls`). A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in a few minutes. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Pricing Per-second rate. `quality` does **not** change the price, and the rate is flat across `480p` and `720p`. See current rate on the [Grok Imagine model page](https://reapi.ai/models/grok-imagine-1-0-video). **Bill formula** (1 credit = $0.001): ``` credits = ceil(per_second_usd × duration × 1000) ``` Failed jobs refund automatically. *** ## Tips * **Prompt motion, not just scene.** "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen. * **Sweet-spot duration: 6–10 seconds.** Above 10s the upstream wall-time grows fast; the per-second price stays the same either way. * **Reference-image quality matters.** Subject centered, clear composition, no heavy filters — I2V output quality tracks input quality directly. * **Send up to 7 references for richer guidance.** A first frame plus several style boards usually outperforms a single reference. *** ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # grok-imagine-image-2-0 (https://reapi.ai/docs/grok-imagine-image-2-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > xAI's Grok Imagine 2.0 on reAPI, served by **two channels with different > parameter surfaces** — pick one with the `model` field: > `grok-imagine-image-2-0` (text-to-image, 7 aspect ratios) or > `grok-imagine-image-2.0-official` (14 aspect ratios, `1k`/`2k` output, > quality control, and image-to-image). Both return **1 to 12 images** per > request, billed per delivered image. Async-first: submit returns a > `task_id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/grok-imagine-image-2-0). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-image-2-0", "prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space", "n": 4, "size": "3:2" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "grok-imagine-image-2-0", "prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space", "n": 4, "size": "3:2", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-imagine-image-2-0", prompt: "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space", n: 4, size: "3:2", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "grok-imagine-image-2-0", "prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space", "n": 4, "size": "3:2", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` The response carries a `task_id`. Poll [`GET /api/v1/tasks/{task_id}`](/docs/api/tasks) until `status` is `completed`, then read `result.images[].url`. ## Channels This model is served by two independent channels with **different parameter surfaces**. Pick one with the `model` field: | `model` value | Framing | Image-to-image | Notes | | --------------------------------- | ---------------------------- | -------------- | -------------------------------------- | | `grok-imagine-image-2-0` | `size`, 7 ratios + 5 aliases | No | Standard channel, documented below. | | `grok-imagine-image-2.0-official` | `aspect_ratio`, 14 ratios | Yes | [Official channel](#official-channel). | They are not interchangeable: a `size` value is rejected by the official channel and an `aspect_ratio` value is rejected by the standard one. The `resolution` field exists on both but means different things. ## Request body Fields below apply to the **standard** channel (`grok-imagine-image-2-0`). | Field | Type | Required | Default | Description | | ------------ | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | yes | — | Must be `grok-imagine-image-2-0`. | | `prompt` | string | yes | — | Image description, used as written — there is no prompt-rewriting step. Up to 10000 characters. | | `n` | integer | no | `1` | Images to return, `1`–`12`. Each delivered image is billed. | | `size` | string | no | vendor | Aspect ratio or pixel alias — see the table below. Values outside the list return a 400. | | `resolution` | string | no | vendor | Quality mode. `quality` is the only accepted value, and it is already the default. This is **not** a pixel tier — framing is `size`. | ### `size` values Seven aspect ratios: | Value | Orientation | Typical use | | ------ | ----------- | ------------------------- | | `1:1` | Square | Product, avatar | | `2:3` | Portrait | Poster, full-body | | `3:2` | Landscape | Photo, wide scene | | `3:4` | Portrait | E-commerce, people | | `4:3` | Landscape | Display art | | `9:16` | Vertical | Story / short-video cover | | `16:9` | Wide | Banner, video cover | Five pixel aliases are also accepted: `1024x1024` (1:1), `1024x1792` (2:3), `1792x1024` (3:2), `720x1280` (9:16), `1280x720` (16:9). Ratios not on this list — `1:2`, `2:1`, `4:5`, `auto` — return `400 INVALID_REQUEST`. Actual output pixels are chosen by the model and may differ from the alias table — a `1:1` request commonly returns 1408x1408. Trust the returned image rather than assuming a fixed pixel size from the ratio you sent. The standard channel is **text-to-image only**. It rejects `image_urls`, `image`, `mask` and every other reference field. For image-to-image on this model, use the [official channel](#official-channel) below, which accepts reference images. Region editing and background removal as demonstrated inside the Grok apps are still not part of either API surface. ## Official channel Send `"model": "grok-imagine-image-2.0-official"` to use the vendor's own parameter surface. It exposes wider framing control, a real pixel tier, a quality setting, and image-to-image. | Field | Type | Required | Default | Description | | -------------- | --------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | Must be `grok-imagine-image-2.0-official`. | | `prompt` | string | yes | — | Image description. Up to 10000 characters. | | `n` | integer | no | `1` | Images to return, `1`–`12`. Each delivered image is billed. | | `aspect_ratio` | string | no | vendor | Output framing — 14 values, listed below. Does **not** change the rate. | | `resolution` | string | no | `1k` | Pixel tier: `1k` or `2k`. A **billing dimension**. Note this is a real tier here, unlike the standard channel. | | `quality` | string | no | `medium` | `low` or `medium`. Also a **billing dimension**. | | `image_urls` | string\[] | no | — | Public http(s) URLs of reference images, 1–10. Present ⇒ image-to-image. | ### `aspect_ratio` values `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `2:3`, `3:2`, `9:19.5`, `19.5:9`, `9:20`, `20:9`, `1:2`, `2:1`, `auto`. `auto` lets the model pick the framing that suits the prompt. Values outside this list return `400 INVALID_REQUEST`. Note the standard channel's `size` values are **not** accepted here, and these values are not accepted there. `resolution` and `quality` stack: each step up raises the rate by the same increment, so `2k` + `medium` is the most expensive combination and `1k` + `low` the cheapest. `aspect_ratio` and framing are free. See the [model page](https://reapi.ai/models/grok-imagine-image-2-0) for the live rate of each combination. ### Text-to-image on the official channel ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-image-2.0-official", "prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space", "n": 1, "aspect_ratio": "16:9", "resolution": "2k", "quality": "medium" }' ``` The response is the same `task_id` envelope as the standard channel — poll [`GET /api/v1/tasks/{task_id}`](/docs/api/tasks) and read `result.images[].url`. ### Image-to-image Supplying `image_urls` switches the request to editing. Describe the change in `prompt`; with several references, refer to them in order as ``, ``, and so on. ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-image-2.0-official", "prompt": "Place the product from on the marble surface in , matching the window light", "image_urls": [ "https://example.com/product.png", "https://example.com/scene.jpg" ], "aspect_ratio": "1:1", "resolution": "2k" }' ``` Reference images must be public http(s) URLs — base64 and `data:` URIs are rejected platform-wide. Each reference image is billed on top of the generated image. ## Response Submission returns the standard async envelope: ```json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX" } ] } ``` Polled completion (`GET /api/v1/tasks/{task_id}`): ```json { "code": 200, "data": { "status": "completed", "result": { "images": [ { "url": "https://cdn.reapi.ai/..." }, { "url": "https://cdn.reapi.ai/..." } ] } } } ``` `result.images` carries one entry per delivered image, so a request with `n: 4` returns four entries. Image URLs are valid for 24 hours from completion — re-host the asset to your own storage if you need durable access. ## Pricing Both channels bill per delivered image, multiplied by `n`, but they dimension the rate differently: * **Standard** — flat. Neither `size` nor `resolution` changes it, so a 16:9 image costs the same as a square one. * **Official** — `resolution` and `quality` each move the rate and stack, for four combinations across three price points (`1k`+`medium` and `2k`+`low` settle at the same rate). `aspect_ratio` and `n` do not change the per-image rate. Reference images are billed on top. A request with `n: 12` costs twelve times a single image on either channel. ``` credits = ceil(per_image_usd × n × 1000) ``` `1 credit = $0.001`. The rounding happens once on the aggregate, not per image. See the [model page](https://reapi.ai/models/grok-imagine-image-2-0) for the live rate. Failed generations are refunded automatically — the reserved credits return to your balance when a task ends in failure. ## Errors `grok-imagine-image-2-0` shares the platform-wide [error envelope](/docs/api/errors). The validation surface is small: * `prompt` missing, empty, or whitespace-only → `400 INVALID_REQUEST`. * `prompt` longer than 10000 characters → `400 INVALID_REQUEST`. * `n` outside `1`–`12` → `400 INVALID_REQUEST`. * `size` outside the seven ratios and five pixel aliases → `400 INVALID_REQUEST`. * `resolution` set to anything other than `quality` → `400 INVALID_REQUEST`. * Any reference media (`image_urls`, `image`, `mask`) supplied → `400 INVALID_REQUEST` with a text-to-image-only message. On the official channel: * `aspect_ratio` outside its 14 values → `400 INVALID_REQUEST`. The standard channel's pixel aliases (`1024x1024` etc.) are not valid here. * `resolution` set to anything other than `1k` / `2k` → `400 INVALID_REQUEST`. The standard channel's `quality` value is rejected. * `quality` set to anything other than `low` / `medium` → `400 INVALID_REQUEST`. * More than 10 entries in `image_urls`, or a non-http(s) URL → `400 INVALID_REQUEST`. ## Tips * The prompt is rendered as written, so lens, lighting and material language survives to the render. A thin prompt stays thin — there is no rewriting layer filling in composition for you. * Ask for the shape you will ship. Generating 16:9 directly beats generating a square and cropping it, because the model composes for the frame. * Batch exploration in one call. Twelve variations of one brief cost the same as twelve separate single-image requests but take one round trip. ## Related * [imagen-4-0](/docs/imagen-4-0) — flat-rate text-to-image, one image per request * [seedream-5-0-lite](/docs/seedream-5-0-lite) — text-to-image plus image editing * [grok-imagine-1-0-video](/docs/grok-imagine-1-0-video) — the video sibling in the same family --- # grok-imagine-video-1.5-official (https://reapi.ai/docs/grok-imagine-video-1-5-official) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Grok Imagine Video 1.5 **Official Channel** — async **image-to-video** > with **native synchronized audio**, distinct from the > [`grok-imagine-video-1.5-beta`](/docs/grok-imagine-video-1-5) channel. > Same one-reference-image workflow at a **lower per-second rate**, with a > slightly stricter input contract: the prompt is required and clips run > 6 to 15 seconds. Model id `grok-imagine-video-1.5-official`. See current > pricing on the > [model page](https://reapi.ai/models/grok-imagine-video-1-5). **Channel differences at a glance.** Compared to the beta channel this surface requires a `prompt`, narrows `aspect_ratio` to `1:1` / `16:9` / `9:16` (no `auto`), starts at 6-second clips, adds an `audio` toggle, and has no `content_filter` parameter. The two channels bill independently — each has its own per-second rate. ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-video-1.5-official", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": ["https://your-cdn.com/source.jpg"], "aspect_ratio": "16:9", "resolution": "720p", "duration": 8 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "grok-imagine-video-1.5-official", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": ["https://your-cdn.com/source.jpg"], "aspect_ratio": "16:9", "resolution": "720p", "duration": 8, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-imagine-video-1.5-official", prompt: "Gentle cinematic push-in, golden-hour light, subtle motion", image_urls: ["https://your-cdn.com/source.jpg"], aspect_ratio: "16:9", resolution: "720p", duration: 8, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "grok-imagine-video-1.5-official", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": []string{"https://your-cdn.com/source.jpg"}, "aspect_ratio": "16:9", "resolution": "720p", "duration": 8, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-video-1.5-official", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL (with audio), valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. This is an **image-to-video** model — exactly one reference image is required on every request. There is no text-to-video mode, no last-frame or reference image input, and no `mode` parameter. *** ## Request body ### `model` — required `string`. Must be `"grok-imagine-video-1.5-official"`. ### `prompt` — string, required Describes the motion, camera, atmosphere, and any dialogue or sound you want in the generated audio. **Required on this channel** (the beta channel accepts image-only requests; this one does not). Maximum **10000 characters**; whitespace-only prompts and prompts over 10000 characters are rejected with `400`. ### `image_urls` — string\[], required Array with **exactly one** public HTTP(S) image URL — the first frame the model animates. Accepted source formats: JPEG, PNG, WebP. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — the image URL must be a public HTTP(S) link. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. More than one entry is rejected. ### `aspect_ratio` — string, default `"16:9"` Output framing. `auto` is **not** available on this channel. Output pixel size follows the ratio × resolution matrix: | Value | 480p | 720p | | ------ | ------- | -------- | | `1:1` | 544×544 | 960×960 | | `16:9` | 736×400 | 1280×720 | | `9:16` | 400×736 | 720×1280 | ### `resolution` — string, default `"480p"` `480p` or `720p`. `720p` costs 2× per second — see Pricing. ### `duration` — integer, default `8` Output length in seconds. Any integer in `[6, 15]` — note the 6-second minimum (the beta channel starts at 1). Out-of-range → `400`. Drives pricing linearly. **Send a number, not a string.** `"duration": "8"` is rejected with `400`. ### `audio` — boolean, default `true` Whether the generated clip carries a native synchronized audio track. Set `false` for a silent video at the same per-second rate. Each request produces exactly **one** video. For multiple takes, submit concurrent requests — each bills and refunds independently. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-video-1.5-official", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days** — re-host to your own storage if you need them longer. *** ## Validation errors Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values) and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------------------- | ------- | ------------------------------------------------ | | `prompt` missing, empty, or whitespace-only | `20002` | `prompt is required` | | `prompt` longer than 10000 characters | `20003` | `prompt must be at most 10000 characters` | | `image_urls` missing | `20002` | `image_urls is required` | | `image_urls` with more than one entry | `20003` | `image_urls allows at most 1 entry` | | `duration` outside `[6, 15]` | `20003` | `duration must be 6-15 seconds` | | Unknown `resolution` | `20003` | `invalid resolution (allowed: 480p / 720p)` | | `aspect_ratio` outside `1:1` / `16:9` / `9:16` | `20003` | `invalid aspect_ratio` | | `image_urls` carrying a `data:` URI or non-http(s) | `20003` | `image_urls entries must be public http(s) URLs` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see the [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Minimum request ```json { "model": "grok-imagine-video-1.5-official", "prompt": "Slow push-in with ambient room tone", "image_urls": ["https://your-cdn.com/source.jpg"] } ``` ### Directed motion + HD ```json { "model": "grok-imagine-video-1.5-official", "prompt": "Slow dolly forward, wind moving the hair, warm cinematic light", "image_urls": ["https://your-cdn.com/portrait.jpg"], "resolution": "720p", "duration": 10 } ``` ### Vertical social clip, no audio ```json { "model": "grok-imagine-video-1.5-official", "prompt": "Energetic motion, quick handheld feel", "image_urls": ["https://your-cdn.com/poster.jpg"], "aspect_ratio": "9:16", "resolution": "720p", "duration": 6, "audio": false } ``` *** ## Polling pattern The task endpoint behaves identically to other video tasks. A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in about a minute. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Pricing Per-second rate by **resolution** — `720p` costs 2× the `480p` rate. This channel is priced independently of (and lower than) the beta channel. See current rates on the [Grok Imagine Video 1.5 model page](https://reapi.ai/models/grok-imagine-video-1-5). **Bill formula** (1 credit = $0.001): ``` credits = ceil(per_second_usd × duration × 1000) ``` Failed jobs refund automatically. *** ## Tips * **Write the prompt like a shot direction.** It is required here — lean into it: camera move, subject motion, atmosphere, and the sound you want. * **One clear subject image works best.** A centered, well-lit reference with clean composition tracks identity and motion far better than a busy frame. * **Sweet-spot duration: 6–10 seconds.** Longer clips raise wall-time without changing the per-second rate. * **Pick `720p` for hero shots, `480p` to save.** The 720p rate is exactly 2× the 480p rate on this channel. *** ## Related * [grok-imagine-video-1.5-beta](/docs/grok-imagine-video-1-5) * [grok-imagine-1.0-video](/docs/grok-imagine-1-0-video) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # grok-imagine-video-1.5-beta (https://reapi.ai/docs/grok-imagine-video-1-5) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Grok Imagine Video 1.5 — async **image-to-video** with **native > synchronized audio**. Pass exactly one reference image (and an optional > prompt) and the model returns a realistic clip with lifelike motion at > 480p or 720p, 1 to 15 seconds. Model id `grok-imagine-video-1.5-beta`. > See current pricing on the > [model page](https://reapi.ai/models/grok-imagine-video-1-5). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine-video-1.5-beta", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": ["https://your-cdn.com/source.jpg"], "resolution": "720p", "duration": 8 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "grok-imagine-video-1.5-beta", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": ["https://your-cdn.com/source.jpg"], "resolution": "720p", "duration": 8, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-imagine-video-1.5-beta", prompt: "Gentle cinematic push-in, golden-hour light, subtle motion", image_urls: ["https://your-cdn.com/source.jpg"], resolution: "720p", duration: 8, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "grok-imagine-video-1.5-beta", "prompt": "Gentle cinematic push-in, golden-hour light, subtle motion", "image_urls": []string{"https://your-cdn.com/source.jpg"}, "resolution": "720p", "duration": 8, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-video-1.5-beta", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL (with audio), valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. This is an **image-to-video** model — exactly one reference image is required on every request. There is no text-to-video mode and no `mode` parameter. *** ## Request body ### `model` — required `string`. Must be `"grok-imagine-video-1.5-beta"`. ### `image_urls` — string\[], required Array with **exactly one** public HTTP(S) image URL — the frame the model animates. Accepted source formats: JPEG, PNG, WebP. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — the image URL must be a public HTTP(S) link. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. More than one entry is rejected. ### `prompt` — string, optional Up to **4,096 characters**. Optional — the reference image alone will animate. Use it to direct motion, camera, atmosphere, and any dialogue or sound you want in the generated audio. ### `aspect_ratio` — string, default `"auto"` Output framing. `auto` follows the source image's size. One of: | Value | Shape | | ------ | ----------------------------- | | `auto` | Follow source image (default) | | `1:1` | Square | | `16:9` | Landscape | | `9:16` | Portrait | | `4:3` | Landscape | | `3:4` | Portrait | | `3:2` | Landscape | | `2:3` | Portrait | ### `resolution` — string, default `"480p"` `480p` or `720p`. Unlike a flat-rate model, `720p` costs more per second than `480p` — see Pricing. ### `duration` — integer, default `8` Output length in seconds. Any integer in `[1, 15]`. Out-of-range → `400`. Drives pricing linearly. **Send a number, not a string.** `"duration": "8"` is rejected with `400`. ### `content_filter` — boolean, default `true` Content safety filter. Defaults to `true`. You can set it to `false` to relax filtering for your own request. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "grok-imagine-video-1.5-beta", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | The generated MP4 carries the native audio track. `output.video_urls` URLs are valid for **7 days** — re-host to your own storage if you need them longer. *** ## Validation errors Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values) and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------------------- | ------- | ------------------------------------------------ | | `image_urls` missing | `20002` | `image_urls is required` | | `image_urls` with more than one entry | `20003` | `image_urls allows at most 1 entry` | | `prompt` longer than 4,096 chars | `20007` | `prompt must be at most 4096 characters` | | `duration` outside `[1, 15]` | `20003` | `duration must be 1-15 seconds` | | Unknown `resolution` | `20003` | `invalid resolution (allowed: 480p / 720p)` | | Unknown `aspect_ratio` | `20003` | `invalid aspect_ratio` | | `image_urls` carrying a `data:` URI or non-http(s) | `20003` | `image_urls entries must be public http(s) URLs` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see the [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Minimum request — image only ```json { "model": "grok-imagine-video-1.5-beta", "image_urls": ["https://your-cdn.com/source.jpg"] } ``` ### Directed motion + HD ```json { "model": "grok-imagine-video-1.5-beta", "prompt": "Slow dolly forward, wind moving the hair, warm cinematic light", "image_urls": ["https://your-cdn.com/portrait.jpg"], "resolution": "720p", "duration": 10 } ``` ### Vertical social clip ```json { "model": "grok-imagine-video-1.5-beta", "prompt": "Energetic motion with ambient street sound", "image_urls": ["https://your-cdn.com/poster.jpg"], "aspect_ratio": "9:16", "resolution": "720p", "duration": 6 } ``` *** ## Polling pattern The task endpoint behaves identically to other video tasks. A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in a few minutes. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Channels Grok Imagine Video 1.5 ships in two independent channels. You pick a channel by switching the `model` id you POST; each bills at its own per-second rate and neither falls back to the other. | Channel | `model` id | prompt | duration | aspect\_ratio | extras | | -------------------- | --------------------------------- | -------- | -------- | ----------------------- | ---------------- | | Official *(default)* | `grok-imagine-video-1.5-official` | required | 6–15 s | `1:1` / `16:9` / `9:16` | `audio` toggle | | Beta | `grok-imagine-video-1.5-beta` | optional | 1–15 s | `auto` + 7 ratios | `content_filter` | Both are image-to-video with exactly one reference image and native audio; submit/poll envelope, task id format, retention (7 days), and error codes are identical. The official channel has the lower per-second rate — see the [full official-channel reference](/docs/grok-imagine-video-1-5-official). *** ## Pricing Per-second rate by **resolution** — `720p` costs more per second than `480p`. See current rates on the [Grok Imagine Video 1.5 model page](https://reapi.ai/models/grok-imagine-video-1-5). **Bill formula** (1 credit = $0.001): ``` credits = ceil(per_second_usd × duration × 1000) ``` Failed jobs refund automatically. *** ## Tips * **One clear subject image works best.** A centered, well-lit reference with clean composition tracks identity and motion far better than a busy frame. * **Prompt the motion and the sound.** "Slow push-in, ambient room tone, soft breathing" gives the native audio something to lock onto, not just the video. * **Sweet-spot duration: 5–10 seconds.** Longer clips raise wall-time without changing the per-second rate. * **Pick `720p` for hero shots, `480p` to save.** Resolution changes the per-second cost on this model, unlike flat-rate siblings. *** ## Related * [grok-imagine-video-1.5-official](/docs/grok-imagine-video-1-5-official) * [grok-imagine-1.0-video](/docs/grok-imagine-1-0-video) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # grok-imagine (https://reapi.ai/docs/grok-imagine) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > xAI's Grok Imagine image models on reAPI at a **flat price per image**, in > two quality tiers selected with the `quality` field (`standard` or `high`). > Up to **10 images per request**, fourteen aspect ratios, `1k` or `2k` > output, and single-image editing on the same endpoint. Async-first: submit > returns a `task_id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/grok-imagine). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine", "prompt": "A product photo of a matte black wireless speaker on a concrete plinth, soft window light, shallow depth of field", "quality": "standard", "n": 4, "aspect_ratio": "1:1" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "grok-imagine", "prompt": "A product photo of a matte black wireless speaker on a concrete plinth, soft window light, shallow depth of field", "quality": "standard", "n": 4, "aspect_ratio": "1:1", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-imagine", prompt: "A product photo of a matte black wireless speaker on a concrete plinth, soft window light, shallow depth of field", quality: "standard", n: 4, aspect_ratio: "1:1", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "grok-imagine", "prompt": "A product photo of a matte black wireless speaker on a concrete plinth, soft window light, shallow depth of field", "quality": "standard", "n": 4, "aspect_ratio": "1:1", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` The response carries a `task_id`. Poll [`GET /api/v1/tasks/{task_id}`](/docs/api/tasks) until `status` is `completed`, then read `result.images[].url`. ## Endpoint `POST https://reapi.ai/api/v1/images/generations` Headers: `Authorization: Bearer YOUR_API_KEY`, `Content-Type: application/json`. Accepts and returns JSON. ## Request body | Field | Type | Required | Default | Description | | -------------- | --------- | -------- | ---------- | ------------------------------------------------------------------------------------------------------------------------ | | `model` | string | yes | — | Must be `grok-imagine`. | | `prompt` | string | yes | — | Image description, rendered as written. Up to 10000 characters. | | `quality` | string | no | `standard` | Quality tier: `standard` or `high`. Selects which Grok Imagine model serves the request. The **only billing dimension**. | | `n` | integer | no | `1` | Images to return, `1`–`10`. Each delivered image is billed. | | `aspect_ratio` | string | no | `auto` | Output framing — 14 values, listed below. Does **not** change the rate. | | `resolution` | string | no | `1k` | Pixel tier: `1k` or `2k`. Does **not** change the rate on either tier. | | `image_urls` | string\[] | no | — | One public http(s) image URL. Present ⇒ image editing (see below), billed at the same flat rate as a generation. | ### `quality` tiers | Value | What it is | | ---------- | --------------------------------------------------------------------------------------------- | | `standard` | The volume tier — the lowest flat rate per image on the platform. Default. | | `high` | Spends more on each image for finer detail. Same request shape, same ratios, same batch size. | Both tiers are Grok Imagine models from xAI. Only `quality` changes the price; everything else is free to vary. The pricing table on the [model page](https://reapi.ai/models/grok-imagine) lists the current rate for each tier. ### `aspect_ratio` values `auto`, `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `2:3`, `3:2`, `9:19.5`, `19.5:9`, `9:20`, `20:9`, `1:2`, `2:1`. `auto` (the default) lets the model pick the framing that suits the prompt. Values outside this list return `400 INVALID_REQUEST`. Output pixels follow the ratio and the `resolution` tier — a `1:1` request at `1k` returns 1024×1024, a `16:9` request at `2k` returns 2816×1584. Trust the returned image rather than assuming a fixed size from the ratio alone. ## Image editing Supplying `image_urls` with one public image URL switches the request to editing on the selected tier. Describe the change in `prompt`. ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-imagine", "prompt": "Render this image as a pencil sketch with detailed shading", "quality": "high", "image_urls": ["https://example.com/photo.jpg"], "aspect_ratio": "1:1" }' ``` Reference images must be public http(s) URLs — base64 and `data:` URIs are rejected platform-wide. This surface takes **exactly one** reference image; multi-image compositing is available on [grok-imagine-image-2-0](/docs/grok-imagine-image-2-0). ## Response Submission returns the standard async envelope: ```json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX" } ] } ``` Polled completion (`GET /api/v1/tasks/{task_id}`): ```json { "code": 200, "data": { "status": "completed", "result": { "images": [ { "url": "https://cdn.reapi.ai/..." }, { "url": "https://cdn.reapi.ai/..." } ] } } } ``` `result.images` carries one entry per delivered image, so a request with `n: 4` returns four entries. Image URLs are valid for 24 hours from completion — re-host the asset to your own storage if you need durable access. ## Pricing Grok Imagine bills a **flat rate per delivered image on each tier**, multiplied by `n`: * **`quality`** selects the tier and is the only dimension that moves the per-image rate. * **`aspect_ratio`**, **`resolution`** and **`n`** do not change the per-image rate — a `2k` banner costs the same as a `1k` square on the same tier. * **Editing** (one reference image) bills the same flat per-image rate as a generation. ``` credits = ceil(per_image_usd × n × 1000) ``` `1 credit = $0.001`. The rounding happens once on the aggregate, not per image. See the [model page](https://reapi.ai/models/grok-imagine) for the live rate of each tier. Failed generations are refunded automatically — the reserved credits return to your balance when a task ends in failure. ## Errors `grok-imagine` shares the platform-wide [error envelope](/docs/api/errors). * `prompt` missing, empty, or whitespace-only → `400 INVALID_REQUEST`. * `prompt` longer than 10000 characters → `400 INVALID_REQUEST`. * `quality` set to anything other than `standard` / `high` → `400 INVALID_REQUEST`. * `n` outside `1`–`10` → `400 INVALID_REQUEST`. * `aspect_ratio` outside its 14 values → `400 INVALID_REQUEST`. * `resolution` set to anything other than `1k` / `2k` → `400 INVALID_REQUEST`. * More than one entry in `image_urls`, or a non-http(s) URL → `400 INVALID_REQUEST`. * Upstream rejection of the content → `80006 CONTENT_POLICY_VIOLATION`; the task fails and is refunded. ## Tips * Use `standard` with `n` up to 10 to explore, then re-run the winning prompt on `high` for the final asset — the request shape is identical. * Ask for the shape you will ship: generating `16:9` directly beats cropping a square, and on Grok Imagine it costs the same. * For edits, describe the change rather than the whole scene — the reference image already carries the composition. ## Related * [grok-imagine-image-2-0](/docs/grok-imagine-image-2-0) — the newer model with quality control and multi-reference editing * [nano-banana-2-lite](/docs/nano-banana-2-lite) — another low-cost image tier * [grok-imagine-video-1-5](/docs/grok-imagine-video-1-5) — the video sibling in the same family --- # happyhorse-1.0-official (https://reapi.ai/docs/happyhorse-1-0-official) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Happy Horse 1.0 **Official Channel** — direct first-party routing, > distinct from the standard [`happyhorse-1.0`](/docs/happyhorse-1-0) > channel. It uses the model vendor's official first-party SKUs behind > one ReAPI model id and keeps ReAPI's URL-only media contract. **Official channel, ReAPI boundary.** The upstream is the model vendor's first-party platform. Media inputs must still be public `http(s)` URLs; base64/data URI media is not accepted by ReAPI even where upstream docs show base64 examples. Watermark policy is also a ReAPI override: the upstream's official default is `true`, but ReAPI defaults `watermark` to `false`. Send `"watermark": true` if you want the upstream watermark. ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "happyhorse-1.0-official", "prompt": "A coastal road at sunset, slow-motion camera push-in, cinematic feel", "resolution": "1080P", "size": "4:5", "duration": 5, "seed": 42 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "happyhorse-1.0-official", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080P", "size": "4:5", "duration": 5, "seed": 42, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "happyhorse-1.0-official", prompt: "A coastal road at sunset, slow-motion camera push-in", resolution: "1080P", size: "4:5", duration: 5, seed: 42, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "happyhorse-1.0-official", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080P", "size": "4:5", "duration": 5, "seed": 42, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Request surface The public endpoint and async response envelope are the same as the standard channel: ```txt POST /api/v1/videos/generations ``` One `model` id auto-routes by request shape: | Shape | Official upstream SKU | | ---------------------------------------------------- | --------------------------- | | `prompt` only | `happyhorse-1.0-t2v` | | `first_frame_image` (+ optional `prompt`) | `happyhorse-1.0-i2v` | | `image_urls` 1-9 + `prompt` | `happyhorse-1.0-r2v` | | `video_url` (+ optional `image_urls` 0-5) + `prompt` | `happyhorse-1.0-video-edit` | `first_frame_image`, `image_urls`, and `video_url` are mutually exclusive except for the legal EDIT combination: `video_url + image_urls`. ## Official-channel constraints | Field | Official channel behavior | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | Must be `"happyhorse-1.0-official"` | | `prompt` | Required for T2V / R2V / EDIT, optional for I2V. The upstream truncates over-length prompt text; ReAPI does not reject official-channel prompts at the standard-channel 2500-character cap. | | `first_frame_image` | Public `http(s)` URL only. Base64/data URI is rejected by ReAPI. | | `image_urls` | Public `http(s)` URLs only. R2V accepts 1-9 images; EDIT accepts 0-5 reference images. | | `video_url` | Public `http(s)` URL only. EDIT source video must be 3-60 seconds, long side ≤2160 px, short side ≥320 px, and aspect ratio between 1:2.5 and 2.5:1. The upstream also enforces file size ≤100 MB and fps >8. | | `resolution` | `"720P"` or `"1080P"`; omitted lets upstream apply its default. | | `size` | T2V/R2V ratio: `"16:9"`, `"9:16"`, `"1:1"`, `"4:3"`, `"3:4"`, `"4:5"`, `"5:4"`. Ignored for I2V and EDIT because output shape follows the source media. | | `duration` | 3-15 seconds for T2V/I2V/R2V. Ignored for EDIT because output length follows the source video. | | `watermark` | ReAPI default is `false` even though the upstream's official default is `true`. Explicit `true` / `false` is honored. | | `seed` | Integer from 0 to 2147483647. | | `audio_setting` | EDIT only: `"auto"` or `"origin"`. | ## Differences from `happyhorse-1.0` | Aspect | `happyhorse-1.0` | `happyhorse-1.0-official` | | ----------------------- | ----------------------------------- | ----------------------------------------------------------------------------- | | Upstream channel | Standard | Vendor first-party official | | Wire `model` value | `"happyhorse-1.0"` | `"happyhorse-1.0-official"` | | T2V/R2V ratios | `16:9`, `9:16`, `1:1`, `4:3`, `3:4` | Adds `4:5` and `5:4` | | Prompt cap | ReAPI rejects above 2500 chars | Upstream truncation semantics; no local 2500-char reject | | EDIT video dimensions | Standard channel validation rules | Official first-party validation rules | | Default watermark | ReAPI default `false` | ReAPI default `false` (intentional override from the upstream default `true`) | | Per-second rate | Baseline | **10% off** the baseline | | Validation error prefix | `happyhorse:` | `happyhorse-official:` | *** ## Pricing Per-second × resolution. **10% off** the standard channel at every supported resolution. See current 720P / 1080P / 4K rates on the [Happy Horse model page](https://reapi.ai/models/happyhorse-1-0). **Bill formula** (1 credit = $0.001): | Mode | Billable seconds | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | T2V / I2V / R2V | `duration` you sent (default 5) | | EDIT | `ceil(probed_source_seconds) + min(ceil(probed_source_seconds), 15)` — vendor processes the source AND produces a capped output; both sides are billable. Failed probe → `400 PRICING_UNAVAILABLE`, no charge. | Final bill: `ceil(per_second_usd_after_discount × billable_seconds × 1000)` credits. Failed jobs refund automatically. ### Examples | Source video | Mode | Billable seconds | | ------------ | ------------------ | --------------------- | | — | T2V, `duration=5` | 5 | | — | T2V, `duration=10` | 10 | | 5s clip | EDIT | 5 + min(5, 15) = 10 | | 8.3s clip | EDIT | 9 + min(9, 15) = 18 | | 60s clip | EDIT | 60 + min(60, 15) = 75 | | 20s clip | EDIT | 20 + min(20, 15) = 35 | Apply `ceil(per_second_usd_after_discount × billable_seconds × 1000)` for the credit charge. *** ## Validation errors The response envelope and numeric error-code system match the standard channel, but official-channel validation follows the first-party rules listed above. Error messages from this channel use the `happyhorse-official:` prefix. Pattern-match on the numeric `code`, not the message string. *** ## When to pick which channel | Need | Channel | | --------------------------------------------- | ------------------------- | | Lowest unit price | `happyhorse-1.0-official` | | Official first-party route | `happyhorse-1.0-official` | | `size` values `4:5` or `5:4` | `happyhorse-1.0-official` | | Existing integration with no migration | `happyhorse-1.0` | | Standard channel route / existing constraints | `happyhorse-1.0` | Switching channels = changing the `model` string in your request body. The response envelope and polling flow are shared; provider-specific validation and pricing differ as documented above. *** ## Related * [`happyhorse-1.0` — full reference](/docs/happyhorse-1-0) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) --- # happyhorse-1.0 (https://reapi.ai/docs/happyhorse-1-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Alibaba Happy Horse 1.0 — a single async video endpoint that > auto-routes between **T2V / I2V / R2V / EDIT** based on which media field > your request carries. 720P or 1080P, 3–15 second outputs, billed only by > resolution × duration regardless of mode. See current pricing on the > [model page](https://reapi.ai/models/happyhorse-1-0). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "happyhorse-1.0", "prompt": "A coastal road at sunset, slow-motion camera push-in, cinematic feel", "resolution": "1080P", "size": "16:9", "duration": 5, "seed": 42 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "happyhorse-1.0", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080P", "size": "16:9", "duration": 5, "seed": 42, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "happyhorse-1.0", prompt: "A coastal road at sunset, slow-motion camera push-in", resolution: "1080P", size: "16:9", duration: 5, seed: 42, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "happyhorse-1.0", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080P", "size": "16:9", "duration": 5, "seed": 42, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "happyhorse-1.0", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URLs, valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Mode routing `happyhorse-1.0` is **one model id** that picks its mode from which media fields you set: | Fields you send | Mode | What it does | | --------------------------------------------------------------------- | -------- | ----------------------------------------- | | `prompt` only | **T2V** | Generate from text | | `prompt` + `first_frame_image` | **I2V** | Animate starting from a still frame | | `prompt` + `image_urls` (1–9) | **R2V** | Compose a new scene from reference images | | `video_url` (+ `prompt`, optional `image_urls` ≤ 5 / `audio_setting`) | **EDIT** | Restyle / rewrite an existing clip | Resolution priority when multiple fields are set: `video_url` > `first_frame_image` > `image_urls` > `prompt`-only. **Mutex rule.** The three media fields (`first_frame_image`, `image_urls`, `video_url`) are mutually exclusive **in pairs**. The single legal pairing is `video_url + image_urls` (EDIT with style references). Any other combination is rejected with `400 first_frame_image and image_urls cannot be combined` or `400 first_frame_image and video_url cannot be combined` (code `20003`). *** ## Request body ### `model` — required `string`. Always `"happyhorse-1.0"`. ### `prompt` — string Up to **2,500 characters**. Required in T2V / R2V / EDIT; optional in I2V (but recommended — phrasing the camera move and motion improves output quality). **Failure modes.** * Missing in non-I2V → `400 prompt is required in T2V / R2V / EDIT modes` (code `20002`). * Longer than 2,500 chars → `400 prompt must be at most 2500 characters` (code `20007`). ### `first_frame_image` — string Public HTTP(S) URL pointing at the still you want animated. Triggers **I2V** when set. Mutually exclusive with `image_urls` and `video_url`. Recommended source asset: JPEG / PNG / BMP / WEBP, short side ≥ 300px, ratio between `1:2.5` and `2.5:1`, ≤ 10MB. The upstream model also enforces these — the gateway forwards the URL untouched, so non-compliant assets surface as a delayed `provider_failed` rather than an immediate 400. Validate before submitting if the source isn't yours. **No `data:` URIs.** reapi rejects base64 inputs platform-wide. Upload to public storage (your own CDN, S3, R2…) and pass the URL. ### `image_urls` — string\[] Array of public HTTP(S) URLs. * **R2V** (no `video_url`): **1–9** entries. The upstream composes a fresh scene that incorporates the supplied subjects / styles. * **EDIT** (`video_url` set): **0–5** entries acting as style references on top of the source video. Sending more than 5 is rejected with `400 image_urls allows at most 5 entries in EDIT mode`. Same per-asset constraints as `first_frame_image` (short side ≥ 720px is recommended for R2V, short / long ≥ 0.4, ≤ 10MB each). T2V and I2V requests are **rejected** if `image_urls` is present — the upstream wouldn't consume it, and silently dropping it would make billing surprising. Mutually exclusive with `first_frame_image`. ### `video_url` — string Public HTTP(S) URL of the source clip. Triggers **EDIT** mode. Combinable with `image_urls` (≤ 5) and `audio_setting`. Mutually exclusive with `first_frame_image`. Source asset shape (enforced upstream): MP4 / MOV (H.264 recommended), duration 3–60 seconds, ≥ 480p / short side ≥ 360, ratio between `1:8` and `8:1`, > 8 fps, ≤ 100MB. **Length caps the output.** If the source video runs longer than 15s, the upstream truncates from second 0 to second 15 before processing. The output clip's length **matches the source's processed length** — trim the input yourself if you need a different segment or a tighter total. In EDIT mode the `duration` parameter is **ignored for both generation and billing**; reapi probes the source clip server-side and charges `(ceil(probed_seconds) + min(ceil(probed_seconds), 15)) × per_second_usd` — input and capped output are both billable. See the `duration` field below. ### `audio_setting` — string, default `"auto"` Only valid in EDIT mode. Sending it without `video_url` is rejected with `400 audio_setting requires video_url (EDIT mode only)`. | Value | Behavior | | ---------- | -------------------------------------- | | `"auto"` | Generate a fresh audio track (default) | | `"origin"` | Keep the source video's original audio | ### `resolution` — string, default `"1080P"` `"720P"` or `"1080P"`. Drives pricing — every other parameter is free across the two tiers. Lowercase forms (`"720p"`, `"1080p"`) are accepted and normalized for symmetry with seedance; the upstream sees the canonical uppercase form. ### `size` — string, default `"16:9"` Output ratio for **T2V and R2V only**. One of `16:9` / `9:16` / `1:1` / `4:3` / `3:4`. In **I2V** and **EDIT**, the upstream derives the output ratio from the input media (first-frame image / source video) and ignores `size`. The gateway still accepts the field — it's just inert. ### `duration` — integer, default `5` Output length in seconds for **T2V / I2V / R2V**. Any integer in `[3, 15]`. Drives pricing linearly: `ceil(per_second_usd × duration × 1000)` credits (1 credit = $0.001). **EDIT mode ignores `duration` for billing.** When `video_url` is set, reapi probes the source video's actual length on the server (ffmpeg metadata) and bills both the input clip AND the (capped) output: ``` billable = ceil(probed_seconds) + min(ceil(probed_seconds), 15) bill_usd = billable × per_second_usd ``` A 5s source bills 10s; a 60s source bills 75s (60 + 15-cap output). Whatever you send in `duration` is ignored for cost. The upstream also ignores `duration` here (output length tracks the source). Probe failures return `400 PRICING_UNAVAILABLE` (code `30002`) with no charge. ### `watermark` — boolean, default `false` Adds the platform watermark to the generated clip when `true`. ### `seed` — integer Reproducibility hint. Range `[0, 2147483647]`. Same seed plus an otherwise identical request returns a similar (not bit-for-bit identical) result. Omit for full randomness. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "happyhorse-1.0", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days**. Re-host to your own storage if you need them longer. *** ## Validation errors All cases below return HTTP 400 with code `20003` unless noted. Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed dimensions, etc.) and are not a stable contract. | Trigger | Code | Message (illustrative) | | ----------------------------------------------------- | ------- | --------------------------------------------------------------------------------- | | `prompt` missing in T2V / R2V / EDIT | `20002` | `happyhorse: prompt is required in T2V / R2V / EDIT modes` | | `prompt` longer than 2,500 chars | `20007` | `happyhorse: prompt must be at most 2500 characters` | | `first_frame_image` + `image_urls` together | `20003` | `happyhorse: first_frame_image and image_urls cannot be combined` | | `first_frame_image` + `video_url` together | `20003` | `happyhorse: first_frame_image and video_url cannot be combined` | | `image_urls` empty array in R2V | `20003` | `happyhorse: image_urls contained no usable URLs` | | `image_urls` > 5 in EDIT | `20003` | `happyhorse: image_urls allows at most 5 entries in EDIT mode` | | `audio_setting` set without `video_url` | `20003` | `happyhorse: audio_setting requires video_url (EDIT mode only)` | | `image_urls` carrying a `data:` URI | `20003` | `happyhorse: image_urls must be public http(s) URLs` | | `video_url` carrying a `data:` URI | `20003` | `happyhorse: video_url must be a public http(s) URL` | | EDIT source duration \< 3s or > 60s | `20003` | `video_url duration X.XXs is out of range (must be 3–60s)` | | EDIT source resolution below 480p (short side \< 360) | `20003` | `video_url resolution WxH is below the 480p minimum (short side must be ≥ 360px)` | | EDIT source ratio outside 1:8–8:1 | `20003` | `video_url aspect ratio WxH is out of range (must be between 1:8 and 8:1)` | | EDIT source video probe fails (network / format) | `30002` | `Could not determine source video duration for billing: …` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### T2V — minimum request ```json { "model": "happyhorse-1.0", "prompt": "A little girl walking down the road, cinematic feel" } ``` ### T2V — full parameters ```json { "model": "happyhorse-1.0", "prompt": "Sunset coastal road, slow camera push-in, cinematic warm tones", "resolution": "1080P", "size": "16:9", "duration": 8, "watermark": false, "seed": 42 } ``` ### I2V — first-frame animation ```json { "model": "happyhorse-1.0", "prompt": "Bring the scene to life with gentle camera dolly forward", "first_frame_image": "https://your-cdn.com/first_frame.png", "resolution": "1080P", "duration": 5 } ``` ### R2V — multiple references ```json { "model": "happyhorse-1.0", "prompt": "The protagonist from image 1 runs through image 2's scene then picks up the prop from image 3. 3D cartoon style, smooth motion.", "image_urls": [ "https://your-cdn.com/img_01.jpg", "https://your-cdn.com/img_02.png", "https://your-cdn.com/img_03.jpeg" ], "resolution": "1080P", "size": "16:9", "duration": 5 } ``` ### EDIT — keep original audio + style reference ```json { "model": "happyhorse-1.0", "prompt": "Repaint the character in a 3D cartoon style, keep the original motion", "video_url": "https://your-cdn.com/source.mp4", "image_urls": ["https://your-cdn.com/style_ref.jpg"], "resolution": "1080P", "audio_setting": "origin", "seed": 42 } ``` ### 720P — cost-conscious ```json { "model": "happyhorse-1.0", "prompt": "Waves crashing on a beach at sunset, wide shot", "resolution": "720P", "size": "16:9", "duration": 5 } ``` *** ## Choosing a mode | Need | Send | | ----------------------------------------- | ------------------------------------------------------------------- | | Generate from text | `prompt` only (T2V) | | Animate a still | `prompt + first_frame_image` (I2V) | | Compose a new scene from reference images | `prompt + image_urls` 1–9 (R2V) | | Restyle / rewrite an existing clip | `video_url` (+ `prompt`, optional refs ≤ 5, `audio_setting`) (EDIT) | | Cut spend in half | Set `resolution: "720P"` | *** ## Polling pattern The task endpoint behaves identically to image tasks — the only difference is the completed `output` shape (`video_urls` instead of `image_urls`). A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in a few minutes. The worker's wall-clock cap is **48 hours**, comfortably above any realistic queue. *** ## Channels `happyhorse-1.0` ships in three channels. The wire schema is identical; you pick a channel by switching the `model` id you POST. Pricing, upstream routing, and a few feature corners differ — same input you send to any of them, just at different cost / quality / latency. | Channel | `model` id | Pricing | 4K | mask | negative prompt | | -------------------- | ------------------------- | -------- | -- | ---- | --------------- | | Standard *(default)* | `happyhorse-1.0` | baseline | — | — | — | | Official *(-10%)* | `happyhorse-1.0-official` | 0.9 × | ✓ | — | — | Both accept the **same request body** documented in this page — `prompt`, `first_frame_image`, `image_urls`, `video_url`, `audio_setting`, `resolution`, `size`, `duration`, `seed`, `watermark`. The only client-visible difference at the schema level is: * **Official channel**: adds 2 extra aspect ratios (`4:5`, `5:4`) and supports `4K` resolution. `watermark` is forced `false`. Submit/poll envelope is identical across channels — task id format, `status` enum, `output.video_urls` shape. Polling rate, retention (7 days for video URLs), and validation error codes are the same. Pick by use case: * **Standard** is the default for new integrations — predictable latency, full feature surface (only one that supports R2V image cardinality up to 9). * **Official** if you need 4K output, the wider aspect-ratio set, or the 10% discount applies to your volume. *** ## Pricing Per-second × resolution. Mode does **not** change the rate. Both channels share the same parameter shape: * **Standard** — `happyhorse-1.0`, full feature surface. * **Official** — `happyhorse-1.0-official`, cheaper than Standard, supports 4K (see official-only doc). See current 720P / 1080P / 4K rates per channel on the [Happy Horse model page](https://reapi.ai/models/happyhorse-1-0). **Bill formula** (1 credit = $0.001): | Mode | Billable seconds | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | T2V / I2V / R2V | `duration` you sent (default 5) | | EDIT | `ceil(server_probed_source_seconds) + min(ceil(server_probed_source_seconds), 15)` — input and capped output both billable. `duration` is **ignored** in EDIT; server measures the uploaded clip. Failed probe → `400 PRICING_UNAVAILABLE`, no charge | Final bill: `ceil(per_second_usd × billable_seconds × 1000)` credits. Failed jobs refund automatically. *** ## Tips * **Prompt motion, not just scene.** "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen. * **Sweet-spot duration: 5–10 seconds.** Below 5s motion looks choppy; above 10s upstream wall-time grows fast. * **First-frame quality matters.** Subject centered, clear composition, no heavy filters — I2V output quality tracks input quality directly. * **Pre-trim EDIT sources.** > 15s clips get auto-truncated to the first 15s upstream **and capped at 15s for billing**. Slice the input yourself if you want a different segment. * **EDIT cost = source length.** A 5s source bills 5s; an 8s source bills 8s; a 60s source bills 15s (the cap). The playground's draft estimate may show a default before the upload finishes — the authoritative number is computed at submit after the server probes the file. *** ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # happyhorse-1-1 (https://reapi.ai/docs/happyhorse-1-1) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Alibaba HappyHorse 1.1 — a single async video endpoint that auto-routes > between **T2V / I2V / R2V** based on which media field your request carries. > 720p or 1080p, 3–15 second outputs, billed only by resolution × duration > regardless of mode. See current pricing on the > [model page](https://reapi.ai/models/happyhorse-1-1). Generation is **asynchronous**: the POST returns a task id, then poll [`GET /api/v1/tasks/{id}`](/docs/api/tasks) until `status` is `completed`. ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "happyhorse-1-1", "prompt": "A coastal road at sunset, slow-motion camera push-in, cinematic feel", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "happyhorse-1-1", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "happyhorse-1-1", prompt: "A coastal road at sunset, slow-motion camera push-in", resolution: "1080p", aspect_ratio: "16:9", duration: 5, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "happyhorse-1-1", "prompt": "A coastal road at sunset, slow-motion camera push-in", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() var out map[string]any json.NewDecoder(resp.Body).Decode(&out) fmt.Println(out) } ``` ## Endpoint ```http POST /api/v1/videos/generations Authorization: Bearer YOUR_API_KEY Content-Type: application/json ``` Submitting returns a task id; poll [`GET /api/v1/tasks/{id}`](/docs/api/tasks) for the result. Polling does not consume credits. ## Parameters | Parameter | Type | Required | Default | Description | | ---------------------- | --------- | ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | yes | — | `happyhorse-1-1` | | `prompt` | string | T2V / R2V: yes · I2V: no | — | Any language. ≤5000 non-CJK / ≤2500 CJK characters (over-length is auto-truncated upstream). In R2V, reference images with `[Image 1]`, `[Image 2]`, … | | `image_urls` | string\[] | I2V | — | First-frame image, **exactly 1** public URL. Presence selects **image-to-video**. JPEG/PNG/WEBP, short side ≥300px, ratio 1:2.5–2.5:1, ≤20MB. | | `reference_image_urls` | string\[] | R2V | — | **1–9** reference image URLs. Presence selects **reference-to-video**. JPEG/PNG/WEBP, short side ≥400px, ≤20MB. | | `resolution` | enum | no | `720p` | `720p` · `1080p` | | `aspect_ratio` | enum | no | `16:9` | `16:9` `9:16` `3:4` `4:3` `4:5` `5:4` `1:1` `9:21` `21:9`. **T2V / R2V only** — in I2V the orientation is derived from the source image. | | `duration` | integer | no | `5` | Output length in seconds, `3`–`15`. | `image_urls` (I2V) and `reference_image_urls` (R2V) are **mutually exclusive**. All media inputs must be public HTTP(S) URLs — base64 / `data:` URIs are rejected. ## Modes Mode is implicit — selected by which inputs you send: | Mode | Trigger | prompt | aspect\_ratio | | ---------------------------- | ---------------------------- | -------- | --------------- | | **Text-to-video (T2V)** | no media | required | yes | | **Image-to-video (I2V)** | `image_urls` (1) | optional | no (from image) | | **Reference-to-video (R2V)** | `reference_image_urls` (1–9) | required | yes | ```json // I2V — animate a first frame { "model": "happyhorse-1-1", "image_urls": ["https://…/frame.jpg"], "resolution": "1080p", "duration": 5 } // R2V — keep subjects consistent across the clip { "model": "happyhorse-1-1", "prompt": "the woman in [Image 1] walks through [Image 2]", "reference_image_urls": ["https://…/a.jpg", "https://…/b.jpg"], "resolution": "1080p", "duration": 5 } ``` ## Pricing Billed by **per-second rate × resolution × duration**; the routing mode does not change the rate. Two tiers: `720p` and `1080p`. See the [model page](https://reapi.ai/models/happyhorse-1-1) for current rates. **Bill formula** (`1 credit = $0.001`): ``` credits = ceil(per_second_usd × duration × 1000) ``` ## Output On success, `GET /api/v1/tasks/{id}` returns: ```json { "id": "task_…", "model": "happyhorse-1-1", "status": "completed", "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/…/0.mp4"] }, "error": null } ``` ## Errors | HTTP | `code` | When | | ---- | ----------------- | ------------------------------------------------------------------------------------ | | 400 | `20002` | Missing / invalid parameter (e.g. prompt required in T2V/R2V, both image fields set) | | 401 | `10001` – `10005` | Auth missing / invalid / revoked | | 402 | `30001` | Insufficient credits | | 429 | `50001` | Per-user rate limit exceeded | Failed generations are surfaced under `error` in the polling response and are refunded automatically. Full catalog: [Errors](/docs/api/errors). ## Tips * **Pick the mode by inputs, not a flag.** Sending `reference_image_urls` switches to R2V; sending `image_urls` switches to I2V; neither → T2V. * In **R2V**, name each subject explicitly and reference it by `[Image N]` in the prompt, matching the array order, for the strongest identity retention. * `aspect_ratio` is ignored in I2V — crop your source image to the orientation you want instead. * Longer `duration` scales the bill linearly; start at 5s while iterating. ## Related * [Tasks](/docs/api/tasks) — universal polling endpoint * [Errors](/docs/api/errors) — full error catalog * [happyhorse-1-0](/docs/happyhorse-1-0) — the previous generation --- # Head Swap (https://reapi.ai/docs/head-swap) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Head Swap replaces the **entire head** in a target photo — face, hair, ears > and outline — with the head from a source image, keeping the target's body, > pose, lighting and background. Two public image URLs in, one image out; pin > a seed to repeat a result. Submit returns a `task_id`; poll until ready. Try > it in the playground on the [model page](https://reapi.ai/models/head-swap), > which also shows current pricing. For the facial region only, see > [Face Swap](/docs/face-swap). Content filtering is always off on this model, and there is **no filter parameter**: the request schema has no `content_filter` field, and a request that includes it is rejected with `400`. Use it on people whose likeness you have the right to use; platform terms apply to everything you generate. Generated images are stored in an isolated bucket and their URLs stay valid for **30 days**. Mirror the files to your own storage if you need them longer. ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "head-swap", "image_url": "https://example.com/target-photo.jpg", "head_image_url": "https://example.com/source-head.jpg" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "head-swap", "image_url": "https://example.com/target-photo.jpg", "head_image_url": "https://example.com/source-head.jpg", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "head-swap", image_url: "https://example.com/target-photo.jpg", head_image_url: "https://example.com/source-head.jpg", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "head-swap", "image_url": "https://example.com/target-photo.jpg", "head_image_url": "https://example.com/source-head.jpg", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "head-swap", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the swapped image URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. Head Swap is **image-to-image only** — there is no prompt and no size control; the output keeps the target photo's frame. Each request produces **exactly one image** (no `n` parameter) and handles one still image (no video). *** ## Request body ### `model` — string, required Must be `head-swap`. ### `image_url` — string, required Public `http(s)` URL of the **target** photo: the image whose head will be replaced. The body, pose, framing, lighting and background are kept. Base64 and `data:` URIs are rejected. ### `head_image_url` — string, required Public `http(s)` URL of the **source** head: the face, hair, ears and outline that are placed onto the target. A head-and-shoulders shot with the full hair visible, facing roughly the same way as the target, gives the strongest result. Base64 and `data:` URIs are rejected. ### `seed` — integer or null, optional `0` to `2147483647`. Pin a seed to reproduce a result for the same two images. `0`, `null`, or omitting the field all mean a random seed. *** ## Pricing Head Swap bills a flat rate **per generated image**, independent of the input sizes and of `seed`. Each request produces one image: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. Failed and rejected requests are not charged. The exact per-image credit cost surfaces on the [model page](https://reapi.ai/models/head-swap). *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "head-swap", "status": "completed", "output": { "image_urls": [ "https://...png" ] } } ``` Output URLs are valid for 30 days — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (a missing or non-`http(s)` `image_url` / `head_image_url`, a `seed` outside 0–2147483647, or an unknown field such as `content_filter`) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. * Upstream could not detect a usable head or failed to generate → the task ends `failed` and the reserved credits are refunded. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * **Head swap vs face swap**: Face Swap keeps the target's hair and head shape and changes the facial features; Head Swap replaces the whole head, hairstyle included. Pick by whether the hair should stay. * **Source head**: the full head visible, hair not cropped, no hat, facing roughly the same direction as the target. Strong angle mismatches weaken the blend at the neck. * **Target photo**: the head should be clearly visible and not tiny in the frame; the neckline and shoulders are where the swap has to join, so keep them unobstructed. * **Batches**: submit many tasks in parallel and poll the ids; pin `seed` when you want to re-create a specific result later. * Output URLs expire after 30 days — copy the file into your own storage as part of the same job. *** ## Related * [Face Swap](/docs/face-swap) — facial region only, hair and head shape kept * [Z-Image Pro](/docs/z-image-pro) — text-to-image on the same terms * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # humanize (https://reapi.ai/docs/humanize) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > `humanize` is a single async endpoint that takes AI-generated text and returns > a rewrite that reads as human-written — varied rhythm, natural transitions, no > tell-tale AI cadence — built to pass common AI detectors. Tune the rewrite > with `readability`, `purpose`, `strength`, and `model_version`. See current > pricing on the [model page](https://reapi.ai/models/humanize). ## Quick example ```bash curl https://reapi.ai/api/v1/humanize \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "humanize", "content": "Artificial intelligence has fundamentally transformed the way modern enterprises approach data-driven decision making.", "readability": "University", "purpose": "General Writing", "strength": "Balanced", "model_version": "v2" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/humanize", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "humanize", "content": "Artificial intelligence has fundamentally transformed the way modern enterprises approach data-driven decision making.", "readability": "University", "purpose": "General Writing", "strength": "Balanced", "model_version": "v2", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/humanize", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "humanize", content: "Artificial intelligence has fundamentally transformed the way modern enterprises approach data-driven decision making.", readability: "University", purpose: "General Writing", strength: "Balanced", model_version: "v2", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "humanize", "content": "Artificial intelligence has fundamentally transformed the way modern enterprises approach data-driven decision making.", "readability": "University", "purpose": "General Writing", "strength": "Balanced", "model_version": "v2", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/humanize", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "humanize", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` until `status === "completed"`. The completed payload's `output.humanized_text` holds the rewritten text. A rewrite usually finishes in a few seconds. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/humanize GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; polling the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required Always `"humanize"`. ### `content` — required (string) The AI-generated text to humanize. Minimum **50 characters**. Longer text takes proportionally longer to return. ### `readability` — required (string) Target reading level of the rewrite. One of: | Value | Register | | ------------- | --------------------------------- | | `High School` | Simple, accessible prose. | | `University` | Standard academic / professional. | | `Doctorate` | Dense, formal, advanced. | | `Journalist` | Punchy, news-style. | | `Marketing` | Persuasive, brand-friendly. | ### `purpose` — required (string) What the text is for — tunes tone and structure. One of: `General Writing`, `Essay`, `Article`, `Marketing Material`, `Story`, `Cover Letter`, `Report`, `Business Material`, `Legal Material`. ### `strength` — optional (string) How aggressively to rewrite. Default: `"Balanced"`. | Value | Behavior | | ------------ | ----------------------------------------------------------- | | `Quality` | Lightest touch; stays closest to the source wording. | | `Balanced` | Default trade-off between fidelity and humanization. | | `More Human` | Most aggressive rewrite for the strongest detector evasion. | ### `model_version` — optional (string) Which humanizer model handles the rewrite. Default: `"v2"`. | Value | Best for | | ------- | -------------------------------------------------- | | `v2` | All languages, medium humanization. | | `v11` | English, high humanization. | | `v11sr` | English, strongest humanization (slightly slower). | `model_version` maps to the underlying engine's model selector. reAPI uses `model` at the top level to route the request, so this knob is exposed as a separate `model_version` field to avoid the name collision — its values are unchanged. *** ## Output ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "humanize", "status": "completed", "created_at": 1735000000, "output": { "humanized_text": "AI has reshaped how today's companies make decisions with data..." }, "error": null } ``` `output.humanized_text` is plain text — drop it straight back into your document or CMS. *** ## Pricing Billed **per word** of the `content` you submit, with a **50-word floor** (text under 50 words is charged as 50 words). Polling the task does not add any charge. Failed and rejected requests are refunded automatically. `1 credit = $0.001 USD`. See the live banner on the [model page](https://reapi.ai/models/humanize) for the current per-1,000-words rate in credits. *** ## Errors Standard envelope: ```json { "error": { "code": 20003, "message": "content must be at least 50 characters", "request_id": "req_..." } } ``` Common cases: | Code | When | | ------- | -------------------------------------------------------------------------------- | | `20002` | `content`, `readability`, or `purpose` missing. | | `20003` | Invalid enum value, or `content` under 50 characters. | | `30001` | Insufficient credits for the submitted word count. | | `80001` | Provider rejected the submission — includes insufficient upstream credits/words. | | `80003` | Provider failed while processing the rewrite. | *** ## Related * [AI Text Detector](/docs/ai-text-detector) — score text 0–100 for AI authorship. Pair it with `humanize` for a detect → rewrite → detect QA loop. --- # imagen-4-0 (https://reapi.ai/docs/imagen-4-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Google's Imagen 4 model on reAPI. **Text-to-image only** — no reference > images, no inpainting masks. Five aspect ratios at a **flat per-image > rate**. Async-first: submit returns a `task_id`; poll until ready. See > current pricing on the [model page](https://reapi.ai/models/imagen-4-0). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "imagen-4-0", "prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k", "size": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "imagen-4-0", "prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k", "size": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "imagen-4-0", prompt: "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k", size: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "imagen-4-0", "prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k", "size": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` The response carries a `task_id`. Poll [`GET /api/v1/tasks/{task_id}`](/docs/api/tasks) until `status` is `completed`, then read `result.images[].url`. ## Request body | Field | Type | Required | Default | Description | | -------- | ------- | -------- | ------- | --------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | Must be `imagen-4-0`. | | `prompt` | string | yes | — | Image description. English or Chinese both supported. Up to 4000 characters. | | `n` | integer | no | `1` | Number of images per request. Only `1` is accepted. | | `size` | string | no | `16:9` | Aspect ratio. One of `1:1` / `4:3` / `3:4` / `16:9` / `9:16`. Passing an unsupported ratio returns a 400. | `imagen-4-0` is **text-to-image only**. The endpoint rejects `image_urls`, `image`, `mask`, and similar reference fields. For image-to-image, see [seedream-5-0-lite](/docs/seedream-5-0-lite) or the [gemini-3-pro-image-preview](/docs/gemini-3-pro-image-preview) family. ## Response Submission returns the standard async envelope: ```json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX" } ] } ``` Polled completion (`GET /api/v1/tasks/{task_id}`): ```json { "code": 200, "data": { "status": "completed", "result": { "images": [{ "url": "https://cdn.reapi.ai/..." }] } } } ``` Image URLs are valid for 24 hours from completion. Re-host the asset to your own storage if you need durable access. ## Pricing Flat per-image rate. `n` is fixed at `1`, so total charge is exactly one image per request. See the [model page](https://reapi.ai/models/imagen-4-0) for the live rate. ## Errors `imagen-4-0` shares the platform-wide [error envelope](/docs/api/errors). The validation surface is small: * `prompt` missing or empty → `400 INVALID_REQUEST`. * `size` outside the five accepted ratios → `400 INVALID_REQUEST`. * `n` set to any value other than `1` → `400 INVALID_REQUEST`. * Any reference media (`image_urls`, `image`, `mask`) supplied → `400 INVALID_REQUEST` with a text-to-image-only message. --- # Welcome (https://reapi.ai/docs) reAPI is an aggregator that runs every leading image, video, chat, and code model behind a single standard endpoint. Pay-as-you-go via credits, no per-provider account juggling. ## Where to start * **[Quickstart](/docs/api/quickstart)** — first call in 5 minutes. * **[Authentication](/docs/api/authentication)** — create and use API keys. * **[Tasks](/docs/api/tasks)** — `GET /api/v1/tasks/{id}` polling reference (image, video, and audio). * **[Errors](/docs/api/errors)** — error codes and how to handle them. * **[MCP Server](/docs/api/mcp)** — connect Claude Code, Cursor, Codex and other MCP clients. Per-model request schemas (parameters, sizes, resolutions, examples) live on each model's own page — see the **Models** sidebar. --- # kimi-k3-1-pro (https://reapi.ai/docs/kimi-k3-1-pro) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; Kimi K3.1 Pro uses `POST https://reapi.ai/api/v1/chat/completions` with model ID `kimi-k3.1-pro`. It returns a synchronous Chat Completions response or SSE stream, rather than a task ID. [Current pricing and playground](/models/kimi-k3-1-pro). The request contract follows Moonshot's official Chat API. Unknown fields pass through; acceptance of a request does not establish that every field changed the result. The dated observations below identify the capabilities checked during integration. ## Quickstart Create a key in [API keys](/settings/apikeys). Keep it on your server. These examples send one request with retries disabled where the SDK otherwise retries. ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kimi-k3.1-pro", "messages": [{"role":"user","content":"Explain three edge cases for an average function."}], "reasoning_effort": "low" }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", max_retries=0, ) response = client.chat.completions.create( model="kimi-k3.1-pro", messages=[{"role": "user", "content": "Explain three edge cases for an average function."}], reasoning_effort="low", ) print(response.choices[0].message.content) # Retain the entire message for another turn, including extra reasoning fields. assistant_message = response.choices[0].message.model_dump(exclude_none=True) ``` ```js import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://reapi.ai/api/v1', maxRetries: 0, }); const response = await client.chat.completions.create({ model: 'kimi-k3.1-pro', messages: [{ role: 'user', content: 'Explain three edge cases for an average function.' }], reasoning_effort: 'low', }); console.log(response.choices[0].message.content); const assistantMessage = response.choices[0].message; ``` ```go package main import ( "bytes" "io" "net/http" "os" "time" ) func main() { body := []byte(`{"model":"kimi-k3.1-pro","messages":[{"role":"user","content":"Explain three edge cases for an average function."}],"reasoning_effort":"low"}`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 120 * time.Second, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() if _, err := io.Copy(os.Stdout, res.Body); err != nil { panic(err) } if res.StatusCode >= 400 { os.Exit(1) } } ``` ## Endpoint `POST https://reapi.ai/api/v1/chat/completions` Send `Authorization: Bearer YOUR_API_KEY` and `Content-Type: application/json`. Responses use `application/json`, or `text/event-stream` when `stream: true`. There is no task-polling endpoint. ## Official input parameters The inventory below contains all 17 top-level fields in Moonshot's `KimiK31ProChatRequest` OpenAPI schema, checked October 24, 2026. Omitted values retain the official default. Both token-cap spellings are forwarded as supplied; neither is silently substituted for the other. | Parameter | Type | Required / default | Meaning | | ----------------------- | ---------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | Required | `kimi-k3.1-pro`; the separate Highspeed ID is not served by this integration. | | `messages` | array | Required | Complete conversation; roles `system`, `user`, `assistant`, `tool`. Content can be text or content parts. | | `reasoning_effort` | string | `max` | `low`, `high`, `max`. Thinking is always enabled. | | `max_completion_tokens` | integer | `131072` | Official output allowance, up to `1048576`, including reasoning. See measured limitation below. | | `max_tokens` | integer | Omitted | Deprecated official output-cap alias. Still forwarded. | | `stream` | boolean | `false` | Set `true` for SSE. | | `stream_options` | object | `include_usage: false` | reAPI requests `include_usage: true` for streaming settlement; other fields remain unchanged. | | `response_format` | object | `type: text` | `text`, `json_object`, or `json_schema`. Schema form includes `json_schema.name`, `schema` and optional `strict`. | | `tools` | array | Omitted | Function definitions: `type: function`, `function.name`, `parameters`, optional `description`, `strict` (official default true). | | `tool_choice` | string or object | `auto` | `auto`, `none`, `required`, or `type: function` with `function.name`. | | `stop` | string or string array | Omitted | Up to five stop strings, each at most 32 UTF-8 bytes. | | `logprobs` | boolean | `false` | Request output token probabilities; see observations below. | | `top_logprobs` | integer | Omitted | `0`–`20`; use with `logprobs: true`. | | `prediction` | object | Omitted | `type: content` with expected string or text-part `content`. | | `prompt_cache_key` | string or null | Omitted / null | Optional prefix-cache key. | | `prompt_cache_options` | object | Implicit, `5m` | `mode: implicit`; `ttl: 5m` or `1h`. | | `safety_identifier` | string | Omitted | Optional caller-provided safety identifier. | Function names follow `^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$`. Tool parameter schemas are JSON objects. Nested message fields include `name`, assistant `reasoning_content`, `tool_calls`, tool `tool_call_id`, and final-assistant `partial`. Return complete assistant messages rather than selecting only the visible text. Moonshot fixes `temperature=1`, `top_p=0.95`, `n=1`, and both penalties at `0`; these are not adjustable controls in its current K3.1 Pro request schema. Existing clients may still send fields: reAPI forwards them and leaves model-specific handling upstream. The context window is 1,048,576 tokens shared by input and output. Moonshot documents automatic reduction of the output allowance when input plus requested output exceeds that window. No maximum-window stress test was performed here. ## Preserved thinking and tool results Keep `reasoning_content` and `tool_calls` exactly as returned. Supply one result for each requested function. Tool execution happens in your application, never automatically in this endpoint or playground. ```python messages = [{"role": "user", "content": "Look up the synthetic inspection result."}] tools = [{"type": "function", "function": { "name": "inspect", "description": "Read a test fixture.", "parameters": {"type": "object", "properties": {}, "additionalProperties": False}, "strict": True, }}] first = client.chat.completions.create( model="kimi-k3.1-pro", messages=messages, tools=tools, tool_choice="required", reasoning_effort="low", ) assistant = first.choices[0].message.model_dump(exclude_none=True) messages.append(assistant) for call in assistant.get("tool_calls", []): # Replace this synthetic value with your application's actual tool result. messages.append({"role": "tool", "tool_call_id": call["id"], "content": "Synthetic inspection result: seven teal circles."}) second = client.chat.completions.create( model="kimi-k3.1-pro", messages=messages, tools=tools, reasoning_effort="low", ) print(second.choices[0].message.content) ``` Official dynamic tools use a system message containing `tools` and no `content`. Preserve that message on later turns. This form returned an unsupported-tools error during current integration checks; it remains forwarded unchanged. Use top-level `tools` for the verified tool loop. For partial completion, the last message can be `role: assistant`, `content: `, `partial: true`. The response contains the continuation: prepend your original prefix when presenting the complete result. ## Images and video Public media inputs must use reachable HTTP(S) URLs. Do not send base64, data URIs or vendor file IDs to reAPI. The service downloads public media and prepares the vendor representation internally. Private addresses, credentials in URLs and nonstandard ports are blocked; redirects are checked again. The request JSON limit is 32 MiB and combined downloaded media is capped at 24 MiB. ```json { "model": "kimi-k3.1-pro", "reasoning_effort": "low", "messages": [{ "role": "user", "content": [ {"type": "text", "text": "Describe the visible scene."}, {"type": "image_url", "image_url": {"url": "https://example.com/scene.jpg"}} ] }] } ``` Replace the example URL with your own accessible image. Moonshot documents JPEG, PNG, GIF, WebP, BMP, HEIC and HEIF. It also documents video parts under `video_url`, with a URL string or object containing `url`. **The current video probe returned HTTP 400: video input unsupported.** The official field remains available for passthrough, but current video support is not claimed. ## Structured output and streaming ```json { "response_format": { "type": "json_schema", "json_schema": { "name": "review", "strict": true, "schema": { "type": "object", "properties": {"result": {"type": "string"}}, "required": ["result"], "additionalProperties": false } } } } ``` Add this object to a complete request. Parse `choices[0].message.content`, not the separate reasoning field. A schema-valid answer still needs checks against the source data. For SSE, send `stream: true`. Accumulate `delta.content`, `delta.reasoning_content` and indexed `delta.tool_calls`, including fragmented function arguments. The final usage frame may have an empty `choices` array. A `[DONE]` event ends the stream; treat an interrupted stream as incomplete. ## Capability observations — October 24, 2026 These are focused integration checks, not a model-quality benchmark or a deployed account-billing audit. | Capability | Observation | | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | Text and SSE | Correct sentinel answer; SSE included usage and completed. | | Effort | `low`, `high`, `max` accepted; relative quality and latency effects unmeasured. | | JSON Schema / JSON object | Returned the required structure; schema test used a conflicting plain-text prompt. | | Tools | Required, named and none choices behaved as requested. Complete thinking/tool-result round trip passed. | | Dynamic tools in system messages | HTTP 400; current execution not supported by the tested path. | | Partial prefix and stop | Continuation and stop-string effects observed. | | Probabilities / prediction | Requests accepted; probabilities absent, prediction acceleration unmeasured. | | Cache | Creation recorded in `cache_creation_input_tokens`; repeated prefix reported 3,072 cached tokens. TTL retention and cache-key isolation unmeasured. | | Image | Correctly described a fixed image containing a large creature, ruined towers and bridge. | | Video | HTTP 400, unsupported. | | Output cap | `max_completion_tokens: 8` was accepted but output exceeded eight tokens. Deprecated `max_tokens: 8` produced `finish_reason: length` at eight tokens. | | Unknown field | Accepted; no parameter-effect claim. | **Do not treat `max_completion_tokens` as an enforced spending limit on the tested path.** Both official spellings remain available; no fallback request or silent parameter substitution is made. The platform's existing settlement checks still refuse untrusted usage above the admitted bound. This is separate from the model's documented ceiling. The local test machine's DNS proxy mapped the media host into a reserved address range, so the safe downloader correctly rejected that address. Media understanding probes used separately downloaded, fixed public fixtures through the same conversion code. Production URL retrieval and very large media remain unverified. ## Pricing and billing Input, generated output (including reasoning) and cached input have separate token rates. View [current rates](/models/kimi-k3-1-pro); no numeric prices are embedded in this document. Repeated context does not guarantee a cache hit. Inspect usage, and measure the entire tool loop when comparing costs. Accounting uses integer micro-USD: `microUSD = ceil(settled_USD_charge × 1,000,000)` and `credits = microUSD / 1,000`. One credit equals $0.001; token rates are available on the model page. The service makes one inference request for each accepted client submission. It does not retry failed calls or execute tools. Existing postpaid settlement requires delivery and valid usage/cost evidence; failed or untrusted settlements are not charged. Production account debits were not exercised during these isolated checks. ## Output schema A non-streaming response has this shape (illustrative fields, not a token estimate): ```json { "id": "req_example", "object": "chat.completion", "model": "kimi-k3.1-pro", "choices": [{ "index": 0, "message": {"role": "assistant", "content": "OK", "reasoning_content": "..."}, "finish_reason": "stop" }], "usage": {"prompt_tokens": 91, "completion_tokens": 28, "total_tokens": 119} } ``` ## Errors Errors use `error.code`, `error.message`, `error.request_id`, plus the Chat-compatible `error.type` where applicable: | HTTP / code | Meaning | | ---------------------------------------- | ---------------------------------------------------------------- | | 401 / `10001`–`10005` | Missing, invalid, revoked key or missing session. | | 400 / `20001`, `20002`, `20003`, `20004` | Invalid JSON, missing input, invalid value or unsupported model. | | 413 / `20008` | Request payload too large. | | 402 / `30001` | Insufficient balance. | | 429 / `50001` | Rate or in-flight limit on this chat path. | | 502–503 / `70001` | Upstream/configuration/pricing service unavailable. | See the [error-code catalog](/docs/api/errors). Use the returned message and request ID to diagnose an error. Correct the request before submitting again; resubmission is a new request. ## Tips * Begin with a small task whose result you can check; record total usage across all turns. * Use top-level tools for the verified function-call loop and preserve the returned assistant state. * Consult the dated output-cap observation before relying on a spending limit. ## Related Compare the [Kimi K3 documentation](/docs/kimi-k3) and [Claude Opus 5.5 documentation](/docs/claude-opus-5-5), or use the [task comparison guide](/resources/kimi-k3-1-pro-vs-claude-opus-5-5). ## Official references * [Kimi K3.1 Pro quickstart](https://platform.kimi.ai/docs/guide/kimi-k3-1-pro-quickstart) * [Chat API](https://platform.kimi.ai/docs/api/chat) and [OpenAPI schema](https://platform.kimi.ai/docs/openapi.json) * [Model parameters](https://platform.kimi.ai/docs/api/models-overview) * [Vision inputs](https://platform.kimi.ai/docs/guide/use-kimi-vision-model) * [Context caching](https://platform.kimi.ai/docs/guide/context-caching) --- # kimi-k3 (https://reapi.ai/docs/kimi-k3) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Moonshot's Kimi K3 — the flagship for long-horizon coding and end-to-end > knowledge work — exposed through reAPI as a drop-in OpenAI-compatible > Chat Completions endpoint. A **1,048,576-token** context window shared by > input and generated output, **reasoning > that is always on** with a three-rung `reasoning_effort` dial, native **image > and video** input, tool calling with a `required` tool choice, strict JSON > Schema output, and automatic context caching. The wire `model` id is > `kimi-k3`. Current rates live on the > [model page](https://reapi.ai/models/kimi-k3). ## Quick example ```bash curl https://reapi.ai/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kimi-k3", "messages": [ { "role": "user", "content": "Refactor this module and add tests." } ], "max_completion_tokens": 16384, "reasoning_effort": "high", "stream": true }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://reapi.ai/api/v1", ) stream = client.chat.completions.create( model="kimi-k3", messages=[{"role": "user", "content": "Refactor this module and add tests."}], max_completion_tokens=16384, reasoning_effort="high", stream=True, ) for chunk in stream: delta = chunk.choices[0].delta reasoning = getattr(delta, "reasoning_content", None) if reasoning: print(reasoning, end="") if delta.content: print(delta.content, end="") ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://reapi.ai/api/v1", }); const stream = await client.chat.completions.create({ model: "kimi-k3", messages: [{ role: "user", content: "Refactor this module and add tests." }], max_completion_tokens: 16384, reasoning_effort: "high", stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "kimi-k3", "messages": []map[string]string{ {"role": "user", "content": "Refactor this module and add tests."}, }, "max_completion_tokens": 16384, "reasoning_effort": "high", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Use your reAPI API key — the same key that calls the image, video and audio endpoints — as a bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create one under **API keys** in your reAPI dashboard. Chat requests are billed from the same credit balance as every other model on the platform. *** ## Endpoint ```http POST /api/v1/chat/completions ``` Base URL `https://reapi.ai/api/v1`. The wire format is OpenAI-compatible, so the same SDKs (`openai-python`, `openai-node`, `openai-go`, …) work once you swap the base URL, the key and the model string. Moonshot's own quickstart drives this model through the OpenAI SDK, so the compatibility is the vendor's design rather than a translation layer. *** ## Request body ### `model` — string, required Must be `kimi-k3` exactly — no date suffix, no version decimal. ### `messages` — array, required Conversation history, each entry an object with `role` and `content`. Text, image and video parts are supported — see [Visual input](#visual-input). **Echo the assistant message back unchanged.** In multi-turn conversations and tool-call loops, the complete assistant message returned by the API has to go back into `messages` as-is, including `reasoning_content` and `tool_calls`. Keeping only `content` — the habit most OpenAI-shaped code has — breaks this model's Preserved Thinking. ### `max_completion_tokens` — integer Upper bound on generated tokens, including reasoning and the visible answer. [Moonshot's native API](https://platform.kimi.ai/docs/api/chat) documents a **131,072** default and accepts parameter values up to **1,048,576**. It also rejects a request when input tokens plus `max_completion_tokens` exceed the context window. The largest accepted parameter value is therefore not a promise of a million-token answer alongside a nonempty prompt. On this reAPI endpoint, omitting the field uses the configured model ceiling, not Moonshot's native default. **Set an explicit output budget**, such as the 16,384 in the examples, and leave room for the input, preserved history, and reasoning. Raise the budget only within the remaining context capacity. ### `reasoning_effort` — string, default `"max"` Top-level field controlling how hard the model thinks. See [Reasoning](#reasoning). ### `stream` — boolean, default `false` When `true`, tokens arrive as server-sent events. Reasoning and answer come as **separate deltas** — `reasoning_content` and `content` — so a client can render the reasoning live and still parse the answer on its own. ### `tools` / `tool_choice` — optional Tool definitions and the strategy for picking among them. `tool_choice` accepts `auto`, `none` and `required`. See [Tool calling](#tool-calling). ### `response_format` — object, optional A JSON Schema with `strict: true` constrains the **answer** field. Parse that field, not `reasoning_content`, which is prose. *** ## Reasoning **This model always reasons.** Moonshot's own FAQ answers "how do I turn off the chain of thought" with a flat *you can't*. There is no thinking toggle; the lever is effort. `reasoning_effort` takes **three** rungs and defaults to the most expensive one: | Level | Use it for | | ------ | --------------------------------------------------------------------------------------------- | | `max` | **The default.** The hardest reasoning, where correctness outweighs cost. | | `high` | A step down that still reasons hard. | | `low` | Short, scoped, latency-sensitive work — and the answer to "the reasoning is taking too long". | There is no `medium`. **Pick the rung before the conversation starts.** Moonshot documents that switching effort levels **invalidates prefix-cache hits**, so flipping it mid-session silently throws away your cache. The K2-era `thinking` object is **not** a parameter on this model. If you are migrating from `kimi-k2.6` or `kimi-k2.7-code`, delete it and use top-level `reasoning_effort` instead. Code that already sends OpenAI's `reasoning_effort` needs no change beyond the accepted values. *** ## Parameters that are fixed Moonshot pins all five of these on this model. Passing any other value returns an error, so leave them out of the request entirely: | Parameter | Fixed at | | ------------------- | -------- | | `temperature` | `1.0` | | `top_p` | `0.95` | | `n` | `1` | | `presence_penalty` | `0` | | `frequency_penalty` | `0` | Steer with prompting and the `reasoning_effort` rung instead. *** ## Tool calling Two controls are specific to this generation. **`tool_choice: "required"`** forces at least one tool call on the turn — the way to stop an agent answering from memory when it was supposed to look something up. The K2 models reject this value; this one accepts it. **Dynamic tool loading** introduces a tool partway through a conversation: put its complete definition in a `system` message that carries `tools` and **no** `content`. It becomes available from that position onward. ```json { "role": "system", "tools": [ { "type": "function", "function": { "name": "calculate", "description": "Evaluate an arithmetic expression", "parameters": { "type": "object", "properties": { "expression": { "type": "string" } }, "required": ["expression"] } } } ] } ``` The server does **not** retain a dynamically loaded tool. Keep that `system` message in your request history or the tool disappears on the next turn. Include the complete `name`, `description` and `parameters` in the definition, and after executing calls, append one `tool` message per call with the matching `tool_call_id`. *** ## Visual input | Modality | Supported | | -------- | :-------: | | Text | ✅ | | Image | ✅ | | Video | ✅ | Output is **text only**. Vision is native to this model rather than a separate variant, which is what makes screenshot-driven work — frontend layout, game development, CAD — practical: it can look at what it just produced. **Public image URLs are not accepted.** Moonshot documents base64 data URIs, or a file reference from its own upload API, as the two ways in. `content` must also be an **array of parts**, not a serialized string. ```json { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0..." } }, { "type": "text", "text": "Why does this layout break at 768px?" } ] } ``` Note that file references come from Moonshot's Files API, which the Chat Completions endpoint does not itself provide. *** ## Context caching Caching is **automatic** — no cache id, no TTL, no extra parameter. Keep a long prefix (system prompt, knowledge document, tool definitions) stable and repeat requests attempt a hit on their own. Two conditions decide whether that happens: * The **previous** request's prompt tokens must exceed **256**. Below that the request is not cached at all. * The `reasoning_effort` rung must not change — switching it invalidates the prefix cache. Put the fixed bulk at the front of `messages` and append the varying question after it. *** ## Pricing dimensions Billing is **per token**, from your reAPI credit balance, with separate **input**, **output** and **cache read** rates. Four things to keep in mind: * **Reasoning tokens bill as output.** Since this model always reasons, that is the usual reason a bill exceeds an estimate built from visible answer length. * **The rate is flat across context length.** Moonshot documents no long-context tier, so a million-token prompt costs the same per token as a short one. * **Effort moves the bill.** It is the only reasoning lever, and it defaults to the most expensive rung — so it is the first thing to tune. * **Cache reads bill at their own rate.** Context caching is automatic, so a repeated prefix is charged at the cache rate instead of the input rate with no parameter on your side. Current numbers are on the [model page](https://reapi.ai/models/kimi-k3) — that table is the canonical source, not this page. The platform constants are `1 credit = $0.001` and `$1 = 1,000 credits`; a request's cost is its input and output tokens at the per-million rates, converted at that ratio. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1785000000, "model": "kimi-k3", "choices": [ { "index": 0, "message": { "role": "assistant", "reasoning_content": "...", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1204, "completion_tokens": 860, "total_tokens": 2064 } } ``` `reasoning_content` is a sibling of `content`, not a replacement for it — and it is the field you must carry into the next request. ### Streaming (`stream: true`) Server-sent events, each `data:` line carrying a `chat.completion.chunk`. Reasoning arrives in `choices[0].delta.reasoning_content` and the answer in `choices[0].delta.content`, terminated by `data: [DONE]`. *** ## Errors Failures use reAPI's standard error envelope. See the [errors catalog](/docs/api/errors) for the full code list. Common cases: | Trigger | What to do | | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | Missing or invalid API key | Create a key under API keys in the reAPI dashboard | | Unknown `model` value | Send `kimi-k3` exactly | | `temperature` / `top_p` / `n` / penalty params present | Remove them; they are fixed on this model | | K2-era `thinking` object present | Remove it and use `reasoning_effort` | | `reasoning_effort` set to `medium` | Not a valid rung — use `low`, `high` or `max` | | A public image URL in an `image_url` part | Send a base64 data URI or an uploaded file reference | | `content` sent as a string for a multimodal turn | Make it an array of parts | | Output budget exceeds the parameter ceiling or remaining context | Lower `max_completion_tokens` or shorten the input; Moonshot validates input plus the requested budget against the context window | | Insufficient balance | Top up your reAPI credits | | Upstream rate limit | Retry with backoff, or route through another model | Moonshot flags its own `web_search` tool as **being updated** and does not recommend using it in the near term. Treat web search as unavailable on this model for now and supply fresh context yourself. *** ## Tips * **Give the whole task up front.** This model is built for long-horizon work under minimal supervision; a complete specification beats a drip-feed of short turns. * **Drop your sampling parameters first.** The single most common migration error here is a carried-over `temperature`. * **Tune effort before anything else.** The default is `max`; `low` exists precisely for the case where reasoning is costing more than the answer is worth. * **Budget for reasoning and input.** Reasoning consumes part of the output allowance. If `finish_reason` is `length`, check the requested cap and remaining context before raising `max_completion_tokens` or continuing in another call. * **Stream anything interactive**, and render `reasoning_content` separately from the answer rather than concatenating them. * **Keep the assistant message intact** in history. Stripping `reasoning_content` is silent — it does not error, it just degrades multi-turn behaviour. * **Front-load the stable bulk** of your prompt so automatic caching can hit, and do not change the effort rung mid-conversation. *** ## Related * [Kimi K3 model page](https://reapi.ai/models/kimi-k3) — current rates * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # kling-3-0-turbo (https://reapi.ai/docs/kling-3-0-turbo) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Kuaishou's Kling 3.0 Turbo on reAPI — the fast tier of Kling 3.0 for > **text-to-video** and **image-to-video** (first frame), at **720p** or > **1080p**. One async endpoint: submit returns a `task_id`; poll until ready. > See current pricing on the [model page](https://reapi.ai/models/kling-3-0-turbo). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-3-0-turbo", "prompt": "a corgi running on the beach, cinematic, golden hour", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "kling-3-0-turbo", "prompt": "a corgi running on the beach, cinematic, golden hour", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "kling-3-0-turbo", prompt: "a corgi running on the beach, cinematic, golden hour", resolution: "1080p", aspect_ratio: "16:9", duration: 5, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "kling-3-0-turbo", "prompt": "a corgi running on the beach, cinematic, golden hour", "resolution": "1080p", "aspect_ratio": "16:9", "duration": 5, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-3-0-turbo", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated video URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Modes There is no separate model id per modality — the modality is implicit in the request shape: * **Text-to-video** — no `first_frame_image`. `prompt` is required, and `aspect_ratio` applies. * **Image-to-video** — pass `first_frame_image` (a public HTTPS URL). The clip starts from that frame, `prompt` is optional, and `aspect_ratio` is ignored (the frame fixes the ratio). Multi-shot direction is expressed inside the `prompt` (describe each shot); there is no dedicated multi-shot field. *** ## Request body ### `model` — string, required Must be `kling-3-0-turbo`. ### `prompt` — string Up to **3,072 characters** (recommended ≤ 2,500). Required for text-to-video; optional in image-to-video (omit it to animate purely from the first frame). ### `first_frame_image` — string, optional Start frame for image-to-video. **Public HTTPS URL only** — base64 / `data:` URIs are rejected at the gateway. JPG / JPEG / PNG, ≤ 50 MB, ≥ 300 px, with an aspect ratio between 1:2.5 and 2.5:1. ### `resolution` — string, default `720p` Output clarity tier: `720p` or `1080p`. Billed per second at the tier's rate. ### `duration` — integer, default `5` Total video length in seconds, range `3–15`. Billed per second. ### `aspect_ratio` — string, default `16:9` One of `16:9`, `9:16`, `1:1`. **Text-to-video only.** When `first_frame_image` is supplied (image-to-video), this field has **no effect** — the output ratio is determined by the first frame. Set it only for text-to-video. ### `watermark` — boolean, optional Add a watermark to the output video. Omitted by default (no watermark). Modality is auto-detected: supply `first_frame_image` for image-to-video, omit it for text-to-video. You never set a mode flag. *** ## Pricing Kling 3.0 Turbo bills **per second**, by resolution tier (`resolution`): ``` credits = ceil(per_second_usd × seconds × 1000) ``` where `1 credit = $0.001 USD` and `seconds` is `duration`. The 1080p tier carries a higher per-second rate than 720p. Failed and rejected requests are not charged. The exact per-second credit cost for each tier surfaces on the [model page](https://reapi.ai/models/kling-3-0-turbo) and through the playground estimator before submit. *** ## Response The poll envelope returns the video URL in `output.video_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "kling-3-0-turbo", "status": "completed", "output": { "video_urls": [ "https://cdn.reapi.ai/...mp4" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (prompt over 3072 chars, out-of-range `duration`, a non-HTTPS `first_frame_image`, an invalid `resolution` or `aspect_ratio`) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * Use cinematic language in the prompt (shot type, camera move, lighting) — Kling 3.0 Turbo reads it; there is no dedicated camera-control parameter. * Draft at `720p` to iterate cheaply, then re-run the winner at `1080p` for delivery — same call, one parameter change. * For image-to-video, the first frame fixes the aspect ratio, so you can skip `aspect_ratio` in that mode. * Reach for the full [Kling 3.0](/docs/kling-3-0) when you need multi-shot control, native audio, or 4K; Kling 3.0 Turbo trades those for speed and a lower per-second cost. *** ## Related * [Kling 3.0](/docs/kling-3-0) * [Video generation models](/docs/seedance-2-0) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # kling-3-0 (https://reapi.ai/docs/kling-3-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Kuaishou's Kling 3.0 on reAPI — one async endpoint for **text-to-video**, > **image-to-video** (first/last frame), and **multi-shot** cinematic > sequences, with optional **native multilingual audio** and up to **4K**. > Submit returns a `task_id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/kling-3-0). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-3-0", "prompt": "A soft anime-style girl in a field, warm sunset glow, smooth loop", "duration": 6, "aspect_ratio": "16:9", "mode": "pro" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "kling-3-0", "prompt": "A soft anime-style girl in a field, warm sunset glow, smooth loop", "duration": 6, "aspect_ratio": "16:9", "mode": "pro", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "kling-3-0", prompt: "A soft anime-style girl in a field, warm sunset glow, smooth loop", duration: 6, aspect_ratio: "16:9", mode: "pro", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "kling-3-0", "prompt": "A soft anime-style girl in a field, warm sunset glow, smooth loop", "duration": 6, "aspect_ratio": "16:9", "mode": "pro", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-3-0", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated video URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Modes There is no separate model id per modality — the modality is implicit in the request shape: * **Text-to-video** — no `image_urls`. `prompt` is required. * **Image-to-video** — pass `image_urls`: index 0 is the start frame, index 1 (optional) is the end frame. Aspect ratio auto-adapts to the images. * **Multi-shot** — set `multi_shots: true` and provide `multi_prompt` (per-shot prompts + durations). The resolution tier (`std` 720p / `pro` 1080p / `4K`) is the `mode` field; native audio is the `sound` toggle. *** ## Request body ### `model` — string, required Must be `kling-3-0`. ### `prompt` — string Up to **2,500 characters**. Required for single-shot; superseded by `multi_prompt` in multi-shot mode. ### `image_urls` — array, optional First/last frame for image-to-video. **Public HTTPS URLs only** — base64 / `data:` URIs are rejected at the gateway. Up to **2** (index 0 = first frame, index 1 = last frame). ### `duration` — integer, default `5` Total video length in seconds, range `3–15`. Billed per second. ### `aspect_ratio` — string, default `16:9` One of `16:9`, `9:16`, `1:1`. Ignored (auto-adapted) when `image_urls` is supplied. ### `mode` — string, default `pro` Resolution tier: `std` (720p), `pro` (1080p), or `4K`. ### `sound` — boolean, default `false` Generate synchronized native audio (dialogue, lip sync, ambient sound). Audio tiers cost more per second. ### `multi_shots` — boolean, default `false` Enable multi-shot mode (a connected sequence of shots). ### `multi_prompt` — array, optional (required when `multi_shots: true`) Up to **5** shots; each item is `{ "prompt": string, "duration": int }` where per-shot duration is **1–12s** and prompt is up to **500 chars**. ```json { "multi_shots": true, "multi_prompt": [ { "prompt": "a chef plating a dish, close-up", "duration": 4 }, { "prompt": "pull back to a busy restaurant", "duration": 5 } ] } ``` ### `kling_elements` — array, optional Up to **3** reusable `@`-referenced elements. Each item is `{ "name": string, "description"?: string, "element_input_urls": [string] }` with **2–4** image URLs (JPG/PNG). Reference an element in the prompt with `@name`. Multi-shot bills the **sum of the per-shot durations**; single-shot bills the top-level `duration`. *** ## Pricing Kling 3.0 bills **per second**, by resolution tier (`mode`) and whether audio is on (`sound`): ``` credits = ceil(per_second_usd × seconds × 1000) ``` where `1 credit = $0.001 USD`, and `seconds` is `duration` (single-shot) or the sum of `multi_prompt` durations (multi-shot). Higher tiers and audio carry a higher per-second rate. Failed and rejected requests are not charged. The exact per-second credit cost for each tier surfaces on the [model page](https://reapi.ai/models/kling-3-0) and through the playground estimator before submit. *** ## Response The poll envelope returns the video URL in `output.video_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "kling-3-0", "status": "completed", "output": { "video_urls": [ "https://cdn.reapi.ai/...mp4" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (prompt over 2500 chars, out-of-range `duration`, a non-HTTPS media URL, more than 2 `image_urls`, more than 5 shots) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * Use cinematic language in the prompt (shot type, camera move, lighting) — Kling 3.0 reads it; there is no dedicated camera-control parameter. * For sequences, prefer multi-shot over stitching separate requests — characters stay consistent across cuts. * For image-to-video, supply both a first and last frame to control the start and end of the motion. * Reach for `mode: "4K"` only when the destination needs it — the per-second rate is highest there. *** ## Related * [Video generation models](/docs/seedance-2-0) * [Grok Imagine Video 1.5](/docs/grok-imagine-video-1-5) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # kling-4-0-flash (https://reapi.ai/docs/kling-4-0-flash) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Kuaishou's Kling 4.0 Flash, the fast tier of Kling 4.0, live on reAPI. One > model id, `kling-4-0-flash`, covers text to video and reference-based > generation: up to 10 reference images, up to 5 reference videos and up to 7 > elements (named subjects built from 2–4 images or one short video), each > mentioned in the prompt. Every clip is 3–20 seconds at `720p` with sound. > See current pricing on the [model page](https://reapi.ai/models/kling-4-0-flash). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-4-0-flash", "prompt": "A paper boat drifts down a rain-filled city gutter at dusk, the camera skimming the water beside it past glowing shop windows, raindrops ticking on the surface. No text, no logos.", "duration": 5, "aspect_ratio": "16:9" }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "kling-4-0-flash", "prompt": "A paper boat drifts down a rain-filled city gutter at dusk, the camera skimming the water beside it past glowing shop windows, raindrops ticking on the surface. No text, no logos.", "duration": 5, "aspect_ratio": "16:9", }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'kling-4-0-flash', prompt: 'A paper boat drifts down a rain-filled city gutter at dusk, the camera skimming the water beside it past glowing shop windows, raindrops ticking on the surface. No text, no logos.', duration: 5, aspect_ratio: '16:9', }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "kling-4-0-flash", "prompt": "A paper boat drifts down a rain-filled city gutter at dusk, the camera skimming the water beside it past glowing shop windows, raindrops ticking on the surface. No text, no logos.", "duration": 5, "aspect_ratio": "16:9" }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | --------------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `kling-4-0-flash`. **Required.** | | `prompt` | string | — | **Required**, up to 8,000 characters. Mention materials as `@image_1`, `@video_1` or `@` — see [Mentions](#mentions). | | `duration` | integer | `5` | `3`–`20` seconds of output. | | `resolution` | string | `720p` | `720p` is the only output. | | `aspect_ratio` | string | by input | `auto` / `16:9` / `9:16` / `1:1` / `21:9`. Left out: `auto` when any reference material is given, `16:9` otherwise. | | `image_urls` | string\[] | — | Reference images, up to 10, mentioned as `@image_1`, `@image_2`, … in order. | | `video_urls` | string\[] | — | Reference videos, up to 5, mentioned as `@video_1`, `@video_2`, … Billed at the video-input rate. | | `keep_original_sound` | boolean | `false` | Keep the reference videos' own audio. Only takes effect with `video_urls`; without reference videos the clip always gets new sound. | | `elements` | object\[] | — | Subjects for this request, up to 7, mentioned as `@name` — see [Elements](#elements). | Every clip comes with sound; there is no sound switch. There are no first, middle or last frame fields, no `negative_prompt`, `watermark` or standalone `voices` field: bind a voice to an element with `voice_url`. Unknown fields are refused rather than ignored. Checked by reAPI before anything is charged: * every media field, including each element's `image_urls`, `video_url` and `voice_url`, is a public HTTP(S) URL — base64 and `data:` URIs are rejected * `resolution` is `720p`, and `duration` is a positive whole number * every reference video and video element can be measured (its length sets the bill — see [Pricing](#pricing)) Every other rule on this page — counts, element shapes, names, mentions, input length — is checked by the model when the task starts. A request that breaks one ends as a failed task with code `80007` and the exact reason, and is refunded in full. ## Mentions Every material is optional; with none, the request is plain text to video. Once you send materials, point at them from the prompt: | Material | Mention | Limit | | ------------ | ------------------------- | -------------------------------------------- | | `image_urls` | `@image_1`, `@image_2`, … | 10 images | | `video_urls` | `@video_1`, `@video_2`, … | 5 videos | | `elements` | `@name` | 7 elements, at most 3 of them video elements | Every `@` followed by a letter, digit, underscore or Chinese character must name a material of this request, or the request fails. Names are matched longest first and without regard to case. A name that ends in a letter, digit or underscore cannot run straight into another one: `@image_12` with a single image fails; write `@image_1 2` or `@image_1,`. Reference videos plus video elements are at most 5, and images, videos and elements together at most 15. ```json { "model": "kling-4-0-flash", "prompt": "The dancer from @image_1 performs the routine of @video_1 on a rooftop at dusk", "image_urls": ["https://example.com/dancer.png"], "video_urls": ["https://example.com/routine.mp4"], "keep_original_sound": false, "duration": 8 } ``` ## Elements An element is a named subject you can reuse in the prompt. There are two kinds: | Field | Image element | Video element | | ------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | `name` | required | required | | `type` | `image` (default) | `video` | | `image_urls` | 2–4 views, the first being the main view | not accepted | | `video_url` | not accepted | one 3–8 second single-shot video of a character, shortest side at least 700 pixels | | `tag` | `character`, `animal`, `prop`, `costume`, `scene`, `effect` or `others`; inferred when left out | `character` only | | `description` | up to 100 characters | up to 100 characters | | `voice_url` | reference audio; characters only (`tag` `character` or left out) | reference audio; left out, the video's own speech is used | Names are 1–20 letters, digits, underscores or Chinese characters, unique without regard to case. `image_N`, `video_N`, `keyframe_N`, `object_N`, `audio_N`, `first_frame` and `last_frame` are reserved. ```json { "model": "kling-4-0-flash", "prompt": "@Mira opens the shop door and greets the morning crowd", "elements": [ { "name": "Mira", "image_urls": ["https://example.com/mira-front.png", "https://example.com/mira-side.png"], "tag": "character", "description": "baker in a flour-dusted apron" } ], "aspect_ratio": "9:16", "duration": 6 } ``` Reference videos and video elements together must be 2–20 seconds long. ## Troubleshooting | Failure | What it means | What to do | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | Synchronous `400` (code `30002`) | `resolution` or `duration` is not a priced value, or an input video's length could not be read | Use `720p` and a whole number of seconds; pass a public MP4 or MOV URL. Nothing was charged | | Task fails with code `80007` | A model rule was broken: an undeclared mention, a bad element, input videos outside 2–20 seconds, an unknown field, … | The message names the field. Fully refunded | | Task fails with code `80006` | The prompt or media was rejected by content review | Fully refunded. Revise the prompt or inputs | | `402` on submit | Not enough credits for the reserve | Top up, or lower `duration` | | Task stays `processing` | Generation takes a few minutes | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-4-0-flash", "status": "completed", "created_at": 1789689600, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/.../0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.video_urls`. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). ## Pricing Kling 4.0 Flash bills **per second of 720p video**, at a rate set by whether the request has input videos: ``` credits = ceil(per_second_rate × billable_seconds × 1000) 1 credit = $0.001 ``` | Request | `billable_seconds` | Rate | | -------------------------------------- | ----------------------------- | ----------- | | Text, reference images, image elements | `duration` | standard | | Reference videos or video elements | `output + max(output, input)` | video input | `input` is the total length of the reference videos and video elements, measured by reAPI when the request is accepted and rounded up to whole seconds. `output` is `duration` (default 5). A 5-second clip guided by a 7.2-second reference video bills 5 + 8 = 13 seconds; with a 3-second reference video it bills 5 + 5 = 10 seconds. Failed tasks are refunded in full. Live per-second rates for both rates are on the [model page](https://reapi.ai/models/kling-4-0-flash). ## Tips * Describe subject, place, camera move, light and sound; the clip's audio follows the prompt. * Use Flash to try prompts, ratios and references, then move the shot that works to [Kling 4.0](/docs/kling-4-0) when you need 1080p, keyframes, editing or extension. * Give a recurring character an element with two or three clear views instead of one reference image. * Add `no text, no logos` to keep invented marks out. ## Related * [Kling 4.0 Flash playground and pricing](https://reapi.ai/models/kling-4-0-flash) * [Kling 4.0](/docs/kling-4-0) * [Kling 3.0 Turbo](/docs/kling-3-0-turbo) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # kling-4-0 (https://reapi.ai/docs/kling-4-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Kuaishou's Kling 4.0, live on reAPI. One model id, `kling-4-0`, covers five > jobs: text to video, image to video with up to 10 frames, reference-based > generation from images, videos and audio, video editing, and video > extension. Every clip is 3–30 seconds at `720p` or `1080p` with stereo > sound. The mode follows the media you send and `omni_reference_task_type`. > See current pricing on the [model page](https://reapi.ai/models/kling-4-0). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-4-0", "prompt": "A paper lantern drifts down a quiet canal at dusk, warm light on the water, slow tracking shot, soft lapping water. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9" }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "kling-4-0", "prompt": "A paper lantern drifts down a quiet canal at dusk, warm light on the water, slow tracking shot, soft lapping water. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'kling-4-0', prompt: 'A paper lantern drifts down a quiet canal at dusk, warm light on the water, slow tracking shot, soft lapping water. No text, no logos.', resolution: '720p', duration: 5, aspect_ratio: '16:9', }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "kling-4-0", "prompt": "A paper lantern drifts down a quiet canal at dusk, warm light on the water, slow tracking shot, soft lapping water. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9" }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | — | `kling-4-0`. **Required.** | | `prompt` | string | — | Describe subject, place, camera move, light and sound. **Required**, except for image to video from frames. Mention references as `@Image1`, `@Video1`, `@Audio1` — see [Referencing media](#referencing-media-in-the-prompt). | | `duration` | integer | `5` | `3`–`30` seconds. Edit: leave it out and the output follows the input video. Extend: the length of the new part. | | `resolution` | string | `720p` | `720p` or `1080p`. | | `aspect_ratio` | string | by mode | `16:9` / `9:16` / `1:1` / `21:9`, or `auto` in reference mode only. Defaults: text `16:9`, image the first frame's shape, reference `auto`, edit the input video's shape. Not accepted with extend. | | `omni_reference_task_type` | string | `auto` | `auto` / `reference` / `edit` / `extend`. `auto` picks the mode from your media; edit and extend must be named. | | `first_frame_image` | string | — | The first frame for image to video. Public HTTP(S) URL. | | `last_frame_image` | string | — | The last frame for image to video, or the target last frame for extend. | | `image_with_roles` | object\[] | — | `{ "url", "role" }` with role `first_frame`, `last_frame`, `keyframe` (or `middle_frame`), or `reference_image`. Exactly 1 first frame, up to 8 keyframes used in order, 10 frames in total. | | `image_urls` | string\[] | — | Image to video: up to 2, the first then the last frame. Reference (with `omni_reference_task_type: "reference"`) and edit: up to 10 reference images. | | `video_urls` | string\[] | — | Reference videos: up to 5, 30 seconds used in total. For edit or extend, exactly 1 in place of `video_url`. | | `video_url` | string | — | The input video for edit or extend; needs `omni_reference_task_type` `edit` or `extend`. | | `audio_urls` | string\[] | — | Reference audio: up to 3 clips of 5–30 seconds each. | | `audio_setting` | string | by mode | `origin` keeps the input video's audio, `auto` generates new audio. Edit keeps it by default; reference with videos regenerates it by default. Not accepted with extend. | Every clip comes with stereo sound; there is no sound switch, and no `mode`, `negative_prompt`, `watermark` or multi-shot field. Images, videos and audio together are at most 15 reference files. Checked by reAPI before anything is charged: * every media field is a public HTTP(S) URL — base64 and `data:` URIs are rejected * `resolution` is `720p` or `1080p`, and `duration` is a positive whole number * for an edit, and for a reference request with `video_urls`, every input video can be measured (its length sets the bill — see [Pricing](#pricing)) Every other rule in the table — mode combinations, counts, lengths — is checked by the model when the task starts. A request that breaks one ends as a failed task with code `80007` and the exact reason, and is refunded in full. Unknown fields are refused the same way rather than ignored. ## Modes | Mode | How to select it | | -------------- | -------------------------------------------------------------------------------------------------- | | Text to video | No media. | | Image to video | A first frame, optionally a last frame and keyframes. | | Reference | `video_urls`, `audio_urls` or `reference_image` roles, or `omni_reference_task_type: "reference"`. | | Edit | `omni_reference_task_type: "edit"` and one input video. | | Extend | `omni_reference_task_type: "extend"` and one input video. | Frames and reference media cannot be mixed in one request. Next to reference videos or audio, `image_urls` count as reference images only with `omni_reference_task_type: "reference"`; use `reference_image` roles otherwise. A `video_url` without `edit` or `extend` is refused. ### Keyframes ```json { "model": "kling-4-0", "prompt": "A girl walks from the window to the door, then looks back and smiles", "image_with_roles": [ {"url": "https://example.com/1.png", "role": "first_frame"}, {"url": "https://example.com/2.png", "role": "keyframe"}, {"url": "https://example.com/3.png", "role": "last_frame"} ], "duration": 10 } ``` ### Edit ```json { "model": "kling-4-0", "prompt": "Change the scene to a snowy winter evening", "omni_reference_task_type": "edit", "video_url": "https://example.com/in.mp4" } ``` The input video must be at least 3 seconds; only its first 30 seconds are used. Without `duration`, the output follows the input video. ### Extend ```json { "model": "kling-4-0", "prompt": "The camera keeps moving forward as the sky grows darker", "omni_reference_task_type": "extend", "video_url": "https://example.com/in.mp4", "duration": 5 } ``` Extension continues from the input video's last frame and returns the original plus the new part. Add `last_frame_image` to choose where it ends. ### Referencing media in the prompt Point the prompt at a specific reference with `@Image1`, `@Video1` and `@Audio1`, numbered from 1 in each list in the order the URLs appear. ```json { "model": "kling-4-0", "prompt": "The woman from @Image1 walks along the beach with the camera movement of @Video1", "image_with_roles": [{"url": "https://example.com/woman.png", "role": "reference_image"}], "video_urls": ["https://example.com/camera.mp4"], "aspect_ratio": "auto", "duration": 5 } ``` ## Troubleshooting | Failure | What it means | What to do | | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | Synchronous `400` (code `30002`) | `resolution` or `duration` is not a priced value, or an input video's length could not be read | Use `720p` / `1080p` and a whole number of seconds; pass a public MP4 or MOV URL. Nothing was charged | | Task fails with code `80007` | A model rule was broken: mixed frames and references, a missing prompt, an edit video under 3 seconds, an unknown field, … | The message names the field. Fully refunded | | Task fails with code `80006` | The prompt or media was rejected by content review | Fully refunded. Revise the prompt or inputs | | `402` on submit | Not enough credits for the reserve | Top up, or lower `duration` or `resolution` | | Task stays `processing` | Generation takes a few minutes, longer for long clips and edits | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-4-0", "status": "completed", "created_at": 1789689600, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/.../0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.video_urls`. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). ## Pricing Kling 4.0 bills **per second of video**, at a rate set by the resolution and by whether the request has input videos: ``` credits = ceil(per_second_rate × billable_seconds × 1000) 1 credit = $0.001 ``` | Mode | `billable_seconds` | Rate | | ------------------------------------- | ------------------------------ | ----------- | | Text, image, reference without videos | `duration` | standard | | Extend | `duration` (the new part only) | standard | | Edit, reference with `video_urls` | `output + max(output, input)` | video input | `input` is the total length of the input videos, measured by reAPI when the request is accepted, rounded up to whole seconds and capped at 30. `output` is `duration`; for an edit without `duration` it equals `input`. Editing a 5.2-second video into a 3-second result bills 3 + 6 = 9 seconds. Failed tasks are refunded in full. Live per-second rates for both rates are on the [model page](https://reapi.ai/models/kling-4-0). ## Related * [Kling 4.0 playground and pricing](https://reapi.ai/models/kling-4-0) * [Kling 3.0](/docs/kling-3-0) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # kling-motion-control (https://reapi.ai/docs/kling-motion-control) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Kling Motion Control transfers the motion from a **reference video** onto a > subject taken from a **reference image**. One async endpoint, two version > tiers (`kling-v3-motion-control`, `kling-v2-6-motion-control`), `std` or > `pro` quality. Billing is per second of the source video's server-probed > length. See current pricing on the > [model page](https://reapi.ai/models/kling-motion-control). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-v3-motion-control", "prompt": "Keep the subject consistent, follow the reference motion, cinematic lighting", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-8s.mp4", "character_orientation": "image", "mode": "std", "keep_original_sound": "yes" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "kling-v3-motion-control", "prompt": "Follow the reference motion, keep the subject consistent", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-8s.mp4", "character_orientation": "image", "mode": "std", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "kling-v3-motion-control", prompt: "Follow the reference motion, keep the subject consistent", image_url: "https://your-cdn.com/subject.png", video_url: "https://your-cdn.com/motion-8s.mp4", character_orientation: "image", mode: "std", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "kling-v3-motion-control", "prompt": "Follow the reference motion, keep the subject consistent", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-8s.mp4", "character_orientation": "image", "mode": "std", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-v3-motion-control", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URLs. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Version tiers Two `model` ids share the **exact same request shape** — pick one by the `model` string you POST: | `model` id | Tier | Notes | | --------------------------- | ---- | --------------------------------------------- | | `kling-v3-motion-control` | v3 | Latest — higher motion fidelity & consistency | | `kling-v2-6-motion-control` | v2.6 | Budget tier, lower per-second rate | Everything else in this page applies identically to both ids. See current per-second rates for each tier on the [model page](https://reapi.ai/models/kling-motion-control). *** ## Request body ### `model` — required `string`. One of `"kling-v3-motion-control"` or `"kling-v2-6-motion-control"`. ### `prompt` — required `string`. Refines the motion, camera, and style. The API rejects requests without a prompt — more specific prompts yield more stable results. ### `image_url` — required `string`. Public HTTP(S) URL of the **reference image** — the subject whose appearance and identity the output keeps. **No `data:` URIs.** reApi rejects base64 inputs platform-wide. Upload to public storage (your own CDN, S3, R2…) and pass the URL. ### `video_url` — required `string`. Public HTTP(S) URL of the **reference video** — the clip whose motion is transferred onto the subject. MP4 / MOV recommended, ≤ 100MB. The allowed source length depends on `character_orientation` (see below). The **billable second count is the source video's server-probed duration**, not a client estimate. ### `character_orientation` — required `string`. Controls whose facing the subject follows. | Value | Behavior | Source video length | | --------- | -------------------------------------- | ------------------- | | `"image"` | Facing follows the reference **image** | 3 – 10 seconds | | `"video"` | Facing follows the reference **video** | 3 – 30 seconds | ### `mode` — required `string`. Quality / cost tier. | Value | Behavior | | ------- | ------------------------------------------------- | | `"std"` | Standard — balances speed and quality | | `"pro"` | Pro — higher quality, usually slower; higher rate | ### `keep_original_sound` — string, default `"yes"` Whether to retain the reference video's original audio track. | Value | Behavior | | ------- | --------------------------------- | | `"yes"` | Keep the original audio (default) | | `"no"` | Drop the original audio | ### `watermark_info` — object Watermark control. Default disabled. ```json { "watermark_info": { "enabled": false } } ``` | Field | Type | Default | Behavior | | --------- | ------- | ------- | --------------- | | `enabled` | boolean | `false` | Add a watermark | *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "kling-v3-motion-control", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | *** ## Pricing Per-second × `mode`. The billable second count is the source video's **server-probed** length — reApi measures the uploaded clip server-side rather than trusting a client value. `kling-v3-motion-control` and `kling-v2-6-motion-control` have separate per-second rates, and `pro` costs more than `std`. **Bill formula** (1 credit = $0.001): ``` billable_seconds = ceil(server_probed_source_seconds) bill_usd = per_second_usd(tier, mode) × billable_seconds credits = ceil(bill_usd × 1000) ``` See current per-second rates for each tier and mode on the [model page](https://reapi.ai/models/kling-motion-control). Failed jobs refund automatically. A probe failure returns `400 PRICING_UNAVAILABLE` (code `30002`) with no charge. The playground's draft estimate may show a default before the upload finishes — the authoritative number is computed at submit, after the server probes the file. *** ## Validation errors All cases below return HTTP 400. Pattern-match on `code`, not `message` — message strings carry request-specific context and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------------------- | ------- | -------------------------------------------------------------- | | `image_url` missing | `20002` | `kling-motion-control: image_url is required` | | `video_url` missing | `20002` | `kling-motion-control: video_url is required` | | `character_orientation` missing / invalid | `20003` | `kling-motion-control: invalid character_orientation` | | `mode` missing / invalid | `20003` | `kling-motion-control: invalid mode (allowed: std / pro)` | | `keep_original_sound` invalid | `20003` | `kling-motion-control: invalid keep_original_sound` | | `image_url` / `video_url` carrying a `data:` URI | `20003` | `kling-motion-control: image_url must be a public http(s) URL` | | Source video probe fails (network / format) | `30002` | `Could not determine source video duration for billing: …` | | Source video length outside the orientation window | `80007` | Provider rejected the request as invalid | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Minimum request (image orientation) ```json { "model": "kling-v3-motion-control", "prompt": "Follow the reference motion, keep the subject consistent", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-8s.mp4", "character_orientation": "image", "mode": "std" } ``` ### Video orientation, pro quality, up to 30s ```json { "model": "kling-v3-motion-control", "prompt": "Follow the reference performance and rhythm, keep motion continuous", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-20s.mp4", "character_orientation": "video", "mode": "pro", "keep_original_sound": "no" } ``` ### Budget tier, watermark off ```json { "model": "kling-v2-6-motion-control", "image_url": "https://your-cdn.com/subject.png", "video_url": "https://your-cdn.com/motion-6s.mp4", "character_orientation": "image", "mode": "std", "watermark_info": { "enabled": false } } ``` *** ## Tips * **Match the clip to the orientation.** `character_orientation: "image"` caps the reference video at 10s; use `"video"` when you need up to 30s. * **Cost tracks the source clip.** A 5s reference video bills \~5 seconds; trim the input to control spend. * **Prompt the motion, not just the scene.** Phrasing the action ("turns and waves, smooth and continuous") sharpens the transfer. * **Start on `std`, escalate to `pro`.** Validate the motion on the cheaper mode, then re-run on `pro` for the final take. * **Pick the tier by budget.** `kling-v2-6-motion-control` is the cheaper run; `kling-v3-motion-control` maximizes fidelity and subject consistency. *** ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # MAI Image 2.6 (https://reapi.ai/docs/mai-image-2-6) MAI Image 2.6 generates one PNG from a required prompt and optional reference images. Use `model: "mai-image-2.6"` with the images endpoint. The website slug uses hyphens: [MAI Image 2.6](/models/mai-image-2-6). ## Quickstart ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mai-image-2.6", "prompt": "A studio photograph of a small ivory ceramic teapot on an ivory ceramic pedestal, soft daylight, no text.", "resolution": "1K", "size": "1:1", "web_grounding": false }' ``` ```python import json import os import urllib.request payload = { "model": "mai-image-2.6", "prompt": "A studio photograph of an ivory ceramic teapot, soft daylight.", "resolution": "1K", "size": "1:1", "web_grounding": False, } request = urllib.request.Request( "https://reapi.ai/api/v1/images/generations", data=json.dumps(payload).encode(), headers={"Authorization": "Bearer " + os.environ["REAPI_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=120) as response: task = json.load(response) print(task["id"]) ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: `Bearer ${process.env.REAPI_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'mai-image-2.6', prompt: 'A studio photograph of an ivory ceramic teapot, soft daylight.', resolution: '1K', size: '1:1', web_grounding: false, }), }); const task = await response.json(); if (!response.ok) throw new Error(JSON.stringify(task.error)); console.log(task.id); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "time" ) func main() { body, err := json.Marshal(map[string]any{ "model": "mai-image-2.6", "prompt": "A studio photograph of an ivory ceramic teapot, soft daylight.", "resolution": "1K", "size": "1:1", "web_grounding": false, }) if err != nil { panic(err) } req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + os.Getenv("REAPI_API_KEY")) req.Header.Set("Content-Type", "application/json") resp, err := (&http.Client{Timeout: 120 * time.Second}).Do(req) if err != nil { panic(err) } defer resp.Body.Close() result, err := io.ReadAll(resp.Body) if err != nil { panic(err) } if resp.StatusCode >= 400 { panic(string(result)) } fmt.Println(string(result)) } ``` ## Endpoint `POST https://reapi.ai/api/v1/images/generations` Send `Authorization: Bearer YOUR_API_KEY` and `Content-Type: application/json`. ## Parameters | Field | Type | Required | Default | Accepted values | | ------------------- | --------- | -------- | ------- | -------------------------------------------------------------------------------------- | | `model` | string | Yes | — | `mai-image-2.6` | | `prompt` | string | Yes | — | Non-empty generation or edit instruction; approximately 32,000 tokens of context | | `size` | string | No | `1:1` | `auto`, integer ratio between `1:4` and `4:1`, or pixel dimensions such as `1536x1024` | | `resolution` | string | No | `1K` | `1K` or `2K`, case-insensitive; no `4K` | | `width` | integer | No | — | Supply with height; each side at least 768, total pixels at most 2,359,296 | | `height` | integer | No | — | Supply with width; same limits | | `image_urls` | string\[] | No | None | Up to five public HTTP(S) image URLs, in order | | `auto_aspect_ratio` | boolean | No | `false` | Infer the frame from the prompt, equivalent to `size: "auto"` | | `web_grounding` | boolean | No | `false` | Allow web context during generation | | `n` | integer | No | `1` | Only `1` | Prompt length is a token limit, not a character count. The gateway does not pretend to reproduce the model tokenizer with a character cap. Keep long instructions within the documented context limit. Pixel size accepts `x`, `*`, or `×`, for example `1536x1024`. Fractional ratios such as `1.5:1` are not supported; use integer equivalents such as `3:2`. No base64 or data URLs are accepted. Prefer JPEG or PNG reference images; WEBP and GIF references are converted during processing. ## Sizing and precedence For **text-to-image**, explicit `width` and `height` take priority, followed by pixel dimensions in `size`, then a ratio in `size` combined with `resolution`. Automatic framing asks the model to choose a frame. Avoid mixing an automatic choice with explicit dimensions when you need a predictable request. Both dimensions must be at least 768 pixels, with `width × height ≤ 2359296`. `1536 × 1536`, `2048 × 1152`, and `3072 × 768` fit; `2048 × 2048` does not. Dimensions that are not multiples of 32 are rounded down: a request for `1000 × 1000` yields a `992 × 992` size under the documented rule. For **reference editing**, the model chooses output dimensions, generally around one megapixel with a frame informed by the reference. `size`, `resolution`, `width`, and `height` do not control the edit output. Inspect actual output dimensions rather than assuming the requested canvas was used. ```json { "model": "mai-image-2.6", "prompt": "A matte ivory ceramic teapot on a pale blue table, soft daylight.", "width": 1024, "height": 1024, "n": 1 } ``` ## Reference editing Provide one to five public image URLs and explain their roles in order. The prompt is still required. Repeated reference URLs are preserved. ```json { "model": "mai-image-2.6", "prompt": "Use the first image as the room and the second image as the chair. Replace the chair beside the window. Keep the window, floor, and camera view unchanged.", "image_urls": ["https://example.com/room.jpg", "https://example.com/chair.jpg"], "web_grounding": false } ``` Replace these illustrative URLs with accessible images you can use. Editing instructions do not guarantee exact preservation of untouched pixels. This endpoint does not expose `mask_url`, `quality`, `style`, `background`, `output_format`, `response_format`, `seed`, or `negative_prompt`. Unknown fields are rejected. The output format is PNG. ## Polling and output Submission returns the reAPI task `id`. Poll that same ID every three to five seconds until `status` is `completed` or `failed`: ```bash curl https://reapi.ai/api/v1/tasks/task_your_id \ -H "Authorization: Bearer $REAPI_API_KEY" ``` Completed-task fields have this shape (values are descriptive placeholders, not a captured response): ```typescript { id: string; status: 'completed'; model: 'mai-image-2.6'; output: { image_urls: string[] }; usage: { credits: number }; } ``` A completed task contains `output.image_urls`. `usage.credits` is the legacy whole-credit value. For precise accounting, poll with `?include=billing` and read `billing.credits_exact`, `billing.cost_usd`, and the settlement's charged and shortfall fields when present. Exact billing is opt-in; do not reconstruct a fractional charge from the rounded `usage.credits` field. ```bash curl 'https://reapi.ai/api/v1/tasks/task_your_id?include=billing' \ -H "Authorization: Bearer $REAPI_API_KEY" ``` A failed task contains `error.code` and `error.message`. Allow several minutes for generation. A client timeout alone does not mean the task failed; query the original task before deciding whether to submit again. Polling does not create an additional image charge. ## Pricing and settlement The initial quote is an estimate. It reserves credits for text input, reference inputs, and expected output pixels. On successful completion, the charge is reconciled using the actual generation cost. Any unused reservation is released; a higher final cost can require an additional debit. If actual cost is unavailable, the reservation is retained and the billing exception is recorded for reconciliation. Failed generations are refunded. The calculation uses these billing dimensions: ```text estimated cost = estimated text input + estimated reference input + estimated output final charge = actual metered generation charge, rounded once to micro-USD precision unused reservation = max(reserved charge - final charge, 0) ``` Output image tokens follow `actual width × actual height / 1024`; input image and text usage also contribute. Reference edits and automatic framing make final output dimensions uncertain. Wide ratios can produce more pixels than a square at the same nominal tier, so a 1K label is not a fixed per-image rate. See the [current pricing estimates](/models/mai-image-2-6#pricing), and read the [MAI Image 2.6 API guide](/blog/mai-image-2-6-api-guide) for request design and polling examples. This page intentionally does not freeze SKU prices. ## Errors and troubleshooting Errors use `{ error: { code, message, request_id } }`. See the shared [error catalog](/docs/api/errors). | Code | Meaning | | --------------- | ------------------------------------------------ | | `10001`–`10004` | Missing, invalid, or revoked API key | | `20002` | Required field missing | | `20003` | Invalid value, range, type, or unsupported field | | `20004` | Unsupported model for this endpoint | | `30001` | Insufficient credits | | `80001` | Submission failure | | `80002` | Task polling deadline reached | | `80003` | Terminal generation failure | | `80004` | Completed response has no image URL | * A size error: check both sides, the total area, and integer-ratio syntax. * An unexpected edit size: references activate model-selected output sizing. * An unreadable reference: check that its URL returns image bytes without login. * A slow task: poll the existing ID before starting another billable task. * A different final charge: compare the estimate with actual dimensions and reference inputs; the quote is neither a fixed rate nor a maximum charge. ## Related * [MAI Image 2.6 playground](/models/mai-image-2-6) * [MAI Image 2.6 API guide](/blog/mai-image-2-6-api-guide) --- # midjourney-v7 (https://reapi.ai/docs/midjourney-v7) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Midjourney V7 on reAPI. **Four images per request**, native MJ prompt > syntax (`--ar`, `--s`, `--chaos`, `--sref`, `--oref`, …), and **eleven edit > operations** that chain off any generated image. Async-first: submit > returns a `task_id`; poll until ready. See current pricing on the > [model page](https://reapi.ai/models/midjourney-v7). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mj-v7", "prompt": "a serene Japanese garden with cherry blossoms --ar 16:9 --s 500", "model_params": { "speed": "fast" } }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "mj-v7", "prompt": "a serene Japanese garden with cherry blossoms --ar 16:9 --s 500", "model_params": {"speed": "fast"}, }, timeout=30, ) task_id = resp.json()["id"] ``` ```javascript const resp = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'mj-v7', prompt: 'a serene Japanese garden with cherry blossoms --ar 16:9 --s 500', model_params: { speed: 'fast' }, }), }); const { id } = await resp.json(); ``` ```go body := strings.NewReader(`{ "model": "mj-v7", "prompt": "a serene Japanese garden with cherry blossoms --ar 16:9 --s 500", "model_params": { "speed": "fast" } }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", body) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) ``` Generation is asynchronous. The call returns a `task_id`; poll `GET /api/v1/tasks/:task_id` until `status` is `completed`, then read the image URLs. Each request returns **1–4 images** (content review may filter some) and is billed **once per request**. ## Endpoint ``` POST https://reapi.ai/api/v1/images/generations GET https://reapi.ai/api/v1/tasks/:task_id ``` | Header | Value | | --------------- | --------------------- | | `Authorization` | `Bearer YOUR_API_KEY` | | `Content-Type` | `application/json` | reAPI accepts only **public http(s) image URLs** for every image input — never base64 or `data:` URIs. For image-to-image, place the URL at the start of the `prompt`; for the direct-image edits, pass it in `image_urls`. ## Models The family is one base generator plus eleven edit operations. Each is a separate `model` id on the same endpoint. | `model` | Operation | References a prior task? | | -------------------- | ------------------------------- | -------------------------------- | | `mj-v7` | Text-to-image / image-to-image | — | | `mj-v7-variation` | Subtle/strong variations | yes (`task_id` + `image_number`) | | `mj-v7-upscale` | Upscale one image | yes | | `mj-v7-remix` | Re-prompt an image | yes | | `mj-v7-enhance` | Enhance a draft image | yes (draft tasks only) | | `mj-v7-pan` | Extend the canvas directionally | yes | | `mj-v7-outpaint` | Zoom out / extend the frame | yes | | `mj-v7-inpaint` | Repaint a masked region | yes | | `mj-v7-edit` | Canvas edit (reposition + fill) | yes | | `mj-v7-remove-bg` | Remove background | no (`image_urls`) | | `mj-v7-retexture` | Re-texture / restyle | no (`image_urls`) | | `mj-v7-upload-paint` | Upload + masked repaint | no (`image_urls`) | The eight parent-referencing edits take the reAPI `task_id` of a **completed Midjourney V7 generation** in `model_params.task_id`, plus `model_params.image_number` (0–3) to pick which of the four grid images to act on. reAPI resolves your task id to the upstream reference automatically. ## Base generation — `mj-v7` | Field | Type | Required | Default | Notes | | -------------------- | ------ | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | `mj-v7` | | `prompt` | string | yes | — | Native MJ syntax, ≤ 8192 chars. Image-to-image: place public image URL(s) at the start. A single image with no text is rejected. | | `model_params.speed` | string | no | `fast` | `draft` / `fast` / `turbo` | Native MJ parameters are written **inside the prompt**, not as JSON fields: | Flag | Range | Default | Meaning | | ----------------- | ------------ | ------- | ------------------------------ | | `--ar W:H` | any ratio | `1:1` | Aspect ratio | | `--s` | 0–1000 | 100 | Stylize | | `--chaos` / `--c` | 0–100 | 0 | Variation spread | | `--no` | keywords | — | Negative prompt | | `--seed` | 0–4294967295 | random | Reproducible seed | | `--weird` / `--w` | 0–3000 | 0 | Unconventional degree | | `--exp` | 0–100 | 0 | Experimental aesthetic (V7) | | `--raw` | flag | off | Disable default beautification | | `--tile` | flag | off | Seamless tile | | `--sref [URL]` | URL | — | Style Reference | | `--sw` | 0–1000 | 100 | Style weight | | `--sv` | 1–6 | 4 | Style version | | `--oref [URL]` | URL | — | Omni Reference (doubles cost) | | `--ow` | 1–1000 | 100 | Omni Reference weight | | `--iw` | 0–3 | 1 | Image-prompt weight | `--v` / `--version` / `--niji` are ignored (the version is locked to V7). Speed is set via `model_params.speed`, not a prompt flag. ## Edit operations All edits share the endpoint and the async `task_id` lifecycle. `speed` (where present) is `fast` / `turbo` (default `fast`). ### Parent-referencing edits Common `model_params`: `task_id` (required, the reAPI task id of a completed Midjourney V7 generation), `image_number` (0–3, default 0). | `model` | Extra `model_params` | Top-level `prompt` | | ----------------- | ------------------------------------------------------------------------------------------------------- | ------------------ | | `mj-v7-variation` | `type`: `subtle` \| `strong` (default `subtle`); `speed` | optional | | `mj-v7-upscale` | `type`: `standard` \| `creative` (default `standard`) | — | | `mj-v7-remix` | `mode`: `strong` \| `subtle` (default `strong`); `speed` | **required** | | `mj-v7-enhance` | — (parent must be a `draft` task) | — | | `mj-v7-pan` | `direction`: `down` \| `right` \| `up` \| `left` (default `down`); `scale` 1.1–3 (default 1.5); `speed` | optional | | `mj-v7-outpaint` | `scale` 1.1–2 (default 1.5); `speed` | optional | | `mj-v7-inpaint` | `mask` (required); `speed` | optional | | `mj-v7-edit` | `canvas` (required); `img_pos` (required); `mask` (optional); `speed` | **required** | `mask` is one of two shapes (mutually exclusive): ```json { "mask": { "areas": [ { "width": 200, "height": 200, "points": [50,50,50,250,250,250,250,50] } ] } } ``` ```json { "mask": { "url": "https://example.com/mask.png" } } ``` `points` is a flat `[x1,y1,x2,y2,…]` closed polygon; for the URL form, white = repaint region, black = preserve. `canvas` is `width` / `height` (px); `img_pos` is `width` / `height` / `x` / `y` (placement of the source image on the canvas). Example — upscale image 0 of a prior generation: ```json { "model": "mj-v7-upscale", "model_params": { "task_id": "task_xxx", "image_number": 0, "type": "standard" } } ``` ### Direct-image edits These take the source image in `image_urls` (exactly one public http(s) URL) and do not reference a prior task. | `model` | Required | `model_params` | | -------------------- | ---------------------- | --------------------------------------------------------------------- | | `mj-v7-remove-bg` | `image_urls` | — | | `mj-v7-retexture` | `prompt`, `image_urls` | `speed` (optional) | | `mj-v7-upload-paint` | `prompt`, `image_urls` | `mask` (required), `canvas` (required), `img_pos` (required), `speed` | ## Pricing Midjourney V7 bills **per request** (four images), not per image. Cost scales with: * **Speed tier** — `draft` \< `fast` \< `turbo`. * **Operation** — base generation and lightweight edits (remove-bg, pan, outpaint, enhance) cost less than heavy edits (upscale, variation, remix, inpaint, canvas edit, retexture, upload-paint). * **`--oref`** — Omni Reference in the prompt **doubles** the cost. Integer credits, `1 credit = $0.001`: ``` credits = ceil(request_price_usd × 1000) ``` where `request_price_usd` is the (model, speed) rate, doubled when the prompt carries `--oref`. See the [model page](https://reapi.ai/models/midjourney-v7) for current rates. ## Output Poll `GET /api/v1/tasks/:task_id`. On `completed`: ```json { "id": "task_xxx", "status": "completed", "output": { "image_urls": ["https://cdn.reapi.ai/.../0.png", "https://cdn.reapi.ai/.../1.png"] } } ``` `output.image_urls` holds 1–4 URLs (content review may filter some of the four). Save them promptly. ## Errors Customer-facing errors use the standard envelope `{ error: { code, message, request_id } }`. Common cases: | Situation | Code | | ----------------------------------------------------- | -------------------------- | | Prompt rejected by content review | `CONTENT_POLICY_VIOLATION` | | Malformed / out-of-range request | `INVALID_REQUEST` | | Referenced task not found / not yours / not completed | `INVALID_REQUEST` | | Insufficient credits | `INSUFFICIENT_CREDITS` | | Upstream generation failed | `UPSTREAM_ERROR` | See the full catalog at [/docs/api/errors](/docs/api/errors). ## Tips * A single reference image with no text is rejected — add a short description. * Use `--oref` for subject consistency and `--sref` for style transfer; they combine. `--oref` doubles the bill, so reserve it for shots that need it. * Generate with `mj-v7` first, then chain `mj-v7-upscale` / `mj-v7-variation` / `mj-v7-inpaint` off the returned `task_id` — no re-upload needed. * `mj-v7-enhance` only accepts a parent created with `speed: "draft"`. * Keep the version implicit — `--v` / `--niji` are ignored on V7. ## Related * [Model page & live playground](https://reapi.ai/models/midjourney-v7) * [API quickstart](/docs/api/quickstart) * [Error codes](/docs/api/errors) --- # midjourney-v8 (https://reapi.ai/docs/midjourney-v8) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Midjourney V8 on reAPI. One `midjourney` model with an `action` parameter > covering generation, blend, edit, and the upscale / variation / zoom / pan / > reroll / reshape toolkit; a separate `midjourney-video` model animates a > still into a short clip. Async-first: submit returns an `id`; poll until > ready. See current pricing on the > [model page](https://reapi.ai/models/midjourney-v8). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "midjourney", "prompt": "a serene Japanese garden with cherry blossoms, painterly", "version": "8.1", "size": "16:9", "speed": "fast" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "midjourney", "prompt": "a serene Japanese garden with cherry blossoms, painterly", "version": "8.1", "size": "16:9", "speed": "fast", }, timeout=30, ) task_id = resp.json()["id"] ``` ```javascript const resp = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'midjourney', prompt: 'a serene Japanese garden with cherry blossoms, painterly', version: '8.1', size: '16:9', speed: 'fast', }), }); const { id: taskId } = await resp.json(); ``` ```go body := strings.NewReader(`{ "model": "midjourney", "prompt": "a serene Japanese garden with cherry blossoms, painterly", "version": "8.1", "size": "16:9", "speed": "fast" }`) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", body) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) ``` Generation is asynchronous. The call returns an `id` (use it as `task_id` in follow-up requests); poll `GET /api/v1/tasks/:task_id` until `status` is `completed`, then read the image URLs. Generation returns **1–4 images** (content review may filter some) and is billed **once per request**. ## Endpoint ``` POST https://reapi.ai/api/v1/images/generations # midjourney (image) POST https://reapi.ai/api/v1/videos/generations # midjourney-video GET https://reapi.ai/api/v1/tasks/:task_id ``` | Header | Value | | --------------- | --------------------- | | `Authorization` | `Bearer YOUR_API_KEY` | | `Content-Type` | `application/json` | reAPI accepts only **public http(s) URLs** for every media input (`image_urls`, `cref`, `sref`, `dref`, `mask_url`, …) — never base64 or `data:` URIs. ## Operations — `action` `midjourney` runs one operation per request, selected by `action` (default `imagine`). All share the images endpoint. | `action` | Operation | References a prior task? | | ---------------- | -------------------------------------------- | ------------------------- | | `imagine` | Text-to-image / image-to-image | — | | `blend` | Fuse 2–4 images | — | | `edits` | Rewrite an image from a prompt | — | | `describe` | Four prompt suggestions from the first image | — | | `inpaint` | Start a local repaint / outpaint task | yes | | `modal` | Continue that same waiting task | yes (must be `modal`) | | `upscale` | Upscale one tile | yes (`task_id` + `index`) | | `variation` | Variations of one tile | yes | | `high_variation` | Strong variation | yes | | `low_variation` | Subtle variation | yes | | `reroll` | Re-roll the whole grid | yes (`task_id`) | | `zoom` | Zoom out / outpaint | yes | | `pan` | Extend the canvas directionally | yes | | `remix_strong` | Strong reshape (v8.1 / v8.2) | yes (`task_id` + `index`) | | `remix_subtle` | Subtle reshape (v8.1 / v8.2) | yes | Except for `modal` (see below), parent-referencing actions take the reAPI `task_id` of a **completed `midjourney` task** plus `index` (1–4) to pick which grid image to act on. reAPI resolves your task id to the upstream reference automatically. ## Generate — `action: "imagine"` | Field | Type | Required | Default | Notes | | ---------------- | --------- | -------- | ------------- | --------------------------------------------------------------------- | | `model` | string | yes | — | `midjourney` | | `action` | string | no | `imagine` | Operation selector | | `prompt` | string | yes | — | Image description | | `image_urls` | string\[] | no | — | Image-to-image reference(s) | | `speed` | string | no | `relax` | `relax` / `fast` / `turbo` | | `content_filter` | boolean | no | `false` (API) | Available on every operation, including video; enabled on the website | The structured parameters below are the JSON form of Midjourney's native `--flags`. You may also type the flags into `prompt`; a body field overrides the matching flag. Ranges mirror Midjourney exactly. | Field | Flag | Range / values | Notes | | ----------------- | ----------- | ------------------------------------------------- | --------------------------------------- | | `size` | `--ar` | e.g. `16:9`, `1:1`, `9:16` | Aspect ratio | | `quality` | `--q` | `0.25` / `0.5` / `1` / `2` | Render quality | | `style` | `--style` | e.g. `raw` | Style preset | | `version` | `--v` | `8.2` / `8.1` / `7` / `6` / `6.1` / `5.2` / `5.1` | Model version | | `seed` | `--seed` | integer | Reproducible seed | | `negative_prompt` | `--no` | keywords | What to avoid | | `stylize` | `--s` | 0–1000 | Stylization strength | | `chaos` | `--c` | 0–100 | Grid variety | | `weird` | `--w` | 0–3000 | Unconventional degree | | `tile` | `--tile` | boolean | Seamless tile | | `niji` | `--niji` | boolean | Anime model (pair with `version` 7 / 6) | | `iw` | `--iw` | 0–3 | Image-prompt weight | | `cw` | `--cw` | 0–100 | Character-reference weight | | `sw` | `--sw` | 0–1000 | Style-reference weight | | `cref` | `--cref` | URL | Character reference | | `sref` | `--sref` | URL | Style reference | | `dref` | `--dref` | URL | Depth reference | | `dw` | `--dw` | 0–100 | Depth-reference weight | | `repeat` | `--repeat` | 2–40 | Repeat the prompt | | `raw` | `--raw` | boolean | Raw mode (v5.1+) | | `draft` | `--draft` | boolean | Draft mode (v7+) | | `hd` | `--hd` | boolean | HD (v8.1 / v8.2) | | `stop` | `--stop` | 10–100 | Stop early (v5–6.1 / niji 5–6) | | `extra` | any `--xxx` | string | Appended to the prompt verbatim | | `metadata` | — | object | Opaque, stored with the task | Online-verified versions: `8.2`, `8.1`, `7`, `6`, `6.1`, `5.2`, `5.1`, plus niji 7 / niji 6 (set `niji: true` with `version: "7"` or `"6"`). The version does not change the price. ## Follow-up operations All follow-ups share the images endpoint and the async `task_id` lifecycle. Common fields: `task_id` (required, a completed `midjourney` task), `index` (1–4, which grid image), `speed`. | `action` | Extra fields | Notes | | ------------------------------------------------ | ---------------------------- | ---------------------------------------------------------------------------------------------- | | `upscale` | `index` | Upscale one tile | | `variation` / `high_variation` / `low_variation` | `index` | Variation strength differs | | `reroll` | — | Re-rolls the whole grid (no `index`) | | `zoom` | `index`; `zoom_ratio` | Below 2 = 1.5× outpaint, 2 and up (or omitted) = 2× zoom | | `pan` | `index`; `direction` | `direction`: `left` / `right` / `up` / `down`; v6+ / niji 6 parents only (v5.x fails upstream) | | `remix_strong` / `remix_subtle` | `index` (required); `prompt` | v8.1 / v8.2 only | `blend` takes `image_urls` (2–4) and an optional aspect ratio: free-form `size` (any `w:h`) or three-step `dimensions` (`SQUARE` / `PORTRAIT` / `LANDSCAPE`); `size` overrides `dimensions`. `edits` takes `prompt` + `image_urls` plus the same structured params as `imagine`. Example — upscale tile 1 of a prior generation: ```json { "model": "midjourney", "action": "upscale", "task_id": "task_xxx", "index": 1 } ``` ## Describe and local repaint `describe` accepts `image_urls` (at least one; only the first is used), `speed`, `content_filter` and `metadata`. Poll the returned `id`. A completed result contains `output.description` and `output.prompt`, with four numbered prompt suggestions, instead of image URLs. ```json {"model":"midjourney","action":"describe","image_urls":["https://example.com/photo.png"]} ``` Local repaint is a two-step operation: 1. Submit `inpaint` with the `task_id` of your completed, upscaled image. `index` (1–4), `custom_id`, `speed`, `content_filter`, and `metadata` are optional. 2. Poll the returned **new** `id` until `status: "modal"`. The response includes `modal_expires_at` (Unix seconds). Continue within 30 minutes. 3. Submit `modal` with this waiting task's `task_id`, optional `prompt`, `mask_url`, `speed`, `content_filter`, and `metadata`. The response returns the **same `id`** with `status: "processing"`. Poll it to completion. ```json {"model":"midjourney","action":"inpaint","task_id":"task_upscaled"} ``` ```json {"model":"midjourney","action":"modal","task_id":"task_inpaint","prompt":"a red sofa","mask_url":"https://example.com/mask.png","speed":"fast"} ``` A PNG mask uses transparency for repainting and white for preserved areas. Without `mask_url`, the operation expands the image. An omitted or empty `prompt` inherits the parent prompt; this also applies to both remix actions. Inpaint reserves the largest currently configured edit-speed price. Modal continues that reservation, without another task or debit, and success settles once using the selected modal speed (`relax` when omitted). Any difference is refunded; a failed or expired task receives a full refund. Concurrent or repeated modal requests cannot submit the continuation twice. If the HTTP acknowledgement is lost, poll the same task before retrying. Set `webhook_url` on the initial inpaint request; its final result uses that callback. ## Image-to-video — `midjourney-video` Animate a still — or one image of a completed `midjourney` grid — into a short (\~5 second) clip on the videos endpoint. Supply exactly one of `image_urls` (a start frame; `prompt` required) or `task_id` (a completed `midjourney` task of yours; reAPI resolves it upstream automatically). | Field | Type | Required | Default | Notes | | -------------- | --------- | -------- | ----------------- | ---------------------------------------------------------------- | | `model` | string | yes | — | `midjourney-video` | | `image_urls` | string\[] | one of | — | Start frame (exactly one URL); requires `prompt` | | `task_id` | string | one of | — | Completed `midjourney` task to animate | | `index` | integer | no | — | `0`–`3` — which grid image (`task_id` path) | | `prompt` | string | no | parent prompt | Required with `image_urls`; optional with `task_id` | | `video_type` | string | no | `vid_1.1_i2v_480` | `vid_1.1_i2v_480` / `_720` / `_start_end_480` / `_start_end_720` | | `animate_mode` | string | no | `manual` | `manual` / `auto`; `auto` requires `task_id` + `index` | | `motion` | string | no | `high` | `low` / `high` | | `batch_size` | integer | no | `1` | `1` / `2` / `4`; other integer values are treated as `1` | | `end_url` | string | no | — | End frame (upgrades to a start-end type) | All operations accept `content_filter`. The compatibility spellings `nsfw_checker` and `nsfw_check` are also accepted; `content_filter` takes precedence, then `nsfw_checker`. Omission preserves the API's upstream default. ## Pricing `midjourney` bills **per request** (a 4-image grid for generation; one image for upscale and the like). The bill depends only on: * **Operation tier** — generation vs every other image action. * **Speed** — `relax` / `fast` / `turbo`. The model version never changes the price. `midjourney-video` bills per resolution (480p / 720p) × `batch_size`. Integer credits, `1 credit = $0.001`: ``` credits = ceil(request_price_usd × 1000) # midjourney credits = ceil(clip_price_usd × batch_size × 1000) # midjourney-video ``` See the [model page](https://reapi.ai/models/midjourney-v8) for current rates. ## Output Poll `GET /api/v1/tasks/:task_id`. On `completed`: ```json { "id": "task_xxx", "status": "completed", "output": { "image_urls": ["https://cdn.reapi.ai/.../0.png", "https://cdn.reapi.ai/.../1.png"] } } ``` `output.image_urls` holds the generated images. Image operations also return `output.grid_image_url` when present, `output.prompt`, and `output.buttons` (`{customId, label}`). Images and grid assets use reAPI storage URLs. Copy a button's exact `customId` into `custom_id` for the corresponding follow-up; this supports advanced HD upscale commands. For upscale and variation, `custom_id` can replace `index`; for pan it can replace `direction`. Describe returns text instead. Tasks waiting for repaint parameters report `status: "modal"`, which is not terminal. `midjourney-video` returns `output.video_urls`. Save them promptly. ## Errors Customer-facing errors use the standard envelope `{ error: { code, message, request_id } }`. Common cases: | Situation | Code | | -------------------------------------------------- | ------- | | Prompt rejected by content review | `80006` | | Malformed / out-of-range request | `20003` | | Referenced task unavailable / not yours | `40001` | | Referenced task not completed / not awaiting modal | `20003` | | Insufficient credits | `30001` | | Upstream generation failed | `80003` | See the full catalog at [/docs/api/errors](/docs/api/errors). ## Tips * Generate with `imagine` first, then chain `upscale` / `variation` / `zoom` / `pan` / `remix_strong` off the returned `task_id` — no re-upload needed. * A body field overrides the matching `--flag` in the prompt, so pick one. * `relax` is the cheapest and the default; `fast` / `turbo` only change queue priority and price, not the visual result. * `remix_strong` / `remix_subtle` require a v8.1 / v8.2 parent; use the variation actions for older versions. * All references (`cref` / `sref` / `dref`, blend inputs) must be public http(s) URLs. ## Related * [Model page & live playground](https://reapi.ai/models/midjourney-v8) * [API quickstart](/docs/api/quickstart) * [Error codes](/docs/api/errors) --- # minimax-h3 (https://reapi.ai/docs/minimax-h3) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > MiniMax H3 (also released as Hailuo 03) — a single async video endpoint that > auto-routes between **T2V / I2V / R2V** based on which media fields your > request carries. Up to 2K output with native stereo audio, 4–15 second > clips. See current pricing on the > [model page](https://reapi.ai/models/minimax-h3). Generation is **asynchronous**: the POST returns a task id, then poll [`GET /api/v1/tasks/{id}`](/docs/api/tasks) until `status` is `completed`. ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "minimax-h3", "prompt": "A cat walking slowly on the beach at sunset, cinematic shot, waves gently lapping the shore", "aspect_ratio": "16:9", "duration": 6 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "minimax-h3", "prompt": "A cat walking slowly on the beach at sunset, cinematic shot", "aspect_ratio": "16:9", "duration": 6, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "minimax-h3", prompt: "A cat walking slowly on the beach at sunset, cinematic shot", aspect_ratio: "16:9", duration: 6, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "minimax-h3", "prompt": "A cat walking slowly on the beach at sunset, cinematic shot", "aspect_ratio": "16:9", "duration": 6, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() var out map[string]any json.NewDecoder(resp.Body).Decode(&out) fmt.Println(out) } ``` ## Endpoint ```http POST /api/v1/videos/generations Authorization: Bearer YOUR_API_KEY Content-Type: application/json ``` Submitting returns a task id; poll [`GET /api/v1/tasks/{id}`](/docs/api/tasks) for the result. Polling does not consume credits. ## Parameters | Parameter | Type | Required | Default | Description | | ---------------------- | --------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | `minimax-h3` | | `prompt` | string | yes | — | 1–7,000 characters. Describe visuals **and** audio (dialogue, music, ambience, SFX) in the same prompt. | | `first_frame_url` | string | I2V\* | — | First-frame image URL. Presence selects **image-to-video**. JPG/JPEG/PNG/WEBP/HEIC/HEIF, ≤30MB, sides 256–5760px, ratio 0.4–2.5. | | `last_frame_url` | string | I2V\* | — | Last-frame image URL. Same limits as `first_frame_url`. | | `reference_image_urls` | string\[] | R2V\*\* | — | Up to **9** reference image URLs. Presence selects **reference-to-video**. Same image limits as above. First 5 are free; images 6–9 bill per image. | | `reference_video_urls` | string\[] | R2V\*\* | — | Up to **3** reference video URLs. MP4/MOV (H.264/H.265; AAC/MP3 audio), ≤50MB each, each clip 2–15s, **all clips together ≤15s**, sides 256–5760px, ratio 0.4–2.5, 23.976–60 fps. Their probed duration bills on top of the output duration. | | `reference_audio_urls` | string\[] | no | — | Up to **3** reference audio URLs. WAV/MP3, ≤15MB each, each 2–15s, total ≤15s. Free. Cannot be used alone — requires an image or video reference. | | `aspect_ratio` | enum | T2V: yes | R2V: `adaptive` | `21:9` `16:9` `4:3` `1:1` `3:4` `9:16` (+ `adaptive`, reference mode only). Required in T2V (`adaptive` rejected); not accepted in I2V (orientation derives from the source image). | | `duration` | integer | no | `6` | Output length in whole seconds, `4`–`15`. | | `resolution` | enum | no | `2K` | Output tier: `768P` or `2K`. **A billing dimension** — 768P bills roughly 38% less per second than 2K. Verified to deliver 1344×768 vs 2560×1440. | | `content_filter` | boolean | no | `true` | Upstream content moderation. `false` routes the request to an unmoderated channel; its output is stored on an isolated host with a 30-day expiry instead of the default CDN. API only — the playground pins it on. | \* In I2V, provide `first_frame_url`, `last_frame_url`, or both. \*\* In R2V, provide `reference_image_urls` or `reference_video_urls` (audio alone is not accepted). Frames (`first_frame_url` / `last_frame_url`) and reference inputs (`reference_*_urls`) are **mutually exclusive**. All media inputs must be public HTTP(S) URLs — base64 / `data:` URIs are rejected. ## Modes Mode is implicit — selected by which inputs you send: | Mode | Trigger | prompt | aspect\_ratio | | ---------------------------- | ------------------------------------ | -------- | ---------------------------- | | **Text-to-video (T2V)** | no media | required | required, no `adaptive` | | **Image-to-video (I2V)** | `first_frame_url` / `last_frame_url` | required | not accepted (from image) | | **Reference-to-video (R2V)** | `reference_*_urls` | required | optional, default `adaptive` | ```json // I2V — animate between two frames { "model": "minimax-h3", "prompt": "the character turns and smiles, camera pushes in", "first_frame_url": "https://…/first.jpg", "last_frame_url": "https://…/last.jpg", "duration": 6 } // R2V — identity from images, motion from a clip, voice from audio { "model": "minimax-h3", "prompt": "a continuous cinematic scene using the referenced character, motion, and voice", "reference_image_urls": ["https://…/id.jpg"], "reference_video_urls": ["https://…/motion.mp4"], "reference_audio_urls": ["https://…/voice.mp3"], "duration": 8 } ``` ## MiniMax H3 Lite `minimax-h3-lite` is a separate model id on the same endpoint: a lower per-second price, text-to-video and first/last-frame video only (no reference inputs), 480P up to 4K. It has its own parameter set: | Parameter | Type | Required | Default | Description | | ----------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | — | `minimax-h3-lite` | | `prompt` | string | yes | — | 1–7,000 characters. | | `quality` | enum | yes | — | `low` (faster) or `high` (higher fidelity). Same rate either way. | | `first_frame_url` | string | no | — | First-frame image URL. | | `last_frame_url` | string | no | — | Last-frame image URL. Requires `first_frame_url`. | | `aspect_ratio` | enum | no | — | `16:9` `9:16` `1:1` `4:3` `3:4` `21:9`. With a first frame and no ratio, the output follows the image's orientation. | | `duration` | integer | no | `5` | Output length in whole seconds, `3`–`15`. | | `resolution` | enum | no | `768P` | `480P` `768P` `1080P` `2K` `4K`. **A billing dimension** — `4K` bills a higher per-second rate; the other tiers share one rate. | | `seed` | integer | no | — | ≥ 0. Omit for a random seed. | | `enhance` | boolean | no | `true` | Rewrite the prompt with a planning pass before generation. `false` uses the prompt exactly as given. | Lite is available through the API only — the website playground does not generate with it. Its output is stored on an isolated host with a 30-day expiry instead of the default CDN. Billing is `duration × tier rate`; see the [model page](https://reapi.ai/models/minimax-h3) for current rates. ```json { "model": "minimax-h3-lite", "prompt": "a paper boat drifting down a rain-soaked street, low angle", "quality": "high", "resolution": "1080P", "duration": 5, "aspect_ratio": "16:9" } ``` ## Pricing Billed **per second**, at a rate that depends on `resolution`. The routing mode does not change the rate — turning `content_filter` off costs the same as leaving it on. Components: * **Output seconds** — the requested `duration`, charged at the tier rate (`768P` is roughly 38% cheaper per second than `2K`). * **Input video seconds** — the server-probed total duration of `reference_video_urls` is added to the billable seconds (the vendor processes input and output footage alike). * **Extra reference images** — the first 5 are free; images 6–9 bill a flat per-image rate. Audio input is free. See the [model page](https://reapi.ai/models/minimax-h3) for current rates. **Bill formula** (`1 credit = $0.001`): ``` credits = ceil((per_second_usd × (duration + input_video_seconds) + extra_image_usd × max(0, reference_images − 5)) × 1000) ``` If a reference video URL cannot be probed for duration, the request is rejected before any charge — billing never falls back to client-stated values. ## Output On success, `GET /api/v1/tasks/{id}` returns: ```json { "id": "task_…", "model": "minimax-h3", "status": "completed", "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/…/0.mp4"] }, "error": null } ``` The clip includes its native stereo audio track in the MP4. ## Errors | HTTP | `code` | When | | ---- | ----------------- | -------------------------------------------------------------------------------------------------------------------------- | | 400 | `20002` | Missing / invalid parameter (e.g. `aspect_ratio` missing in T2V, frames mixed with references, audio reference used alone) | | 400 | `30002` | Pricing unavailable (e.g. a reference video's duration could not be probed) | | 401 | `10001` – `10005` | Auth missing / invalid / revoked | | 402 | `30001` | Insufficient credits | | 429 | `50001` | Per-user rate limit exceeded | Failed generations are surfaced under `error` in the polling response and are refunded automatically. Full catalog: [Errors](/docs/api/errors). ## Tips * **Direct the audio in the prompt.** MiniMax H3 renders sound with the picture — describe dialogue lines, music mood, ambience, and effect cues alongside the visual action for the tightest sync. * **Assign roles to references.** In R2V, say what each asset controls (identity, motion, camera language, voice); it reduces conflicts between reference materials. * **Watch reference-video length.** Input clips bill their own seconds on top of the output — a 12s reference plus a 10s output bills as 22s. * `aspect_ratio` is rejected in I2V — crop your frames to the orientation you want instead. * Longer `duration` scales the bill linearly; start at the 6s default while iterating. ## Related * [Tasks](/docs/api/tasks) — universal polling endpoint * [Errors](/docs/api/errors) — full error catalog * [seedance-2-0](/docs/seedance-2-0) — sibling multimodal video family * [veo3-1](/docs/veo3-1) — premium video generation with optional audio --- # minimax-m3 (https://reapi.ai/docs/minimax-m3) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > MiniMax M3 is an open-weight model that pairs frontier coding and agentic > benchmarks with a 1M-token context window and native multimodal input — > exposed through api.reapi.ai as a drop-in OpenAI-compatible Chat > Completions endpoint. 1M context, 512K max output, native thinking, image > and video input, prompt caching, and tool use. The wire `model` id is > `minimax/minimax-m3`. Current rates live on the > [model page](https://reapi.ai/models/minimax-m3) and on > [api.reapi.ai/pricing](https://api.reapi.ai/pricing). ## Quick example ```bash curl https://api.reapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "minimax/minimax-m3", "group": "default", "messages": [ { "role": "user", "content": "Hello" } ], "stream": true, "max_tokens": 4096, "temperature": 1.0 }' ``` ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.reapi.ai/v1", ) stream = client.chat.completions.create( model="minimax/minimax-m3", messages=[{"role": "user", "content": "Hello"}], stream=True, max_tokens=4096, temperature=1.0, extra_body={"group": "default"}, ) for chunk in stream: delta = chunk.choices[0].delta.content or "" print(delta, end="", flush=True) ``` ```js import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.reapi.ai/v1", }); const stream = await client.chat.completions.create({ model: "minimax/minimax-m3", messages: [{ role: "user", content: "Hello" }], stream: true, max_tokens: 4096, temperature: 1.0, // `group` is an api.reapi.ai-specific extension; pass via extra body. // @ts-expect-error — not part of the OpenAI types group: "default", }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "minimax/minimax-m3", "group": "default", "messages": []map[string]string{ {"role": "user", "content": "Hello"}, }, "stream": true, "max_tokens": 4096, "temperature": 1.0, }) req, _ := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` *** ## Authentication Every request needs a Bearer token. The MiniMax M3 chat workspace lives on the `api.reapi.ai` platform — sign in there to create a key and top up tokens. 1. Open [api.reapi.ai](https://api.reapi.ai/) and sign in (or create an account). 2. Generate an API key under **API Keys**. 3. Top up tokens under **Top Up** (pay-as-you-go, billed in USD per 1M tokens — see [api.reapi.ai/pricing](https://api.reapi.ai/pricing)). ```http Authorization: Bearer YOUR_API_KEY ``` The chat surface (api.reapi.ai) is a **separate workspace** from the image/video/audio task gateway at `reapi.ai/api/v1/*`. Keys and balances do not cross over — a key issued on `reapi.ai/settings/apikeys` will not authenticate against `api.reapi.ai/v1/chat/completions`, and vice versa. *** ## Endpoint ```http POST https://api.reapi.ai/v1/chat/completions ``` Drop-in for the OpenAI SDKs — same request shape, same SSE wire format. Set `base_url` to `https://api.reapi.ai/v1` and `model` to `minimax/minimax-m3`. *** ## Request body ### `model` — string, required Must be `"minimax/minimax-m3"`. Echoed back in the response envelope. ### `messages` — array, required Conversation history as an array of message objects. Same shape as the OpenAI Chat Completions spec, plus content-parts for image and video input: ```json { "role": "system" | "user" | "assistant" | "tool", "content": "string OR content-parts array (text + image_url + video_url parts)" } ``` Multi-turn history is sent in chronological order — the last message is the one the model responds to. Strip a prior turn's reasoning content before re-sending it in `messages`. ### `max_tokens` — integer, default `4096` Upper bound on output tokens for this response, **including the chain-of-thought when MiniMax M3 is thinking**. The synchronous API supports up to **512K** output tokens (128K recommended) — set it generously for long-form or reasoning-heavy outputs. ### `stream` — boolean, default `false` When `true`, the response is streamed as server-sent events (SSE) with `Content-Type: text/event-stream`. Each event is a JSON delta in the OpenAI format, terminated by a `data: [DONE]` line. ### `temperature` — number, default `1` Sampling temperature. Lower values produce more deterministic output. ### `top_p` — number, default `0.95` Nucleus sampling cutoff. ### `tools` / `tool_choice` — optional Standard OpenAI tool-calling parameters. MiniMax M3 is tuned for agentic, multi-step workflows with reliable function calling and JSON output, and it can interleave reasoning with tool calls across a long run. ### `group` — string, default `"default"` api.reapi.ai-specific extension. Selects a token group on the gateway, which routes the request to a specific upstream channel pool. Omit if default routing is fine. *** ## Thinking MiniMax M3 is a native thinking model: it reasons before it answers and can interleave reasoning with tool calls during a multi-step run. Thinking is **adaptive by default** — the model reasons on hard tasks and answers directly on simple ones. When the model thinks, the chain-of-thought is returned in a `reasoning_content` field alongside `content`: ```json { "choices": [ { "index": 0, "message": { "role": "assistant", "reasoning_content": "Let me work through this step by step...", "content": "The final answer." }, "finish_reason": "stop" } ] } ``` For latency-sensitive or simple calls you can disable thinking for faster, cheaper responses. Strip `reasoning_content` from assistant messages before sending them back in a follow-up request — the chain-of-thought from a previous turn is not meant to be re-fed as input. *** ## Multimodal input MiniMax M3 is natively multimodal — send images and video alongside text via OpenAI content-parts: ```json { "model": "minimax/minimax-m3", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What does this chart show?" }, { "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } } ] } ] } ``` Video frames are passed the same way via `video_url` content-parts. Each image or video counts toward the input token budget based on its resolution and length. *** ## Prompt caching MiniMax M3 caches stable prompt prefixes. When a request reuses a cached prefix, those input tokens bill at a small fraction of the standard input rate — a big saving for agent loops and chatbots that replay long system prompts and tool schemas. The `usage.prompt_tokens_details.cached_tokens` field reports how many input tokens were served from cache. *** ## Response shape ### Non-streaming (`stream: false`) ```json { "id": "chatcmpl-018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "object": "chat.completion", "created": 1735000000, "model": "minimax/minimax-m3", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21, "prompt_tokens_details": { "cached_tokens": 0 } } } ``` When the model thinks, `message.reasoning_content` carries the chain-of-thought alongside `content`. ### Streaming (`stream: true`) `Content-Type: text/event-stream`. Each `data:` line is a JSON delta in the OpenAI chunk format; the final event before `[DONE]` carries the `finish_reason` (`stop` / `length` / `tool_calls` / `content_filter`). *** ## Pricing MiniMax M3 is billed **pay-as-you-go in USD** against your api.reapi.ai token balance. It bills along three dimensions — input tokens, output tokens, and cache-read tokens. Current rates live on [api.reapi.ai/pricing](https://api.reapi.ai/pricing) and in the pricing card at the top of the [model page](https://reapi.ai/models/minimax-m3). Per-call bill: ``` billable_input = (prompt_tokens - cached_tokens) × input_rate / 1,000,000 cache_read_bill = cached_tokens × cache_read_rate / 1,000,000 output_bill = completion_tokens × output_rate / 1,000,000 ``` Output tokens include the chain-of-thought when the model is thinking. Failed requests are not charged. *** ## Limits | Limit | Value | | ------------------- | ----------- | | Context window | 1M tokens | | Max output per call | 512K tokens | Streams that hit the output cap finish with `finish_reason: "length"`; call again with a continuation message if you need more text. *** ## Errors The error envelope follows the OpenAI shape — HTTP status, plus a JSON body: ```json { "error": { "message": "...", "type": "invalid_request_error", "code": "..." } } ``` Common cases: | Status | When | Notes | | ------ | ------------------------------------------ | -------------------------------------------- | | `400` | Bad request shape, unsupported param combo | Check the `messages` array and `model` id | | `401` | Missing / invalid API key | Re-issue a key at api.reapi.ai | | `402` | Insufficient balance | Top up at api.reapi.ai | | `429` | Per-group rate limit hit | Back off, or move to a different `group` | | `500` | Upstream / gateway error | Safe to retry — failed calls are not charged | api.reapi.ai does **not** internally retry chat requests. Every customer call maps to exactly one upstream POST. If a network error reaches you, that is a one-for-one wire failure and a retry from your side is safe; the gateway will not double-bill. *** ## Recipes ### Minimum request ```json { "model": "minimax/minimax-m3", "max_tokens": 4096, "messages": [ { "role": "user", "content": "Summarise this in three sentences." } ] } ``` ### Tool use (function calling) ```json { "model": "minimax/minimax-m3", "max_tokens": 4096, "messages": [ { "role": "user", "content": "What's the weather in Tokyo today?" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Look up the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` ### Vision ```json { "model": "minimax/minimax-m3", "max_tokens": 4096, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Read the error in this screenshot and suggest a fix." }, { "type": "image_url", "image_url": { "url": "https://your-cdn.com/screenshot.png" } } ] } ] } ``` ### Long-context analysis ```json { "model": "minimax/minimax-m3", "max_tokens": 8192, "messages": [ { "role": "system", "content": "" }, { "role": "user", "content": "List every mention of constraint X with line numbers." } ] } ``` Keep the long reference block stable across calls so the cache-read rate applies on subsequent requests. *** ## When to pick MiniMax M3 Pick MiniMax M3 when you want frontier coding and agentic capability at open-weight pricing: * **Long-horizon agentic coding** — multi-file refactors, tool-using agents, and runs that must stay on-task across many steps. * **Million-token analysis** — whole repositories, long research packs, and multi-document review in a single call. * **Multimodal workflows** — tasks that mix screenshots, diagrams, video, and code in one conversation. Route lighter traffic (classification, short replies, tight loops) to a cheaper model on the same key. *** ## Tips * **Set `max_tokens` generously when the task is hard.** The chain-of-thought counts toward the output budget; a low cap can truncate before the final answer. * **Strip `reasoning_content` before the next turn.** Re-feeding a prior turn's chain-of-thought as input is not supported. * **Stream by default for chat UX.** Streaming cuts perceived latency. * **Cache stable prefixes.** Reuse the same system prompt and tool schemas across calls to bill repeated input at the low cache-read rate. * **Disable thinking for simple, latency-sensitive calls.** Adaptive thinking already skips reasoning on easy prompts, but you can force it off when you never need the chain-of-thought. *** ## Related * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Errors catalog](/docs/api/errors) --- # Multistem Splitter API (https://reapi.ai/docs/multistem-splitter) # Multistem Splitter API Use `audio-multistem` to extract up to six supported stems from one public audio URL. ## Endpoint ```http POST /api/v1/audio/generations ``` Poll completion with: ```http GET /api/v1/tasks/{id} ``` ## Example ```bash curl https://reapi.ai/api/v1/audio/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "audio-multistem", "audio_url": "https://cdn.example.com/song.wav", "stem_list": ["vocals", "drum", "bass"], "encoder_format": "mp3" }' ``` ## Parameters | Field | Type | Required | Notes | | ------------------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | Use `audio-multistem`. | | `audio_url` | URL | yes | Public HTTP(S) source audio URL. | | `stem_list` | enum\[] | yes | 1-6 values: `vocals`, `drum`, `piano`, `bass`, `electric_guitar`, `acoustic_guitar`. | | `splitter` | enum | no | `auto`, `andromeda`, `perseus`, `orion`, `phoenix`, `lyra`, or `lynx`. `auto` is omitted upstream so the default engine is used. | | `extraction_level` | enum | no | `deep_extraction` or `clear_cut`. Defaults to `deep_extraction`. | | `dereverb_enabled` | boolean | no | Enable dereverb cleanup. | | `encoder_format` | enum | no | `mp3`, `wav`, `flac`, `aac`, or `ogg`. | ## Output Completed tasks return `output.audio_urls` and, when available, labeled `output.tracks`. Multistem jobs are billed per rounded-up source minute, multiplied by the selected stem count. See current rate on the [Multistem Splitter model page](https://reapi.ai/models/multistem-splitter). --- # Mureka V9 Song API (https://reapi.ai/docs/mureka-v9-song) # Mureka V9 Song API Use `mureka-v9-song` to turn written lyrics into one or more fully produced songs. Each call is asynchronous: submit the task, poll for completion, then fetch the rendered audio from the returned URLs. ## Endpoint ```http POST /api/v1/audio/generations ``` Poll completion with: ```http GET /api/v1/tasks/{id} ``` The task stays in `processing` until the song is rendered; final URLs land in `output.audio_urls` when the status flips to `completed`. ## Example ```bash curl https://reapi.ai/api/v1/audio/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mureka-v9-song", "lyrics": "Verse 1...\nChorus...\nVerse 2...", "prompt": "Emotional pop ballad with piano, warm strings, cinematic chorus, expressive female vocal, polished modern production", "number_of_songs": 1, "output_format": "mp3" }' ``` ## Parameters | Field | Type | Required | Notes | | ----------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | Must be `mureka-v9-song`. | | `lyrics` | string | yes | Lyrics for the song. Up to 3000 characters. | | `prompt` | string | no | Optional style prompt — genre, mood, instrumentation, vocal tone, tempo, production feel. Up to 1024 characters. | | `number_of_songs` | integer | no | `1`, `2`, or `3`. Defaults to `1`. Each additional song multiplies the per-request cost. | | `output_format` | enum | no | `mp3`, `wav`, or `flac`. Defaults to `mp3`. | | `reference_id` | string | no | Optional Mureka reference-track ID for tighter style guidance. | | `vocal_id` | string | no | Optional Mureka vocal-reference ID. | | `melody_id` | string | no | Optional Mureka melody-reference ID. | The three reference IDs are minted by Mureka's own upload system. ReAPI forwards them verbatim and does not proxy uploads — bring an ID you already have, or omit them entirely for fully generated songs. ## Output Successful tasks return one URL per generated song in `output.audio_urls`. With `number_of_songs: 3` the array contains three URLs, all in the same format selected by `output_format`. ## Pricing Billed per generated song. Only `number_of_songs` affects pricing — `prompt`, `output_format`, and the three reference IDs are free to use. See current rates on the [Mureka V9 model page](https://reapi.ai/models/mureka-v9-song). ## Tips * Structure lyrics with clear `Verse` / `Chorus` / `Bridge` blocks for better arrangement. * Use the style prompt to pin genre, tempo, and vocal character — Mureka follows these strongly. * Set `number_of_songs > 1` when you want quick variations from the same lyrics. * Use a reference ID only when you want the model to track a specific vocal or melody — without one it composes freely from the lyrics + prompt. * Stick with `mp3` while iterating; switch to `wav` or `flac` for final mastering. --- # muse-image (https://reapi.ai/docs/muse-image) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Muse Image, the image model from Meta Superintelligence Labs, live on reAPI. > One model id, `muse-image`, makes one picture from a prompt, or from a prompt > plus up to 9 reference images, in one of seven aspect ratios. Every request > costs the same flat price per image. See current pricing on the > [model page](https://reapi.ai/models/muse-image). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "muse-image", "prompt": "A travel poster for a seaside town called Porto Azul: pastel houses stacked on a cliff above a turquoise bay, the headline PORTO AZUL in bold serif letters at the top, flat retro illustration style.", "aspect_ratio": "3:4" }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/images/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "muse-image", "prompt": "A travel poster for a seaside town called Porto Azul: pastel houses stacked on a cliff above a turquoise bay, the headline PORTO AZUL in bold serif letters at the top, flat retro illustration style.", "aspect_ratio": "3:4", }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'muse-image', prompt: 'A travel poster for a seaside town called Porto Azul: pastel houses stacked on a cliff above a turquoise bay, the headline PORTO AZUL in bold serif letters at the top, flat retro illustration style.', aspect_ratio: '3:4', }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "muse-image", "prompt": "A travel poster for a seaside town called Porto Azul: pastel houses stacked on a cliff above a turquoise bay, the headline PORTO AZUL in bold serif letters at the top, flat retro illustration style.", "aspect_ratio": "3:4" }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `muse-image`. **Required.** | | `prompt` | string | — | **Required**, also with references. Must not be empty after trimming. Name the subject, setting, light and framing; with references, say what to keep and what to change. | | `image_urls` | string\[] | — | `0`–`9` public HTTP(S) image URLs used as references for a new picture. PNG, JPEG or WebP, 11 MB in total. Leave it out for text to image. | | `aspect_ratio` | string | auto | `1:1` / `16:9` / `9:16` / `4:3` / `3:4` / `3:2` / `2:3`. Leave it out for auto: `1:1` for text only, the references' shape otherwise. Do not send `"auto"`. | | `size` | string | — | Alias of `aspect_ratio`: one of the ratios above, or `auto`. Pixel sizes such as `1024x1024` are refused. `aspect_ratio` wins when both are sent. | | `n` | integer | `1` | Only `1`. Each request returns one image. | There is no resolution, seed, negative prompt, mask or output format field. Fields outside this table are not refused: they are passed through to the model, which currently ignores them. Checked by reAPI before anything is charged: * `prompt` is present and not blank * `image_urls` holds at most 9 public HTTP(S) URLs — base64 and `data:` URIs are rejected * `aspect_ratio`, `size` and `n` hold one of their listed values The reference files' format and total size are checked when the task starts. A request that breaks one ends as a failed task with the exact reason, and is refunded in full. ## Modes | Mode | How to select it | | --------------- | --------------------------------------------------------------------------------- | | Text to image | No `image_urls`. Without `aspect_ratio` the image is square. | | With references | 1–9 images in `image_urls`. Without `aspect_ratio` the image follows their shape. | ### With references ```json { "model": "muse-image", "prompt": "Keep this exact jacket; show it folded in a flat lay of hiking gear on pine boards, soft morning light.", "image_urls": ["https://example.com/jacket.png"], "aspect_ratio": "9:16" } ``` Muse Image returns a new picture built from the references. There is no mask or inpainting field. ## Troubleshooting | Failure | What it means | What to do | | ------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | Synchronous `400` (code `20002`) | No `prompt` | Add a prompt. Nothing was charged | | Synchronous `400` (codes `20003` / `20005`) | A blank prompt, more than 9 references, a non-URL reference, or a value outside a field's list | The message names the field. Nothing was charged | | Task fails with code `80007` | The model refused the input, for example references over 11 MB in total | Fully refunded. Fix the input and send it again | | Task fails with code `80006` | The prompt or an image was rejected by content review | Fully refunded. Revise the prompt or images | | `402` on submit | Not enough credits for the reserve | Top up | | Task stays `processing` | Generation usually takes one to a few minutes | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "muse-image", "status": "completed", "created_at": 1789689600, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.webp"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.image_urls`. The image is WebP, the model's own format; the model chooses the pixel size. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). ## Pricing Muse Image bills **one flat price per image**: ``` credits = ceil(per_image_rate × 1 × 1000) 1 credit = $0.001 ``` Text-only and reference requests, and every aspect ratio, cost the same. The amount reserved when the task is accepted is the amount charged, and failed tasks are refunded in full. The live per-image rate is on the [model page](https://reapi.ai/models/muse-image). ## Tips * Name the subject, setting, light and framing; Muse Image follows a specific brief closely. * With references, say exactly what must stay the same, such as the product's color or shape. * Leave `aspect_ratio` out to match a reference's shape; set it to crop for a channel. * Add `No text, no logos.` to keep invented marks out of the picture. * Need a clip instead? Pass the finished image to [Muse Video](/docs/muse-video) as a reference. ## Related * [Muse Image playground and pricing](https://reapi.ai/models/muse-image) * [Muse Video](/docs/muse-video) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # muse-video (https://reapi.ai/docs/muse-video) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Muse Video, the video model from Meta Superintelligence Labs, live on reAPI. > One model id, `muse-video`, makes a clip of about 10 seconds at `720p` with > sound, from a prompt or from a prompt plus up to 9 reference images, in one > of seven aspect ratios. Every clip costs the same flat price. See current > pricing on the [model page](https://reapi.ai/models/muse-video). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "muse-video", "prompt": "A golden retriever shakes off water on a sunny dock, droplets flying in slow motion, the camera pushing in gently, splashes and a happy bark. No text.", "aspect_ratio": "16:9" }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "muse-video", "prompt": "A golden retriever shakes off water on a sunny dock, droplets flying in slow motion, the camera pushing in gently, splashes and a happy bark. No text.", "aspect_ratio": "16:9", }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'muse-video', prompt: 'A golden retriever shakes off water on a sunny dock, droplets flying in slow motion, the camera pushing in gently, splashes and a happy bark. No text.', aspect_ratio: '16:9', }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "muse-video", "prompt": "A golden retriever shakes off water on a sunny dock, droplets flying in slow motion, the camera pushing in gently, splashes and a happy bark. No text.", "aspect_ratio": "16:9" }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------- | ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | — | `muse-video`. **Required.** | | `prompt` | string | — | **Required**, also with references. Must not be empty after trimming. Describe subject, action, camera move and light, and name the sounds you want. | | `image_urls` | string\[] | — | `0`–`9` public HTTP(S) image URLs used as references. PNG, JPEG or WebP, 11 MB in total. Leave it out for text to video. | | `aspect_ratio` | string | auto | `1:1` / `16:9` / `9:16` / `4:3` / `3:4` / `3:2` / `2:3`. Leave it out for auto: `16:9` for text only, the references' shape otherwise. Do not send `"auto"`. | | `size` | string | — | Alias of `aspect_ratio`: one of the ratios above, or `auto`. `aspect_ratio` wins when both are sent. | | `duration` | integer or string | `10` | Only `10`, `"10"` or `"10s"`. The clip runs about 10 seconds. | | `resolution` | string | `720p` | Only `720p`. | | `audio` | boolean | `true` | Only `true`; every clip has sound. `false` is refused. | | `n` | integer | `1` | Only `1`. Each request returns one clip. | There are no first or last frame, reference video, reference audio, extend, seed or negative prompt fields. Fields outside this table are not refused: they are passed through to the model, which currently ignores them. Checked by reAPI before anything is charged: * `prompt` is present and not blank * `image_urls` holds at most 9 public HTTP(S) URLs — base64 and `data:` URIs are rejected * `aspect_ratio`, `size`, `duration`, `resolution`, `audio` and `n` hold one of their listed values The reference files' format and total size are checked when the task starts. A request that breaks one ends as a failed task with the exact reason, and is refunded in full. ## Modes | Mode | How to select it | | --------------- | -------------------------------------------------------------------------------- | | Text to video | No `image_urls`. Without `aspect_ratio` the clip is `16:9`. | | With references | 1–9 images in `image_urls`. Without `aspect_ratio` the clip follows their shape. | ### With references ```json { "model": "muse-video", "prompt": "The fox slowly lifts its head, wind moving through its fur, the camera pushing in gently, soft forest ambience.", "image_urls": ["https://example.com/fox.png"] } ``` The clip stays close to the references, but its first frame is not an exact copy of an image. ## Troubleshooting | Failure | What it means | What to do | | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | Synchronous `400` (code `20002`) | No `prompt` | Add a prompt. Nothing was charged | | Synchronous `400` (codes `20003` / `20005`) | A blank prompt, more than 9 references, a non-URL reference, or a value outside a field's list (for example `audio: false`) | The message names the field. Nothing was charged | | Task fails with code `80007` | The model refused the input, for example references over 11 MB in total | Fully refunded. Fix the input and send it again | | Task fails with code `80006` | The prompt or an image was rejected by content review | Fully refunded. Revise the prompt or images | | `402` on submit | Not enough credits for the reserve | Top up | | Task stays `processing` | Generation usually takes a few minutes | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "muse-video", "status": "completed", "created_at": 1789689600, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.video_urls`. The clip is an MP4 with an audio track. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). ## Pricing Muse Video bills **one flat price per clip**: ``` credits = ceil(per_clip_rate × 1 × 1000) 1 credit = $0.001 ``` The price is not multiplied by seconds. Text-only and reference requests, and every aspect ratio, cost the same. The amount reserved when the task is accepted is the amount charged, and failed tasks are refunded in full. The live per-clip rate is on the [model page](https://reapi.ai/models/muse-video). ## Tips * Describe subject, action, camera move and light, and name the sounds; the audio is generated together with the picture. * Make a still with [Muse Image](/docs/muse-image), then pass its URL here to set it in motion. * For vertical video, send `aspect_ratio: "9:16"`, or a portrait reference. * Add `No text.` to keep invented captions out. * Need a longer clip, a higher resolution, or video and audio references? Use [Seedance 2.0](/docs/seedance-2-0). ## Related * [Muse Video playground and pricing](https://reapi.ai/models/muse-video) * [Muse Image](/docs/muse-image) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # Music Extractor API (https://reapi.ai/docs/music-extractor) import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; # Music Extractor API Use `audio-music-extractor` to extract the background music (instrumental bed) from a public source audio URL — the inverse of a vocal remover's "vocals" output. Typical uses: karaoke tracks, sampling, replacing a vocal take while keeping the original arrangement, and preparing beds for video. ## Endpoint ```http POST /api/v1/audio/generations ``` Poll completion with: ```http GET /api/v1/tasks/{id} ``` ## Example ```bash curl https://reapi.ai/api/v1/audio/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "audio-music-extractor", "audio_url": "https://cdn.example.com/mix.wav", "encoder_format": "mp3" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/audio/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "audio-music-extractor", "audio_url": "https://cdn.example.com/mix.wav", "encoder_format": "mp3", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/audio/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "audio-music-extractor", audio_url: "https://cdn.example.com/mix.wav", encoder_format: "mp3", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "audio-music-extractor", "audio_url": "https://cdn.example.com/mix.wav", "encoder_format": "mp3", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/audio/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Parameters | Field | Type | Required | Notes | | ------------------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | yes | Use `audio-music-extractor`. | | `audio_url` | URL | yes | Public HTTP(S) source audio URL. Base64 / `data:` URIs are rejected platform-wide. | | `splitter` | enum | no | `auto`, `andromeda`, `perseus`, `orion`, `phoenix`, `lyra`, or `lynx`. `auto` is omitted upstream so the default engine is used. | | `dereverb_enabled` | boolean | no | Enable dereverb cleanup. | | `encoder_format` | enum | no | `mp3`, `wav`, `flac`, `aac`, or `ogg`. | Requests are strictly validated: unknown fields are rejected with `400` rather than ignored. ## Output Completed tasks return `output.audio_urls` and, when available, labeled `output.tracks` (each with `type`, `label`, and `url`): ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "status": "completed", "output": { "audio_urls": ["https://cdn.reapi.ai/.../music.mp3"] } } ``` ## Billing Audio jobs are billed per rounded-up source minute — a 2:30 source bills as 3 minutes. Failed jobs refund automatically. See the current per-minute rate on the [Music Extractor model page](https://reapi.ai/models/music-extractor). ## Which audio model do I need? | Goal | Model | Docs | | --------------------------------- | -------------------------------------------- | ---------------------------------------------- | | Keep the music, drop the vocals | `audio-music-extractor` | this page | | Keep the vocals, drop the music | `audio-stem-separator` with `stem: "vocals"` | [Vocal Remover](/docs/vocal-remover) | | Split several instruments at once | `audio-multistem` | [Multistem Splitter](/docs/multistem-splitter) | | Denoise / de-reverb speech | `audio-voice-clean` | [Voice Cleaner](/docs/voice-cleaner) | | Convert vocals to another voice | `audio-voice-change` | [Voice Changer](/docs/voice-changer) | ## Related * [Tasks & polling](/docs/api/tasks) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) --- # music-video-1-0 (https://reapi.ai/docs/music-video-1-0) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Music Video 1.0 turns a **song** into a **music video**. Pass an audio > track plus **1-7 reference images** (the visual style/model) and the API > returns a video synced to the song. One async endpoint, five aspect ratios, > up to 1080P, optional burned-in subtitles. Billing is per second of the > song's server-probed length. See current pricing on the > [model page](https://reapi.ai/models/music-video-1-0). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "music-video-1-0", "reference_image_urls": ["https://your-cdn.com/style.png"], "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "16:9", "resolution": "540P" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "music-video-1-0", "reference_image_urls": ["https://your-cdn.com/style.png"], "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "16:9", "resolution": "540P", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "music-video-1-0", reference_image_urls: ["https://your-cdn.com/style.png"], audio_url: "https://your-cdn.com/song.mp3", aspect_ratio: "16:9", resolution: "540P", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "music-video-1-0", "reference_image_urls": []string{"https://your-cdn.com/style.png"}, "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "16:9", "resolution": "540P", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "music-video-1-0", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Request body ### `model` — required `string`. Must be `"music-video-1-0"`. ### `reference_image_urls` — required `string[]`. **1 to 7** public HTTP(S) image URLs (JPEG / PNG / WebP). These are the style / model references that fix the visual identity of the music video. **No `data:` URIs.** reApi rejects base64 inputs platform-wide. Upload to public storage (your own CDN, S3, R2…) and pass the URL. ### `audio_url` — required `string`. Public HTTP(S) URL of the **song** (MP3). The audio must be **10 to 300 seconds** (up to 5 minutes). The output music video length tracks the song, and the **billable second count is the song's server-probed duration**, not a client estimate. ### `aspect_ratio` — string, default `"16:9"` Output frame shape. | Value | Orientation | | -------- | ------------------- | | `"1:1"` | Square | | `"16:9"` | Landscape (default) | | `"9:16"` | Portrait | | `"4:3"` | Landscape | | `"3:4"` | Portrait | ### `resolution` — string, default `"540P"` Output clarity. Higher resolutions take longer to render. | Value | Notes | | --------- | ----------------- | | `"540P"` | Fastest (default) | | `"720P"` | Balanced | | `"1080P"` | Highest clarity | ### `name` — string, optional A label for the track. Shown on subtitles when `add_subtitle` is enabled. ### `prompt` — string, optional Up to **3000 characters**. Steers the visual style, mood, and scene direction of the music video. ### `add_subtitle` — boolean, default `false` Burn lyric subtitles into the music video. With `add_subtitle: true` and no `srt_url`, subtitles are generated from the song. ### `subtitle_color` — string, default `"#FFFFFF"` Hex color for burned-in subtitles (e.g. `"#FF0000"`). ### `srt_url` — string, optional Public HTTP(S) URL of a `.srt` subtitle file. Overrides auto-generated subtitles when `add_subtitle` is on. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "music-video-1-0", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ---------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds the MP4 | | `error` | object \| null | Populated on `failed` — `{ code, message }` | *** ## Pricing Flat **per second of the song**. The billable second count is the audio's **server-probed** length — reApi measures the uploaded track server-side rather than trusting a client value. **Bill formula** (1 credit = $0.001): ``` billable_seconds = min(ceil(server_probed_song_seconds), 300) bill_usd = per_second_usd × billable_seconds credits = ceil(bill_usd × 1000) ``` See the current per-second rate on the [model page](https://reapi.ai/models/music-video-1-0). Failed jobs refund automatically. A probe failure returns `400 PRICING_UNAVAILABLE` (code `30002`) with no charge. The playground's draft estimate may show a default before the upload finishes — the authoritative number is computed at submit, after the server probes the song. *** ## Validation errors All cases below return HTTP 400. Pattern-match on `code`, not `message` — message strings carry request-specific context and are not a stable contract. | Trigger | Code | Message (illustrative) | | -------------------------------------- | ------- | --------------------------------------------------------------- | | `reference_image_urls` missing / empty | `20002` | `reference_image_urls is required` | | More than 7 reference images | `20003` | `reference_image_urls accepts at most 7 items` | | `audio_url` missing | `20002` | `audio_url is required` | | `aspect_ratio` / `resolution` invalid | `20003` | `invalid aspect_ratio (allowed: 1:1 / 16:9 / 9:16 / 4:3 / 3:4)` | | `subtitle_color` not a hex color | `20003` | `subtitle_color must be a hex color like #FFFFFF` | | Any media field carrying a `data:` URI | `20003` | `audio_url must be a public http(s) URL` | | Song probe fails (network / format) | `30002` | `Could not determine source audio duration for billing: …` | | Song length outside the 10-300s window | `80007` | Provider rejected the request as invalid | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Minimum request ```json { "model": "music-video-1-0", "reference_image_urls": ["https://your-cdn.com/style.png"], "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "16:9", "resolution": "540P" } ``` ### Portrait lyric video, 1080P, with subtitles ```json { "model": "music-video-1-0", "reference_image_urls": [ "https://your-cdn.com/style-1.png", "https://your-cdn.com/style-2.png" ], "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "9:16", "resolution": "1080P", "prompt": "Dreamy pastel anime style, soft lighting, visuals shift with each chorus", "add_subtitle": true, "subtitle_color": "#FFE0F0" } ``` ### Bring your own subtitle file ```json { "model": "music-video-1-0", "reference_image_urls": ["https://your-cdn.com/style.png"], "audio_url": "https://your-cdn.com/song.mp3", "aspect_ratio": "16:9", "resolution": "720P", "add_subtitle": true, "srt_url": "https://your-cdn.com/lyrics.srt" } ``` *** ## Tips * **Cost tracks the song.** A 90-second track bills \~90 seconds; trim the audio to control spend. Songs must be 10 to 300 seconds. * **Use reference images to lock the look.** Pass 1-7 style/model images; reuse the same set across tracks for a consistent channel aesthetic. * **Prompt the mood, not just the scene.** Phrasing the energy ("dynamic lights pulsing on the downbeat") sharpens the result. * **Subtitles, three ways.** Leave `add_subtitle` off for a clean cut, on for auto-generated lyrics, or supply your own `srt_url` for exact timing. * **Start at 540P.** Validate the look on the fastest tier, then re-run at 720P / 1080P for the final take. *** ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # Nano Banana 2.1 (https://reapi.ai/docs/nano-banana-2-1) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Google's Nano Banana 2.1 image model on reAPI. **Text-to-image**, > **image editing and multi-image fusion** (up to 14 reference images and > 10 reference videos), > **Google Search grounding** (web and image search), three **thinking > levels**, 14 aspect ratios and **1K / 2K / 4K** output — at one flat > price per image, or billed per token on the official channel > (`nano-banana-2.1-official`). Async-first: submit returns a task `id`; poll until ready. > See current pricing on the > [model page](https://reapi.ai/models/nano-banana-2-1). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-2.1", "prompt": "A clean infographic poster titled \"HOW COFFEE IS MADE\" with four labeled steps", "aspect_ratio": "3:4", "resolution": "2k" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "nano-banana-2.1", "prompt": 'A clean infographic poster titled "HOW COFFEE IS MADE" with four labeled steps', "aspect_ratio": "3:4", "resolution": "2k", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "nano-banana-2.1", prompt: 'A clean infographic poster titled "HOW COFFEE IS MADE" with four labeled steps', aspect_ratio: "3:4", resolution: "2k", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "nano-banana-2.1", "prompt": `A clean infographic poster titled "HOW COFFEE IS MADE" with four labeled steps`, "aspect_ratio": "3:4", "resolution": "2k", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a task `id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. A typical image is ready in about **35–45 seconds** — poll every 3–5 seconds and allow a few minutes before giving up. ## Request body Mode is implicit: no `image_urls` / `video_urls` is text-to-image; references turn it into editing, reference-guided generation, multi-image fusion or video-to-image. | Field | Type | Default | Notes | | --------------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `nano-banana-2.1` (flat price per image) or `nano-banana-2.1-official` (billed on actual token usage — see [Pricing](#pricing)). Both accept exactly the parameters below. **Required.** | | `prompt` | string | — | What to generate or how to edit the references, 1–262,144 chars. Google limits the whole input to 131,072 tokens, so a very long prompt can still be rejected upstream. **Required.** | | `aspect_ratio` | string | `auto` | `auto` or one of `1:1`, `1:4`, `1:8`, `2:3`, `3:2`, `3:4`, `4:1`, `4:3`, `4:5`, `5:4`, `8:1`, `9:16`, `16:9`, `21:9`. `auto` (or leaving it out) lets the model pick the frame — set a ratio when you need a predictable size. | | `resolution` | string | `1k` | `1k` / `2k` / `4k` (case-insensitive). Every tier costs the same on `nano-banana-2.1`; on `nano-banana-2.1-official` higher tiers bill more output tokens. | | `image_urls` | string\[] | — | Up to 14 reference images (up to 10 objects and up to 4 characters). Public HTTP(S) URLs. | | `video_urls` | string\[] | — | Up to 10 reference videos used as context (thumbnails, posters, recaps). Public HTTP(S) URLs; mp4, mov, webm and the other formats Google lists. Videos are sent inline, so the whole request — base64-encoded, about a third larger than the files — must stay under 20 MB: keep the videos under about 14 MB in total. YouTube links are not accepted. | | `google_search` | boolean | `false` | Ground the image in Google web search results — see [Grounding](#google_search--google_image_search--boolean-default-false). | | `google_image_search` | boolean | `false` | Ground the image in Google image search. Works on its own or together with `google_search`. | | `thinking_level` | string | `medium` | `minimal` / `medium` / `high` — see [`thinking_level`](#thinking_level--string-default-medium). | Checked before anything is submitted or charged: * `prompt` is present * `aspect_ratio` is `auto` or one of the 14 ratios above (`9:21` and pixel sizes are rejected) * `resolution` is `1k`, `2k` or `4k` — there is no `0.5k` on this model * `prompt` is at most 262,144 characters * `image_urls` has at most 14 entries and `video_urls` at most 10, all public HTTP(S) URLs * `thinking_level` is `minimal`, `medium` or `high` * No `n`, `seed`, `temperature` or `top_p` — one image per request ### `google_search` / `google_image_search` — boolean, default `false` Grounding lets the model look things up before drawing — today's weather for a forecast card, a real landmark, the current look of a product. Turn on `google_search` for web results, `google_image_search` for reference images from Google image search, or both. Google does not use real-world images of people from web search for grounding. When Google returns **search suggestions** for a grounded request, they come back as an HTML snippet in `output.search_suggestions`. Google requires you to display these search suggestions when you use image search grounding, and its Gemini API terms set the full display rules for grounded results. Render the snippet as-is (for example in a sandboxed iframe) next to the image. Not every grounded result carries one. ### `thinking_level` — string, default `medium` How much the model reasons about the prompt before generating. `minimal` is the fastest; `high` spends more reasoning on dense layouts, infographics and long text. Leaving it out is the same as `medium`. The level does not change the price on `nano-banana-2.1`; on `nano-banana-2.1-official` thinking is billed as output tokens. ## Troubleshooting | Failure | What it means | What to do | | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | Synchronous 400 on submit | A field breaks a rule above (unknown ratio, `0.5k`, more than 14 images or 10 videos, an over-long prompt, …) | The error names the field — fix and resubmit; nothing was charged | | Task fails citing content policy (`80006`) | The prompt, a reference image or the generated image was blocked by safety filtering | Fully refunded. Rephrase the prompt or replace the image | | Task fails with an invalid-input error (`80007`) | A reference URL could not be downloaded (404, not an image or video, too large), or the request with videos exceeds 20 MB once encoded | Fully refunded. Check that every URL is public and returns the file; shorten or compress the videos | | Task fails with a provider error (`80001`) | Upstream timed out or was unavailable | Fully refunded. Resubmit | | `402` on submit | Not enough credits | Top up | See the [errors catalog](/docs/api/errors) for every code. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "nano-banana-2.1", "status": "completed", "created_at": 1735000000, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/.../0.jpg"], "search_suggestions": "
…
" }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. Images are JPEG. `search_suggestions` appears only on grounded results that include it. Generated URLs expire — mirror the files to your own storage. ## Pricing ### `nano-banana-2.1` — flat per image Nano Banana 2.1 bills **one flat price per image**: ``` credits = ceil(per_image_price × 1000) 1 credit = $0.001 ``` The live per-image rate is on the [model page](https://reapi.ai/models/nano-banana-2-1). Failed tasks are always refunded in full. `1k`, `2k` and `4k` cost the same, and so do reference images and videos, grounding and every thinking level. That makes `2k` or `4k` the sensible choice whenever you need the detail. ### `nano-banana-2.1-official` — actual token usage The official channel bills the tokens the request actually used, on Google's published per-token rates for Nano Banana 2.1 with a discount applied. The current rates are on the [model page](https://reapi.ai/models/nano-banana-2-1). Three meters are billed: * **Input** — the prompt plus reference images and videos * **Text and thinking output** * **Image output** ``` usd = Σ (tokens × rate per token, each meter) × discount credits = ceil(usd × 1000) 1 credit = $0.001 ``` * An image is metered at **1,120** output tokens at `1k`, **1,680** at `2k` and **3,780** at `4k`; a reference image adds about 1,120 input tokens. * Thinking tokens depend on `thinking_level` and the prompt, so the exact charge is known only after generation. The task is charged a hold when it is submitted, and the hold is replaced by the actual amount when it completes. * Grounding search queries are not billed. * Failed tasks are always refunded in full. ## Tips * Spell out the exact text you want in the image, in quotes (`titled "HOW COFFEE IS MADE"`) — text rendering and infographic layout are the areas Google improved most in this version. * For multi-image fusion, say which reference is which in the prompt ("the mug from the first image on the beach from the second"). * Wide panoramas (`4:1`, `8:1`) and tall strips (`1:4`, `1:8`) at `2k` and `4k`: Google fixed the tiling artifacts that Nano Banana 2 showed at these ratios. * Use `thinking_level: "high"` for infographics, menus and dense layouts; `minimal` for quick drafts. ## Related * [Nano Banana 2](/docs/gemini-3-1-flash-image-preview) — the previous version * [Nano Banana Pro](/docs/gemini-3-pro-image-preview) * [Nano Banana 2 Lite](/docs/nano-banana-2-lite) * [Tasks reference](/docs/api/tasks) * [Errors catalog](/docs/api/errors) --- # nano-banana-2-lite (https://reapi.ai/docs/nano-banana-2-lite) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Google DeepMind's Nano Banana 2 Lite (aka **Gemini 3.1 Flash-Lite Image**) on > reAPI — the speed-focused member of the Nano Banana family: fast **1K > text-to-image** and **prompt-based image editing** with up to 10 reference > images. Submit returns a `task_id`; poll until ready. See current pricing on > the [model page](https://reapi.ai/models/nano-banana-2-lite). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-2-lite", "prompt": "a pig on the grass, cinematic light", "aspect_ratio": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "nano-banana-2-lite", "prompt": "a pig on the grass, cinematic light", "aspect_ratio": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "nano-banana-2-lite", prompt: "a pig on the grass, cinematic light", aspect_ratio: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "nano-banana-2-lite", "prompt": "a pig on the grass, cinematic light", "aspect_ratio": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_019f25700fef760e879fc22ad9de512c", "model": "nano-banana-2-lite", "status": "processing", "created_at": 1783039530 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the generated image URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. The generation mode is implicit — there is no `mode` field: * **No `image_urls` (or an empty array)** → text-to-image. * **`image_urls` set** → prompt-based editing / reference-driven generation using up to 10 input images. Each request produces **exactly one 1K image** (no `n` parameter, no resolution control). *** ## Request body ### `model` — string, required Must be `nano-banana-2-lite`. ### `prompt` — string, required Up to **20,000 characters**. For text-to-image, describe subject, scene, style and composition. For editing, state the change you want ("replace the background with…", "make it nighttime, keep the subject unchanged"). ### `image_urls` — string\[], optional Up to **10 public http(s) image URLs** used as edit sources or visual references. Accepted types: JPEG, PNG, WebP; up to 30 MB per image. Omit it (or pass an empty array) for pure text-to-image. Base64 / `data:` URIs are rejected platform-wide — host the image on a public URL first. ### `aspect_ratio` — string, default `auto` One of `1:1`, `1:4`, `1:8`, `2:3`, `3:2`, `3:4`, `4:1`, `4:3`, `4:5`, `5:4`, `8:1`, `9:16`, `16:9`, `21:9`, `auto`. With `auto` the model chooses the ratio itself (for edits it follows the source image). *** ## Pricing Nano Banana 2 Lite bills a flat rate **per generated image**, independent of aspect ratio and mode (text-to-image and editing cost the same). Each request produces one image: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. It is one of the lowest per-image rates on the platform. Failed and rejected requests are not charged. The exact per-image credit cost surfaces on the [model page](https://reapi.ai/models/nano-banana-2-lite) and through the playground estimator before submit. *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019f25700fef760e879fc22ad9de512c", "model": "nano-banana-2-lite", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...jpeg" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (prompt over 20,000 characters, more than 10 `image_urls`, an unsupported `aspect_ratio`) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * Nano Banana 2 Lite is the **speed tier** of the Nano Banana family — pick it for drafts, previews and high-volume 1K assets; step up to [Nano Banana 2](/docs/gemini-3-1-flash-image-preview) when you need 2K/4K output or maximum quality. * For edits, reference what should **stay unchanged** ("keep the furniture and composition unchanged") — the model is strong at targeted, consistent edits. * `aspect_ratio: "auto"` follows the source image on edits; set an explicit ratio when you need a fixed canvas (e.g. `16:9` thumbnails). *** ## Related * [Nano Banana 2](/docs/gemini-3-1-flash-image-preview) * [Nano Banana Pro](/docs/gemini-3-pro-image-preview) * [Z-Image](/docs/z-image) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # pixverse-v6-max (https://reapi.ai/docs/pixverse-v6-max) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > PixVerse V6 Max, the Max tier of PixVerse V6, live on reAPI. One model id, > `pixverse-v6-max`, covers two jobs: text to video, and image to video from > one still with an optional prompt. Every clip is 1–15 seconds at `360p`, > `540p`, `720p` or `1080p`, with optional native audio. Sending an image picks > image to video. See current pricing on the > [model page](https://reapi.ai/models/pixverse-v6-max). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "pixverse-v6-max", "prompt": "A vintage red convertible drives along a coastal cliff road at golden hour, low tracking shot, engine hum and crashing waves. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", "audio": true }' ``` ```python import requests response = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "pixverse-v6-max", "prompt": "A vintage red convertible drives along a coastal cliff road at golden hour, low tracking shot, engine hum and crashing waves. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", "audio": True, }, timeout=60, ) response.raise_for_status() task_id = response.json()["id"] ``` ```javascript const response = await fetch('https://reapi.ai/api/v1/videos/generations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'pixverse-v6-max', prompt: 'A vintage red convertible drives along a coastal cliff road at golden hour, low tracking shot, engine hum and crashing waves. No text, no logos.', resolution: '720p', duration: 5, aspect_ratio: '16:9', audio: true, }), }); if (!response.ok) throw new Error(`Request failed: ${response.status}`); const { id: taskId } = await response.json(); ``` ```go package main import ( "encoding/json" "fmt" "net/http" "strings" "time" ) func main() { body := strings.NewReader(`{ "model": "pixverse-v6-max", "prompt": "A vintage red convertible drives along a coastal cliff road at golden hour, low tracking shot, engine hum and crashing waves. No text, no logos.", "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", "audio": true }`) req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 60 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() var task struct { ID string `json:"id"` } if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) } fmt.Println(task.ID) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns a task id right away; poll the task endpoint until `status` is `completed` or `failed`. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `model` | string | — | `pixverse-v6-max`. **Required.** | | `prompt` | string | — | Describe subject, place, camera move, light and sound. Text to video: **required**, up to 5,000 characters. With an image: optional, up to 2,048 characters. | | `image_urls` | string\[] | — | Image to video: exactly **1** public HTTP(S) URL. JPG, PNG or WebP, up to 20 MB and 10,000 pixels on each side. Leave it out for text to video. | | `resolution` | string | `540p` | `360p` / `540p` / `720p` / `1080p`. Sets the per-second rate. | | `quality` | string | — | Alias of `resolution`, same values. Used only when `resolution` is not sent; `resolution` wins when both are. | | `duration` | integer | `5` | `1`–`15` seconds. | | `aspect_ratio` | string | `16:9` | `16:9` / `9:16` / `4:3` / `3:4` / `1:1` / `2:3` / `3:2` / `21:9`. Text to video only; with an image the clip follows the image's shape. | | `audio` | boolean | `false` | `true` generates native sound and bills at the audio rate. | | `seed` | integer | — | `0`–`2147483647`. The same request and seed give similar results. | There is no `mode` field, and no `negative_prompt`, `watermark`, `motion_mode` or multi-clip field. First and last frames, reference images and extend are [PixVerse V6](/docs/pixverse-v6) features. Checked by reAPI before anything is charged: * every field is in the table above — unknown fields are refused, not ignored * `image_urls` holds exactly one public HTTP(S) URL — base64 and `data:` URIs are rejected * a request without an image has a `prompt`; with an image the prompt is at most 2,048 characters * `resolution`, `aspect_ratio`, `duration` and `seed` are in their ranges, and so is `quality` when it is used (no `resolution`) * prompt lengths count characters, so an emoji is one character The image's format, size and dimensions are checked by the model when the task starts. A request that breaks one ends as a failed task with code `80007` and the exact reason, and is refunded in full. ## Modes | Mode | How to select it | | -------------- | --------------------------------------------------------------------------------------------- | | Text to video | No `image_urls`. `prompt` is required; `aspect_ratio` sets the shape. | | Image to video | One image in `image_urls`. The clip starts from it and keeps its shape; `prompt` is optional. | ### Image to video ```json { "model": "pixverse-v6-max", "prompt": "The subject slowly turns toward the camera, soft natural light.", "image_urls": ["https://example.com/start.png"], "resolution": "1080p", "duration": 5 } ``` ## Troubleshooting | Failure | What it means | What to do | | ----------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | Synchronous `400` (code `20002`) | No `prompt` and no image | Add a prompt for text to video, or one image. Nothing was charged | | Synchronous `400` (codes `20003` / `20005` / `20006`) | A field is out of range, unknown, or not a public URL; more than one image | The message names the field. Nothing was charged | | Task fails with code `80007` | The model refused the input, for example an image it cannot read | The message names the reason. Fully refunded | | Task fails with code `80006` | The prompt or image was rejected by content review | Fully refunded. Revise the prompt or image | | `402` on submit | Not enough credits for the reserve | Top up, or lower `duration` or `resolution` | | Task stays `processing` | Generation takes a minute or more, longer at higher resolutions | Keep polling; a task that can never finish is failed and refunded automatically | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage and pass the URL. ## Response envelope ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "pixverse-v6-max", "status": "completed", "created_at": 1789689600, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/.../0.mp4"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`, then read `output.video_urls`. A failed task carries `error.code` and `error.message`; see the [errors catalog](/docs/api/errors). ## Pricing PixVerse V6 Max bills **per second of video**, at a rate set by the resolution and by whether audio is on: ``` credits = ceil(per_second_rate × duration × 1000) 1 credit = $0.001 ``` The resolution is `resolution`, else `quality`, else `540p`; `duration` defaults to `5`. Text to video and image to video cost the same. The amount reserved when the task is accepted is the amount charged, and failed tasks are refunded in full. Live per-second rates for every resolution, with and without audio, are on the [model page](https://reapi.ai/models/pixverse-v6-max). ## Tips * Describe subject, place, camera move and light; name the sounds you want when `audio` is on. * Draft at `360p` for a second or two, then render the final shot at `1080p` with the same request and `seed`. * For vertical video, send `aspect_ratio: "9:16"` with text to video, or a portrait image. * Add `No text, no logos.` to keep invented marks out of the frame. * Need a transition between two frames, several references, or a longer continued shot? Use [PixVerse V6](/docs/pixverse-v6). ## Related * [PixVerse V6 Max playground and pricing](https://reapi.ai/models/pixverse-v6-max) * [PixVerse V6](/docs/pixverse-v6) * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # pixverse-v6 (https://reapi.ai/docs/pixverse-v6) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Pixverse v6 — async video generation. **One model id** (`pixverse-v6`) and > one endpoint cover five modes: **text-to-video**, **image-to-video**, > **first/last-frame** transition, **multi-reference fusion**, and **video > extend**. Mode is implicit — the fields you send pick it. 1–15 second > outputs at 360p / 540p / 720p / 1080p, optional generated audio. See current > pricing on the [model page](https://reapi.ai/models/pixverse-v6). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "pixverse-v6", "prompt": "A neon-lit Tokyo alley at night, light rain, anamorphic flare", "size": "21:9", "resolution": "720p", "duration": 8 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "pixverse-v6", "prompt": "A neon-lit Tokyo alley at night, light rain, anamorphic flare", "size": "21:9", "resolution": "720p", "duration": 8, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "pixverse-v6", prompt: "A neon-lit Tokyo alley at night, light rain, anamorphic flare", size: "21:9", resolution: "720p", duration: 8, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "pixverse-v6", "prompt": "A neon-lit Tokyo alley at night, light rain, anamorphic flare", "size": "21:9", "resolution": "720p", "duration": 8, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "pixverse-v6", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.video_urls` holds the generated MP4 URL, valid for 7 days. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` Keys carry the active workspace's billing scope — there is no separate project header. *** ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Mode routing `pixverse-v6` picks its mode from **which fields you send** — there is no `mode` parameter. Matching is by priority; the first satisfied condition wins: | Send | Mode | What it does | | ---------------------------------------- | -------------------- | -------------------------------------------------------- | | `prompt` only | **Text-to-video** | Generate from text. `size` applies. | | `image_urls` | **Image-to-video** | Animate from a single starting frame (first used). | | `first_frame_image` + `last_frame_image` | **First/Last-frame** | Interpolate a transition between two frames. | | `img_references` | **Multi-reference** | Fuse 1–7 reference images into one clip. `size` applies. | | `extend_from_task_id` | **Video extend** | Continue a completed `pixverse-v6` clip. | **Field rules.** * `prompt` is **required** in every mode. * `first_frame_image` and `last_frame_image` must be sent **together**. * `img_references` accepts **1 to 7** entries. * First/Last-frame mode accepts only **5 or 8** second `duration`. * `size` is honored only in text-to-video and multi-reference fusion. *** ## Request body ### `model` — required `string`. Always `"pixverse-v6"`. ### `prompt` — string, required Up to **5,000 characters**. Required in every mode. Empty / whitespace-only prompts are treated as missing. ### `resolution` — string, default `"540p"` One of `360p` / `540p` / `720p` / `1080p`. Drives pricing. ### `duration` — integer, default `5` Output length in seconds. Any integer in `[1, 15]`. First/Last-frame mode accepts only `5` or `8`. Drives pricing linearly: `ceil(per_second_usd × duration × 1000)` credits (1 credit = $0.001). ### `size` — string, default `"16:9"` Output aspect ratio. Honored in **text-to-video** and **multi-reference fusion** only (other modes derive the ratio from the source media). One of: | Value | Shape | | ------ | -------------- | | `16:9` | Landscape | | `4:3` | Landscape 4:3 | | `1:1` | Square | | `3:4` | Portrait 3:4 | | `9:16` | Portrait | | `2:3` | Portrait 2:3 | | `3:2` | Landscape 3:2 | | `21:9` | Cinematic wide | ### `seed` — integer, default `0` Reproducibility hint. Range `[0, 2147483647]`. Same prompt plus seed returns a similar (not bit-for-bit identical) result. ### `negative_prompt` — string Up to **2,048 characters**. Describes content to keep out of the frame. ### `audio` — boolean, default `false` When `true`, the model synthesizes a soundtrack alongside the video. Audio **raises the per-second rate** (see Pricing). Default `false` is silent. ### `watermark` — boolean, default `false` When `true`, adds a watermark to the bottom-right corner. ### `motion_mode` — string `pixverse-v6` supports only `"normal"`. Other values are rejected upstream. ### `generate_multi_clip_switch` — boolean, default `false` When `true`, generates a multi-segment continuous video. Supported in **text-to-video** and **image-to-video** only. ### `image_urls` — string\[] (image-to-video) Public HTTP(S) URL array. The model uses the **first** entry as the starting frame. ### `first_frame_image` / `last_frame_image` — string (first/last-frame) Public HTTP(S) URLs. Must be sent **as a pair**; the model interpolates motion from the first frame to the last over a 5 or 8 second clip. ### `img_references` — string\[] (multi-reference fusion) **1 to 7** public HTTP(S) URLs. The model fuses subjects from each reference into one clip. ### `extend_from_task_id` — string (video extend) The reAPI task id (`task_...`) of one of **your own completed `pixverse-v6`** videos. Do not pass the upstream provider task id — reAPI resolves that internally before sending the extend request. The model continues the scene from where that clip ended. Clips generated before the October 24, 2026 update cannot be extended; the request returns `400` before any charge. **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field on this endpoint must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. *** ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "pixverse-v6", "status": "completed", "created_at": 1735000000, "output": { "video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"] }, "error": null } ``` | Field | Type | Notes | | ------------ | -------------- | ------------------------------------------------------- | | `id` | string | Task identifier — keep it for polling and audit | | `model` | string | Echo of the submitted `model` | | `status` | string | `processing` / `completed` / `failed` | | `created_at` | integer | Submission unix timestamp | | `output` | object \| null | `null` until completion. `output.video_urls` holds MP4s | | `error` | object \| null | Populated on `failed` — `{ code, message }` | `output.video_urls` URLs are valid for **7 days**. Re-host to your own storage if you need them longer. To extend a clip later, keep the task `id` — pass it as `extend_from_task_id`. *** ## Validation errors All cases below return HTTP 400. Pattern-match on `code`, not `message` — message strings carry request-specific context (field names, observed values) and are not a stable contract. | Trigger | Code | Message (illustrative) | | ------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------- | | `prompt` missing / empty | `20002` | `prompt is required` | | `prompt` longer than 5,000 chars | `20007` | `prompt exceeds 5000 characters (got N)` | | Unknown `resolution` | `20003` | `invalid resolution "X" (allowed: 360p / 540p / 720p / 1080p)` | | `duration` outside `[1, 15]` | `20003` | `duration must be 1-15 seconds, got N` | | `duration` not 5/8 in first/last-frame mode | `20003` | `first-last-frame transition supports only 5 or 8 second duration` | | Only one of `first_frame_image` / `last_frame_image` | `20003` | `first_frame_image and last_frame_image must be provided together` | | `img_references` length > 7 | `20003` | `img_references supports at most 7 images, got N` | | `motion_mode` not `normal` | `20003` | `motion_mode must be "normal"` | | A URL field carrying a `data:` URI or non-http(s) | `20003` | `image_urls entries must be public http(s) URLs` | | `extend_from_task_id` points at a clip from before 2026-10-24 | `20003` | `This source task can no longer be extended; generate a new pixverse-v6 clip and extend that one` | The full envelope is `{ "error": { "code", "message", "request_id" } }` — see [Errors catalog](/docs/api/errors) for the wire format and request\_id correlation tips. *** ## Recipes ### Text-to-video — minimum request ```json { "model": "pixverse-v6", "prompt": "A corgi running through a sunflower field at golden hour" } ``` ### Text-to-video — full parameters ```json { "model": "pixverse-v6", "prompt": "A neon-lit Tokyo alley at night, light rain, anamorphic lens flare", "size": "21:9", "resolution": "720p", "duration": 8, "seed": 42, "audio": true } ``` ### Image-to-video — animate a single frame ```json { "model": "pixverse-v6", "prompt": "Camera slowly zooms in, gentle wind moves the leaves", "image_urls": ["https://your-cdn.com/first_frame.jpg"], "resolution": "540p", "duration": 5 } ``` ### First/Last-frame transition ```json { "model": "pixverse-v6", "prompt": "Transform smoothly from a puppy to a cat", "first_frame_image": "https://your-cdn.com/puppy.jpg", "last_frame_image": "https://your-cdn.com/cat.jpg", "resolution": "540p", "duration": 5 } ``` ### Multi-reference fusion ```json { "model": "pixverse-v6", "prompt": "A girl wearing the outfit from image 2, holding the cat from image 3", "img_references": [ "https://your-cdn.com/character.jpg", "https://your-cdn.com/outfit.jpg", "https://your-cdn.com/cat.jpg" ], "size": "9:16", "resolution": "720p", "duration": 5 } ``` ### Video extend ```json { "model": "pixverse-v6", "prompt": "The character now walks into a forest", "extend_from_task_id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "resolution": "540p", "duration": 5 } ``` *** ## Choosing a mode | Need | Send | | ------------------------------------ | -------------------------------------------------------- | | Generate from text | `prompt` only — `size` applies | | Animate a still | `prompt + image_urls` | | Smooth transition between two frames | `first_frame_image + last_frame_image` (duration 5/8) | | Combine subjects from several images | `prompt + img_references` (1–7) | | Continue an existing clip | `prompt + extend_from_task_id` | | Cut spend | Drop `resolution`, shorten `duration`, leave `audio` off | *** ## Polling pattern The task endpoint behaves identically to other video tasks — the completed `output` carries `video_urls`. A pragmatic schedule: ``` 0–5 minutes: poll every 5s 5 min – 1 h: back off gradually toward 1 min ≥ 1 h: cap at 3 min between polls ``` A typical task completes in a few minutes. *** ## Pricing Per-second × resolution. Turning **audio** on raises the per-second rate at every tier; every other parameter is free. See current rates on the [Pixverse v6 model page](https://reapi.ai/models/pixverse-v6). **Bill formula** (1 credit = $0.001): ``` credits = ceil(per_second_usd × duration × 1000) ``` Failed jobs refund automatically. *** ## Tips * **Prompt motion, not just scene.** "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen. * **Keep references on-topic.** Multi-reference fusion works best when each image contributes a distinct, clearly-framed subject (a face, an outfit, a prop) rather than overlapping whole scenes. * **Two frames need to make sense as endpoints.** First/Last interpolation is smoothest when the two frames share enough subject and composition. * **Chain extends one beat at a time.** Build a longer sequence by extending the latest clip's task id repeatedly instead of asking for one long shot. * **Audio is opt-in here.** Leave `audio` off unless you need a soundtrack — it raises the per-second rate. *** ## Related * [PixVerse V6 Max](/docs/pixverse-v6-max) — text and one-image video, the Max tier of V6 * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) --- # qwen-image-2.1 (https://reapi.ai/docs/qwen-image-2-1) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Alibaba's unified Qwen image model on reAPI — one async endpoint for > **generation and editing**. Qwen Image 2.1 writes **native transparent** > PNG / WebP output, combines up to **10 reference images** into one result, > and edits a single **masked region** while leaving the rest of the image > untouched. Mode is implicit: no `image_urls` → text-to-image; `image_urls` → > image-to-image; `image_urls` + `mask_url` → local edit. See pricing on the > [model page](https://reapi.ai/models/qwen-image-2-1). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-image-2.1", "prompt": "A cute cartoon dragon sticker, bold outline", "background": "transparent", "resolution": "2K" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "qwen-image-2.1", "prompt": "A cute cartoon dragon sticker, bold outline", "background": "transparent", "resolution": "2K", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "qwen-image-2.1", prompt: "A cute cartoon dragon sticker, bold outline", background: "transparent", resolution: "2K", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "qwen-image-2.1", "prompt": "A cute cartoon dragon sticker, bold outline", "background": "transparent", "resolution": "2K", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; poll the task endpoint until it completes. Polling does not consume credits. A 1K image typically takes seconds; 2K takes noticeably longer, up to a few minutes with reference images. ## Request body One image per request — there is no `n`. | Field | Type | Default | Notes | | ---------------- | --------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `qwen-image-2.1`. **Required.** | | `prompt` | string | — | 1–5000 characters, any language. **Required.** With several references, name them by position ("the first image", "the second image"). With `mask_url`, describe what should appear inside the white area. | | `image_urls` | string\[] | — | 1–10 reference images; setting it switches to image-to-image. The order is the order the prompt refers to. JPEG / PNG / WebP, each up to 30 MB and 25 MP, public HTTP(S) URLs that answer a plain GET. | | `mask_url` | string | — | Black-and-white inpainting mask — white is changed, black is kept. Switches to local-edit mode — see [Local edits](#local-edits-with-mask_url). | | `aspect_ratio` | string | `1:1` / `auto` | `1:1` / `4:3` / `3:4` / `3:2` / `2:3` / `16:9` / `9:16` / `21:9` / `9:21`, plus `auto` with `image_urls`. Default is `1:1` for text-to-image and `auto` (nearest supported ratio of the first reference) for image-to-image. Ignored in local-edit mode. | | `resolution` | string | `1K` | `1K` / `2K`. 2K has four times the pixels and bills at twice the 1K rate. `4K` is not available. | | `background` | string | `opaque` | `opaque` / `transparent`. `transparent` returns a real alpha channel — see [Transparent output](#transparent-output). | | `output_format` | string | `png` | `png` / `webp` / `jpeg`. PNG and WebP carry alpha; JPEG cannot be combined with `background: "transparent"`. | | `enhance_prompt` | boolean | `true` | Rewrites the prompt into a fuller scene description before generating. Pass `false` to follow your prompt literally. Ignored in local-edit mode. | | `seed` | integer | — | Omitted → random. The same seed with the same prompt and parameters reproduces the same image. | | `content_filter` | boolean | `true` | Safety checking — see [`content_filter`](#content_filter--boolean-default-true) below. | Checked before anything is submitted or charged: * `aspect_ratio: "auto"` needs `image_urls` * `mask_url` needs exactly one `image_urls` entry * `mask_url` cannot be combined with `background: "transparent"` * `output_format: "jpeg"` cannot be combined with `background: "transparent"` * at most 10 `image_urls`; every media field is a public HTTP(S) URL ### Transparent output Set `background: "transparent"` and Qwen Image 2.1 returns a PNG (or WebP) with a real alpha channel — no separate background-removal step. Describe the subject only: a prompt that mentions a scene, surface or backdrop may come back opaque. With a reference image, the same setting edits a transparent layer or cuts a subject out of an ordinary photo. ```json { "model": "qwen-image-2.1", "prompt": "Extract the sneaker as a clean product cutout", "image_urls": ["https://example.com/sneaker-on-street.jpg"], "background": "transparent", "output_format": "png" } ``` ### Local edits with `mask_url` Send exactly one reference image and a mask of the same aspect ratio (a mask of a different size is scaled to it). White marks the area to change, black is kept; a few pixels of feathering along the edge help the blend. In this mode the output follows the reference image's shape, so `aspect_ratio` and `enhance_prompt` are ignored. ```json { "model": "qwen-image-2.1", "prompt": "A green velvet armchair", "image_urls": ["https://example.com/living-room.jpg"], "mask_url": "https://example.com/living-room-mask.png" } ``` ### `content_filter` — boolean, default `true` Screens the request and output. Enabled by default; pass `content_filter: false` from an API key to turn it off. Requests from the playground always run with the filter on. A request the filter rejects fails and the reserved credits are refunded. With `content_filter: false`, the output is stored in an isolated bucket and its URLs stay valid for 30 days — mirror the files if you need them longer. ## Troubleshooting | Failure | What it means | What to do | | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | Synchronous 400 on submit | A field breaks one of the rules above (auto ratio without references, mask with two references, transparent JPEG, `4K`, 11 references, …) | The error names the field — fix and resubmit; nothing was charged | | Task fails citing a reference URL | A reference or mask URL did not return the file (4xx from the origin, or the domain does not resolve) | Make sure every URL answers a plain GET without cookies or signed headers; fully refunded | | Transparent request returns an opaque image | The prompt described a background, scene or surface | Describe only the subject when `background` is `transparent` | | Fine details lost with many references | Each extra reference leaves less detail for the others | Stay within four references when fidelity matters; use a landscape ratio such as `3:2` or `16:9` for group shots | | `402` on submit | Not enough credits for the reserve | Top up your balance | **No `data:` URIs.** reAPI rejects base64 inputs platform-wide — every URL field must be a public HTTP(S) URL. Upload to your own object storage (S3, R2, OSS, …) and pass the URL. ## Response envelope Submit and poll share the same shape — only `status` and `output` fill in over time. ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "qwen-image-2.1", "status": "completed", "created_at": 1758600000, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/.../0.png"] }, "error": null } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. `output.image_urls` holds the single generated image. Generated URLs expire — mirror them to your own storage for long-term use. Failures return `{ error: { code, message, request_id } }`; the full catalog is at [/docs/api/errors](/docs/api/errors). ## Pricing Qwen Image 2.1 bills **per delivered image**, at a rate set by `resolution`: ``` credits = ceil(per_image_rate[resolution] × 1000) 1 credit = $0.001 ``` 1. **Resolution is the only price dimension.** 2K costs twice 1K; an omitted `resolution` bills as 1K. 2. **Mode does not change the price.** Text-to-image, image-to-image and masked edits cost the same at the same resolution. 3. **Reference images are free.** One or ten references, the price is the same. 4. **Failed generations are refunded** in full. Live per-image rates are on the [model page](https://reapi.ai/models/qwen-image-2-1) — that table is generated from the current price, so it is always the authoritative number. ## Related * [Errors catalog](/docs/api/errors) * [Authentication](/docs/api/authentication) * [Quickstart](/docs/api/quickstart) * [Qwen Image 3.0](/docs/qwen-image-3) * [Qwen Image 2](/docs/qwen-image-2) --- # qwen-image-2 (https://reapi.ai/docs/qwen-image-2) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Alibaba's Qwen Image 2 on reAPI — one async endpoint for **generation and > editing**. Write a prompt for **text-to-image**, or attach one source image > to **edit it in plain language**. Known for **structured in-image text** > (posters, slides, infographics, comics). Submit returns a `task_id`; poll > until ready. See current pricing on the > [model page](https://reapi.ai/models/qwen-image-2). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-image-2", "prompt": "a vintage travel poster that reads VISIT MARS in bold retro type", "image_size": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "qwen-image-2", "prompt": "a vintage travel poster that reads VISIT MARS in bold retro type", "image_size": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "qwen-image-2", prompt: "a vintage travel poster that reads VISIT MARS in bold retro type", image_size: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "qwen-image-2", "prompt": "a vintage travel poster that reads VISIT MARS in bold retro type", "image_size": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "qwen-image-2", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the generated image URL. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Modes There is no `mode` field — the modality is implicit in the request shape: * **Text-to-image** — no `image_url`. `prompt` is required. * **Image editing** — pass a single `image_url`. `prompt` describes the change (background swap, object edit, restyle, in-frame text rewrite). Each request produces **exactly one image** — there is no `n` parameter. *** ## Request body ### `model` — string, required Must be `qwen-image-2`. ### `prompt` — string, required Up to **800 characters**. Required for both text-to-image and editing. ### `image_url` — string, optional A single source image for editing. **Public HTTPS URL only** — base64 / `data:` URIs are rejected at the gateway. Passing it switches the request to editing mode; omit it for text-to-image. ### `image_size` — string, optional, default `16:9` Output aspect ratio. * **Text-to-image** accepts: `1:1`, `3:4`, `4:3`, `9:16`, `16:9`. * **Editing** additionally accepts: `2:3`, `3:2`, `21:9`. `2:3`, `3:2`, and `21:9` are **editing-only**. Requesting one without an `image_url` (text-to-image) is rejected with `400`. ### `output_format` — string, optional, default `png` One of `png` or `jpeg`. ### `seed` — integer, optional The same seed with the same prompt yields a repeatable result. ### `content_filter` — boolean, optional, default `false` Enables upstream content moderation. Off by default. *** ## Pricing Qwen Image 2 bills a flat rate **per generated image**, independent of modality, resolution, and aspect ratio. Each request produces one image: ``` credits = ceil(per_image_usd × 1000) ``` where `1 credit = $0.001 USD`. Failed and rejected requests are not charged. The exact per-image credit cost surfaces on the [model page](https://reapi.ai/models/qwen-image-2) and through the playground estimator before submit. *** ## Response The poll envelope returns the image URL in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "qwen-image-2", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...png" ] } } ``` Generated URLs expire — mirror them to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (prompt over 800 characters, an editing-only `image_size` in text-to-image, a non-HTTPS `image_url`) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * The modality is decided by your inputs, not a flag — omit `image_url` for generation, include it to edit. * Put the literal text you want rendered **in the prompt** — Qwen Image 2 is tuned for legible in-image typography, so spelling out headline copy works. * For wide layouts, `21:9` is available only when editing (pass an `image_url`). * To produce a set of images, send multiple requests — each is billed as one image. *** ## Related * [Image generation models](/docs/gpt-image-2) * [Wan 2.7 Image](/docs/wan-2-7-image) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # qwen-image-3 (https://reapi.ai/docs/qwen-image-3) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > Alibaba's third-generation Qwen image model on reAPI — one async endpoint for > **generation and editing**. Prompts up to **\~4.5k tokens** compose whole-page > layouts (newspapers, storyboards, exam papers, infographic grids) in a single > pass, with text legible down to **10px** across **12 languages**. Two tiers: > `qwen-image-3.0` (1K and 2K cost the same) and `qwen-image-3.0-pro` (tuned for > dense text and layout; 2K costs twice 1K). ## Quick example ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-image-3.0-pro", "prompt": "A cafe menu board, three columns - appetizers, mains, desserts - five dishes each with prices, serif headings, cream paper background", "size": "3:4", "resolution": "2K", "n": 1 }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "qwen-image-3.0-pro", "prompt": "A cafe menu board, three columns - appetizers, mains, desserts - five dishes each with prices, serif headings, cream paper background", "size": "3:4", "resolution": "2K", "n": 1, }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "qwen-image-3.0-pro", prompt: "A cafe menu board, three columns - appetizers, mains, desserts - five dishes each with prices, serif headings, cream paper background", size: "3:4", resolution: "2K", n: 1, }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "qwen-image-3.0-pro", "prompt": "A cafe menu board, three columns - appetizers, mains, desserts - five dishes each with prices, serif headings, cream paper background", "size": "3:4", "resolution": "2K", "n": 1, }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ### Submit response ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "qwen-image-3.0-pro", "status": "processing", "created_at": 1735000000 } ``` Poll `GET /api/v1/tasks/{id}` (see the [Tasks](/docs/api/tasks) reference) until `status === "completed"`. The completed payload's `output.image_urls` holds the generated image URLs. *** ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` *** ## Endpoint ```http POST /api/v1/images/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a `task_id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. *** ## Tiers Two model ids share one parameter shape: | Model id | Tier | Resolution pricing | | -------------------- | -------- | ----------------------- | | `qwen-image-3.0` | Standard | 1K and 2K cost the same | | `qwen-image-3.0-pro` | Pro | 2K costs twice 1K | Pick Pro for dense text and layout work — menus, newspapers, storyboards, exam papers. Standard is the cheaper general-purpose tier and is the better default when the output is a single illustration or photo. ## Modes The mode is implicit in the request shape — there is no `mode` field: | Inputs | Mode | | ----------------------- | ----------------------------------------- | | `prompt` only | Text-to-image | | `prompt` + `image_urls` | Image-to-image / editing (1-3 references) | Each reference image adds a per-request charge on top of the image price — see [Pricing](#pricing). *** ## Request body ### `model` — string, required `qwen-image-3.0` or `qwen-image-3.0-pro`. See [Tiers](#tiers). ### `prompt` — string, required What to draw or how to edit. The upstream model accepts roughly **4.5k tokens**, which is enough to describe a full multi-column page in one request. The limit is counted in tokens rather than characters, so an over-long prompt is rejected upstream rather than by a character count on reAPI's side. ### `image_urls` — array, optional 1-3 public image URLs to edit or draw from. Supplying them switches the request to image-to-image. Public `http(s)` URLs only. Base64 payloads and `data:` URIs are rejected by reAPI on every model. Accepted source formats: JPG / JPEG / PNG / BMP / TIFF / WEBP / GIF, up to 10 MB each. ### `n` — integer, default `1` How many images to return, `1`-`6`. Every delivered image is billed, so `n: 6` costs six images. ### `size` — string, default `1:1` Aspect ratio, or an explicit pixel size. Documented ratios: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `3:2`, `2:3` The field also accepts `16x9` style and explicit pixels such as `1600x900`. For custom pixels each edge must be **512-2048** and the aspect ratio must fall between 1:8 and 8:1. Ratio and tier combine as follows: | Resolution | 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 3:2 | 2:3 | | ---------- | --------- | --------- | --------- | --------- | --------- | --------- | --------- | | **1K** | 1024×1024 | 1152×864 | 864×1152 | 1280×720 | 720×1280 | 1248×832 | 832×1248 | | **2K** | 2048×2048 | 2048×1536 | 1536×2048 | 2048×1152 | 1152×2048 | 2048×1360 | 1360×2048 | A raw pixel `size` whose area exceeds **2.25M pixels** is billed at the **2K** rate even if you did not send `resolution`. On the Pro tier that is twice the 1K rate — name the tier explicitly if you want to control the bill. ### `resolution` — string, default `1K` `1K` or `2K` (lowercase is accepted and normalised). On `qwen-image-3.0` both tiers cost the same; on `qwen-image-3.0-pro` `2K` costs twice `1K`. ### `negative_prompt` — string, optional Content to keep out of the image. ### `prompt_extend` — boolean, default `false` Enables intelligent prompt rewriting before generation. Note this defaults to **false** here — the 2.0 series defaulted to true. Turn it on for terse prompts; leave it off when you have written a precise layout brief you want followed literally. ### `prompt_extend_mode` — string, optional How aggressively the prompt is rewritten. Requires `prompt_extend: true`. | Value | Behaviour | | -------- | ----------------------------------------------- | | `direct` | Works for both text-to-image and image-to-image | | `agent` | More aggressive rewrite; **text-to-image only** | Sending `prompt_extend_mode` without `prompt_extend: true`, or `agent` together with `image_urls`, returns a `400`. ### `content_filter` — boolean, default `true` Screens the prompt and reference images before generation. Enabled by default; pass `content_filter: false` from an API key to turn it off. Requests from the playground always run with the filter on. A request the filter rejects fails before any image is generated, and the reserved credits are refunded. *** ## Pricing Qwen Image 3.0 bills **per successfully generated image**, plus a charge for each reference image. Total charge is the per-image rate for the selected tier and resolution times `n`, plus the per-reference rate times the number of distinct reference images: ``` credits = ceil((per_image_usd × n + per_reference_usd × references) × 1000) ``` where `1 credit = $0.001 USD`. The rate depends on the model id and, on Pro, the resolution tier: | Model id | Rate dimension | | -------------------- | ---------------------------------------- | | `qwen-image-3.0` | One rate for every resolution | | `qwen-image-3.0-pro` | One rate for `1K`, a higher one for `2K` | References are charged **once per request**, not once per output image, so `n: 4` with two references pays for four images and two references. Duplicate URLs count once. Failed and rejected requests are not charged. The exact per-image credit cost for each row surfaces on the [model page](https://reapi.ai/models/qwen-image-3) and through the playground estimator before submit. *** ## Response The poll envelope returns image URLs in `output.image_urls`: ```json { "id": "task_019dfd44b7fd74168541552a3260a623", "model": "qwen-image-3.0-pro", "status": "completed", "output": { "image_urls": [ "https://cdn.reapi.ai/...png" ] } } ``` For `n > 1`, `image_urls` holds every delivered image. Mirror the URLs to your own storage if you need long-term retention. *** ## Errors Failures return the standard reAPI envelope `{ error: { code, message, request_id } }`. Common cases: * Invalid input (`n` outside 1-6, more than 3 `image_urls`, a custom pixel edge outside 512-2048, an invalid ratio, `prompt_extend_mode` without `prompt_extend: true`, `agent` mode with `image_urls`, a non-HTTPS media URL) → `400`. * Insufficient credits → `402`. * Rate limited → `429`. See the full catalog at [/docs/api/errors](/docs/api/errors). *** ## Tips * The mode is decided by your inputs, not a flag — omit `image_urls` for pure generation, include it to edit. * Spend the prompt budget. This model is built for long, structural briefs: describe the masthead, each column, the captions and the sidebar in one request instead of generating pieces and assembling them. * Draft at `1K` and re-run only the winner at `2K`. On the Pro tier that halves the cost of iteration. * Leave `prompt_extend` off when your prompt is already a precise layout spec — rewriting can restructure a brief you wrote deliberately. * Reach for `qwen-image-3.0-pro` when the image has to carry a lot of small text; use `qwen-image-3.0` for general illustration and photography. *** ## Related * [Qwen Image 2](/docs/qwen-image-2) * [Wan 2.7 Image](/docs/wan-2-7-image) * [Tasks API](/docs/api/tasks) * [Error codes](/docs/api/errors) --- # reapi-video-1 (https://reapi.ai/docs/reapi-video-1) import { Callout } from 'fumadocs-ui/components/callout'; import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; > reAPI's video generation model, built on MiniMax H3. One request makes the > whole scene, picture and sound together: a 5–15 second clip with its own > dialogue, ambience and effects. Unlike most video models on reAPI, the mode > is an explicit field — `mode` picks text to video, image to video or > reference to video. See pricing on the > [model page](https://reapi.ai/models/reapi-video-1). ## Quick example ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "reapi-video-1", "mode": "text_to_video", "prompt": "A lighthouse keeper in a wool coat stands on a wet stone pier at dawn and says, \"The fog lifts at seven.\" Locked-off shot, waves slapping the stones, no music.", "duration": 5, "resolution": "768p", "aspect_ratio": "16:9" }' ``` ```python import requests resp = requests.post( "https://reapi.ai/api/v1/videos/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, json={ "model": "reapi-video-1", "mode": "text_to_video", "prompt": "A lighthouse keeper in a wool coat stands on a wet stone pier at dawn and says, \"The fog lifts at seven.\" Locked-off shot, waves slapping the stones, no music.", "duration": 5, "resolution": "768p", "aspect_ratio": "16:9", }, timeout=30, ) print(resp.json()) ``` ```js const r = await fetch("https://reapi.ai/api/v1/videos/generations", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "reapi-video-1", mode: "text_to_video", prompt: 'A lighthouse keeper in a wool coat stands on a wet stone pier at dawn and says, "The fog lifts at seven." Locked-off shot, waves slapping the stones, no music.', duration: 5, resolution: "768p", aspect_ratio: "16:9", }), }); console.log(await r.json()); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { body, _ := json.Marshal(map[string]any{ "model": "reapi-video-1", "mode": "text_to_video", "prompt": `A lighthouse keeper in a wool coat stands on a wet stone pier at dawn and says, "The fog lifts at seven." Locked-off shot, waves slapping the stones, no music.`, "duration": 5, "resolution": "768p", "aspect_ratio": "16:9", }) req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(string(out)) } ``` ## Authentication Every call needs a Bearer token. Generate keys at [reapi.ai/settings/apikeys](https://reapi.ai/settings/apikeys). ```http Authorization: Bearer YOUR_API_KEY ``` ## Endpoint ```http POST /api/v1/videos/generations GET /api/v1/tasks/{id} ``` Submission is async. The POST returns immediately with a task `id`; the task endpoint returns the same envelope until completion. Polling does not consume credits. ## Request body | Field | Type | Default | Notes | | -------------------- | --------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | string | — | `reapi-video-1`. **Required.** | | `mode` | enum | `reference_to_video` | `text_to_video`, `image_to_video` or `reference_to_video`. The short forms `t2v`, `i2v` and `ref2va` are accepted. See [Modes](#modes). | | `prompt` | string | — | 1 to 32,000 characters. Describes the picture **and** the sound. **Required.** | | `duration` | integer | `5` | Any whole number of seconds from `5` to `15`. | | `resolution` | enum | `768p` | `480p` or `768p`. | | `aspect_ratio` | enum | by mode | `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, plus `adaptive` in `reference_to_video` only. `text_to_video` defaults to `16:9`, `reference_to_video` to `adaptive`; `image_to_video` always follows the first frame. | | `prompt_enhancement` | enum | `turbo` | `turbo` (fast expansion), `quality` (more thorough) or `disabled` (the prompt is used word for word). | | `seed` | integer | random | `0`–`4294967295`. The same prompt and seed return the same clip; omitted → a new random seed per request. | | `image` | object | — | `image_to_video` only, **required** there. The literal first frame: `{ "type": "url", "url": "https://…" }`. | | `reference_images` | object\[] | `[]` | `reference_to_video` only. Up to 9 `{ "type": "url", "url" }` objects. | | `reference_videos` | object\[] | `[]` | `reference_to_video` only. Up to 3. Only the first 5 seconds of each clip are read. | | `reference_audio` | object\[] | `[]` | `reference_to_video` only. Up to 3. | The schema is strict: unknown fields are rejected rather than ignored. `callback_url` / `callback_id` are not accepted — poll the task, or set a webhook on your API key. Checked before anything is submitted or charged: * `prompt` is 1–32,000 characters; `duration` is a whole number 5–15 * `image` is present in `image_to_video` and absent in the other modes * `reference_images`, `reference_videos` and `reference_audio` carry values only in `reference_to_video` (an empty list or `null` passes in any mode) * `reference_to_video` has at least one reference image or video, and at most 9 images, 3 videos, 3 audio clips and 12 references in total * `adaptive` is used only in `reference_to_video` * every media object is exactly `{ "type": "url", "url": "" }` * each reference video's length can be measured (it is billed — see [Pricing](#pricing)); an unreadable file is rejected with nothing charged ## Modes | Mode | Requires | Takes | | ------------------------------ | -------------------------------------------------- | --------------------------------------------------------- | | `text_to_video` | `prompt` | the shared fields | | `image_to_video` | `prompt` and `image` | `image` as the first frame | | `reference_to_video` (default) | `prompt` and at least one reference image or video | `reference_images`, `reference_videos`, `reference_audio` | `image_to_video` treats the image as the literal first frame, so the clip opens exactly as that still looks. To place a product or a person into a scene of your own, use `reference_to_video` and describe the scene around it. ### Referencing media in the prompt In `reference_to_video`, list order becomes the label you use in the prompt. The first entry of `reference_images` is ``, the second ``; the first entry of `reference_videos` is `
", "prompt": "", "content_filter": false } ``` This option is model-specific, not a global request parameter. It selects a less restrictive moderation path; it does **not** disable safety review. The hosted Playground keeps moderation enabled, and upstream policy checks still apply, so a request can still return `80006`. Check the selected model's parameter list before sending it. Refund behavior depends on where the verdict occurred and on the selected model's documented policy. Check the failed task's `usage.credits`: `0` means the reservation was fully refunded; a positive value means a post-generation charge was retained. ## Recommended handling ```python import requests, time def safe_call(method, url, **kwargs): for attempt in range(3): r = requests.request(method, url, **kwargs) body = r.json() if r.status_code == 200: return body if r.status_code == 429: time.sleep(int(r.headers.get('Retry-After', '5'))) continue if r.status_code in (502, 503, 504): time.sleep(2 ** attempt) continue raise RuntimeError( f"{body['error']['code']}: {body['error']['message']}" ) raise RuntimeError("max retries exceeded") ``` ### What to retry vs not | HTTP | Retry? | | ----------------------- | ------------------------------ | | 200 | n/a | | 400 / 401 / 402 / 404 | ❌ Fix the request | | 429 | ✅ With `Retry-After` | | 500 — `60001` / `60002` | ⚠️ Credits refunded, re-submit | | 500 — `60099` | ✅ Idempotent retry safe | | 502 / 503 / 504 | ✅ Exponential backoff | ## Support When reporting an issue, include: * The `request_id` from the response * The full request URL + method * Approximate timestamp (UTC) Email: [support@reapi.ai](mailto:support@reapi.ai) --- # Overview (https://reapi.ai/docs/api) The reAPI HTTP API exposes image, video, audio, and text models through one set of endpoints at `https://reapi.ai/api/v1`, authenticated with `Authorization: Bearer YOUR_API_KEY`. Generation is asynchronous: a submit returns a task `id`, and you poll `GET /api/v1/tasks/{id}` until it reports `completed` or `failed`. Billing runs on credits, where 1 credit is $0.001. Credits are reserved when a request is accepted and settled when the task reaches a terminal state: a task that fails is refunded, and a task that costs less than the reserved amount gets the difference back. The one exception is documented per model — a model that runs a post-generation content check can charge for a generation the check blocks, because the generation itself already happened. ## Base URL ``` https://reapi.ai/api/v1 ``` All endpoints accept and return JSON. The API mirrors OpenAI's conventions where it makes sense — many existing OpenAI clients work by changing only `base_url`. ## Authentication Every request must carry an API key as a Bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Create keys in your [dashboard](https://reapi.ai/settings/apikeys). See [Authentication](/docs/api/authentication) for full details. ## Asynchronous tasks (image, video) Generation calls are **asynchronous**. The pattern is: 1. **POST** the model endpoint (e.g. `/api/v1/images/generations`) → returns a `task_id` immediately. 2. **GET** `/api/v1/tasks/{task_id}` periodically until `status` is `completed` or `failed`. ``` ┌──────────┐ ┌──────────┐ ┌──────────┐ │ POST │ → │processing│ → │ completed│ │ /images/ │ └──────────┘ │ failed │ │generations│ └──────────┘ └──────────┘ │ ▼ output / error ``` Recommended polling cadence: **1 request every 1–2 seconds**. For details see [Tasks](/docs/api/tasks). Per-model request schemas are on each model's page in the **Models** sidebar. ## Credits Each call deducts credits from your balance. Failed tasks are **automatically refunded** by the worker the moment the workflow ends in failure — atomically, before any poll observes the `failed` status. The exception is a model that runs a post-generation content check: when that check blocks an output, the task ends `failed` and is still charged, because the generation itself completed. Those models say so on their own page. Refund is one-shot; re-polling never refunds twice. Pricing per model is configured in your account dashboard. ## Idempotency reAPI does **not** deduplicate by `Idempotency-Key`. Every successful HTTP POST to a generation endpoint creates a new task and charges credits — by design, so no upstream provider call is ever silently skipped. If you need retry safety, generate the same payload only once on your side or rely on the natural recovery path: when a task fails, credits are refunded automatically and you can resubmit. The `Idempotency-Key` header is currently accepted and recorded for telemetry but does **not** alter request behavior. Don't rely on it to prevent duplicate charges. ## Rate limits Requests are limited **per user**, in 1-second windows. The default is **50 requests / second / user**. When exceeded, you get HTTP `429` with code `50001` and a `Retry-After` header. Polling `GET /api/v1/tasks/{id}` shares the same limit, so don't poll faster than once every 1–2 seconds per task. ## Response format Successful responses are JSON of the resource type. Errors follow a standard shape: ```json { "error": { "code": 20002, "message": "Both `model` and `prompt` are required", "request_id": "req_8a4f0d2e-1c8b-4f1a-9e2d-3b7c5a6f0a1b" } } ``` `code` is a 5-digit numeric identifier (see [Errors](/docs/api/errors) for the full catalog). `request_id` is unique per call — include it in support requests. --- # MCP Server (https://reapi.ai/docs/api/mcp) reAPI runs a remote [Model Context Protocol](https://modelcontextprotocol.io) server, so an AI agent can list models, submit image, video, audio and text tasks, and fetch results without you writing any integration code. ```text https://reapi.ai/api/mcp ``` * **Transport:** Streamable HTTP, stateless, one JSON-RPC message per HTTP request (batch arrays are rejected). * **Auth:** your reAPI API key as a Bearer token — `Authorization: Bearer YOUR_API_KEY`. Create one under **Dashboard → API Keys** ([Authentication](/docs/api/authentication)). * **Billing:** the same as the HTTP API. Every `submit_task` call is exactly one `POST` to the matching `/api/v1` endpoint and is billed the same way: a call that creates a task is charged for that task. Clients that can only sign in with OAuth (no custom header field) cannot connect yet. ## Connect a client ### Claude Code ```bash claude mcp add --transport http reapi https://reapi.ai/api/mcp \ --header "Authorization: Bearer YOUR_API_KEY" ``` ### Cursor Add to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project): ```json { "mcpServers": { "reapi": { "url": "https://reapi.ai/api/mcp", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ### Codex CLI Codex reads the key from an environment variable: ```bash export REAPI_API_KEY=YOUR_API_KEY codex mcp add reapi --url https://reapi.ai/api/mcp \ --bearer-token-env-var REAPI_API_KEY ``` Codex saves the variable name, not the key, so start Codex from a terminal where `REAPI_API_KEY` is set (for example, export it in your shell profile). ### VS Code Add to `.vscode/mcp.json`: ```json { "servers": { "reapi": { "type": "http", "url": "https://reapi.ai/api/mcp", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Any other client that supports remote Streamable HTTP servers with a custom `Authorization` header works the same way. ## Tools | Tool | What it does | Charges credits | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | | `list_models` | Lists the model ids `submit_task` accepts. Optional `endpoint`: `images`, `videos`, `audio` or `text`. | No | | `get_model_schema` | Returns the JSON Schema of a model's request body. Rules JSON Schema cannot express (conditional requirements, cross-field limits, case-insensitive values) are enforced by the API and listed on each model's docs page. | No | | `estimate_cost` | Returns the credits a `submit_task` call with this `model` and `input` would charge, without submitting. Token-billed models may settle differently; the final charge is `usage.credits` on `get_task`. | No | | `submit_task` | Submits one task: `model` plus `input` (the request body from `get_model_schema`). Returns a task id. | **Yes**, for every call that creates a task | | `get_task` | Returns a task's status and output. Optional `wait_seconds` (0–50) waits on the server while the task is still `processing`. | No | | `get_balance` | Returns the credit balance of the key's account. | No | `submit_task` is not idempotent. A retry creates and bills a second task, so check `get_task` or `get_balance` before retrying a call whose result you did not receive. ## Typical flow 1. `list_models` with `endpoint: "images"`. 2. `get_model_schema` for the model you picked. 3. Optionally `estimate_cost` to see the price first. 4. `submit_task` with `model` and an `input` that matches the schema. 5. `get_task` with `wait_seconds: 50`, repeated while `status` is still `processing`, then read `output`. Generation runs asynchronously, exactly like the HTTP API: `submit_task` returns as soon as the task is accepted and never waits for the result. `wait_seconds` saves the agent from polling in a loop; a long video may still need a few `get_task` calls. If a status check fails for a temporary reason during the wait (rate limit, server error, timeout), `get_task` returns the last `processing` snapshot instead of the error; call it again. Midjourney inpainting can stop at `status: "modal"`. Continue that same task with `submit_task`, passing `action: "modal"` and its `task_id` in `input` (see `get_model_schema` for `midjourney`). The call returns the original task id rather than creating a new task. ## Rules carried over from the HTTP API * Media inputs (`image_urls`, `video_url`, `audio_urls`, …) must be public `http(s)` URLs. Base64 and `data:` URIs are rejected. * When the HTTP API answers, its response body is the tool result unchanged, with the same [error codes](/docs/api/errors) and `request_id`. Errors raised before a request reaches it — an unknown model, invalid tool arguments, or a network failure — come back as a plain error message, and a rejected key or origin on the MCP endpoint itself is an HTTP error. * The per-user [rate limit](/docs/api#rate-limits) applies to MCP requests too, and at most 100 tasks can be processing at once per account — see [limits for agents](/docs/api/agents#limits-to-plan-around). * Model ids and parameters are the ones on each model's docs page. New models appear in `list_models` as soon as they launch. --- # Quickstart (https://reapi.ai/docs/api/quickstart) Every generation on reAPI takes the same three steps: POST a prompt to a generation endpoint, keep the `id` that comes back, then poll `GET /api/v1/tasks/{id}` every 1–2 seconds until `status` is `completed`. Requests authenticate with `Authorization: Bearer YOUR_API_KEY` against the base URL `https://reapi.ai/api/v1`. Billing is credit-based, where 1 credit is $0.001. Credits are reserved when the request is accepted and settled at the terminal state, so a task that ends in `failed` is refunded. See [Overview](/docs/api) for the one documented exception. ## 1. Get an API key Sign up at [reapi.ai](https://reapi.ai), then go to **Dashboard → API Keys → Create new key**. Copy it now — you won't see it again. Keys have no fixed prefix; use the full key exactly as shown. ## 2. Submit a generation task ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a cute red panda eating bamboo, photorealistic", "size": "1:1" }' ``` Response (immediately): ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "processing", "created_at": 1735000000 } ``` ## 3. Poll until done ```bash curl https://reapi.ai/api/v1/tasks/task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e \ -H "Authorization: Bearer YOUR_API_KEY" ``` Repeat every 1–2 seconds until `status` is `completed`: ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "completed", "created_at": 1735000000, "output": { "image_urls": [ "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png" ] }, "usage": { "credits": 56 }, "error": null } ``` That's it. Your image is at `output.image_urls[0]`. ## Full example (Node.js) ```js const KEY = process.env.REAPI_KEY; async function generate(prompt) { const submit = await fetch('https://reapi.ai/api/v1/images/generations', { method: 'POST', headers: { 'Authorization': `Bearer ${KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'gpt-image-2', prompt, }), }).then(r => r.json()); const taskId = submit.id; while (true) { await new Promise(r => setTimeout(r, 1500)); const task = await fetch(`https://reapi.ai/api/v1/tasks/${taskId}`, { headers: { 'Authorization': `Bearer ${KEY}` }, }).then(r => r.json()); if (task.status === 'completed') return task.output.image_urls; if (task.status === 'failed') throw new Error(task.error?.message ?? 'failed'); } } console.log(await generate('a cute red panda')); ``` ## Python ```python import os, time, requests KEY = os.environ['REAPI_KEY'] HEAD = {'Authorization': f'Bearer {KEY}'} submit = requests.post( 'https://reapi.ai/api/v1/images/generations', headers=HEAD, json={ 'model': 'gpt-image-2', 'prompt': 'a cute red panda', }, ).json() task_id = submit['id'] while True: time.sleep(1.5) task = requests.get(f'https://reapi.ai/api/v1/tasks/{task_id}', headers=HEAD).json() if task['status'] == 'completed': print(task['output']['image_urls']) break if task['status'] == 'failed': raise RuntimeError(task['error']) ``` ## Next steps * [API overview](/docs/api) — full conventions * [Tasks](/docs/api/tasks) — `GET /api/v1/tasks/{id}` polling reference * [gpt-image-2 model card](/docs/gpt-image-2) — capabilities + pricing * [Errors](/docs/api/errors) — error code reference --- # Tasks (https://reapi.ai/docs/api/tasks) Generation on reAPI is **asynchronous**. Every submission endpoint — `/api/v1/images/generations`, `/api/v1/videos/generations`, and any future `/api/v1/audio/generations` — returns a task id, and you poll `GET /api/v1/tasks/{id}` until the task reaches a terminal state. This page is the canonical reference for the polling endpoint. The request shape, status values, error codes, polling cadence, and refund semantics are the same regardless of which submission endpoint produced the task; only the contents of `output` differ by media kind. Midjourney adds a nonterminal `modal` state while a local repaint task waits for parameters. `modal_expires_at` is its Unix deadline. Send `action: "modal"` to the images endpoint with the same task ID; see [Midjourney](/docs/midjourney-v8). The initial reservation is settled once when the continued task finishes. ## GET /api/v1/tasks/\{id} Retrieve the current state of a task. ### Request ```http GET /api/v1/tasks/{id} Authorization: Bearer YOUR_API_KEY ``` `{id}` is the `id` returned by the submitting POST. Polling **does not consume credits**. For exact GPT Image token evidence, opt in without changing the legacy polling response used by existing clients: ```http GET /api/v1/tasks/{id}?include=billing Authorization: Bearer YOUR_API_KEY ``` Prefer not to poll at all? Pass a `webhook_url` when you submit and reAPI POSTs this same response to you when the task finishes — see [Webhooks](/docs/api/webhooks). This endpoint stays the guaranteed path: if a webhook delivery fails, the result is still here, and `?include=webhook` returns the delivery record so you can see what happened. ### Response `200 OK` — image task example: ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "model": "gpt-image-2", "status": "completed", "created_at": 1735000000, "output": { "image_urls": [ "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.png", "https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/1.png" ] }, "usage": { "credits": 56 }, "error": null } ``` `200 OK` — video task example: ```json { "id": "task_01k9s419324drezfbwnsvxyr6h", "model": "doubao-seedance-2.0", "status": "completed", "created_at": 1762853430, "output": { "video_urls": [ "https://cdn.reapi.ai/media/tasks/01k9s419324drezfbwnsvxyr6h/0.mp4" ] }, "usage": { "credits": 189 }, "error": null } ``` ### `usage` Backward-compatible whole-credit settlement summary. ```json "usage": { "credits": 189 } ``` `usage` is always present and `credits` is always an integer, in every state, so a polling client can read `usage.credits` without guarding the access. This legacy wire type is unchanged for existing generated clients. | State | `usage.credits` | | ------------ | ------------------------------------------------------- | | `processing` | `0` — nothing settled yet | | `modal` | `0` — Midjourney is waiting for continuation parameters | | `completed` | the amount charged | | `failed` | `0` — fully refunded (or the amount kept, if any) | `0` appears in two different situations, so pair it with `status`: `processing` + `0` means the task has not been billed yet, while `failed` + `0` means it was billed and refunded. **This is the rounded-up settled summary, not the reservation.** Submitting a request places a hold based on the parameters you sent. Once the task settles, the reservation is replaced by the final amount: excess reserve is returned, while an amount above the reserve is deducted from the remaining balance. How far the two diverge is model-specific. The cases below are examples, not universal behaviour — check the model's own page for its billing table: * **Seedance 2.5** with `duration: -1` holds the 30-second ceiling and then settles against the video actually produced. * **Wan 3.0** with `duration: -1` is charged at the 30-second ceiling. The length the model picks does not bring it down, so pass an explicit `duration` when cost matters. * **Reference-video jobs**, on the models that accept them, bill input seconds plus output seconds, and some tiers bill a minimum window — a short clip can settle above its literal duration. For legacy integer-priced models, read `usage.credits` instead of recomputing any of this client-side. Token-metered models additionally expose their settlement source under `billing`. For `gpt-image-2-official`, polling with `?include=billing` adds a top-level `billing` object with the exact image-token meters and settled amount. Without that query parameter, the response keeps the legacy field set exactly: ```json "usage": { "credits": 39 }, "billing": { "source": "openai_token_usage", "credits_exact": 38.966, "cost_usd": 0.038966, "text_input_tokens": 396, "image_input_tokens": 2482, "image_output_tokens": 571 } ``` The submitted request reserves the Playground/model-page estimate. A successful task replaces it with: ``` actual_usd = text_input_tokens x $5 / 1,000,000 + image_input_tokens x $8 / 1,000,000 + image_output_tokens x $30 / 1,000,000 actual_micro_usd = text_input_tokens x 5 + image_input_tokens x 8 + image_output_tokens x 30 final_micro_usd = ceil(actual_micro_usd x factor_basis_points / 10,000) billing.cost_usd = final_micro_usd / 1,000,000 billing.credits_exact = final_micro_usd / 1,000 charged_micro_usd = final_micro_usd - shortfall_micro_usd usage.credits = ceil(charged_micro_usd / 1,000) ``` The balance and public `billing` values retain `final_micro_usd` precision; the factor is rounded upward only once at that boundary. `usage.credits` remains the rounded-up whole-credit compatibility field; do not use it to reconcile token-metered tasks. Use `billing.credits_exact` or `billing.cost_usd`. If a successful generation does not return all three trustworthy usage meters, the task still completes and the admission reservation becomes the final whole-credit charge. With `?include=billing`, that fallback is explicit and never presented as exact: ```json "usage": { "credits": 56 }, "billing": { "source": "reservation_estimate", "credits_charged": 56, "cost_usd_charged": 0.056 } ``` Only `source: "openai_token_usage"` carries formula-derived exact token fields. In the rare case that the actual amount exceeds both the reservation and the remaining balance, the successful task still completes and the balance is reduced to zero. reAPI records the unpaid remainder internally as a billing shortfall; `billing.credits_exact` and `billing.cost_usd` continue to report the full formula-derived actual amount, while `usage.credits` remains the rounded whole-credit summary of the amount actually collected. ### Status values | Status | Meaning | | ------------ | ---------------------------------------------------------------------------------------------------------------------- | | `processing` | Submitted, provider is generating | | `completed` | Done — `output` populated | | `failed` | `error` populated; `usage.credits` shows whether the reservation was refunded or a post-generation charge was retained | ### Output shape The shape of `output` depends on the media kind of the task: | Media kind | Field | Type | | ---------- | ------------ | --------- | | Image | `image_urls` | string\[] | | Video | `video_urls` | string\[] | | Audio | `audio_urls` | string\[] | Some video models add an extra `last_frame_url` (string) when the request opted into a return-last-frame capability. URLs returned in `output` are rehosted to reAPI's CDN. If you need long-term archival, copy them to your own storage as soon as the task completes — bucket lifecycle policies are configured per-deployment and not guaranteed by this contract. ### Errors | HTTP | `code` | When | | ---- | ----------------- | ------------------------------------------------------------------------ | | 401 | `10001` – `10005` | Auth missing / invalid / revoked | | 404 | `40001` | Task doesn't exist or belongs to another user | | 429 | `50001` | Per-user request rate limit exceeded — retry after `Retry-After` seconds | ## Polling pattern Recommended: ``` attempt 1: wait 2s attempt 2: wait 2s ... the worker keeps a task alive up to a wall-clock cap before it self-reports an 80002 timeout: 1 hour for image and audio, 48 hours for video. Most tasks finish far sooner (image/audio usually under a minute, video in minutes), so size your client-side give-up to your own tolerance, not the cap. ``` The polling endpoint is cached for **5 seconds** while a task is in-flight, so polling faster than every 2–3 seconds returns the same state and just consumes rate-limit budget. Video tasks routinely take several minutes; pace your polling accordingly. ## Refund behavior Provider failures, timeouts, and persistence failures are automatically refunded by the worker when the workflow ends. Missing token evidence after a successful GPT Image generation is not a task failure: the image is delivered and the reserved amount is charged. Any credit return happens atomically with the status flip, before a poll observes it, and re-polling never refunds twice. Some model-specific post-generation safety policies can retain the generation charge even though the output is hidden and the task status is `failed`. Always read `usage.credits`: `failed` + `0` means fully refunded, while a positive value is the retained amount documented by that model. A failed task surfaces the failure code under `error`: ```json { "id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e", "status": "failed", "output": null, "error": { "code": 80006, "message": "Request violates content policy" } } ``` The `code` here is one of the 8xxxx workflow-execution codes — see [Errors → 8xxxx](/docs/api/errors#8xxxx--workflow-execution-returned-in-polling-response-when-statusfailed). --- # Webhooks (https://reapi.ai/docs/api/webhooks) Every submission endpoint accepts an optional `webhook_url`. When the task reaches a terminal state — **completed or failed** — reAPI sends one POST to that URL with the same JSON you would get from `GET /api/v1/tasks/{id}`. Polling keeps working exactly as before; the webhook is an addition, not a replacement. **`GET /api/v1/tasks/{id}` is always the fallback.** A webhook is a notification, not the only copy of the result. If your endpoint is down, slow, or returns a non-2xx, reAPI retries a few times and then stops — but the task result is never lost: it stays available through [`GET /api/v1/tasks/{id}`](/docs/api/tasks) at any time, and `?include=webhook` tells you whether the delivery succeeded. Build your integration so that a missed webhook degrades into a poll, never into a missing result (see [Retries and duplicates](#retries-and-duplicates)). ## Requesting a webhook Add `webhook_url` next to the model parameters on any of these endpoints: `/api/v1/images/generations`, `/api/v1/videos/generations`, `/api/v1/audio/generations`, `/api/v1/detect`, `/api/v1/humanize`, `/api/v1/essay`, `/api/v1/moderations`. ```http POST /api/v1/images/generations Authorization: Bearer YOUR_API_KEY Content-Type: application/json { "model": "z-image", "prompt": "A red fox running through fresh snow at dawn", "webhook_url": "https://hooks.example.com/reapi" } ``` Everything except `webhook_url` is the model's normal request; the field is simply added to whatever you already send. Rules for the URL: | Rule | Detail | | -------------- | ------------------------------------------------------------------------------------------------- | | `https` only | `http://` and any other scheme are rejected | | Hostname only | The host must be a domain name; IP addresses (IPv4 or IPv6, in any notation) are rejected | | Port 443 only | An explicit port is accepted only if it is `443` (`https://hooks.example.com:8443/x` is rejected) | | No credentials | `https://user:pass@host/` is rejected | | Length | At most 2048 characters | These are checked **at submission**: a URL that breaks one of them returns a `20003` parameter error and no task is created. Whether the endpoint is reachable is not checked at submission. One more rule applies **at delivery**, when the name is resolved: if it resolves to a private, loopback, link-local or cloud-metadata address (any of its records), the attempt is refused and recorded as `blocked_private_address`. The task itself is created and runs normally — only the notification is affected, and `GET /api/v1/tasks/{id}` still has the result. ## The delivery ```http POST https://hooks.example.com/reapi Content-Type: application/json User-Agent: reAPI-Webhook/1 ``` There are no reAPI-specific headers: the task is identified by the `id` field in the body, and nothing else about your account travels with the call. If you use several API keys and need to tell their tasks apart, give each key its own `webhook_url`. The body is **exactly** the default `GET /api/v1/tasks/{id}` response for that task — same fields, same shapes, nothing added — with `status` always `completed` or `failed`. Its `id` is the same task id the submission POST returned, so you always know which task a call belongs to: ```json { "id": "task_01a093d0162671be8280f65bc79becff", "model": "z-image", "status": "completed", "created_at": 1789186286, "output": { "image_urls": ["https://cdn.reapi.ai/media/tasks/task_01a093d0162671be8280f65bc79becff/0.jpg"] }, "usage": { "credits": 5 }, "error": null } ``` A failed task arrives the same way, with `output: null`, `usage.credits` at the final charge (`0` when the reservation was fully refunded), and the same `error` object polling would return. The body never includes the opt-in `billing` block; fetch it with `?include=billing` if you need exact token billing. `error.request_id` carries the delivery id (`whd_…`), useful when contacting support about a specific call. Your endpoint should respond with any **2xx** status within **10 seconds** and do the real work afterwards. Redirects are not followed and the response body is never read. ## Retries and duplicates | Attempt | When | | ------- | ------------------------------------------------------------ | | 1 | as soon as the task finishes | | 2 | about 40 seconds later, if attempt 1 failed | | 3 | about 5 minutes after the task finished, if attempt 2 failed | A non-2xx status, a timeout, or a connection failure counts as a failed attempt. After the third failure reAPI stops. **Nothing is lost when that happens**: the task result stays available through `GET /api/v1/tasks/{id}` indefinitely, and `GET /api/v1/tasks/{id}?include=webhook` shows `"status": "failed"` with the reason. The recommended pattern: 1. Record the task `id` when you submit. 2. Handle the webhook when it arrives (deduplicate on the task id). 3. If no webhook has arrived within the time you expect the task to take (plus the \~5 minute retry window), poll `GET /api/v1/tasks/{id}` for that id and continue exactly as if the webhook had come in. Treat the webhook as the fast path and the GET as the guaranteed path. Delivery is **at-least-once**. If your server processed a call but the 2xx response was lost on the network, reAPI cannot tell the difference from a failure and will send it again. Every attempt for a task carries the same body `id` and an otherwise identical body (apart from `error.request_id`), so **deduplicate on the task id**: if you have already handled that id, respond 2xx and ignore the payload. ## Verifying that a call is from reAPI reAPI does not sign webhooks and sends no credentials of its own. The robust pattern needs no secret at all: **treat the call as a signal, not as the source of truth**. Read the body's `id`, then fetch `GET /api/v1/tasks/{id}` with your API key and act on that response. The GET is authenticated, so a forged call **cannot forge a task result**. A forged call can still make you do a lookup, so keep the lookups cheap: only act on task ids you recorded as pending when you submitted them and drop anything else without a request; treat a repeated id as one event; and do not let a burst of calls fan out into a burst of `GET`s — the polling endpoint is rate-limited per user, and a flood of lookups could throttle your own legitimate requests. If you would rather trust the payload directly, put a secret of your own into the URL — a query parameter or a path segment, for example `https://hooks.example.com/reapi?token=` — and check it on your side. The URL is called back verbatim, so whatever you embed arrives unchanged; you generate, store, and rotate that value. ## Checking a delivery ```http GET /api/v1/tasks/{id}?include=webhook Authorization: Bearer YOUR_API_KEY ``` Adds a `webhook` object to the task response: ```json { "webhook": { "status": "failed", "attempts": 2, "response_status": 503, "last_error": "http_503", "last_attempt_at": "2026-09-12T10:31:02.118Z", "delivered_at": null } } ``` `status` is `pending` (task not finished yet), `in_progress`, `delivered`, or `failed`. `last_error` is one of `http_`, `timeout`, `connect_failed`, `dns_failed`, `tls_error`, `blocked_private_address`, `request_failed`, `render_timeout`, `render_failed` (reAPI could not build the payload in time — the task result itself is unaffected), `stale_claim` (an attempt was abandoned because it could no longer finish inside its window), or `attempt_lost` (the last attempt died before it could report; nothing more will be sent — poll the task). `webhook` is `null` when the task was submitted without a `webhook_url`. Without `?include=webhook` the task response is unchanged. --- # AI Image API Content Filters: How Refusals Happen (https://reapi.ai/blog/ai-image-api-content-filters) **Image content filtering is multi-layered**, not a single on/off switch. Some hosted image APIs expose a moderation setting that can be adjusted per request, but adjusting one layer does not erase provider policies, model alignment, upstream request inspection, legal restrictions, or application-level obligations. Different hosts route requests differently, and each route passes through multiple checkpoints. The more useful question is: **which safety layer blocked the request, and which controls are actually configurable?** That framing helps teams handle benign false positives—medical illustration, fine art, swimwear, health education— without pretending prohibited content has become acceptable. ## TL;DR * No production image API should be treated as unconditionally unfiltered. * Some hosts expose a configurable moderation setting that can be adjusted on selected routes. It does not disable upstream provider moderation. * Different vendors vary in whether they expose filtering controls to direct callers. Some let you adjust output checks; others do not. * Diagnose rejections by stage: before task creation, during provider generation, or after an output is returned. * “Less restrictive” still requires consent, age controls, abuse prevention, and compliance with the provider's acceptable-use rules. ## Why “uncensored AI image API” is the wrong technical model Image safety is a pipeline, not one Boolean value. A request can pass one classifier and fail at the next stage. Even when a model has comparatively light alignment, the host, gateway, storage provider, or application may apply separate controls. A typical production request moves through four layers: 1. **Application policy.** Your own product validates users, prompts, source images, permissions, and intended use. 2. **Gateway moderation.** An API gateway may run an independent prompt or output classifier. 3. **Provider and model controls.** The upstream service can reject inputs, refuse generation, or filter results under its own policies. 4. **Output review and distribution.** The application decides whether a generated asset can be stored, shown, shared, or published. OpenAI, for example, documents separate moderation models for classifying text and image inputs, while its platform data controls still require customers to follow usage policies even when approved for modified abuse monitoring or zero data retention.\[1]\[2] Retention settings, moderation behavior, and generation policy are related but not interchangeable controls. ![Four-layer AI image API moderation pipeline showing application policy, gateway checker, provider controls, and output review](https://cdn.reapi.ai/media/blog/ai-image-api-content-filters/uncensored-ai-image-api-content-filters-layers.png) ## How to diagnose image API safety rejections ### Rejected before a task ID exists The request likely failed in application validation, gateway prompt moderation, authentication, or upstream input inspection. Capture the HTTP status, provider error code, model ID, and which configurable checks were enabled. Do not automatically mutate and resubmit the prompt. First determine whether the request is malformed, benign but ambiguous, or outside policy. ### Task created but generation failed The provider or model may have rejected the prompt or source image after deeper inspection. Some systems also fail when a reference image cannot be downloaded, is the wrong format, or violates a size limit. Keep safety errors separate from technical media errors in your telemetry. ### Generation completed but the output is hidden This pattern points to an output-classification layer. When a host separates the generation step from a final safety check, the output can be generated and billed even when the final image is withheld. A retry can therefore repeat the charge without changing the underlying problem. ### Output returned but your application blocks it That is your product policy working as designed. Model output is untrusted user content until it passes your publication and rights checks. A provider accepting an image does not mean your marketplace, ad network, school, or app store must accept it. ## How to choose a less restrictive image API responsibly Look for **control and documentation**, not the word uncensored. ### Prefer explicit request fields A documented field for controlling moderation is easier to govern than a provider that vaguely promises “no filters.” You can test it, restrict it by account, record configuration, and detect schema changes. ### Require a clear acceptable-use policy The provider should define prohibited categories, appeals, data handling, and enforcement. Missing rules are operational risk, not creative freedom. ### Test a benign boundary set Build a small evaluation set covering permitted medical, art, fashion, and health scenarios that are relevant to your product. Record acceptance, false-positive stage, latency, and billing. Do not include illegal or exploitative material in this test set. ### Keep identity and consent checks separate A general nudity classifier does not solve non-consensual intimate imagery, face misuse, impersonation, copyright, or model-release consent. These need their own rules and sometimes human review. ### Preserve provider traceability Store the model ID, provider route, policy version, prompt hash, source-asset provenance, safety configuration, and decision result. Minimize retained personal data, but keep enough structured evidence to investigate abuse and appeals. ## Claims that should make buyers cautious Treat the following marketing phrases as warning signs: * “100% uncensored” without an acceptable-use policy; * “no logs” without retention documentation or contractual terms; * “all content allowed” without jurisdiction or age restrictions; * “filter off” without explaining whether it affects the gateway, provider, or model; * “private by default” without describing storage and abuse monitoring. The same caution applies to unauthorized account automation. A third-party wrapper can appear permissive because it hides whose account or endpoint it is using. That is not a stable API contract. Authorization matters even when a JSON endpoint appears to work. ## Building an application-level moderation policy A practical image application needs more than one universal threshold: 1. Define prohibited content that is never accepted. 2. Define restricted content allowed only in specific contexts or age groups. 3. Detect source-image identity, consent, and rights risks separately. 4. Review prompts and outputs, because either side can carry policy risk. 5. Give users a reason code and an appeal path for permitted edge cases. 6. Rate-limit repeated rejected requests and investigate adversarial patterns. 7. Re-test whenever the model, provider, or classifier version changes. OpenAI's moderation endpoint can classify both text and image inputs, but its categories and thresholds are only one possible policy component.\[1] Your final rules must match the product's audience, geography, distribution channel, and risk tolerance. For video, the same layered filtering principle applies. Do not assume that an image-model setting transfers unchanged to video generation routes. ## FAQ ### Can content filtering be completely disabled? Not in the unconditional sense. Hosted APIs operate under provider policies, law, infrastructure controls, and application rules even when one optional filtering layer can be adjusted. ### How should medical or fine-art applications handle false positives? Use reviewed prompts, adult-only and non-sexual context where relevant, a domain-specific moderation policy, reason codes, and human appeals. Do not rely on disabling every safety layer. ## Conclusion The answer to finding a less-restrictive image API is not a provider leaderboard. It is understanding the moderation pipeline. Choose routes with explicit controls, document which layer each control affects, keep upstream policy assumptions visible, and replace broad false-positive filters with a more precise safety system—not with no safety system at all. ## References 1. OpenAI. *Moderations API reference for text and image inputs.* [platform.openai.com/docs/api-reference/moderations](https://platform.openai.com/docs/api-reference/moderations) 2. OpenAI. *Data controls, abuse monitoring, and customer responsibilities.* [platform.openai.com/docs/models/default-usage-policies-by-endpoint](https://platform.openai.com/docs/models/default-usage-policies-by-endpoint) --- # AI Image Generation Cost vs Video: 2-9x More Per Frame (https://reapi.ai/blog/ai-image-generation-cost-vs-video) A second of 720p video from Seedance 2.0 Face costs $0.15375 and contains 24 frames, which puts each frame at $0.0064\[1]. The cheapest single image on the same platform, Nano Banana 2 Lite, costs $0.015\[2]. The AI image generation cost is 2.3 times the video frame, and the video frame arrives with 23 siblings that are temporally consistent with it. That inversion holds across every tier we sell and gets wider at the cheap end, where a Seedance 2.0 Mini frame runs about $0.00148 against $0.015 for the least expensive standalone image. Roughly ten to one. It is worth understanding why, because it changes which tool you reach for when you need a still. ## TL;DR * A 720p video frame costs **$0.0064**; the cheapest standalone image costs **$0.015**\[1]\[2]. * Normalized per megapixel, images run **about 1.4 to 9 times** the AI image generation cost of a video frame. * The AI image generation cost gap is widest at the low end (Mini 480p frame at $0.00148, roughly 10x cheaper than any image) and narrowest at 4K, where images are about 1.4 to 1.9x. * Video pricing meters on total pixels across the clip; image pricing meters per generation, so short clips subsidize their own frame count. * The catch is control. A video frame is not addressable, not re-rollable, and not prompt-steerable in isolation. * Extracting stills from generated video is cheap and legitimate; it is also the wrong tool when you need nine unrelated compositions. ## The per-frame numbers Video is quoted per second and renders at 24 frames per second, so per-frame cost is the per-second rate divided by 24. The table uses rates without source video across the Seedance 2.0 family, checked on October 22, 2026\[1]\[3]: | Tier | Per second | Per frame | Per megapixel | | -------------- | ---------- | --------- | ------------- | | Mini 480p | $0.036 | $0.00148 | $0.0035 | | Mini 720p | $0.077 | $0.00320 | $0.0035 | | Fast Face 480p | $0.057 | $0.00236 | $0.0055 | | Fast Face 720p | $0.121 | $0.00502 | $0.0054 | | Face 480p | $0.07125 | $0.00297 | $0.0069 | | Face 720p | $0.15375 | $0.00641 | $0.0070 | | Face 1080p | $0.3825 | $0.01594 | $0.0077 | | Face 4K | $0.780 | $0.03250 | $0.0039 | Against the image catalog, checked the same day\[2]\[4]\[5]\[6]: | Model | Per image | Per megapixel | | --------------------- | --------- | ------------- | | Nano Banana 2 Lite 1K | $0.015 | $0.0143 | | Nano Banana 2 1K | $0.028 | $0.0267 | | Nano Banana 2 4K | $0.045 | $0.0054 | | Nano Banana Pro 1K | $0.028 | $0.0267 | | Seedream 5.0 Pro 1K | $0.032 | $0.0305 | | GPT Image 2 1K | $0.025 | $0.0238 | | GPT Image 2 4K | $0.060 | $0.0072 | At 1K, the AI image generation cost per megapixel bottoms out at $0.0143 (Nano Banana 2 Lite), while the cheapest video tiers cost $0.0035. About four times. Compare the flagship image models against the same video tiers and the multiple reaches nine. ## Why AI image generation cost diverges from video Video meters on total pixels shipped. The published formula for the Seedance family multiplies duration by frame area by frame rate, then divides into token buckets\[7]. Every frame is priced identically to every other frame, and there is no fixed per-request overhead worth speaking of. Image generation prices per invocation. Whatever the model spends on prompt interpretation, sampling schedule and safety passes gets amortized across exactly one output. A four-second clip amortizes the same class of overhead across 96. The second factor is what the model is being asked to do. An image model treats every generation as an independent problem: fresh composition, fresh subject, fresh everything. A video model solves one composition and then propagates it, which is a fundamentally cheaper operation per frame even though it is a harder problem overall. Neither of those is a pricing quirk anyone chose. It is what the workloads actually cost to run, surfaced in the rate card. ## When pulling a still from video is the right call The arithmetic suggests an obvious arbitrage, and for some jobs it genuinely works. If you need a hero shot of a specific subject in a specific pose, the four-second minimum at 1080p costs $1.53 and returns 96 candidate frames at about $0.01594 each. Pick the best. Against $0.028 for a single Nano Banana Pro image, you are paying about 55 times the total price for 96 times the options, with the subject held consistent across all of them. If you need a character to appear in several shots with the same face, video is the cheaper consistency mechanism by a wide margin. That is the whole premise of reference-driven generation, and it is why the reference tier exists at a lower per-second rate. If you need contact-sheet variety on one concept, the same logic applies. Twenty seconds of Mini 480p across multiple requests is about $0.71 and yields 480 frames. ## When it is the wrong call, which is often A video frame is not addressable. You cannot prompt frame 37. You steer the clip and accept what lands, whereas an image model gives you a seed, a full prompt, and a re-roll on a single output. Compression is real. Video frames arrive from an encoded stream with motion-compensated artifacts that a still generator never introduces. At 480p, on a subject with fine texture, this is visible and not fixable in post. Text rendering falls apart. If the still needs legible words in it, GPT Image 2 exists precisely because video models do not hold typography stable frame to frame\[6]. Aspect ratios are constrained. Video tiers ship 16:9 and a handful of standard ratios. Image models on the same platform reach 1:4, 4:1 and 8:1\[4], which video cannot do at any price. And nine unrelated compositions means nine generations either way. The per-frame advantage evaporates the moment you need frames that are not related to each other, because relatedness is the entire thing you are buying. ## The number that actually matters for a product Neither per-frame nor per-image AI image generation cost is the figure to budget on. Budget on cost per accepted output. An image workflow accepting one in four generations at $0.025 costs $0.100 per keeper. A video workflow that generates the four-second minimum at 720p Face for $0.615, then keeps one frame, costs $0.615 per keeper, and that is worse, right up until you need additional keepers from the same clip. Run your own acceptance rate before deciding which AI image generation cost applies to you. The AI image generation cost advantage of video frames is real, but it only converts into money saved when your workflow consumes more than one frame per generation. ## Where the gap shows up on a real bill Take a storefront that needs 500 product stills a month. At Nano Banana Pro, the AI image generation cost is $14.00. Harvesting the same 500 frames from 1080p video means 21 seconds of generation at about $8.033, a little over half, and every frame shares lighting and camera treatment. Now change the brief to 500 unrelated products. The video route collapses, because 500 different subjects means 500 separate clips, and the AI image generation cost is suddenly the cheaper option by a wide margin. Same monthly volume, opposite answer, and the deciding variable was never price. That is the useful way to read the tables above. The AI image generation cost premium is not a markup on equivalent output. It is what you pay for independence between generations, and independence is either the entire point of your workflow or it is dead weight. Work out which one you have before you optimize the wrong number. ## FAQ ### Does a video frame match the quality an AI image generation cost buys? No. It comes out of an encoded stream, so it carries compression artifacts, and it is generally softer on fine texture. At 1080p and above the difference narrows considerably. ### Can I extract frames from a generated video? Yes. The output is a standard video file, so any frame extraction tool handles it. Nothing on the platform restricts it. ### Why is 4K video cheaper per megapixel than 1080p? The token rate for the 4K tier is lower than the 1080p tier\[7]. The total cost is still far higher because the frame carries four times the pixels, but normalized per megapixel it comes out ahead. ### Which is cheaper for character consistency across shots? Video, decisively. Reference-driven generation keeps a subject stable across frames at the per-second rate, which is what image models charge per output to approximate. ### Does the reference video tier change this math? It lowers the per-second rate but adds your input clip to the billed duration\[7]. For frame-harvesting with no reference input, the plain rate is what applies. ### What resolution do the video tiers actually render? 480p renders around 864 x 496, 720p at 1280 x 720, 1080p at 1920 x 1080 and 4K at 3840 x 2160\[7]. Those are the dimensions the per-megapixel column uses. ### Do failed generations cost money? No. Failed jobs refund automatically on reAPI\[1]. ## Choosing between the two The rate cards say video frames are cheap and AI image generation cost is high, and taken literally that is correct by a factor of two to nine. Taken as advice it is misleading, because the two products are not substitutes. Video sells you a sequence in which every frame relates to its neighbours. Images sell you independent control over one output at a time. The workflows where the math genuinely pays are the ones that want relatedness: character sheets, shot variations on a fixed subject, contact sheets from a single concept. For anything requiring nine distinct compositions or legible text, the higher AI image generation cost buys control you cannot get from a video frame at any price, and that control is usually the cheaper purchase in the end. ## References 1. reAPI. *Seedance 2.0 Face, Fast Face, and Mini — model pages and live pricing.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-0](/models/seedance-2-0) and [reapi.ai/models/seedance-2-0-mini](/models/seedance-2-0-mini) 2. reAPI. *Nano Banana 2 Lite — model page and live pricing.* Retrieved August 2026 from [reapi.ai/models/nano-banana-2-lite](/models/nano-banana-2-lite) 3. reAPI. *Seedance 2.0 Mini — model page and live pricing.* Retrieved August 2026 from [reapi.ai/models/seedance-2-0-mini](/models/seedance-2-0-mini) 4. reAPI. *Nano Banana 2 — model page and live pricing.* Retrieved August 2026 from [reapi.ai/models/gemini-3-1-flash-image-preview](/models/gemini-3-1-flash-image-preview) 5. reAPI. *Nano Banana Pro — model page and live pricing.* Retrieved August 2026 from [reapi.ai/models/gemini-3-pro-image-preview](/models/gemini-3-pro-image-preview) 6. reAPI. *GPT Image 2 — model page and live pricing.* Retrieved August 2026 from [reapi.ai/models/gpt-image-2](/models/gpt-image-2) 7. BytePlus. *ModelArk — model pricing, token calculation formula and per-video examples.* Retrieved August 2026 from [docs.byteplus.com/en/docs/ModelArk/1544106](https://docs.byteplus.com/en/docs/ModelArk/1544106) --- # AI Image Generation for Games: Cut Cost With Caching (https://reapi.ai/blog/ai-image-generation-games-cache-first) Caching can bring the average AI image API cost per player action down to $0.002, but it cannot make a genuinely new image cheaper. At Z-Image's current reAPI rate of $0.005 per completed image, the controlling rule is **paid miss rate × completed attempts per accepted asset ≤ 0.4**. A 40% miss rate reaches the ceiling only when every new asset passes on its first completed attempt; staying below $0.002 requires a result below that boundary.\[1] Cache the meaning of an item, not just its prompt. Merge concurrent misses, pre-generate only likely items, and measure cost per accepted game asset rather than per API response. ## TL;DR * At **$0.005 per completed Z-Image generation**, a game targeting an effective cost at or below $0.002 per craft needs `paid miss rate × completed attempts per accepted asset ≤ 0.4`. With exactly one attempt, 40% meets the ceiling; strictly below it means less than 40%.\[1] * Keep a **recipe key** for what the player combined and a **semantic asset key** for the resulting object and art version. * Enforce one active asset job with a shared database uniqueness constraint. An in-memory Promise map can merge same-process callers, but it is not the lock that protects multiple workers. * Image generation is asynchronous. Submit once, retain the task ID, poll the task endpoint, and copy completed output to storage you control. \[2]\[3] * A three-task smoke test completed three original candidates on the first submission at **15 credits or $0.015 total**. They were not visually reviewed, so they are candidates, not accepted assets.\[4] * If 3,000 daily images are already genuinely new semantic assets after caching, a conventional cache will not rescue the economics. The game must reuse more art, narrow the generative surface, or support a higher cost. ## The real problem is cost per craft, not cost per image Suppose an infinite-crafting game combines items such as iron and fire, then generates both a new result and its picture. How can it keep media cost below $0.002 per craft if players trigger 3,000 craft events a day, including many combinations the game has not seen before? That question exposes the key constraint: a game may create novel requests faster than its revenue can pay for them. Start with this equation: ```text daily generation cost = craft events x paid miss rate x completed attempts per accepted asset x price per completed generation ``` At $0.005 per completed Z-Image task, the ceiling is: ```text $0.005 x paid miss rate x completed attempts per accepted asset <= $0.002 paid miss rate x completed attempts per accepted asset <= 0.4 ``` For 3,000 craft events a day over 30 days, the one-attempt scenarios look like this: | Paid miss rate | New generations/day | 30-day API cost | | -------------: | ------------------: | --------------: | | 100% | 3,000 | $450 | | 40% | 1,200 | $180 | | 20% | 600 | $90 | | 10% | 300 | $45 | These are scenarios, not predicted hit rates, and every row assumes one completed attempt per accepted asset. At 1.5 attempts, for example, the miss rate must be no more than 26.7% to keep the same $0.002 ceiling. If all 3,000 events remain unique after semantic deduplication, the first row applies. ## Recipe keys and semantic asset keys solve different problems A recipe key represents the player's input. If order does not matter in your rules, sort the exact canonical item IDs before hashing them. The unhashed identity is easy to inspect: ```text recipe identity: v3 | fire | iron ``` That makes `iron + fire` and `fire + iron` resolve through the same server-owned recipe row. Include a rules version because a later balance patch may change the result. Do not slugify IDs for the key: lossy normalization can merge two different items. A semantic asset key represents what the game ultimately displays. Its unhashed identity can remain equally clear: ```text asset identity: ember-shield | inventory-icon-v1 | z-image | 1:1 | filtered ``` Several recipes may resolve to `ember-shield`; translations may also name it differently. Those paths can still reuse one approved visual. Raw prompts make poor keys: wording changes fragment the cache, and identical prompts go stale after an art-direction change. Map each recipe to a stable result ID, then key the art by result ID, model, aspect ratio, safety mode, and style version. Bump the version when you want new art. ## A cache-first request flow Treat generation as background asset production, even when the player starts it. A practical flow is: 1. Resolve the incoming recipe to a semantic result ID. 2. Look up the semantic asset key in durable storage. 3. On a hit, return the stored URL immediately. 4. On a miss, atomically insert one shared job row keyed by the semantic asset. 5. In the same database transaction, reserve one slot in a shared daily submission budget. Other workers return the existing job. 6. Commit the row as `submitting` before making one POST, then persist the task ID immediately after the response. 7. If submission is ambiguous, mark `submit_uncertain` and stop. Poll a known task ID with GET until it becomes `completed` or `failed`. 8. Record terminal status and settled credits. Copy a completed image to your own storage and move it to `pending_review`. 9. Only an acceptance check may move `pending_review` to `ready`. After step six, return a placeholder and `pending` state. Let a worker poll while the client checks your game endpoint. Never expose the reAPI key to the client. Polling is free, and the in-flight task endpoint is cached for five seconds, so poll about every five seconds.\[3] Respect `Retry-After` on a `429`. Do not blindly retry the POST: reAPI does not deduplicate generation requests by `Idempotency-Key`, so a lost response may hide an accepted task and a second charge.\[5] ## A runnable Node 20 module with a shared lock The smallest example that protects multiple workers needs shared state. The module below is plain `.mjs`, uses PostgreSQL through the `postgres` package, and returns after submission instead of holding the player's request open. ```bash npm install postgres ``` Create the tables once. Populate `game_recipes` from the game's own rule data; the browser sends two item IDs, never a result ID or display name. ```sql CREATE TABLE game_recipes ( recipe_key text PRIMARY KEY, result_item_id text NOT NULL, result_display_name text NOT NULL ); CREATE TABLE game_asset_jobs ( asset_key text PRIMARY KEY, origin_recipe_key text NOT NULL REFERENCES game_recipes(recipe_key), result_item_id text NOT NULL, state text NOT NULL CHECK (state IN ( 'submitting', 'submit_uncertain', 'processing', 'completed', 'pending_review', 'ready', 'failed', 'rejected' )), submit_owner uuid NOT NULL, prompt text NOT NULL, task_id text UNIQUE, source_url text, durable_url text, usage_credits integer, error_message text, created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now() ); CREATE TABLE game_generation_budgets ( budget_day date PRIMARY KEY, submissions integer NOT NULL CHECK (submissions >= 0), submission_limit integer NOT NULL CHECK (submission_limit > 0) ); ``` Save this as `cache-first.mjs`. The full SHA-256 keys hash exact canonical IDs; there is no slugification step that can collapse two different IDs. ```js import { createHash, randomUUID } from 'node:crypto'; import postgres from 'postgres'; const API_BASE = 'https://reapi.ai/api/v1'; const apiKey = process.env.REAPI_API_KEY; const databaseUrl = process.env.DATABASE_URL; const dailyLimit = Number(process.env.DAILY_NEW_ASSET_LIMIT ?? '100'); if (!apiKey) throw new Error('Set REAPI_API_KEY on the server'); if (!databaseUrl) throw new Error('Set DATABASE_URL on the server'); if (!Number.isInteger(dailyLimit) || dailyLimit < 1) { throw new Error('DAILY_NEW_ASSET_LIMIT must be a positive integer'); } const sql = postgres(databaseUrl); const localFlights = new Map(); // L1 only; PostgreSQL owns correctness. function hashIdentity(value) { return createHash('sha256') .update(JSON.stringify(value), 'utf8') .digest('hex'); } function canonicalId(value) { if (typeof value !== 'string' || value.length === 0 || value.length > 200) { throw new Error('Item IDs must be non-empty canonical server IDs'); } return value; // Preserve the exact string; do not trim, slugify, or case-fold. } export function recipeKey(leftItemId, rightItemId) { const pair = [canonicalId(leftItemId), canonicalId(rightItemId)].sort( (a, b) => (a < b ? -1 : a > b ? 1 : 0), ); return `recipe:v3:${hashIdentity({ rulesVersion: 'v3', itemIds: pair })}`; } function assetKey(resultItemId) { return `asset:${hashIdentity({ resultItemId, styleVersion: 'inventory-icon-v1', model: 'z-image', aspectRatio: '1:1', contentFilter: true, })}`; } async function resolveRecipe(leftItemId, rightItemId) { const key = recipeKey(leftItemId, rightItemId); const [recipe] = await sql` SELECT result_item_id, result_display_name FROM game_recipes WHERE recipe_key = ${key} `; if (!recipe) throw new Error('Unknown recipe'); if (recipe.result_display_name.length > 200) { throw new Error('Canonical display name is too long'); } return { ...recipe, recipeKey: key }; } function publicJob(job) { return { assetKey: job.asset_key, state: job.state, taskId: job.task_id ?? null, url: job.state === 'ready' ? job.durable_url : null, usageCredits: job.usage_credits ?? null, }; } async function claimSharedJob(recipe, key, prompt) { const owner = randomUUID(); return sql.begin(async (tx) => { const created = await tx` INSERT INTO game_asset_jobs ( asset_key, origin_recipe_key, result_item_id, state, submit_owner, prompt ) VALUES ( ${key}, ${recipe.recipeKey}, ${recipe.result_item_id}, 'submitting', ${owner}, ${prompt} ) ON CONFLICT (asset_key) DO NOTHING RETURNING * `; if (created.length === 0) { const [existing] = await tx` SELECT * FROM game_asset_jobs WHERE asset_key = ${key} `; if (!existing) throw new Error('Concurrent job was not readable'); return { ownsSubmit: false, job: existing }; } const budget = await tx` INSERT INTO game_generation_budgets ( budget_day, submissions, submission_limit ) VALUES ( (now() AT TIME ZONE 'UTC')::date, 1, ${dailyLimit} ) ON CONFLICT (budget_day) DO UPDATE SET submissions = game_generation_budgets.submissions + 1, submission_limit = EXCLUDED.submission_limit WHERE game_generation_budgets.submissions < EXCLUDED.submission_limit RETURNING submissions `; if (budget.length === 0) throw new Error('Shared daily budget reached'); return { ownsSubmit: true, owner, job: created[0] }; }); } async function markSubmitUncertain(key, owner, message) { const [job] = await sql` UPDATE game_asset_jobs SET state = 'submit_uncertain', error_message = ${message}, updated_at = now() WHERE asset_key = ${key} AND submit_owner = ${owner} AND state = 'submitting' RETURNING * `; return job; } async function submitClaimedJob(claim, key, prompt) { let response; let body = ''; try { response = await fetch(`${API_BASE}/images/generations`, { method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'z-image', prompt, aspect_ratio: '1:1', content_filter: true, }), }); body = await response.text(); } catch (error) { const job = await markSubmitUncertain( key, claim.owner, error instanceof Error ? error.message : String(error), ); return publicJob(job ?? claim.job); } let task; try { task = JSON.parse(body); } catch { task = null; } if (!response.ok || !task?.id) { const message = `Unconfirmed submit response: HTTP ${response.status}`; const job = await markSubmitUncertain(key, claim.owner, message); return publicJob(job ?? claim.job); } const [saved] = await sql` UPDATE game_asset_jobs SET state = 'processing', task_id = ${task.id}, updated_at = now() WHERE asset_key = ${key} AND submit_owner = ${claim.owner} AND state = 'submitting' RETURNING * `; if (!saved) { throw new Error(`Task ${task.id} was accepted but its ID was not persisted; do not resubmit`); } return publicJob(saved); } async function startOrRead(recipe, key) { const prompt = [ `A clean 3D inventory icon of ${recipe.result_display_name}.`, 'One centered object, readable silhouette, plain warm background,', 'soft studio light, no text, no logo, no existing game character.', ].join(' '); const claim = await claimSharedJob(recipe, key, prompt); if (!claim.ownsSubmit) return publicJob(claim.job); return submitClaimedJob(claim, key, prompt); } export async function getOrCreateCraftAsset({ leftItemId, rightItemId }) { const recipe = await resolveRecipe(leftItemId, rightItemId); const key = assetKey(recipe.result_item_id); const existing = localFlights.get(key); if (existing) return existing; const work = startOrRead(recipe, key).finally(() => { if (localFlights.get(key) === work) localFlights.delete(key); }); localFlights.set(key, work); return work; } export async function pollAsset(key) { const [job] = await sql` SELECT * FROM game_asset_jobs WHERE asset_key = ${key} `; if (!job) throw new Error('Unknown asset job'); if (job.state !== 'processing' || !job.task_id) return publicJob(job); const response = await fetch(`${API_BASE}/tasks/${job.task_id}`, { headers: { Authorization: `Bearer ${apiKey}` }, }); if (response.status === 429) { const parsed = Number.parseInt(response.headers.get('retry-after') ?? '', 10); return { ...publicJob(job), retryAfterSeconds: Number.isFinite(parsed) ? Math.max(parsed, 1) : 5, }; } if (!response.ok) { throw new Error(`GET task failed with HTTP ${response.status}; retry this GET, not the POST`); } const task = await response.json(); if (task.status === 'processing') return publicJob(job); const credits = Number.isInteger(task.usage?.credits) ? task.usage.credits : null; if (task.status === 'failed') { const [failed] = await sql` UPDATE game_asset_jobs SET state = 'failed', usage_credits = ${credits}, error_message = ${task.error?.message ?? 'Generation failed'}, updated_at = now() WHERE asset_key = ${key} AND task_id = ${job.task_id} RETURNING * `; return publicJob(failed); } if (task.status !== 'completed') { throw new Error(`Unexpected task status: ${task.status}`); } const sourceUrl = task.output?.image_urls?.[0] ?? null; const [completed] = await sql` UPDATE game_asset_jobs SET state = 'completed', source_url = ${sourceUrl}, usage_credits = ${credits}, error_message = ${sourceUrl ? null : 'Completed task returned no image URL'}, updated_at = now() WHERE asset_key = ${key} AND task_id = ${job.task_id} RETURNING * `; return publicJob(completed); } export async function stageForReview(key, durableUrl) { const [job] = await sql` UPDATE game_asset_jobs SET state = 'pending_review', durable_url = ${durableUrl}, updated_at = now() WHERE asset_key = ${key} AND state = 'completed' AND source_url IS NOT NULL RETURNING * `; if (!job) throw new Error('Only an archived completed asset can enter review'); return publicJob(job); } export async function reviewAsset(key, accepted, reason = null) { const nextState = accepted ? 'ready' : 'rejected'; const [job] = await sql` UPDATE game_asset_jobs SET state = ${nextState}, error_message = ${reason}, updated_at = now() WHERE asset_key = ${key} AND state = 'pending_review' RETURNING * `; if (!job) throw new Error('Asset is not pending review'); return publicJob(job); } ``` The database row, not `localFlights`, prevents a second worker from submitting the same asset. A process that dies during POST leaves `submitting`; treat a stale row as `submit_uncertain` and investigate it rather than recycling it. After a known task ID exists, transient polling failures retry only GET. The shared counter is a conservative submission cap. An unconfirmed or rejected POST still consumes its slot, which is safer than silently exceeding the cap. If a terminal task fails, its status and `usage.credits` stay in the row. This example does not auto-retry failed or rejected assets; add a separate attempt ledger and an explicit, budgeted operator action before supporting retries. Your storage worker should download `source_url`, upload it to your object store, and pass that durable URL to `stageForReview`. Only `reviewAsset(..., true)` creates a cacheable `ready` asset. ## What the three-task smoke test proves On September 3, 2026, we submitted three original 1:1 inventory-item prompts with `content_filter: true`: a moss lantern, a glass compass, and an ember shield. Each task completed on its first submission and reported 5 credits. \[4] | Candidate | Task ID | Observed completion time | Credits | | ------------- | --------------------------------------- | -----------------------: | --------------: | | Moss lantern | `task_01a065490250739d893a1efcd83f4d1d` | 25.1 s | 5 | | Glass compass | `task_01a0654995df7265b44b132dce34a914` | 25.0 s | 5 | | Ember shield | `task_01a0654995fd73e28e7c682170664070` | 18.2 s | 5 | | **Total** | 3 tasks | — | **15 / $0.015** | The [public smoke-test record](/data/game-image-cache-smoke-test-2026-09-03.json) contains the request settings, task IDs, elapsed times, and settled credits. It deliberately omits the temporary output URLs.\[4] This is a smoke test, not a latency benchmark; it says nothing about p95, bursts, or long-term reliability. The protocol recorded task results and settlement but did not include an art review. `completed` means three candidates arrived, not that an art reviewer accepted them. That is why the useful creative metric is: ```text cost per accepted asset = total settled generation credits x $0.001 / accepted assets ``` If three attempts yield one usable icon, its effective cost is $0.015. Record technical status and creative acceptance separately. ## Pre-generate for latency, not imaginary savings Pre-generate only predictable requests, such as the top 20 recipes reachable from a player's inventory. Use the same semantic cache and single-flight path, with a separate daily cap. Do not generate the theoretical combination space. Unused assets cost money, and open-ended crafting outgrows a brute-force queue. Rank by observed demand and stop at the cap. The hybrid usually feels best: * approved semantic assets return immediately; * high-probability next items are pre-generated; * long-tail misses show a placeholder while one background task runs; * unpopular or abusive requests hit a quota instead of an unlimited retry loop. ## Safety, storage, and operational boundaries Keep `content_filter: true` for player-facing generation. Z-Image leaves that setting off by default, so relying on the default is not enough. \[2] Moderate or constrain player text before it becomes a prompt, block attempts to imitate protected characters or real people, and rate-limit by account and device. An upstream filter is one layer, not your complete game policy. Keep the key server-side. Log recipe and asset keys, task ID, status, credits, and acceptance without retaining unnecessary player data. Finally, copy completed files to durable storage before publishing their URLs to game clients. Task output URLs are not a permanent asset contract. \[3] Store a checksum and content type beside the asset record so a retry cannot quietly replace approved art. ## Conclusion: when caching is not enough Caching works only when the game permits reuse. If `paid miss rate × completed attempts per accepted asset` exceeds 0.4, the $0.002 ceiling cannot hold at a $0.005 unit price. If the 3,000 daily requests in this scenario are already unique semantic assets after caching, changing cache software will not solve the problem. Then change a product constraint: share art between similar items, use procedural recoloring or overlays, generate only popular items, cap discoveries, charge for long-tail creation, or accept a larger media budget. Check the live [Z-Image model page](/models/z-image) before setting a budget, then use the [Z-Image API guide](/docs/z-image) and [Tasks API reference](/docs/api/tasks) to implement submission and polling. Prices and model behavior can change; your own settled credits remain the source of truth for a production bill. ## FAQ ### Does caching reduce the price of a new AI image? No. It reduces how often you buy one. The current Z-Image charge remains five credits per completed generation; a cache hit costs no new generation credits. ### Should the prompt itself be the cache key? Usually not. Resolve recipes to a stable result ID, then version its art separately. ### What if item order matters? Do not sort the recipe inputs. `water + fire` and `fire + water` should have different recipe keys whenever your rules give them different outcomes. ### Should a game pre-generate assets or generate them in real time? Use both: pre-generate a budgeted likely set, serve hits immediately, and generate unpredictable long-tail items in the background. ### How often should I poll a reAPI image task? About every five seconds is a practical starting point. Faster polling does not make generation finish sooner and can waste rate-limit budget. ### Are failed generations charged? The Z-Image documentation says failed and rejected requests are not charged. Still inspect `status` together with `usage.credits`: a completed but visually unusable result is different from a failed task and counts toward creative cost.\[2]\[3] ### Can I promise an average below $0.002 per craft? Only after measuring your paid miss rate and completed attempts per accepted asset. At $0.005 per image, staying strictly below $0.002 requires their product to remain below 0.4. A 40% miss rate merely meets the ceiling when every asset passes on its first completed attempt. ### Can the game client call the image endpoint directly? It should not. A client-side credential can be extracted and abused. Route generation through your backend, enforce quotas there, and let clients query a game-owned pending job. ## References 1. reAPI. *Z-Image model page and live pricing.* Retrieved September 3, 2026 from [reapi.ai/models/z-image](/models/z-image) 2. reAPI. *Z-Image API documentation: inputs, asynchronous response, pricing, filters, and output retention.* Retrieved September 3, 2026 from [reapi.ai/docs/z-image](/docs/z-image) 3. reAPI. *Tasks API: status, settled usage, polling, rate-limit behavior, and output storage.* Retrieved September 3, 2026 from [reapi.ai/docs/api/tasks](/docs/api/tasks) 4. reAPI. [*Three-task Z-Image smoke-test record.*](/data/game-image-cache-smoke-test-2026-09-03.json) Run September 3, 2026\. Temporary output URLs are omitted; no visual acceptance review was performed. 5. reAPI. [*API overview: idempotency behavior.*](/docs/api#idempotency) Retrieved September 3, 2026. --- # AI Music Video Generator API: Full Songs, Photos, and Lyrics (https://reapi.ai/blog/ai-music-video-generator-api) **Music Video 1.0 turns one 10–300-second MP3 and one to seven reference images into a full-length music video in a single asynchronous API task.** It supports five aspect ratios, 540P/720P/1080P output, and optional burned-in lyrics generated from the song or supplied as an SRT file.\[1] This is a different product from generating thirty five-second shots and editing them to a track. The song sets both the output length and the bill. ## Inputs, output, and limits | Field | What it does | Limit | | ---------------------- | ------------------------------------------------ | ------------------------- | | `audio_url` | The complete song | MP3, 10–300 seconds | | `reference_image_urls` | Artist, character, location, or style references | 1–7 public URLs | | `prompt` | Visual direction | Up to 3,000 characters | | `aspect_ratio` | Landscape, portrait, or square | 16:9, 9:16, 1:1, 4:3, 3:4 | | `resolution` | Output tier | 540P, 720P, 1080P | | `add_subtitle` | Burn lyrics into the video | Optional | | `srt_url` | Supply approved lyric timing | Optional public SRT URL | The output follows the song's duration, up to five minutes. The API returns a task id immediately; the application polls until `output.video_urls` contains the MP4.\[1] ## Minimum request ```bash curl -X POST https://api.reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "music-video-1-0", "audio_url": "https://files.example.com/song.mp3", "reference_image_urls": [ "https://files.example.com/artist-portrait.jpg", "https://files.example.com/neon-stage.jpg" ], "aspect_ratio": "16:9", "resolution": "540P", "prompt": "Intimate live performance, practical colored lights, slow camera movement" }' ``` All media must be public HTTP(S) URLs. Local paths and base64 data are rejected. ## What a complete song costs The live public rates are $0.05 per song second at 540P, $0.08 at 720P, and $0.15 at 1080P.\[2] ```text music video cost = rounded-up song seconds × resolution rate ``` | Song length | 540P | 720P | 1080P | | ----------: | -----: | -----: | -----: | | 30 seconds | $1.50 | $2.40 | $4.50 | | 60 seconds | $3.00 | $4.80 | $9.00 | | 2 minutes | $6.00 | $9.60 | $18.00 | | 3 minutes | $9.00 | $14.40 | $27.00 | | 5 minutes | $15.00 | $24.00 | $45.00 | The server probes the MP3 rather than trusting a client-supplied duration. Trimming a 12-second silent outro before upload reduces both output length and billable length. ## Use the reference images as a visual contract Seven images are available, but every one should have a job. A practical set for an artist video is: * one clean face/wardrobe reference; * one full-body image; * two location or set references; * one color/lighting reference; * one object or album-art reference. Do not mix several versions of the same character with different hair, clothing, or age unless variation is intended. The model has no way to know which contradiction is a mistake. The prompt should explain the roles rather than restating the image contents: ```text Keep the singer's face and silver jacket from the first two images. Use the warehouse and amber light from images three and four. Verses are restrained handheld close-ups; choruses widen into fast dolly moves. No crowd, no logos, no text except supplied subtitles. ``` ## Auto lyrics or your own SRT? There are three valid choices: | Subtitle mode | Use it when | Risk | | --------------------- | -------------------------------------- | ------------------------------------- | | `add_subtitle: false` | A clean master will be captioned later | No lyrics in the delivered file | | Auto subtitles | A fast draft is enough | Names, slang, and timing may be wrong | | `srt_url` supplied | Lyrics and timing are approved | Requires preparing the SRT | For a release master, bring an SRT. Automatic transcription is useful for review, not as proof that every lyric is correct. ```json { "model": "music-video-1-0", "audio_url": "https://files.example.com/song.mp3", "reference_image_urls": ["https://files.example.com/look.jpg"], "aspect_ratio": "9:16", "resolution": "720P", "add_subtitle": true, "srt_url": "https://files.example.com/song-approved.srt", "subtitle_color": "#F4EBDD" } ``` ## Full-song generation or shot-by-shot? Use a full-song task when speed and broad visual continuity matter more than editing every beat. Use a shot list when the video needs exact products, choreography, narrative continuity, or a fixed edit on beat. The middle path is often best: generate a complete 540P visual treatment, mark the sections worth keeping, then rebuild only the hero moments with shot-level models. The full song becomes an animatic rather than the final master. ## What one full-song request can and cannot control A single task is good at preserving an overall look, pacing direction, and recurring subject across a track. It is weaker when the editor needs a specific action on bar 17, an exact product in every chorus, or a narrative event at a fixed lyric. Treat the prompt as a music-video brief rather than a shot list with fifty timestamp commands. Describe the visual grammar: how verses differ from choruses, what changes at the bridge, which subject must remain recognizable, and what should never appear. Then review the result as an animatic. Use a timeline editor or shot-level generations for deterministic overlays, logos, legal copy, lyric typography, and exact beat cuts. Generative frames are a poor place to typeset an approved sponsor name. The subtitle system is the exception because it burns a known transcript/SRT through a dedicated field rather than asking the video model to draw arbitrary text from a prompt. ## Estimate retry exposure before choosing 1080P The cost table becomes more useful when multiplied by expected attempts. A three-minute track costs $27 at 1080P. Three different visual concepts cost $81; two revisions of the chosen concept can bring the total to $135. The same exploration at 540P is $9 per attempt. Three concepts plus one 1080P final cost $54: ```text 3 × 180-second 540P concepts $27 1 × 180-second 1080P final $27 total $54 ``` That staged plan does not work when the acceptance issue is visible only at final resolution. Run one short or full high-resolution calibration early if the video depends on face detail, fine costume texture, or subtitle legibility. ## Prepare the audio and references before submission The server measures the actual MP3, so the uploaded master should already be final. Before sending it: * remove unintended silence and count-in audio; * confirm the sample contains no temporary watermark or guide voice; * normalize the approved master outside the video task; * verify every reference image is licensed and intentionally part of the look; * crop references around the subject information the model needs; * remove near-duplicate images with conflicting color grades; * create and proofread the SRT if lyrics matter. Changing the song after generation shifts every later edit and subtitle cue. A full-song render is downstream of audio mastering, not a place to discover that the bridge will be eight seconds shorter. ## Handling a failed or stalled long job Do not automatically resubmit when polling times out. The original task may still be processing, and a blind retry can create a second full-song charge. Persist the task id, query its status again, and distinguish an application timeout from a terminal `failed` state. If the server cannot probe the audio, the request returns a pricing error without a charge. Check that the URL is public, returns the MP3 directly, and supports remote access. A share page containing an audio player is not the same as a direct audio URL. ## Build around a long-running async task A multi-minute render may take much longer than a short text-to-video job. Production code should: 1. save the task id before returning to the user; 2. poll in the background rather than keeping an HTTP request open; 3. allow a long timeout window; 4. show the probed song length and estimated resolution cost; 5. retain the input URLs and prompt for audit and retry. The full request and error contract is in the [Music Video 1.0 API documentation](/docs/music-video-1-0), and the current rates are on the [Music Video 1.0 model page](https://reapi.ai/models/music-video-1-0). ## References
  1. reAPI Music Video 1.0 API documentation , accessed August 23, 2026.
  2. reAPI Music Video 1.0 model and pricing page , accessed August 23, 2026.
--- # How to Direct Natural AI Video Acting with a Beat Sheet (https://reapi.ai/blog/ai-video-acting-beat-sheet) **Believable AI video acting starts with a beat sheet, not a longer list of emotions.** A beat sheet turns a scene into small changes that the model can show: a character hears a line, pauses, looks away, makes a decision, then speaks. It also defines the visible state at the end of each beat, so the next moment has somewhere concrete to begin. This beginner tutorial builds one short dialogue scene from idea to review. You can use the method with any video model that accepts detailed prompts. The API example uses Seedance 2.5 on reAPI because it supports generated audio and clips up to 30 seconds in one request.\[1] ## TL;DR * Write one sentence describing what changes emotionally during the scene. * Give each character a stable starting state, private goal, and pressure point. * Divide the scene into beats of roughly one action or reaction each. * End every beat with an observable state: gaze, posture, distance, prop, or expression. * Put dialogue, performance, blocking, camera, and sound in separate prompt blocks. * Review speaker assignment, pauses, gaze, hands, screen direction, and the final state before accepting the clip. ![AI video acting workflow from character state through timed beats, generation, and performance review](https://cdn.reapi.ai/media/blog/ai-video-acting-beat-sheet/ai-video-acting-beat-sheet-workflow.png) ## What an acting beat is An acting beat is the smallest meaningful change in a scene. It is not simply a time range. Something has to happen that changes what a character knows, wants, or does. Consider this line: ```text Maya: "You already packed?" ``` “Maya looks sad” is weak direction because it describes a general mood. A beat is more useful: ```text Maya notices the suitcase before she speaks. Her shoulders stop moving. She looks at the suitcase, then at Leo, and asks quietly, "You already packed?" She ends the beat holding eye contact, waiting for him to answer. ``` The second version gives the model a trigger, a sequence, a line reading, and an end state. Those are visible instructions rather than an abstract label. ## Step 1: Reduce the scene to one emotional change Before writing dialogue, finish this sentence: ```text The scene begins with __________ and ends with __________ because __________. ``` For example: ```text The scene begins with Maya expecting a normal goodbye and ends with her realizing Leo planned to leave without telling her because she sees his packed suitcase before he can hide it. ``` This is the spine of the scene. If a proposed camera move, gesture, or extra line does not help the viewer understand that change, remove it. Beginners often ask one generation to carry several emotional turns, a location reveal, product placement, and complicated camera choreography. The model then spreads its attention across too many jobs. Start with one turn. Add complexity only after the simple version works. ## Step 2: Write a compact character state card A model does not need a page of biography. It needs the details that affect this scene. ```json { "maya": { "starting_state": "relaxed, expecting a routine goodbye", "goal": "get an honest explanation", "pressure_point": "being excluded from important decisions", "default_behavior": "stays quiet before confronting someone", "fixed_visuals": "dark bob, green coat, silver watch" }, "leo": { "starting_state": "guarded and eager to leave", "goal": "end the conversation without admitting guilt", "pressure_point": "direct eye contact", "default_behavior": "handles nearby objects when uncomfortable", "fixed_visuals": "short brown hair, charcoal jacket, black suitcase" } } ``` The `default_behavior` field is especially useful. “Nervous” can become random blinking and exaggerated facial movement. “Turns the suitcase handle when uncomfortable” gives the performance a physical outlet. If likeness matters, prepare clear reference images before generation. This tutorial focuses on performance planning; the [character consistency workflow](/blog/gpt-image-2-seedance-2-0-character-workflow) covers reference preparation in more detail. ## Step 3: Turn the dialogue into timed beats Use four to six beats for a short scene. The exact seconds are guides, not a frame-accurate edit decision. What matters is order and a clear end state. | Time | Trigger | Visible performance | Dialogue | End state | | ------ | ----------------------------- | ------------------------------------------- | ------------------------------ | --------------------------------- | | 0–4s | Maya sees suitcase | Walk stops; eyes move to suitcase | None | Maya still, suitcase between them | | 4–8s | Leo notices her | Hand tightens on handle; avoids eye contact | Maya: “You already packed?” | Leo looks toward door | | 8–13s | Silence becomes uncomfortable | Maya steps closer; Leo exhales | Leo: “It was easier this way.” | Both hold position | | 13–19s | Maya understands | Brief look down, then steady eye contact | Maya: “For who?” | Maya calm; Leo cornered | | 19–24s | Leo cannot answer | Hand leaves suitcase; posture softens | None | Silence, no reconciliation | Notice that not every beat contains speech. Silence gives the model time to show a reaction. It also keeps speaker assignment clearer than continuous overlapping dialogue. ## Step 4: Plan blocking before camera movement Blocking describes where people and objects are. Camera direction describes how the audience sees that blocking. Fix the first before adding the second. For the example scene: * Maya starts frame left, two meters from the suitcase. * Leo starts frame right with his right hand on the handle. * The suitcase remains between them. * Neither person crosses the center line. * Maya takes one step forward during the third beat. * Leo does not walk away before the final beat. These constraints protect screen direction and make later cuts easier. Then add a simple camera progression: ```text 0-8s: locked medium two-shot. 8-19s: very slow push toward a tighter two-shot. 19-24s: hold. No additional camera movement. ``` Do not make the camera perform every emotion. A sudden orbit, crane move, and zoom can compete with the actors. For a dialogue test, one restrained move is enough. ## Step 5: Assemble the prompt in six blocks Separate prompt blocks make mistakes easier to diagnose. If the camera is wrong, you can edit the camera block without rewriting character identity or dialogue. ```text REFERENCES Image 1 is Maya's identity and wardrobe reference. Image 2 is Leo's identity and wardrobe reference. Image 3 defines the station entrance, lighting, and initial blocking. CHARACTERS Maya stays quiet before confronting someone. Leo handles the suitcase when he is uncomfortable. Preserve their age, facial features, hair, clothing, and body proportions throughout. SCENE AND BLOCKING Evening outside a train station. Maya remains frame left. Leo remains frame right. A black suitcase stays between them. They do not cross positions. PERFORMANCE TIMELINE 0-4s: Maya enters, notices the suitcase, stops walking, and looks from the suitcase to Leo. End with Maya still and Leo unaware. 4-8s: Leo notices her and tightens his hand on the handle without looking at her. Maya asks quietly, "You already packed?" End with Leo looking at the door. 8-13s: Maya takes one step closer. Leo exhales and says, "It was easier this way." End with both holding position. 13-19s: Maya briefly looks down, regains eye contact, and asks, "For who?" End with Maya calm and Leo unable to answer. 19-24s: Leo releases the handle and softens slightly. Neither speaks. End in unresolved silence. CAMERA 0-8s locked medium two-shot. 8-19s very slow push to a tighter two-shot. 19-24s hold. Keep both faces visible and preserve the left-right axis. SOUND AND CONSTRAINTS Natural American English. Keep the exact lines and speaker assignment. Quiet station ambience. No narration, subtitles, extra dialogue, background music, or exaggerated crying. ``` ByteDance documents that Seedance can reference composition, movement, camera language, and sound from multimodal inputs. It also notes that the model still has room to improve on multi-subject consistency and text accuracy, which is why the reference roles and review step matter.\[2] ## Step 6: Generate a rehearsal before the final scene Use a short, low-risk rehearsal to test speaker order, blocking, and emotional timing. Do not judge wardrobe texture or final color yet. On reAPI, a minimal Seedance 2.5 request looks like this: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "PASTE_THE_SIX_BLOCK_PROMPT_HERE", "image_urls": [ "https://example.com/maya.jpg", "https://example.com/leo.jpg", "https://example.com/station.jpg" ], "resolution": "720p", "size": "16:9", "duration": 24, "generate_audio": true }' ``` The request is asynchronous. Poll the returned task ID until the status is `completed` or `failed`. Current field limits and billing rules belong in the [Seedance 2.5 API documentation](/docs/seedance-2-5), not in hard-coded client assumptions. ## Step 7: Review the performance in the right order Watch the result three times with a different purpose each time. ### Pass one: sound only Listen without watching. Check exact lines, speaker assignment, line order, unwanted narration, pacing, and whether pauses exist where the beat sheet asks for them. ### Pass two: picture without sound Mute the clip. Check gaze, body position, hand behavior, facial continuity, screen direction, and whether each beat ends in the planned state. ### Pass three: full scene Now judge whether dialogue, reaction, camera, and sound support the same turn. If one layer fails, repair that layer first. Do not rewrite the whole scene because one pause is too short. Use a simple acceptance sheet: ```json { "speaker_order": "pass", "exact_dialogue": "pass", "left_right_axis": "pass", "beat_3_end_state": "repair", "identity": "pass", "camera": "pass", "repair_note": "Leo looks at Maya too early; hold gaze on the door through 13s" } ``` This is the same principle as an [AI video critic loop](/blog/ai-video-agent-critic-loop): accept or repair against explicit evidence instead of asking whether the clip “feels good.” ## Common beginner mistakes | Mistake | Why it fails | Better move | | -------------------------------------------- | ---------------------------------- | ----------------------------------------------- | | Writing “sad, cinematic, emotional” | Mood words do not define behavior | Add a trigger, physical reaction, and end state | | Giving both characters constant motion | The scene becomes busy and unclear | Let one act while the other receives | | Filling every second with dialogue | Reactions have no time to register | Reserve beats for silence | | Changing camera style every beat | Camera competes with performance | Use one progression and one hold | | Regenerating everything after one defect | Good parts are lost | Repair the smallest failed block | | Asking for exact brand text inside the scene | Generated text can be unreliable | Add critical copy in post-production | ## FAQ ### How many acting beats should a beginner use? Start with four to six. Each beat should contain one main trigger or reaction. If a row needs several sentences to explain what changes, split it. ### Do timecodes guarantee exact timing? No. Treat them as pacing guidance. Check the rendered result and trim in an editor when exact delivery timing matters. ### Should every emotion be visible on the face? No. Posture, gaze, distance, hand movement, and silence often communicate more cleanly than an exaggerated expression. ### Can I use this workflow without character reference images? Yes, but visual identity will be less constrained. References become more important when a specific person or recurring fictional character must remain recognizable. ### What should I fix first when a dialogue scene fails? Fix speaker order and blocking before subtle emotion. A beautifully rendered reaction cannot save a scene in which the wrong character speaks or crosses to the wrong side. ## Conclusion An AI video acting beat sheet converts an emotional idea into observable work: triggers, reactions, dialogue, blocking, end states, and review criteria. Build one simple turn, give silence room, and keep the camera restrained. Once that version works, you can add more complex performances without losing control of the scene. ## References 1. ByteDance Seed. *One-take Creation, Flexible Referencing: Introducing Seedance 2.5.* July 31, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/one-take-creation-flexible-referencing-introducing-seedance-2-5) 2. ByteDance Seed. *Seedance 2.0 Official Launch.* February 12, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/seedance-2-0-%E6%AD%A3%E5%BC%8F%E5%8F%91%E5%B8%83) 3. reAPI. *Seedance 2.5 API — Parameters, Modes & Billing.* Retrieved August 27, 2026. [reapi.ai](/docs/seedance-2-5) --- # AI Video Agent Workflow: Build a Critic Loop for Reliable Video QA (https://reapi.ai/blog/ai-video-agent-critic-loop) **An AI video agent needs a separate acceptance decision after generation.** A task can finish successfully while the clip still changes a face, bends a product, invents label text, or ends on a frame that cannot connect to the next shot. A critic loop catches those failures, explains what broke, and sends only the affected shot back for repair. This is an evaluator-optimizer workflow applied to video production. The generator makes a clip; the critic compares it with explicit criteria; the agent either accepts, repairs, escalates, or stops.\[1] ## TL;DR * Write a **shot contract** before generation. Separate details that must stay fixed from motion, lighting, and camera changes that are allowed. * Run **deterministic checks first**: task status, output URL, file readability, duration, dimensions, and audio presence. * Make the critic return **evidence and repair scope**, not one vague quality score. * Retry only the failed shot, and preserve every part that already passed. * Set a ceiling for completed attempts. A loop without a stop condition can turn one difficult shot into an open-ended bill. * Keep a human gate for likenesses, legal copy, brand claims, and the final cut. ![AI video agent critic loop from shot planning through generation, checks, selective repair, and approval](https://cdn.reapi.ai/media/blog/ai-video-agent-critic-loop/ai-video-agent-critic-loop-workflow.png) ## Why a completed generation is not an accepted shot Generation infrastructure and creative review answer different questions. The task system knows whether a provider returned a file. It does not know whether the bottle kept its proportions, the actor stayed recognizable, or the last frame matches the storyboard. That distinction also affects cost. On reAPI, `completed` tasks report the settled charge in `usage.credits`, while failed tasks are refunded when the workflow ends in failure.\[3] If a task completes and your team rejects the clip for a creative defect, it remains a completed generation. The application therefore needs a budget for creative retries, even when provider failures cost nothing. Treat the generation result as a candidate, not the finished asset. ## Step 1: Give the AI video agent a shot contract A critic cannot make a consistent decision from “does this look good?” Write the acceptance rules before the first request so the planner, generator, critic, and human reviewer are judging the same thing. ```json { "shot_id": "03-product-orbit", "intent": "Reveal the side label while keeping the bottle centered", "must_keep": [ "bottle silhouette and cap width", "label colors and aspect ratio", "no added words or marks", "single continuous shot" ], "allowed_change": [ "camera moves 30 degrees left", "background becomes slightly warmer" ], "end_state": "front label readable and product centered", "max_completed_attempts": 3, "max_provider_failures": 2 } ``` The contract should describe observable conditions. “Premium,” “cinematic,” and “beautiful” may belong in the creative brief, but they are poor pass/fail rules. “Cap width unchanged” and “no added text” are easier to inspect and repair. If the work needs detailed product-reference preparation, use the [Seedance 2.5 e-commerce workflow](/blog/seedance-2-5-ecommerce-video). If the failure is identity drift between shots, the [GPT Image 2 and Seedance character workflow](/blog/gpt-image-2-seedance-2-0-character-workflow) covers the reference package and continuity handoff. The critic loop sits above either workflow rather than replacing it. ## Step 2: Reject technical failures before using a model critic Not every check needs another AI call. Use code for facts that code can verify, then reserve visual judgment for a multimodal evaluator or a human. | Check | Best method | Failure action | | ------------------------------ | ------------------- | ----------------------------------- | | Task terminal state | API status | Wait, retry a true failure, or stop | | Output URL exists | Response validation | Reject before review | | File can be decoded | Media probe | Reject as broken output | | Duration is within tolerance | Media metadata | Repair or human review | | Dimensions match delivery spec | Media metadata | Reject or resize if permitted | | Expected audio track exists | Media metadata | Repair audio or regenerate | | First and final frames exist | Frame extraction | Continue to continuity checks | This ordering matters. Asking a vision model to evaluate a corrupt file wastes time and produces ambiguous feedback. A clean technical gate gives the critic valid evidence to inspect. The same principle appears in agent evaluation more broadly: useful evals mix methods, and no single layer catches every problem.\[2] ## Step 3: Ask the critic for evidence, severity, and repair scope One overall score hides the decision you actually need. A critic returning `0.78` does not tell the agent whether to regenerate the shot, fix the audio, or send the clip to a person. Use structured output instead: ```json { "decision": "repair", "severity": "hard_fail", "failed_check": "bottle geometry changes during the orbit", "evidence": { "time_range": "4.2s-5.0s", "observation": "cap narrows and label aspect ratio shifts" }, "repair_scope": "shot_03_only", "preserve": ["camera path", "lighting", "duration"], "next_instruction": "reinforce product geometry from the identity reference" } ``` Keep the critic's vocabulary small. Four decisions are usually enough: * `accept`: every hard rule passed; * `repair`: the failure has a narrow, actionable scope; * `human_review`: the evidence is ambiguous or the judgment is sensitive; * `stop`: the retry ceiling or budget has been reached. This structure prevents a common failure in automated video QA: the critic rewrites the entire brief after finding one local defect. ## Step 4: Repair only what failed Selective repair is the main economic benefit of the loop. If five shots pass and the sixth has a bad final frame, do not send the full sequence back through generation. | Failure | Narrow response | What should remain frozen | | ------------------------------ | ---------------------------------------------------------------------- | -------------------------------------- | | Product or face drifts late | Regenerate the one shot from the same approved start frame | Identity references, framing, duration | | Final frame misses the handoff | Restate the end state or shorten the action | Opening frame, character, set | | Generated text is wrong | Remove critical text from generation and add it in post | Accepted motion and composition | | Audio is missing | Repair the audio path or regenerate only when native sync is essential | Accepted visual clip when possible | | Camera move is wrong | Simplify to one movement with a defined end frame | Subject, environment, lighting | Do not let the critic introduce a second creative direction. Its job is to compare, diagnose, and constrain the next attempt. The planner owns the brief. ## Step 5: Set a retry budget and a stopping rule Every automated loop needs an exit. Anthropic's evaluator-optimizer guidance recommends the pattern when evaluation criteria are clear and feedback can produce measurable improvement; it is a poor fit when the critic cannot articulate a useful correction.\[1] Use both an attempt ceiling and a spend ceiling: ```text creative retry ceiling = maximum completed attempts × estimated completed-task cost ``` The estimate comes from the chosen model's live rate card. The settled amount comes from the task's `usage.credits`; read that value instead of trying to reconstruct model-specific billing rules in the client.\[3] A practical stopping policy might escalate when the same hard rule fails twice, when the next repair would change a previously accepted property, or when the remaining budget cannot cover another attempt. These are product decisions, not universal model limits. ## A minimal critic-loop implementation The loop can sit above any asynchronous video model. The media model generates; the application stores the task id, waits for a terminal state, runs technical checks, and calls the critic only on valid output. ```ts type CriticDecision = | { action: 'accept' } | { action: 'repair'; repairPrompt: string } | { action: 'human_review'; reason: string } | { action: 'stop'; reason: string }; async function produceAcceptedShot(contract: ShotContract) { let request = contract.initialRequest; let completedAttempts = 0; let providerFailures = 0; while ( completedAttempts < contract.maxCompletedAttempts && providerFailures < contract.maxProviderFailures ) { const task = await submitVideo(request); const result = await pollUntilTerminal(task.id); if (result.status === 'failed') { providerFailures++; continue; } completedAttempts++; await runDeterministicMediaChecks(result.output.video_urls[0], contract); const decision: CriticDecision = await reviewShot(result, contract); if (decision.action === 'accept') return result; if (decision.action !== 'repair') return decision; request = applyNarrowRepair( contract.initialRequest, decision.repairPrompt ); } return { action: 'stop', reason: 'attempt or provider-failure ceiling reached' }; } ``` Production code also needs persistence, timeouts, rate-limit handling, and a record of which output the human finally approved. Most importantly, do not submit a duplicate merely because the client stopped waiting. Video tasks can run for minutes, and the task endpoint provides the authoritative state.\[3] ## Where reAPI fits in an AI video agent workflow The critic loop should not depend on one video model. The planner may need a long take for one shot, stronger reference control for another, or a cheaper draft route while the visual direction is unsettled. reAPI exposes current video models through one catalog and uses an asynchronous task lifecycle for media generation.\[4] That keeps submission, polling, settled usage, failure handling, and output storage consistent while model-specific request fields remain explicit. The agent can change models without pretending their control surfaces are identical. Start with the [video model catalog](/models?type=video), then use the selected model's documentation for its actual fields. Use the canonical [Tasks API reference](/docs/api/tasks) for polling, output, usage, errors, and refund semantics. ## FAQ ### Does an AI video critic need to watch the entire video? Not always. Deterministic checks can inspect metadata, while a visual critic can begin with sampled frames and the planned start and end states. Continuous motion, lip sync, sound, or short-lived artifacts may require full video and audio review. Escalate when the available evaluator cannot inspect the relevant evidence. ### Should the generator and critic use the same model? They can, but they do not have to. Separation of roles matters more than the number of model vendors. The critic needs the contract, the output evidence, and a constrained decision schema; it should not inherit permission to rewrite the creative brief. ### How many retries should an AI video agent allow? There is no universal number. Set the ceiling from shot importance, completed generation cost, delivery time, and the likelihood that the critic's feedback can change the result. Escalate repeated hard failures instead of looping until the budget disappears. ### Are failed video generations charged on reAPI? Failed tasks are refunded automatically. A completed clip that your critic rejects for creative reasons is still a completed task and reports its settled charge in `usage.credits`.\[3] ### Which checks should always require a person? Keep a human decision for legal or factual claims, identifiable likenesses, critical brand text, sensitive content, and final editorial approval. Automated checks should narrow the review queue, not silently assume accountability. ## Conclusion An AI video agent workflow becomes useful when it can reject a technically successful but unusable shot. Define the contract first, use code for objective checks, demand evidence from the critic, repair only the failed scope, and stop when the budget or feedback quality runs out. The loop does not guarantee a perfect generation. It prevents one bad shot from quietly becoming the editor's problem. ## References 1. Anthropic. *Building effective agents: evaluator-optimizer workflows, gates, and stopping conditions.* Retrieved August 27, 2026 from [anthropic.com](https://www.anthropic.com/engineering/building-effective-agents) 2. Anthropic. *Demystifying evals for AI agents.* Retrieved August 27, 2026 from [anthropic.com](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) 3. reAPI. *Tasks API: polling, `usage.credits`, status values, and refund behavior.* Retrieved August 27, 2026 from [reapi.ai/docs/api/tasks](/docs/api/tasks) 4. reAPI. *Live model catalog and video model availability.* Retrieved August 27, 2026 from [reapi.ai/models](/models) ### Further reading * reAPI. *Seedance 2.5 for E-commerce Video: A Real Workflow.* [reapi.ai/blog/seedance-2-5-ecommerce-video](/blog/seedance-2-5-ecommerce-video) * reAPI. *GPT Image 2 + Seedance 2.0: A Character Consistency Workflow.* [reapi.ai/blog/gpt-image-2-seedance-2-0-character-workflow](/blog/gpt-image-2-seedance-2-0-character-workflow) * reAPI. *AI video generation API comparison.* [reapi.ai/blog/best-ai-video-generation-api-2026](/blog/best-ai-video-generation-api-2026) --- # How to Keep AI Video Continuity Across Multiple Clips (https://reapi.ai/blog/ai-video-continuity-state-ledger) **AI video continuity improves when every clip ends with a written and visual handoff to the next clip.** The final frame is part of that handoff, but it is not enough. You also need a state ledger that records where characters stand, which way they face, what they hold, what has changed, and what the next shot is allowed to do. This tutorial builds a sequence longer than one model call. The example uses two Seedance 2.5 generations because ByteDance documents clips up to 30 seconds and multi-round extension.\[1] The state-ledger method also applies to shorter models and separate-shot edits. ## TL;DR * Plan the full sequence before generating the first clip. * Split at a stable visual state, not in the middle of the hardest action. * Record identity, position, direction, props, environment, light, camera, and unresolved action in a state ledger. * Request the last frame of the first clip and use it as a boundary anchor. * Begin the continuation prompt by restating the inherited state. * Review the join frame-by-frame and then at normal speed. * Repair only the boundary or affected clip; do not regenerate the entire story. ![Long-form AI video continuity workflow from master sequence and state ledger through boundary frame, continuation generation, join review, and selective repair](https://cdn.reapi.ai/media/blog/ai-video-continuity-state-ledger/ai-video-continuity-workflow.png) ## Why a final frame alone does not preserve continuity A frame shows appearance and position at one instant. It does not fully explain movement direction, character intention, prop history, audio timing, or what must happen next. Imagine a cyclist at the right edge of frame. The image does not tell the next generation whether the cyclist arrived from the left, is about to exit right, or has stopped and will turn around. The state ledger provides that missing temporal information. Think of continuity as eight connected states: | State | Example | | ------------ | --------------------------------------------------------- | | Identity | same rider, helmet, blue jacket, black bicycle | | Position | rider at right third, bicycle parallel to road | | Direction | traveling left to right, no reversal | | Pose/action | right foot down, hands on handlebars, decelerating | | Props | red backpack remains on rider; water bottle in frame cage | | Environment | wet mountain road, pine trees, morning fog | | Light | soft backlight from upper left | | Camera/audio | low tracking view; tire noise continues under cut | A stable sequence preserves all eight unless the story deliberately changes one. ## Step 1: Plan the complete sequence before the first call Write the full action in plain language. Then divide it into clips based on natural handoff states. ```text Full sequence: A cyclist descends through fog, brakes before a fallen branch, carries the bike around it, remounts, and continues toward a sunlit opening. Clip 1: Descent and braking. End with the bicycle stopped on the right side of the road, front wheel turned slightly left, rider's right foot on the ground. Clip 2: Rider dismounts, carries the bicycle around the branch, remounts, and exits toward the sunlit opening. ``` The split occurs after the braking action settles. It does not occur while the front wheel is turning or the foot is moving toward the ground. Stable handoffs give the continuation less ambiguity. ## Step 2: Create the master continuity bible The continuity bible contains details that apply to the whole sequence. ```json { "character": { "identity": "same adult cyclist", "wardrobe": "matte black helmet, blue rain jacket, black pants", "fixed_details": "red backpack, no gloves" }, "vehicle": { "type": "black hardtail mountain bike", "fixed_details": "water bottle in down-tube cage, no rear suspension" }, "world": { "location": "wet mountain road through pine forest", "weather": "light fog, no active rain", "light": "soft morning backlight from upper left" }, "camera_language": { "height": "low waist-height tracking", "lens": "moderate wide look", "movement": "smooth with small natural vibration", "screen_direction": "left to right" }, "audio": { "bed": "tire noise, light wind, distant birds", "music": "none" } } ``` Reuse this information across every clip. A separate [character consistency guide](/blog/seedance-2-0-character-consistency-guide) covers reference design; the continuity bible records the production decisions that surround identity. ## Step 3: Add a clip-specific state ledger The ledger has three columns: inherited state, changes during this clip, and required end state. ```json { "clip_id": "01-descent-and-stop", "inherits": { "rider_position": "left third", "direction": "left to right", "speed": "moderate downhill", "hands": "both on handlebars", "bike": "upright and rolling" }, "changes": [ "fallen branch becomes visible", "rider brakes without reversing", "bike moves to right side of road", "right foot lowers to ground" ], "end_state": { "rider_position": "right third", "direction": "still facing right", "speed": "stopped", "right_foot": "on ground", "left_foot": "on pedal", "front_wheel": "turned slightly left", "hands": "both on handlebars", "branch": "two meters ahead", "camera": "stable low three-quarter view", "hold": "one second" } } ``` The next clip's `inherits` object should match this `end_state`. If they differ, you have found a continuity problem before spending on generation. ## Step 4: Generate the first clip with a deliberate handoff The prompt should devote enough attention to the final state. ```text The same cyclist in a matte black helmet, blue rain jacket, black pants, and red backpack rides a black hardtail mountain bike from left to right on a wet forest road. Low waist-height tracking camera, soft morning backlight from upper left. The cyclist sees a fallen branch, brakes gradually without reversing, moves to the right side of the road, and stops. The right foot lowers to the ground while the left foot stays on the pedal. Both hands remain on the handlebars. The front wheel points slightly left. End on a stable low three-quarter view with the branch two meters ahead. Hold the exact final state for one second. No cut, wardrobe change, extra rider, or direction reversal. ``` Request the last frame in the API call: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "The cyclist rides left to right, brakes before a fallen branch, and stops on the right side of the road. Right foot on ground, left foot on pedal, both hands on handlebars, front wheel slightly left. Hold the exact final state for one second. Preserve rider, bicycle, wardrobe, road, light, and direction.", "image_urls": ["https://example.com/rider-and-bike-reference.jpg"], "resolution": "720p", "size": "16:9", "duration": 12, "generate_audio": true, "return_last_frame": true }' ``` When the task completes, reAPI returns the generated video URL and, when requested, `output.last_frame_url`.\[2] ## Step 5: Audit the boundary before continuing Do not automatically forward the last frame. Confirm that it represents the written end state. ```json { "identity": "pass", "screen_direction": "pass", "right_foot_grounded": "pass", "left_foot_on_pedal": "repair", "both_hands_on_handlebars": "pass", "front_wheel_direction": "pass", "branch_distance": "pass", "stable_hold": "pass" } ``` If a hard continuity condition fails, repair clip one or choose an earlier valid frame. Forwarding a bad boundary makes the next generation inherit the error. ## Step 6: Build the continuation request Start the second prompt by restating the inherited state, then describe only the new changes. ```text Begin exactly from Image 1. The same cyclist is stopped on the right side of the wet road, facing right. Right foot is on the ground, left foot is on the pedal, both hands hold the handlebars, front wheel points slightly left, and the fallen branch is two meters ahead. Preserve the same rider, helmet, blue jacket, red backpack, black bicycle, water bottle, fog, and light direction. The rider dismounts to the left side without turning the bicycle around, lifts the bicycle by the frame, walks around the near end of the branch, places both wheels back on the road facing right, remounts, and rides toward the brighter opening. Maintain left-to-right screen direction. End with the rider exiting frame right. No new props, wardrobe changes, weather changes, or cuts. ``` Use the returned image as an explicit first frame: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "Begin exactly from Image 1. Preserve rider, wardrobe, bicycle, prop placement, fog, light, and left-to-right direction. The rider dismounts, carries the bicycle around the branch without reversing it, remounts, and exits frame right. No cuts or new objects.", "image_with_roles": [ { "url": "LAST_FRAME_URL_FROM_CLIP_1", "role": "first_frame" } ], "resolution": "720p", "size": "adaptive", "duration": 14, "generate_audio": true, "return_last_frame": true }' ``` On the current reAPI route, first-frame roles use `image_with_roles`, require adaptive sizing, and cannot be mixed with `image_urls`, `video_urls`, or `audio_urls` in the same request. This is a gateway rule that should be handled in request validation rather than discovered after submission.\[2] If you need several identity references instead of a hard first-frame role, use a reference-image workflow and describe the previous final frame as one of the ordered inputs. That provides more identity evidence but a softer boundary. The right choice depends on which failure is more expensive. ## Step 7: Review the join at three speeds Place the clips next to each other in an editor. ### Frame-by-frame Compare the final frame of clip one and first frames of clip two for body shape, wardrobe, hand position, prop position, bicycle geometry, light, and camera height. ### Half speed Check whether motion restarts unnaturally, a wheel jumps, a limb changes support, or the camera accelerates at the cut. ### Normal speed Judge whether a viewer notices the join. A small texture difference may be invisible in motion; a direction reversal will not be. Use a boundary report: ```json { "visual_match": "pass", "screen_direction": "pass", "action_continuation": "repair", "camera_velocity": "pass", "audio_bed": "repair in edit", "note": "clip 2 lifts the left foot before the hands shift to the frame" } ``` ## Step 8: Repair the smallest continuity break Not every mismatch requires regeneration. | Problem | Smallest practical repair | | ------------------------------ | ------------------------------------------------------------------ | | One or two bad boundary frames | Trim to a cleaner point | | Audio ambience changes | Replace with one continuous sound bed in edit | | Camera pauses at the join | Add a short overlap or choose a stable cut | | Prop switches hands | Regenerate the affected continuation beat | | Character or vehicle changes | Strengthen the boundary/reference workflow and regenerate clip two | | Screen direction reverses | Rewrite the inherited direction and regenerate clip two | | Lighting shifts slightly | Grade in post if identity and geometry pass | Continuity is not pixel identity. The goal is a believable handoff where story, space, and action remain readable. ## Step 9: Scale the ledger to more clips For a longer project, store one master bible and one ledger per clip. ```text /sequence master-continuity.json clip-01-ledger.json clip-02-ledger.json clip-03-ledger.json /references /boundary-frames /generated /approved ``` Before generating clip three, compare: ```text clip-02.end_state == clip-03.inherits ``` An agent can perform this consistency check automatically. A human should still approve identity, sensitive likenesses, narrative intent, and the final cut. ## Common beginner mistakes ### Splitting during fast action Choose a stop, hold, contact, or completed gesture. Mid-motion boundaries force the next generation to infer momentum from one image. ### Describing only what changes The continuation also needs inherited facts. Restate direction, props, position, light, and camera conditions before new action. ### Forwarding an invalid last frame Review it first. A distorted hand or missing prop becomes the starting evidence for the next clip. ### Solving visual continuity while ignoring audio Use one ambience bed across the join when separate generations produce a tonal or volume change. ### Regenerating every clip after a late failure Freeze approved clips. Repair the boundary or the first failed continuation. ## FAQ ### Is the last frame enough to continue an AI video? It helps with appearance and position, but not with direction, intent, prop history, or future action. Pair it with a state ledger and continuation prompt. ### Where should I split a long sequence? Split after an action settles: a stop, landing, placed object, closed door, held pose, or stable camera frame. ### How many details belong in the state ledger? Record anything whose unexplained change would distract a viewer or break the next action. Ignore decorative details that can vary safely. ### Can I combine a first-frame role with other references? Not on the current reAPI Seedance 2.5 request surface. `image_with_roles` cannot be combined with the other media-reference fields, so choose between a hard frame boundary and a broader reference set. ### Should every clip use the maximum duration? No. Choose duration around natural actions and handoffs. A shorter complete beat is easier to control than a long clip filled to its limit. ## Conclusion AI video continuity is a handoff discipline. Plan the full sequence, end each clip on a stable state, verify the boundary frame, and make the next prompt inherit a written ledger before introducing new action. This does not eliminate variation, but it turns “make it continue” into a production process you can inspect, repair, and automate. ## References 1. ByteDance Seed. *One-take Creation, Flexible Referencing: Introducing Seedance 2.5.* July 31, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/one-take-creation-flexible-referencing-introducing-seedance-2-5) 2. reAPI. *Seedance 2.5 API — Parameters, Modes & Billing.* Retrieved August 27, 2026. [reapi.ai](/docs/seedance-2-5) 3. ByteDance Seed. *Seedance 2.0 Official Launch.* February 12, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/seedance-2-0-%E6%AD%A3%E5%BC%8F%E5%8F%91%E5%B8%83) --- # AI Video Generation API: Why the Prices Don't Compare (https://reapi.ai/blog/ai-video-generation-api-pricing) Comparing any AI video generation API by its headline rate breaks almost immediately, because the models in this category do not bill in the same unit. Some charge per second of output. Others charge a flat rate per generation regardless of how long the clip runs. A number like `$0.126` and a number like `$0.161` are not comparable quantities, and treating them as though they were is how video budgets get written wrong by an order of magnitude. The fix when evaluating an AI video generation API is not a bigger comparison table. It is knowing which billing unit a model uses, and where the crossover between the two sits for the clip length you actually ship. ## TL;DR * **Two billing units coexist across the AI video generation API category**: per second of output, and flat per generation. * **Per-second examples**: Kling 3.0 Turbo at $0.126/s (720p), Vidu Q3 Turbo at $0.037/s (540p), Seedance 2.0 Face at $0.07125/s (480p, no source video). * **Per-generation example**: Veo 3.1 fast at $0.161 per generation at 720p and 1080p. * **The crossover is short.** Against Kling 3.0 Turbo at 1080p, a flat $0.161 generation breaks even at about **1 second**. Past that, flat pricing wins. * **Resolution slopes differ wildly.** Seedance 2.0 Face climbs from $0.07125/s at 480p to $0.78/s at 4K, roughly 11x. Vidu Q3 Pro moves from $0.138/s at 720p to $0.148/s at 1080p, about 7%. * **Every AI video generation API here is async.** Submit returns a task id; you poll. Design for that before picking a model. ## The two billing units in AI video generation API pricing Every rate below is a per-model figure on reAPI, checked on October 22, 2026 and priced in credits where 1 credit is $0.001. **Per second.** You pay for duration, so a 10-second clip usually costs roughly twice a 5-second clip at the same resolution. Seedance source-video requests are an exception to the output-only clock: they add the rounded-up source-video duration to the output duration. | Model | 540p / 480P | 720p | 1080p | | ---------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | --------- | | Vidu Q3 Turbo | $0.037/s | $0.056/s | $0.065/s | | Vidu Q3 Pro | $0.065/s | $0.138/s | $0.148/s | | Seedance 2.0 Mini, no source video | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s | n/a | | Seedance 2.0 Face, no source video | $0.07125/s | $0.15375/s | $0.3825/s | | Kling 3.0 Turbo | n/a | $0.126/s | $0.158/s | **Flat per generation.** You pay once per job, and duration does not move the bill within whatever limit the model allows. | Veo 3.1 tier | 720p / 1080p | 4K | | ------------ | ------------ | ------ | | fast | $0.161 | $0.66 | | quality | $1.1 | $1.725 | ![Two billing units in AI video generation API pricing: per-second models like Kling 3.0 Turbo at $0.126 and Vidu Q3 Turbo at $0.037 versus flat per-generation pricing like Veo 3.1 fast at $0.189, with the break-even point at roughly 1.2 seconds](https://cdn.reapi.ai/media/blog/ai-video-generation-api-pricing/billing-units.png) Read those two tables as different currencies rather than different prices. Until you fix a clip length, they cannot be ranked against each other. ## Where the crossover sits Pick a target resolution and length, then convert everything into cost-per-clip. At 1080p, Kling 3.0 Turbo bills $0.158 per second and Veo 3.1 fast bills $0.161 per generation. The break-even is `0.161 / 0.158`, about **1 second**. Almost every real clip runs longer than that, so for 1080p output at these two tiers, the flat rate is cheaper essentially always. Against Seedance 2.0 Face at 1080p without source video, which is $0.3825 per second, the same flat $0.161 breaks even at roughly **0.42 seconds** — meaning it is cheaper for any usable clip at that resolution. Run the same arithmetic at a resolution where per-second pricing is cheap and the answer flips. Vidu Q3 Turbo at 540p is $0.037 per second, so a 5-second clip is about $0.185, slightly above a flat $0.161 generation. The break-even sits near 4.4 seconds: below it, per-second wins; above it, flat wins. **The practical rule**: flat-rate pricing rewards long clips, per-second pricing rewards short ones and low resolutions. If your product generates 3-second loops, those are different economics than a product generating 15-second spots, and the right model is probably not the same one. One caveat worth stating rather than glossing: flat-per-generation models have their own duration ceilings. The flat rate applies within that limit, not to arbitrarily long output. Check the limit on the model page before assuming a long clip is free upside. ## Resolution is a pricing dimension, not a quality toggle The slope from low to high resolution differs enormously across this category, and that slope matters more than the entry price for anything shipping at scale. Seedance 2.0 Face runs $0.07125/s at 480p and $0.78/s at 4K without source video. That is roughly **11x** across the range on one model. Choosing 4K there is a budget decision, not a preference. Vidu Q3 Pro runs $0.138/s at 720p and $0.148/s at 1080p — about **7%** for a full step up in resolution. On that model, defaulting to 1080p costs almost nothing. Veo 3.1 fast goes from $0.161 to $0.66 stepping into 4K, roughly 4.1x. So "which AI video generation API is cheapest" has no answer independent of resolution. Any AI video generation API comparison that omits the target resolution is incomplete. A model that is cheap at 480P can be the most expensive option at 4K. ## Design for async before you pick An AI video generation API is long-running by nature, and this category is uniformly asynchronous. The shape is the same regardless of which model you land on: POST a job, get a task id back immediately, poll until the status is terminal, then read the output URL. ```bash # submit curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.0-face", "prompt": "slow dolly across a rain-streaked window at dusk", "resolution": "720p", "size": "16:9", "duration": 5 }' # poll curl https://reapi.ai/api/v1/tasks/{id} \ -H "Authorization: Bearer YOUR_API_KEY" ``` Two consequences people discover late. Your request path cannot block on generation, so a webhook or a job queue belongs in the design from the start rather than bolted on after the prototype. And because jobs fail for reasons outside your control, your cost model needs to account for retries — on reAPI failed generations are refunded automatically, so the meter only moves on output you receive, but that is a platform behavior worth confirming wherever you integrate. ## Media inputs: hosted URLs only Image-to-video and reference-driven generation need their source assets reachable. On this platform, media inputs are **public http(s) URLs only, with no base64 accepted on any model**, so hosting comes before the API call rather than after. That constraint is easy to miss in a prototype where everything is a local file, and it shapes your pipeline: you need somewhere to put frames and reference clips that the API can fetch. ## Choosing an AI video generation API without a spreadsheet A short sequence that reaches an AI video generation API decision faster than a feature matrix: 1. **Fix the output spec first.** Resolution and typical clip length. Without these, no price comparison is meaningful. 2. **Convert every AI video generation API candidate to cost-per-clip** at that spec. This is the only step that makes per-second and per-generation models comparable. 3. **Check the resolution slope**, not just the entry price, if you might move up later. 4. **Confirm the input mode** you need — text-only, image-to-video, or reference video — is supported at the tier you priced. 5. **Prototype on the cheap tier.** Draft at a low resolution, then re-run only what survives review at the tier you ship. That last one is where most of the savings actually live. Generation cost per attempt matters far less than how many attempts you throw away. ## FAQ ### What is an AI video generation API? An HTTP endpoint that takes a prompt, and optionally reference images or video, and returns a generated clip. In practice it is asynchronous: you submit a job, receive a task id, and poll for the result. ### Why can't I compare AI video generation API prices directly? Because the AI video generation API category uses two different billing units. Per-second models charge by output duration; per-generation models charge a flat rate per job. Convert both to cost-per-clip at a fixed resolution and length first. ### Which is cheaper, per-second or per-generation billing? It depends entirely on clip length. Against Kling 3.0 Turbo at 1080p ($0.158/s), a flat $0.161 generation breaks even at about 1 second, so flat pricing wins for nearly any real clip. At 540p against Vidu Q3 Turbo ($0.037/s), the break-even stretches to about 4.4 seconds. ### How much does resolution change the cost? More than most people expect, and by wildly different amounts per model. Seedance 2.0 Face spans roughly 11x from 480p to 4K. Vidu Q3 Pro moves about 7% from 720p to 1080p. ### Do I need a subscription to use an AI video generation API? Not on this platform. Billing is pay-as-you-go: $1 buys 1,000 credits, credits do not expire, and new accounts start with 100 credits ($0.10) to verify an integration end to end. ### Can I send a local video file to the API? No. Media inputs are public http(s) URLs only, with no base64 on any model, so assets need hosting before the call. ### What happens if a generation fails? Failed generations are refunded automatically, so you only pay for output you actually receive. Build retry handling anyway, since a failed job still costs you wall-clock time. ### Should I use one AI video generation API or several? Several, if your workloads differ in length or resolution. Because these models sit behind one endpoint and one key, switching is a model-id change rather than a new integration, which makes routing cheap work to a cheap tier practical. ## Pricing the clip, not the model The useful question about any AI video generation API is not what it charges per unit but what it charges for the clip you actually ship. Fix the resolution, fix the length, convert every candidate into cost-per-clip, and the category stops looking like a pile of incomparable numbers. Do that once for each AI video generation API on your shortlist and the second-order decisions get easier: draft at a cheap tier, escalate only what survives, and check the live rates rather than the ones in an article, because every number here is a value in a table that changes. The rate tables for each model referenced above are on [reapi.ai/models](/models), and those are canonical. ## References 1. reAPI. *Model catalog — live per-model rates for video generation.* Seedance rates retrieved August 17, 2026 from [reapi.ai/models](/models) ### Further reading * reAPI. *Seedance 2.0 cost per second.* [reapi.ai/blog/seedance-2-0-cost-per-second](/blog/seedance-2-0-cost-per-second) * reAPI. *Nano Banana API free tier.* [reapi.ai/blog/nano-banana-api-free-tier](/blog/nano-banana-api-free-tier) * reAPI. *What reAPI does.* [reapi.ai/blog/what-is-reapi](/blog/what-is-reapi) --- # AI Video Generator Long Videos: Chaining Past the Cap (https://reapi.ai/blog/ai-video-generator-long-videos) Every AI video model caps a single generation well under a minute. Seedance 2.5 stops at 30 seconds, Seedance 2.0 and MiniMax H3 at 15, and Veo 3.1 is fixed at 8.\[1]\[2]\[3]\[4] There is no setting that lifts those ceilings, and no AI video generator long videos feature hiding behind a paid tier. The limit is architectural. So every multi-minute AI video you have seen was assembled from segments. The question worth answering is not which model makes long videos, it is how to join segments without the join being visible, what that costs when you count the segments you throw away, and which parameter combinations quietly become illegal the moment you start chaining. This covers all three, using the API rather than a timeline editor. ## TL;DR * **30 seconds is the current single-call ceiling**, on Seedance 2.5.\[1] Every AI video generator long videos workflow past that point is chained segments. * **`return_last_frame` is the joint.** Ask for it, then feed `output.last_frame_url` into the next call as the first frame.\[1] * **Chaining forces `size: adaptive`.** A first-frame job rejects any other aspect ratio at submit, so pick your framing in segment one.\[1] * **A chained segment cannot also carry a reference video.** `image_with_roles` is mutually exclusive with `video_urls` and `audio_urls`.\[1] * **A three-minute 720p piece is about $48 of generation if nothing is rejected**, and closer to $144 at three attempts per segment.\[5] ## Why an AI video generator long videos mode does not exist Published limits, from each model's parameter reference: | Model | Single-call duration | | ---------------- | --------------------------------------------------------------------------- | | Seedance 2.5 | 4–30 s, or `-1` to let the model choose\[1] | | Seedance 2.0 | 4–15 s\[2] | | MiniMax H3 | 4–15 s, default 6\[3] | | Grok Imagine 1.5 | 1–15 s\[6] | | Veo 3.1 | fixed at 8 s upstream\[4] | Thirty seconds is the best available, and it is recent. Treat any AI video generator long videos claim as either chaining on your behalf or describing something other than one continuous generation. That distinction matters for cost. A tool that chains for you still pays for every segment, and so do you. ## The chain: last frame out, first frame in The mechanism is two fields. Set `return_last_frame: true` on a generation and the completed task carries `output.last_frame_url` alongside the video.\[1] Hand that URL to the next call as a first frame and the second clip starts on the exact pixel the first one ended on. Segment one, establishing the framing for the whole piece: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "Wide shot, harbour at dawn, slow push in", "resolution": "720p", "size": "16:9", "duration": 30, "return_last_frame": true }' ``` Segment two onward, starting from the previous frame: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "The camera continues past the moored boats toward the market", "resolution": "720p", "duration": 30, "return_last_frame": true, "image_with_roles": [ { "url": "https://cdn.reapi.ai/media/tasks/.../0.png", "role": "first_frame" } ] }' ``` Note what disappeared from the second request. There is no `size`. ## Three rules that only bite once you chain **Chained segments must run adaptive.** A request carrying `image_with_roles` accepts only `size: "adaptive"` or no `size` at all; anything else is rejected at submit rather than minutes later.\[1] This is not arbitrary, the output follows the first frame's geometry, which is exactly the behaviour continuity needs. The practical consequence is that segment one decides the aspect ratio for the entire piece, so get it right before you generate 6 more. **A chained segment cannot carry reference video or audio.** `image_with_roles` is mutually exclusive with both `video_urls` and `audio_urls`.\[1] If a mid-sequence shot needs a motion reference, that shot cannot also be frame-chained. Pick one per segment. **`image_urls` and `image_with_roles` cannot be combined.** Character reference images and frame chaining are separate modes.\[1] For a chained sequence with a recurring character, carry the character through the frame itself rather than through reference images. Those three constraints are enforced before submit, which is the good case. You get a 400 in a second rather than a failed task in four minutes. ## Where chains actually break Frame continuity is not scene continuity. The joint is pixel-perfect and the drift shows up somewhere else. **Colour and exposure walk.** Each segment re-derives its own grade from one frame. Over six segments the sequence can wander perceptibly even though every individual join is seamless. Grade the assembled cut, not the segments. **Motion discontinuity at the seam.** A still frame carries no velocity. If segment one ends mid-pan, segment two starts from a static frame and has to re-establish the movement, which reads as a stutter. Write segment endings that come to rest, or accept a cut on the joint and treat it as a shot change rather than a continuation. **Audio does not chain.** Each generation synthesises its own track. Six segments give you six independent audio beds, and the seams are more audible than the visual ones. For anything longer than about a minute, generate without audio and lay a single track over the assembled cut. **Identity drift on people.** A face reconstructed from one frame each time accumulates error. This is where a chained sequence usually gives itself away first. None of these are fixable by prompting harder. They are properties of restarting a generation from a still image, and the practical answer is to design the piece so its cuts land where the seams are. ## What three minutes actually costs 180 seconds at 720p on Seedance 2.5 is six 30-second segments. At the published rate of $0.266824 per second:\[5] | Attempts per segment | Total generated seconds | Cost | | -------------------- | ----------------------- | ------- | | 1 (nothing rejected) | 180 | $48.03 | | 2 | 360 | $96.06 | | 3 | 540 | $144.09 | At 480p the same three tiers are $21.35, $42.70 and $64.04.\[5] The realistic number is the second or third row. Chained work has a failure mode single clips do not: a segment can be individually good and still be wrong, because it drifted from the one before it, and you only find out after generating it. Budget the retries or you will be surprised twice. An obvious saving follows. Draft the whole sequence at 480p, confirm the chain holds and the cuts land, then regenerate only the segments that survive review at 720p. That is $21 of drafting instead of $48, and it is the single biggest lever on a long piece. ## When to let the model pick the length Seedance 2.5 accepts `duration: -1`, which hands the choice to the model, and it is required rather than optional for video-edit prompts.\[1] Billing reserves at the 30-second cap and settles to the length actually produced, refunding the difference.\[5] For chaining, explicit durations are usually better. A sequence built from known-length segments is one you can cut to music or to a script; a sequence of model-chosen lengths is one you have to conform afterwards. Use `-1` for edits, where the vendor requires it, and for single clips where the natural length is genuinely unknown. ## FAQ ### What is the longest single AI video generation available? 30 seconds, on Seedance 2.5.\[1] Most other models cap at 15 and Veo 3.1 is fixed at 8.\[2]\[3]\[4] ### How do I make an AI video generator produce long videos? Chain generations. Set `return_last_frame: true`, then pass the returned `last_frame_url` into the next call as a `first_frame` role.\[1] There is no single call that produces minutes of output. ### Why does my chained request get rejected for aspect ratio? Because a first-frame job only accepts `size: "adaptive"`, or no size field at all.\[1] Remove `size` from every segment after the first. ### Can I use reference images and frame chaining together? No. `image_urls` and `image_with_roles` are mutually exclusive, as are `image_with_roles` and `video_urls`.\[1] ### What does a three-minute AI video cost? About $48 at 720p if every segment lands on the first attempt, and roughly $144 at three attempts each.\[5] Drafting at 480p first cuts the exploration phase to about $21. ### Why does the audio jump between segments? Each generation makes its own audio. Turn `generate_audio` off for chained work and lay one track over the finished cut. ### Do the joins look seamless? The joins do. The drift between segments is what gives a chain away: colour walk, restarted motion, and identity error on faces. ## Building length out of segments There is no AI video generator long videos setting, and treating its absence as a limitation of the tool rather than of the technology leads people to buy plans looking for it. What exists is a 30-second ceiling, a frame-chaining mechanism, three parameter rules that are enforced at submit, and four kinds of drift that are not. Plan around them in that order. Set the aspect ratio in segment one because you cannot change it later. Write segment endings that come to rest. Generate silent and score the assembly. Draft at 480p and finish at 720p. Then price the whole thing at three attempts per segment, because that is what it will actually take. Do that and an AI video generator long videos workflow stops being a feature you are shopping for and becomes a build you can budget. Parameter reference and error codes are at [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5), and current per-second rates are on the [Seedance 2.5 model page](/models/seedance-2-5). ## References 1. reAPI. *doubao-seedance-2.5-face — duration, `return_last_frame`, `image_with_roles` and cross-field constraints.* Retrieved August 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5) 2. reAPI. *Seedance 2.0 — parameter reference and duration limits.* Retrieved August 2026 from [reapi.ai/docs/seedance-2-0](/docs/seedance-2-0) 3. reAPI. *MiniMax H3 — parameter reference and duration limits.* Retrieved August 2026 from [reapi.ai/docs/minimax-h3](/docs/minimax-h3) 4. reAPI. *Veo 3.1 — parameter reference, fixed 8-second duration.* Retrieved August 2026 from [reapi.ai/docs/veo3-1](/docs/veo3-1) 5. reAPI. *Seedance 2.5 — published per-second rate band and auto-duration settlement.* Retrieved 9 August 2026 from [reapi.ai/models/seedance-2-5](/models/seedance-2-5) 6. reAPI. *Grok Imagine 1.5 — parameter reference and duration limits.* Retrieved August 2026 from [reapi.ai/docs/grok-imagine-video-1-5](/docs/grok-imagine-video-1-5) ### Further reading * reAPI. *Seedance 2.5 API Pricing: fal vs kie vs WaveSpeed vs reAPI.* [reapi.ai/blog/seedance-2-5-api-pricing-compared](/blog/seedance-2-5-api-pricing-compared) * reAPI. *Dreamina Seedance 2.5 Prompt Guide: References & Timing.* [reapi.ai/blog/dreamina-seedance-2-5-prompt-guide](/blog/dreamina-seedance-2-5-prompt-guide) --- # AI Video Generator With Real People: What Actually Works (https://reapi.ai/blog/ai-video-generator-with-real-people) Can you use an AI video generator with real people? Yes, when the subject has consented and the selected route documents real-person references. The practical questions are whether the input is accepted, whether the model generates speech, how review works, and what the job costs. The useful split is not by tool. It is by whose face it is. A photograph of a consenting subject, a synthetic character and a named celebrity are legally and technically distinct inputs. This guide explains the documented path for each case, what talking requires, and what to check when a reference is refused. ## TL;DR * **Reference photos and clips of real people are supported.** Seedance 2.5's parameter reference states plainly that "reference images / videos may contain real people."\[1] * **Rejected reference material refunds in full.** Material passes automated review before generation, and anything refused fails with an error and a full refund of the reserve.\[2] * **Talking is a separate capability.** Seedance 2.5 generates "synced speech, sound effects and background music" with `generate_audio`, on by default.\[1] Kling 3.0 documents lip sync explicitly.\[3] * **Named celebrities are refused on every route.** That is the model's own line, not a platform policy setting, and no parameter reaches it. * **Consent is still yours to obtain.** An API that accepts an upload has not acquired permission on your behalf. ## Four different asks wearing one search term **Your own footage, or a consenting subject.** This is the largest legitimate case: founders in their own product demos, UGC creators, actors who signed a release, a client whose brand video you are making. It is supported, and the rest of this article is mostly about it. **A synthetic person whose reference is refused.** The error alone does not prove how a review system classified the image or which internal check made the decision. Check the documented input requirements and review result before deciding what caused it. **A named public figure.** Refused. Not by reAPI as a matter of policy, but by the model, on every host that resells it. Any platform advertising otherwise is either wrong or selling you a likeness-rights problem. **People talking.** A capability question rather than a permission question, and it is answered by which model you pick rather than by which platform. Keep these cases separate when troubleshooting. A supported real-person reference, a refused synthetic reference and a request for a named person do not have the same next step. ## Using a consented person as a reference The supported path is reference material, not prompting a description. Seedance 2.5 takes up to 30 reference images, 10 reference clips and 10 audio tracks in one generation.\[1] ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "@Image1 walks through a sunlit workshop, handheld follow", "resolution": "720p", "duration": 8, "image_urls": ["https://your-cdn.example.com/subject-01.jpg"] }' ``` The constraints worth knowing before you assemble a reference set:\[1] | Field | Limit | Formats | | ------------ | -------------------------------------------------- | ------------------------------------------- | | `image_urls` | up to 30, each under 30 MB | jpeg, png, webp, bmp, tiff, gif, heic, heif | | `video_urls` | up to 10, each 2–30 s, under 200 MB, combined 30 s | mp4, mov, 480p to 4K | | `audio_urls` | up to 10, each 2–30 s, under 15 MB | wav, mp3 | Two rules catch people out. Every reference must be a **public HTTP(S) URL**; base64 and `data:` payloads are rejected across the whole platform, not just this model.\[1] And `image_urls` cannot be combined with `image_with_roles`, so character references and first/last-frame chaining are separate modes.\[1] Reference material goes through automated review before generation runs. If it is refused, the task fails with an error and the reserve is refunded in full,\[2] so a rejected attempt costs time rather than the reserved amount. ## Making them talk This is where model choice matters more than platform choice, and the two documented options behave differently. **Seedance 2.5** generates audio natively. `generate_audio` defaults to `true` and produces "synced speech, sound effects and background music (mono)."\[1] The speech is generated with the video rather than dubbed onto it, so mouth movement and audio come from the same pass. You direct it through the prompt. **Kling 3.0** documents the capability more specifically, describing synchronized native audio as "dialogue, lip sync, ambient sound."\[3] If lip sync accuracy on dialogue is the thing you are being judged on, that is the explicit claim to test against. What neither offers is a dubbing mode where you supply a finished voice track and get precise mouth-shape matching to it. Seedance 2.5's `audio_urls` are documented as reference audio tracks,\[1] which is a different job from lip-sync driving. If your pipeline already has recorded VO, test that assumption on a short clip before you build around it. One practical note for talking-head work: audio does not survive segmentation. Each generation synthesises its own track, so a sequence assembled from several clips gives you several independent audio beds. For dialogue longer than one generation, record or synthesise the voice separately and treat the video as picture only. ## The line that does not move **Named living people are refused.** Every honest route enforces this, and it sits with the model rather than with any platform's settings. If a host claims otherwise, the correct response is suspicion, not a signup. **Third-party characters are refused too.** The same check catches recognisable copyrighted characters, which is a recurring frustration for anime and fan work and has no workaround worth publishing. **Consent is not transferred by an upload form.** The API accepting your reference photo is not permission from the person in it. Releases, likeness rights and, in several jurisdictions, biometric-data rules are your responsibility and do not become the platform's because a request returned 200. That last one is not legal boilerplate. It is the reason the supported path exists at all: the check is designed to stop the non-consensual case, and it works better when the legitimate case has somewhere to go. ## When a synthetic reference is refused A refusal message does not establish whether the reference was rejected because of its content, its format, or another review rule. Do not infer the internal mechanism from the wording alone. First confirm that the URL, file type, size, duration and field combination match the published parameter reference.\[1] If the input is valid but automated review still rejects it, treat that result as a moderation outcome rather than proof about the image's origin. Try another compliant reference or a model whose documented input policy fits the job. The [face-detected troubleshooting guide](/blog/seedance-face-detected-real-person-error) separates input validation from review without guessing which internal system produced the message. ## What it costs Reference-driven work is priced the same as any other generation on Seedance 2.5, with one wrinkle. Reference images and audio do not change the rate; a reference **video** moves you to a lower per-second rate. reAPI then bills `max(output + ceil(total source-video duration), ceil(5 / 3 × output))` seconds.\[2] | Job, 720p | Cost | | --------------------------------- | ------ | | 8 s from reference images | $2.135 | | 30 s from reference images | $8.005 | | 10 s reference clip to 5 s output | $2.402 | Rates from the published per-second band.\[2] A failed moderation check refunds in full, so exploratory reference sets cost time rather than credits. ## FAQ ### Can I use an AI video generator with real people at all? Yes, with reference material of a consenting subject. Seedance 2.5's parameter reference states that reference images and videos may contain real people.\[1] ### Can I generate a famous person? No. Named public figures are refused at the model level on every route, and no parameter changes that. ### Which model handles people talking? Seedance 2.5 generates synced speech alongside the video with `generate_audio`.\[1] Kling 3.0 documents dialogue and lip sync explicitly.\[3] ### Can I supply my own voice recording and get lip sync to it? Not as a documented mode. Seedance 2.5's `audio_urls` are reference tracks rather than a lip-sync driver.\[1] Test it on one short clip before designing a pipeline around it. ### Why was my AI-generated character rejected as a real person? The message does not reveal the internal reason. Verify the reference URL, format, size and field combination first; if those are valid, handle the result as a review rejection. The [face-detected explainer](/blog/seedance-face-detected-real-person-error) gives a documented checklist. ### Do I get charged when a reference is rejected? Not on reAPI. A task that fails review refunds the reserve in full.\[2] ### Can I upload the reference file directly? No. Every reference must be a public HTTP(S) URL. Base64 and `data:` payloads are rejected platform-wide.\[1] ### How many reference images can one generation take? Up to 30, plus 10 clips and 10 audio tracks.\[1] ## Working with faces instead of around them Decide which of the four asks you actually have before you pick a tool. A consenting subject and a valid reference set form a supported workflow with published parameters and a refund when review says no. A refused synthetic reference needs an input-and-review check, not a guess about the hidden classifier. Dialogue remains a model-selection question with two documented answers. Only the fourth ask, a named person who did not agree, has no route, and that is worth defending rather than routing around. An AI video generator with real people is a normal tool when the people said yes, and the reason the supported path stays open is that the unsupported one stays closed. Full parameter reference at [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5); current rates on the [Seedance 2.5 model page](/models/seedance-2-5). ## References 1. reAPI. *doubao-seedance-2.5-face — request body, reference limits, `generate_audio` and platform media rules.* Retrieved August 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5) 2. reAPI. *Seedance 2.5 — model page, real-person reference support, published rates and refund behaviour.* Retrieved 9 August 2026 from [reapi.ai/models/seedance-2-5](/models/seedance-2-5) 3. reAPI. *Kling 3.0 — native audio with dialogue and lip sync.* Retrieved August 2026 from [reapi.ai/docs/kling-3-0](/docs/kling-3-0) ### Further reading * reAPI. *Seedance Face Detected: Real Person Errors, Explained.* [reapi.ai/blog/seedance-face-detected-real-person-error](/blog/seedance-face-detected-real-person-error) * reAPI. *AI Video Generator Long Videos: Chaining Past the Cap.* [reapi.ai/blog/ai-video-generator-long-videos](/blog/ai-video-generator-long-videos) --- # What is the best API platform for building an AI design or marketing creative tool? (https://reapi.ai/blog/api-platform-for-ai-creative-tools) There is no single best API platform for building an AI design or marketing creative tool, and any article naming one without asking what you are shipping is selling something. What exists is four platforms with genuinely different shapes, and one comparison axis that decides more than catalog size does. That axis is the request contract. Text generation is synchronous and streams; image and video generation are long-running jobs that finish minutes later. A creative product needs both, and these platforms differ less in which models they carry than in how honestly they model that split. Below: the matrix, then one section per platform using its own published words, then what a complete workflow actually costs. ## TL;DR * **The modality gap most comparisons cite is out of date.** OpenRouter's own catalog lists 345 text models, 38 image, 17 video, 15 speech, 12 transcription, 4 audio, 27 embeddings and 4 rerank\[1]. * **fal.ai names its own scope precisely:** a generative media platform covering image, video and audio, with serverless GPUs and on-demand clusters for developing and fine-tuning models\[2]. Notice which modality is absent. * **Replicate's pitch is run, fine-tune, deploy**\[3]: infrastructure framing, and the right answer when your differentiator is a model you trained. * **reAPI carries 50 model pages**: 8 chat, 14 image, 18 video, 7 music and audio, 3 text-processing, one of which is a launch preview\[4]. * **A complete creative workflow prices out at about $1.06** per finished asset at current rates\[7]\[8], and the ratio inside it matters more than the total. * **Signup credits are 100, which is ten cents**\[5]. Budget a top-up as part of any evaluation. ## The comparison at a glance | Platform | How it describes itself | Where the depth is | Long-running jobs | Pick it when | | ---------- | ------------------------------------------------------------------------------ | ------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------- | | fal.ai | Generative media platform for developers\[2] | Image, video, audio; serverless GPUs; fine-tuning | Media-native | Media inference at scale, or serving your own weights | | Replicate | Run AI with an API; run, fine-tune, deploy\[3] | Model breadth, custom deployment | Media-native | You're still choosing a model, or the model is the product | | OpenRouter | Model comparison and routing\[1] | 345 text vs 38 image vs 17 video | Text-native | Language is the centre, visuals are a supporting feature | | reAPI | Curated multi-modal catalog\[4] | 50 documented models across five buckets | Async submit + free polling\[5] | A media pipeline plus a separately keyed chat step | Read that "long-running jobs" column before the model counts. It is the one that shows up in your incident log. ## Why the request contract decides more than the catalog Catalogs are the least durable thing in this category. Models churn quarterly, and everyone lists the same frontier releases within a week of each other; fal, Replicate and reAPI were all leading with HappyHorse 1.1 and the current Seedance generation on the day I checked\[2]\[3]\[4]. What does not churn is request shape, and creative products have two shapes that fight each other. Text generation is synchronous: connection open, tokens streaming, user watching words appear, done in seconds. Image and video generation is a job. A video render takes one to several minutes, far past any sensible HTTP timeout, so it must be submit-then-collect: get an identifier, poll or subscribe, retrieve the artifact. Billing differs too. Text bills per token afterward; media bills per image or per second of output, usually at submission, and the question that matters is what happens to that charge when the render fails. A platform can handle this three ways. Expose one endpoint shape and make the media case awkward, usually by holding a connection open or polling something built to stream. Expose two contracts and say why. Or paper over the difference in an SDK and let you discover during your first production incident which one you actually bought. So when the marketing says "one API for everything", the useful follow-up is: one API with how many contracts underneath? Clear credentials and billing for each contract are real conveniences worth paying for. One request shape across streaming text and a four-minute render is not a thing that exists. ## fal.ai: media infrastructure, in its own words **What it says it is.** A "generative media platform for developers", offering "the world's best generative image, video, and audio models, all in one place", with serverless GPUs and on-demand clusters for developing and fine-tuning models, trusted by over 1,500,000 developers\[2]. **What that is good for.** The deepest media-infrastructure story of the four. If the hard problem in your product is scaling diffusion workloads, or you are serving weights you fine-tuned, this is the shape that fits. **Where it stops.** Read the modality list again: image, video, audio. Text is not in it. If your creative tool needs a language model to read a brand brief and write campaign angles before it generates anything, that step lives on another platform, with another key and another invoice. ## Replicate: run, fine-tune, deploy **What it says it is.** "Run AI with an API. Run and fine-tune models. Deploy custom models. All with one line of code."\[3] **What that is good for.** Two real phases of real projects: the exploration phase where you compare a dozen open-weight variants before committing, and the production phase where your differentiator is a model you trained rather than a workflow you assembled. **Where it stops.** That is infrastructure framing, not creative-workflow framing. A marketing tool shipping campaign assets daily wants predictable parameter sets and stable model availability more than it wants deployment flexibility, and more of the orchestration layer stays your problem. ## OpenRouter: language depth, more visual than its reputation **What it says it is.** A model comparison and routing layer, presented around pricing, context and benchmarks\[1]. **What that is good for.** Text-heavy creative work: headline generation, prompt expansion, brand-voice rewriting, creative-brief analysis, agent workflows. Its catalog page carries a modality filter with counts printed next to each entry: Text 345, Image 38, Embeddings 27, Audio 4, Video 17, Rerank 4, Speech 15, Transcription 12\[1]. **Where it stops.** The centre of gravity is obviously language, and 345 against 38 tells you where the depth is. But comparisons written six months ago that call it text-only, or "limited" on visual, are describing a product that has changed: 17 video models is not zero. Whether it is enough is a question you answer by opening the filter, not by reading a listicle. ## reAPI: a curated catalog behind one async contract **What it says it is.** A curated multi-modal catalog with a deliberately narrow surface. Fifty model pages are live: 8 chat models, 14 image, 18 video, 7 music and audio, and 3 text-processing endpoints, with one video entry being a preview page for an unreleased model\[4]. **What that is good for.** Uniformity. Every image and video model sits behind the same asynchronous contract: submit, get a `task_id`, poll `GET /api/v1/tasks/{id}` for free until it settles. Mode is implicit rather than a dropdown, so one request body covers text-to-video, image-to-video, frame interpolation and reference-driven generation, with the fields you set deciding which runs\[5]. Adding a video model to your product is a model string and a parameter diff, not a new integration. Fifty is not a big number in this company, and it is a design position: each of those models has a hand-written documentation page with its exact parameter set, constraints and error catalog\[5]. ### Where I would send you elsewhere A comparison with no disqualifiers is a brochure, so here are reAPI's. * **No fine-tuning, no custom model deployment.** That is Replicate and fal territory, and pretending otherwise would waste your week. * **Two base URLs, not one.** Media runs on the async task contract; chat runs on a standard `/v1/chat/completions` endpoint on its own host\[6]. Two honest contracts instead of one dishonest one, but it is two things to configure. * **Media inputs must be public HTTP(S) URLs.** Base64 and `data:` URIs are rejected at the gateway, so object storage is part of your architecture from day one\[5]. * **The catalog is curated.** If the model you want is not on it, it is not on it. * **Signup credits are ten cents.** One hundred credits at a tenth of a cent each, which covers about three draft images\[5]. ## Pricing one whole workflow instead of one call Model counts are free to publish; prices are not, which makes them the more informative comparison. Here is a complete marketing pipeline at reAPI's current rates. | Step | What runs | Cost | | ----------------- | ---------------------------------------------------------------- | -------------- | | Campaign angles | A chat model, a few hundred tokens | Rounds to zero | | Direction finding | 5 × 1K image at $0.032\[7] | $0.16 | | Finalists | 2 × 2K image at $0.063\[7] | $0.13 | | Motion | 5s × 720p Face at $0.15375/s\[8] | $0.769 | | | **Per finished creative** | **$1.06** | One credit is a tenth of a cent, charges land on submit, and a task ending `failed` refunds automatically\[5]. The ratio inside that table is what I would actually optimize. A 720p clip costs roughly 24 times a 1K still, so any pipeline that discovers composition problems during a video render is paying about 24 times too much for the same information. No amount of catalog breadth fixes a pipeline with its stages in the wrong order. ## Five questions to ask before you integrate Platform-independent, and each has cost me time somewhere. 1. **How does a long-running job work?** Submit-and-poll, webhook, or held connection. If the answer for video is a held connection, you will be fighting timeouts in production. 2. **What happens to the charge when a render fails?** Automatic refund, manual credit, or nothing. Ask specifically about content-policy blocks, where the compute happened and no artifact arrived. That is where policies differ most and nobody volunteers the answer. 3. **Is the request shape uniform across models in one modality?** If every video model has its own parameter names, what you bought is a directory of integrations with one invoice attached. 4. **What input formats are accepted?** Public URL only, base64, or direct upload. This single answer decides whether you need object storage on day one. 5. **Where does the per-model documentation live, and who wrote it?** An auto-generated schema dump and a hand-written page with an error catalog are very different artifacts at 2am. ## FAQ ### What is the best API platform for AI design tools? It depends whether your differentiator is the workflow or the model. For a workflow product chaining text, image and video, a curated multi-modal catalog with one uniform media contract saves the most engineering time. For a product built on weights you trained, Replicate or fal's fine-tuning and deployment story matters more than catalog breadth\[2]\[3]. ### Is OpenRouter enough for a visual creative tool? More than older comparisons suggest: 38 image and 17 video models alongside 345 text models\[1]. Whether it is enough depends on whether the specific models you need are among them. ### Do I need separate APIs for text, image and video? Separate contracts, not necessarily separate vendors. Streaming text and multi-minute renders are different request shapes, and a platform hiding that has hidden it, not solved it. Authentication, billing and support are what genuinely consolidate. ### How is video generation billed? Per second on most platforms, banded by resolution. On reAPI the public Seedance rates run from (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second on Mini at 480p with source video to (live price: https://reapi.ai/models/seedance-2-0/llms.txt) per output second on Face at 4K without one. Source-video requests bill output duration plus the rounded-up total source-video duration, and failed tasks are refunded automatically\[8]. ### Can I upload images directly, or do they need hosting? On reAPI, media inputs must be public HTTP(S) URLs across every model, and base64 is rejected at the gateway\[5]. Other platforms differ, so check before architecting around direct upload. ### How many models does a creative tool actually need? Fewer than the catalogs suggest. A production pipeline typically settles on one text model, one or two image models, one video model, and a fallback for each. What you want from the platform is that switching any one of those is a parameter change rather than a rewrite. ### Which platform has the most models? Not worth answering, and I could not retrieve a first-party total for fal or Replicate to answer it honestly. Catalog size predicts almost nothing about integration effort and correlates negatively with per-model documentation quality. ## Choosing without a beauty contest Match the platform to the hard part of your product. Media infrastructure at scale or your own weights, go to fal or Replicate. Language with visuals attached, OpenRouter's depth is on the side you need. A creative pipeline where text, image, video and audio each do a step and you can use a separately keyed chat gateway alongside a uniform media-task contract, that is the case reAPI is built for, and fifty documented models are the point rather than the limitation. What I would not do is pick a best API platform from a table of model counts. Ask the five questions above, price one complete workflow at real rates, and see which platform's shape matches the product you are actually building. ## References 1. OpenRouter. *Models catalog — modality filter counts.* Retrieved July 2026 from openrouter.ai/models 2. fal.ai. *Generative media platform for developers — homepage positioning and developer count.* Retrieved July 2026 from fal.ai 3. Replicate. *Run AI with an API — homepage positioning.* Retrieved July 2026 from replicate.com 4. reAPI. *Model catalog.* Retrieved July 2026 from [reapi.ai/models](/models) 5. reAPI. *API documentation — async task contract, mode routing, billing, media input rules, per-model references.* Retrieved July 2026 from [reapi.ai/docs](/docs) 6. reAPI. *Chat model documentation — standard chat-completions endpoint on api.reapi.ai.* Retrieved July 2026 from [reapi.ai/docs/claude-opus-4-8](/docs/claude-opus-4-8) 7. reAPI. *Seedream 5.0 Pro — live pricing table.* Retrieved July 2026 from [reapi.ai/models/seedream-5-0-pro](/models/seedream-5-0-pro) 8. reAPI. *Seedance 2.0 and Seedance 2.0 Mini — live pricing tables.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-0](/models/seedance-2-0) and [reapi.ai/models/seedance-2-0-mini](/models/seedance-2-0-mini) ### Further reading * reAPI. *fal.ai alternatives.* [reapi.ai/blog/best-fal-ai-alternatives](/blog/best-fal-ai-alternatives) * reAPI. *Replicate alternatives.* [reapi.ai/blog/best-replicate-alternatives](/blog/best-replicate-alternatives) * reAPI. *Seedream 5.0 Pro Seedance 2.5 Workflow: What Actually Ships.* [reapi.ai/blog/seedream-5-0-pro-seedance-2-5-workflow](/blog/seedream-5-0-pro-seedance-2-5-workflow) --- # Atlas Cloud vs Higgsfield: API Platform or Creator Studio? (https://reapi.ai/blog/atlas-cloud-vs-higgsfield) **Choose reAPI when you are building a SaaS product and want a focused multi-model API, one media balance, and a documented asynchronous media workflow. Choose Higgsfield when a creator wants presets and a polished browser studio. Choose Atlas Cloud when maximum catalog breadth or raw GPU infrastructure is the deciding requirement.** That three-way distinction also explains the recent “Seedance 2.5 Higgsfield” and “Atlas Cloud Seedance 2.5” searches. A platform can publish a model page without proving that the model is callable. reAPI has since crossed that line with a live model ID, schema, and rates; the Atlas Cloud and Higgsfield statements below remain dated to the sources retrieved on August 2. ## TL;DR * **reAPI:** best fit for product teams that want a curated multi-model API, live model pages, pay-as-you-go credits, and the same submit-and-poll workflow across media. * **Atlas Cloud:** best fit when a very broad catalog, GPU services, or enterprise infrastructure matters more than a focused integration path.\[1] * **Higgsfield:** best fit for people producing clips in a browser with presets, identity tools, and a visual project workflow. * **Seedance 2.5:** reAPI now exposes `doubao-seedance-2.5-face`; Atlas Cloud advertised early access and Higgsfield showed a coming-soon page in the August 2 source check.\[2]\[3]\[7] * **What to ship today:** developers can run [Seedance 2.5](/models/seedance-2-5), [Seedance 2.0](/models/seedance-2-0), or [MiniMax H3](/models/minimax-h3) through reAPI; creators should verify the current Higgsfield picker for account-level access. ## Atlas Cloud vs Higgsfield at a glance ![Three AI video paths: Atlas Cloud for catalog breadth, reAPI for a unified SaaS API, and Higgsfield for browser-based creation](https://cdn.reapi.ai/media/blog/atlas-cloud-vs-higgsfield/atlas-cloud-higgsfield-reapi-decision-map.png) | Area | Atlas Cloud | Higgsfield | reAPI | | -------------- | ------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------- | | Core product | Broad multi-model API and GPU cloud | AI video creator studio | Curated multi-model API gateway | | Primary user | Infrastructure and enterprise teams | Creators, marketers, and agencies | SaaS and application developers | | Main interface | Model pages, APIs, and GPU services | Browser generator, presets, and projects | Model playground, REST API, and task status | | Model breadth | 400+ models advertised | Curated studio catalog | Curated catalog with live availability on [model pages](/models) | | Billing | Usage based; varies by model | Subscription tiers and credits | Pay-as-you-go credits; no monthly plan required | | Seedance now | Seedance 2.0 API in the August 2 source check | Seedance 2.0 creator workflow in the August 2 source check | [Seedance 2.0 API](/models/seedance-2-0) and [Seedance 2.5 API](/models/seedance-2-5) | | Seedance 2.5 | Early-access cohort in the August 2 source check | Coming-soon notification page in the August 2 source check | Live as `doubao-seedance-2.5-face` | | Product work | You build UI, review, storage, and delivery | Studio supplies most creator workflow | You build the UI; reAPI supplies the model and task layer | | Best outcome | Broad infrastructure platform | A finished clip made interactively | A programmable product pipeline | This comparison is published by reAPI. reAPI competes with Atlas Cloud at the API layer, so its product claims point to live reAPI pages and the recommendations state where Atlas Cloud or Higgsfield is genuinely the better fit. ## Atlas Cloud is an API platform Atlas Cloud gives developers one account for a large model catalog spanning video, image, audio, and language generation. Its Seedance 2.0 endpoint follows a familiar asynchronous pattern: submit a job, retain the task identifier, then poll or otherwise retrieve the result when generation finishes.\[1] This is useful when your product already has its own user interface. A team can place model selection behind configuration, route workload by price or capability, and store outputs in its own system. The trade-off is ownership: Atlas Cloud does not become your review queue, brand workflow, customer permissions, or final delivery experience. The breadth is useful when one account must cover an unusually wide set of models or when the same vendor also needs to supply GPU infrastructure. The trade-off is focus: every production decision should use the live model page and price table, not the size of the overall catalog. ## Higgsfield is a creator studio Higgsfield starts from the opposite end. A creator chooses a model within a web product, then combines it with platform-level tools such as camera presets, character or identity workflows, advertising formats, and project organization. Higgsfield uses subscription tiers and credits, with exact offers varying by plan, promotion, and region.\[4] It also documents a 30-day Seedance Unlimited promotion built on Enhanced Seedance 2.0 Fast. That promotion uses standard queues and 480p or 720p output; it is not unlimited Seedance 2.5 or unlimited 4K.\[5] The studio saves setup work for a human operator. It is less suitable as the invisible engine behind your own SaaS unless a specific API program covers the required workflow. ## reAPI is the focused API alternative reAPI sits between Atlas Cloud's broad infrastructure catalog and Higgsfield's finished creator studio. Selected image, video, and audio models use its media workspace; language models use a separate chat workspace. The two workspaces have separate keys and balances. Media jobs use a consistent asynchronous flow: submit a request, receive a task ID, then poll the task until it completes or fails. The practical difference is what can be used now. [Seedance 2.5 on reAPI](/models/seedance-2-5) is live as `doubao-seedance-2.5-face` for 480p/720p/1080p output, 4–30-second clips, and documented edit, extend, and mixed-reference workflows.\[7]\[8] [Seedance 2.0](/models/seedance-2-0) remains available for 4K and cheaper tiers, while [MiniMax H3](/models/minimax-h3) reaches up to 2K. reAPI does not replace Higgsfield's full editing workspace, reusable-identity tools, or campaign presets. It also does not sell the raw GPU infrastructure that can make Atlas Cloud attractive. It is the narrower choice for teams that want to put generation inside their own product without maintaining a separate provider integration and billing relationship for every selected model. **Building a product? [Try Seedance 2.5 on reAPI](/models/seedance-2-5), review the [API quickstart](/docs/api/quickstart), or compare it with [Seedance 2.0](/models/seedance-2-0).** ## Seedance 2.5 availability: early access is not an endpoint ByteDance demonstrated Seedance 2.5 with 30-second continuous output, expanded multimodal references, second-level control, and video editing.\[6] reAPI now supplies the production pieces that were missing: model ID `doubao-seedance-2.5-face`, a public schema, 480p/720p/1080p output, and live pricing.\[7]\[8] Atlas Cloud's August 2 source described a Seedance 2.5 early-access cohort while its callable Seedance documentation remained on 2.0.\[2] Higgsfield's page at that check was still a notification surface.\[3] By contrast, reAPI now presents [Seedance 2.5](/models/seedance-2-5) as a live route with its own 2.5 contract. Use the same test on any platform: 1. Is `Seedance 2.5` present in the signed-in live catalog? 2. Is there a real model ID or selectable generator option? 3. Are duration, resolution, reference limits, and audio behavior stated? 4. Is the actual charge visible before generation? If any answer is missing, treat that particular platform surface as an announcement or waitlist, not a production dependency. The [Seedance 2.5 on Higgsfield guide](/blog/seedance-2-5-on-higgsfield) tracks that platform-specific distinction in more detail. ## Pricing: three different bills Atlas Cloud meters model calls. Higgsfield sells plan access and credits. reAPI meters completed API work against a pay-as-you-go credit balance and automatically refunds a media job that finishes in failure. Comparing the cheapest visible number produces a misleading winner because the three products include different work. For Atlas Cloud, estimate: * generated seconds by model and resolution; * average failed or rejected generations; * storage, delivery, moderation, and application hosting; * engineering time for queue and error handling. For Higgsfield, estimate: * monthly plan and any add-ons; * credits consumed per accepted clip; * unused credits; * creator time saved by presets, identity, and in-app workflows. For reAPI, estimate: * the live per-model rate for the chosen resolution and duration; * any billable reference-video time documented by that model; * accepted outputs after automatic failed-job refunds; * the product work your team still owns: UI, review, storage, and delivery. Then divide the total by accepted deliverables. Pay as you go usually fits variable API traffic. A subscription studio can be cheaper for a creator who uses its workflow every day. For reAPI, use the [live Seedance 2.0 model page](/models/seedance-2-0) rather than copying a price from an article that may age. ## Model choice and switching Atlas Cloud's wider catalog makes switching easier at the account level, but models still have different request schemas and behaviors. Normalizing `prompt`, `duration`, and `aspect_ratio` does not make reference video, native audio, and safety errors identical. Higgsfield deliberately narrows those differences behind a visual interface. That makes testing easier for a creator but automation harder for a product team. Its value is curation and workflow, not maximum backend portability. reAPI narrows the operational differences at the media-job layer: one media credential, task status pattern, balance, and model directory. Model-specific fields still matter, so switching from Seedance to H3 is a controlled adapter change rather than a promise that every request body is identical. If portability is the goal, define an internal job object and provider adapter. Store the upstream model ID with every result, maintain a fixed evaluation set, and never silently change the model behind an existing product label. ## Which should you choose? ### Choose Atlas Cloud when * you are building a SaaS product or internal application; * API calls, metered billing, and model breadth matter; * your team can own job queues, storage, review, and delivery; * you want the Seedance routes verified in Atlas Cloud's current live catalog plus access to other model families; * you can treat Seedance 2.5 as early access until a live endpoint appears. ### Choose Higgsfield when * creators need to work in a browser with minimal setup; * reusable identity, camera presets, and marketing tools save time; * subscription credits match predictable monthly use; * the final deliverable is a clip, not an API response; * the Seedance models visible in your current account are sufficient. ### Choose reAPI when * you are adding AI video to your own SaaS or application; * Seedance 2.5, Seedance 2.0, or MiniMax H3 needs to be callable now; * one task workflow and credit balance are more useful than the widest possible catalog; * live model pages and automatic failed-job refunds matter; * you do not need a full browser editing studio or raw GPU rental. ### Use Higgsfield with reAPI when * a creative team explores and approves a visual language in Higgsfield; * developers then automate approved, structured variants through reAPI; * the cost of two tools is lower than forcing either platform to do the other's job. ## Atlas Cloud and Higgsfield alternatives None of the three will fit every team. fal and Replicate offer model-level developer access, Krea provides another creator workspace, and Dreamina is the official ByteDance consumer route. The [best Higgsfield alternatives guide](/blog/best-higgsfield-alternatives-ai-video) compares those platform categories directly. ## FAQ ### Is Atlas Cloud cheaper than Higgsfield? Not universally. Atlas Cloud meters API usage, while Higgsfield sells subscriptions and credits that include creator tools. Compare cost per accepted deliverable for your workload. ### Does Atlas Cloud have a Seedance API? Yes, Atlas Cloud publicly documents Seedance 2.0 endpoints. Its Seedance 2.5 page describes early access; verify a live model ID before planning production. ### Does Higgsfield offer an API? Higgsfield's public product is primarily a creator studio. If an API is essential, confirm current developer access, supported models, and commercial terms directly rather than assuming the web model picker is programmable. ### Which platform is better for MiniMax H3? For a documented route on this platform, use [MiniMax H3 on reAPI](/models/minimax-h3). Atlas Cloud remains relevant when its broader catalog or infrastructure is the reason for the account. Higgsfield should be evaluated through its current live model picker. See the [H3 API guide](/blog/hailuo-h3-minimax-h3-api-guide) for request modes and limits. ### Which is better for a marketing team? Higgsfield usually fits a hands-on marketing team because it provides creator workflows. reAPI fits a marketing software product that generates assets programmatically. Atlas Cloud becomes more relevant when that product also needs maximum catalog breadth or GPU infrastructure. ### Is reAPI an Atlas Cloud alternative? Yes, for teams buying model access through an API. reAPI is the more focused option for selected media and language models; Atlas Cloud is broader and also sells GPU infrastructure. Compare the exact live models your product needs rather than total catalog size. ### Does reAPI have Seedance 2.5? Yes. The [reAPI Seedance 2.5 page](/models/seedance-2-5) is live, and the callable model ID is `doubao-seedance-2.5-face`.\[7]\[8] ## The verdict Atlas Cloud wins on breadth and infrastructure. Higgsfield wins on interactive creator workflow. reAPI is the practical choice for teams that want to put Seedance and other selected media models inside their own product with a documented async API and live pay-as-you-go pricing. For Seedance 2.5, reAPI now has the concrete production route: `doubao-seedance-2.5-face`, with 480p/720p/1080p rates and documented billing.\[7]\[8] ## References 1. Atlas Cloud. *Model catalog and Seedance 2.0 API.* Retrieved August 2, 2026. atlascloud.ai 2. Atlas Cloud. *Seedance 2.5 early access.* Retrieved August 2, 2026. atlascloud.ai 3. Higgsfield. *Seedance 2.5 — coming-soon notification page.* Retrieved August 2, 2026. higgsfield.ai 4. Higgsfield. *AI pricing and plans.* Retrieved August 2, 2026. geo.higgsfield.ai 5. Higgsfield. *What Creators Really Get with Seedance Unlimited.* Updated July 9, 2026. geo.higgsfield.ai 6. ModelArk. *Doubao Seedance 2.5 official promotion.* Retrieved August 2, 2026. [ark.volcengine.com](https://ark.volcengine.com/promotion?modelName=seedance-2-5) 7. reAPI. *Seedance 2.5 — live production pricing.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-5](/models/seedance-2-5) 8. reAPI. *doubao-seedance-2.5-face — model ID, supported resolutions, request schema, and billing.* Retrieved August 17, 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5) ### Further reading * reAPI. *Seedance 2.5 on Higgsfield.* [reapi.ai/blog/seedance-2-5-on-higgsfield](/blog/seedance-2-5-on-higgsfield) * reAPI. *MiniMax H3 vs Seedance 2.5.* [reapi.ai/blog/minimax-h3-vs-seedance-2-5](/blog/minimax-h3-vs-seedance-2-5) * reAPI. *Best Seedance 2.5 alternatives.* [reapi.ai/blog/best-seedance-2-5-alternatives](/blog/best-seedance-2-5-alternatives) --- # Atlas Cloud AI Alternatives: Review, Pricing and Legit Check (https://reapi.ai/blog/atlascloud-ai-alternatives) Atlas Cloud sells itself as a "full-modal AI inference platform": one OpenAI-compatible API for chat, image, video, and audio, with a catalog it bills at 400+ models and a promise to launch new ones on day zero\[1]. Its own docs name fal.ai and kie.ai as the incumbents it undercuts, and it runs a per-second, per-image, pay-as-you-go meter with no monthly minimum\[2]. If you are shopping for **AtlasCloud alternatives**, you usually want one of three things: the same image and video models for less money, a bill you can read without a sales call, or a platform whose headline price is not a rotating promo. This guide compares five AtlasCloud alternatives on the axis that decides most media work, which is what the same models actually cost, plus catalog breadth, API shape, and where each one fits. Four are platforms in their own right: fal.ai, Replicate, Together AI, and RunPod. The fifth is reAPI, which we build, so read that section knowing the source. Every figure below came from each vendor's own pages in July 2026, and prices move, so confirm before you commit. ## TL;DR * **fal.ai** is the closest media-first match: 1,000+ image, video, and audio models on the fastest diffusion engine, but each model is its own endpoint and it is not OpenAI-compatible\[4]. * **Replicate** runs almost any model through one predictions API and lets you deploy your own, at the cost of fragmented billing and no OpenAI endpoint\[6]. * **Together AI** is the open-source LLM cloud with real GPU clusters and drop-in OpenAI compatibility; media generation is a thin add-on to a text-first catalog\[8]. * **RunPod** is GPU-first (H100 SXM from $3.29/hr) and now serves managed media endpoints too, but the media side is a scattered catalog rather than one unified API\[11]. * **reAPI** carries the same flagship media models through a REST media gateway, with a separate OpenAI-compatible gateway for chat. The two workspaces use separate keys and balances. Its list prices (re-checked October 22, 2026) were lower than Atlas Cloud's on Nano Banana Pro (80–88% below Atlas Cloud's standard tier), GPT Image 2, Seedance 2.0 and Wan 3.0\[12]. ## What Atlas Cloud does well, and where it leaves gaps Atlas Cloud's pitch is breadth on top of a serious inference engine. Where it is strong: * **One unified, OpenAI-compatible API across every modality.** Chat, image, video, and audio through a single key, sold as a drop-in replacement for the OpenAI SDK, with streaming, batching, and structured outputs\[1]. * **Day-0 access to new frontier media models.** The catalog carries the newest video and image models (Seedance 2.0, Kling V3.0, Nano Banana 2, Veo 3.1, Grok Imagine) close to their release\[1]. * **A real high-throughput engine.** Its "Atlas Photon" stack is built on SGLang with FP4 quantization, and Atlas Cloud is a named SGLang collaborator, which is a genuine credential rather than a slogan\[1]. * **Enterprise posture and a GPU business.** SOC and HIPAA certifications, plus on-demand GPUs, bare metal, and serverless fine-tuning for teams that want to rent compute directly\[3]. Where teams hit walls: * **The flagship price page hides behind a challenge and a promo.** The public model-pricing table renders behind a bot check, and headline discounts like "20% off Seedance" are promotional, so the number you quote today may not be the number you pay next month\[2]. * **GPU pricing is a sales call.** Compute starts "from $2.95/GPU-hr," but the per-model H100, H200, and B200 rates sit behind a contact form\[3]. * **It is an aggregator serving upstream models.** Availability and quality ride on models it does not own, which is the same structural reality as any unified gateway, reAPI included. ## How to evaluate an AtlasCloud alternative Four questions sort the field faster than any feature list: * **Price on the models you actually run.** Not the headline "from" rate, but the specific resolution and mode you use, and whether that price is stable or a promo. * **Catalog fit.** Do they carry the exact image and video models you need, and how quickly do new ones land? * **API shape.** OpenAI-compatible chat plus clean REST for media, and whether the two surfaces share credentials or use separate workspaces, keys, and balances. * **How you pay.** Transparent per-unit pricing, free credits to start, and no prepaid minimum, or seats, quotes, and sales gates. ## What the same models cost on Atlas Cloud and reAPI Both platforms carry the same flagship image and video models, so their prices line up model by model. Atlas Cloud figures below come from its public price calculator on October 5, 2026, at each model's default settings, with any promotional discount Atlas Cloud was showing already applied. reAPI figures are the list prices on its model pages the same day\[2]\[12]. ### Image models | Model and size | Atlas Cloud | reAPI | Difference | | ------------------------ | ----------------------------- | ----------- | ------------------------ | | Nano Banana Pro, 1K / 2K | $0.14 (developer tier $0.049) | $0.028 | −80% (−43% vs developer) | | Nano Banana Pro, 4K | $0.24 (developer tier $0.084) | $0.030 | −88% (−64% vs developer) | | GPT Image 2, 1024×1024 | $0.0577 | $0.025 (1K) | −57% | | GPT Image 2, 2048×2048 | $0.1120 | $0.030 (2K) | −73% | | GPT Image 2, 3840×2160 | $0.1051 | $0.060 (4K) | −43% | Atlas Cloud lists Nano Banana Pro in a standard tier and a cheaper "developer" tier; reAPI's Default price is lower than both. Its GPT Image 2 figures are calculator estimates at the default medium quality, because Atlas Cloud meters that model by tokens. reAPI's default GPT Image 2 variant charges a flat price per resolution\[2]\[12]. ### Video models Atlas Cloud prices video by token-based estimates, so the per-second figures below are its calculator total for a 10-second clip at default settings, divided by ten. | Model and resolution | Atlas Cloud | reAPI | Difference | | ---------------------------------- | ------------------------------ | ------------------------------ | ------------------ | | Seedance 2.5, 480p | $0.140/s | $0.119/s | −15% | | Seedance 2.5, 720p | $0.302/s | $0.267/s | −12% | | Seedance 2.0, 480p | $0.090/s | $0.072/s | −20% | | Seedance 2.0, 720p | $0.194/s | $0.154/s | −21% | | Seedance 2.0, 1080p | $0.437/s | $0.383/s | −12% | | Seedance 2.0, 4K | $0.976/s | $0.780/s | −20% | | Wan 3.0, 480p / 720p / 1080p | $0.040 / $0.080 / $0.160 per s | $0.036 / $0.071 / $0.142 per s | −10% / −11% / −11% | | Wan 3.0 Prime, 480p / 720p / 1080p | $0.061 / $0.126 / $0.252 per s | $0.057 / $0.116 / $0.232 per s | −7% / −8% / −8% | For a 10-second 720p Seedance 2.0 clip, that is about $1.94 on Atlas Cloud and $1.54 on reAPI. Atlas Cloud's video totals move with clip length and settings, and its promotions change, so check both calculators before you commit a budget\[2]\[12]. ## Five AtlasCloud alternatives worth comparing ### 1. fal.ai: the media-first inference API fal.ai is the closest thing to Atlas Cloud's media half done as a pure-play. It bills itself as a "generative media platform for developers," with the world's image, video, and audio models in one place\[4]. * **What it does:** serves 1,000+ generative media models on an inference engine tuned for speed, with serverless GPUs and on-demand clusters underneath\[4]. * **Models:** FLUX, Kling, Veo, Seedance, Nano Banana, Sora, Hailuo, Wan, and more, the same frontier media roster Atlas Cloud carries\[4]. * **API:** its own queue model (submit, poll status, fetch result) with a first-party client. It is not OpenAI-compatible, and each model is a separate `fal-ai/` endpoint with its own schema\[4]. * **GPU rental:** yes, from $1.89/hr for an H100\[5]. * **For:** teams that want the widest, fastest media catalog and do not mind wiring each model separately. * **Vs Atlas Cloud:** both are media-first, and fal.ai's catalog is larger. The trade is that fal.ai gives you a per-model endpoint zoo rather than one normalized, OpenAI-compatible interface. ### 2. Replicate: run and fine-tune almost any model Replicate's line is "Run AI with an API," and it leans on running open-source models plus deploying your own\[6]. * **What it does:** runs community models and lets you package custom ones with Cog, deploy them, and autoscale, all behind one predictions API\[6]. * **Models:** the same media flagships appear here, including Seedance 2.0, Veo 3.1, Kling v3, FLUX.2, Nano Banana 2 and Pro, and GPT Image 2\[6]. * **API:** a predictions endpoint you submit to and poll, not OpenAI-compatible, and billing is mixed, with some models charged by hardware and time and others by input and output\[6]. * **GPU rental:** billed as per-second hardware, with an H100 at $5.49/hr and an A100 80GB at $5.04/hr\[7]. * **For:** teams that want to run community models and ship their own custom models on the same platform. * **Vs Atlas Cloud:** comparable media breadth plus custom deploys, but the fragmented billing and lack of a normalized media schema or OpenAI endpoint make cost harder to predict. ### 3. Together AI: the open-source LLM cloud with GPUs Together AI calls itself "the AI Native Cloud," a full stack of inference, fine-tuning, and GPU clusters centered on open-weight LLMs\[8]. * **What it does:** open-source LLM inference, fine-tuning, and raw GPU clusters, with image generation attached to a text-first catalog\[8]. * **Models:** for media it carries FLUX, GPT Image 2, Wan, and Seedance, but not Kling, Veo, or Nano Banana at the time of writing\[8]. * **API:** genuinely OpenAI-compatible. Point the OpenAI SDK at `api.together.ai/v1` and most calls work unchanged\[9]. * **GPU rental:** yes, with an H100 at $3.99/hr, H200 at $5.99/hr, and B200 at $8.19/hr on demand\[9]. * **For:** teams built around open-weight LLMs and fine-tuning who want some media on the side. * **Vs Atlas Cloud:** Together is stronger on open LLM infrastructure and clusters, but its media catalog is thinner, so a media-first workload gets more from fal.ai, Atlas Cloud, or reAPI. ### 4. RunPod: raw GPUs plus managed media endpoints RunPod is "the AI Developer Cloud," and it started as raw GPU rental before growing managed endpoints on top\[10]. * **What it does:** GPU pods, serverless workers, and clusters across 30+ GPU SKUs, plus "Public Endpoints" that serve ready-made media models per call\[10]. * **Models:** its Public Endpoints now include Seedance, Kling, Nano Banana Edit and Pro Edit, FLUX, and WAN, so it is no longer GPU-only\[11]. * **API:** partial OpenAI compatibility, limited to its vLLM LLM endpoints; the media endpoints each have their own REST shape\[10]. * **GPU rental:** its core business, with an H100 SXM at $3.29/hr and a B200 at $5.89/hr\[11]. * **For:** teams that want low-level GPU control, fast cold starts, and no egress fees, with a few managed media endpoints available. * **Vs Atlas Cloud:** RunPod gives you cheaper raw compute and more control, but its media side is a scattered set of endpoints rather than one curated, unified media API. ### 5. reAPI: the same media models at a lower listed price reAPI pairs an OpenAI-compatible chat gateway with a separate REST media gateway and a deliberately focused catalog of image, video, and chat models\[12]. Each workspace has its own key and balance. Up front, the catalog is narrower than Atlas Cloud's 400+ and reAPI does not rent raw GPUs, so if you need the widest possible catalog or bare-metal compute, Atlas Cloud or RunPod is the honest answer. * **What it does:** async image and video generation on REST endpoints plus OpenAI-compatible chat, with sub-second failover and zero request retention across separate media and chat gateways\[12]. * **Models:** the same flagships you would pick Atlas Cloud for, including Seedance 2.5 and 2.0, Nano Banana Pro, GPT Image 2, plus Veo, Kling, and Wan\[12]. * **API:** OpenAI-compatible chat at `https://api.reapi.ai/v1` and media REST at `https://reapi.ai/api/v1`; each gateway has its own bearer key and balance\[12]. * **Pricing:** credit-based at 1 credit = $0.001, you pay only for completed generations, provider failures and timeouts are refunded automatically, and eligible new accounts may receive promotional test credits with no card\[12]. * **For:** builders who want Atlas Cloud's flagship media models at a lower listed price with a bill they can read. * **Vs Atlas Cloud:** Atlas Cloud advertises one OpenAI-compatible interface across modalities; reAPI separates OpenAI-compatible chat from its REST media API. Atlas Cloud wins on raw breadth, GPU rental, and enterprise compliance. reAPI's edge is a lower per-unit price on several shared flagship models and transparent credit billing with no promo or quote games, as the price section above lays out. ## AtlasCloud vs the alternatives at a glance | Platform | Catalog | Media focus | OpenAI-compatible | Rents GPUs | How you pay | | ----------- | -------------------------- | ----------------------------- | --------------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------- | | Atlas Cloud | 400+ models | Image, video, audio, plus LLM | Yes | Yes (from $2.95/GPU-hr, rates on request) | Pay-as-you-go, promo-driven | | fal.ai | 1,000+ media models | Media-first | No (own queue) | Yes (H100 from $1.89/hr) | Per generation + GPU/hr | | Replicate | Large, plus custom deploys | Media and general models | No (predictions) | By hardware-time (H100 $5.49/hr) | Per run, mixed metrics | | Together AI | 180+ models | LLM-first, media add-on | Yes | Yes (H100 $3.99/hr) | Per token, per image, GPU/hr | | RunPod | 30+ GPU SKUs + endpoints | GPU-first, media endpoints | Partial (vLLM only) | Yes (H100 SXM $3.29/hr) | Per-hour GPU, per-call endpoints | | reAPI | \~48 curated models | Image, video, chat | Yes (chat); media uses a separate REST/task gateway, key, and balance | No | Credits, 1cr = $0.001, pay per completion | Capability claims are from each vendor's official pages as of July 2026, and features change, so confirm before you commit. ## The split that actually decides it Two questions sort this list faster than any feature table. First, do you want raw compute or a finished media API? RunPod and the GPU side of Together and Atlas Cloud rent you hardware to run whatever you like. fal.ai, Replicate, reAPI, and the media side of Atlas Cloud hand you the model as a call. If your workload is "generate this video," you want the second group, and paying for GPU hours is mostly a distraction. Second, unified or per-model? fal.ai and Replicate give you enormous reach but a different endpoint and schema per model. Together AI and reAPI's chat gateway are OpenAI-compatible, and Atlas Cloud advertises the same. If you are wiring media into a product, clearly defined interfaces and credentials save more time than a few extra models in the catalog. ## Calling reAPI from the OpenAI SDK Because reAPI's chat gateway speaks the OpenAI format, moving a chat call over is a base-URL change. Image and video use the media REST endpoints with a separate key and balance. ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Draft three taglines for a launch."}], ) ``` ## FAQ ### Is Atlas Cloud AI legit? Atlas Cloud is an operating API platform with public model pages, documentation and a price calculator. It states that it holds SOC 2 and HIPAA certifications\[1]\[2]. Those are Atlas Cloud's own statements, not an independent audit, so run a small paid test before moving production traffic. ### Is Atlas Cloud AI safe? Atlas Cloud says it encrypts data at rest and in transit and offers private cloud deployment on dedicated infrastructure for stricter data requirements\[1]. Check its data retention and content policies against your own requirements before sending sensitive inputs. ### What is Atlas Cloud AI? Atlas Cloud is an AI inference and API platform that serves image, video, audio and language models through one API, alongside GPU rental\[1]\[3]. reAPI covers a narrower catalog of image, video and chat models and does not rent GPUs\[12]. ### How much does Atlas Cloud cost? Atlas Cloud is pay-as-you-go: images are priced per image and video per second, with token-based estimates for some models, as shown in the tables above\[2]. On October 5, 2026 its calculator gave about $1.94 for a 10-second 720p Seedance 2.0 clip, against $1.54 on reAPI\[2]\[12]. ### Is Atlas Cloud free? Atlas Cloud advertises free credits for trying its models; beyond those it is pay-as-you-go\[1]. On reAPI, eligible new accounts may receive promotional test credits, with no card required\[12]. ### Is Atlas Cloud AI down? This article cannot show Atlas Cloud's live status. Atlas Cloud describes its platform as production-grade with high concurrency and a dedicated support team\[1]. If you need a second provider ready for the models in the tables above, those models are also available on reAPI\[12]. ## Picking an AtlasCloud alternative Atlas Cloud does a real job: it puts 400+ models, day-0 media access, a fast inference engine, and a GPU business behind one OpenAI-compatible API. The reason to look at an AtlasCloud alternative is usually specific. Choose fal.ai for the widest, fastest media catalog, Replicate to run and deploy your own models, Together AI for open-weight LLMs with real clusters, and RunPod when you want raw GPU control. If what you want is the same flagship image and video models at a lower listed price, with credit billing you can read and refunds on failed jobs, reAPI is the AtlasCloud alternative aimed at developers who care more about cost and clarity than catalog size. Run one real workload through two of these and let price and model fit decide which AtlasCloud alternative you keep. ## Further reading * [reapi.ai/models](/models) lists the full catalog of image, video, and chat models across the two gateways. * [reapi.ai/models/seedance-2-0](/models/seedance-2-0) and [reapi.ai/models/gemini-3-pro-image-preview](/models/gemini-3-pro-image-preview) show the live rates used above. * [reapi.ai/docs/api/quickstart](/docs/api/quickstart) covers the OpenAI-compatible chat endpoint in a few lines. ## References 1. Atlas Cloud. *Homepage, model highlights and FAQ.* Retrieved July and October 2026 from atlascloud.ai 2. Atlas Cloud. *Docs, model pricing, and price calculator — OpenAI-compatible API and pay-as-you-go billing.* Calculator prices retrieved October 5, 2026 from atlascloud.ai. 3. Atlas Cloud. *GPU Cloud — on-demand compute from $2.95/GPU-hr.* Retrieved July 2026 from atlascloud.ai/gpus 4. fal.ai. *Generative media platform for developers — models and quickstart.* Retrieved July 2026 from fal.ai 5. fal.ai. *Pricing — serverless GPUs and per-model rates.* Retrieved July 2026 from fal.ai/pricing 6. Replicate. *Run AI with an API — models and predictions.* Retrieved July 2026 from replicate.com 7. Replicate. *Pricing — hardware and per-run rates.* Retrieved July 2026 from replicate.com/pricing 8. Together AI. *The AI Native Cloud — inference, fine-tuning, and clusters.* Retrieved July 2026 from together.ai 9. Together AI. *Pricing and OpenAI compatibility.* Retrieved July 2026 from together.ai/pricing 10. RunPod. *The AI Developer Cloud — pods, serverless, and vLLM compatibility.* Retrieved July 2026 from runpod.io 11. RunPod. *Pricing — GPU rates and Public Endpoints.* Retrieved July 2026 from runpod.io/pricing 12. reAPI. *Model catalog, model pages and live rates.* Retrieved October 5, 2026 from [reapi.ai/models](/models) --- # Background Removal API Pricing: Cost per Usable Image (https://reapi.ai/blog/background-removal-api-pricing) The current **background removal API pricing** for `mj-v7-remove-bg` is 88 credits, or **$0.088 per completed request**, when checked on September 3, 2026\. That is the right starting number for a request budget. It is not automatically the cost of one usable cutout. A completed image can still have a halo, lose a handle opening, flatten a shadow, or arrive in a format that the next service cannot accept. This guide shows how to call the route, poll it safely, inspect the settled charge, and calculate cost per image that actually passes review. ## TL;DR * The live estimator returned **88 credits ($0.088) per completed `mj-v7-remove-bg` request** on September 3, 2026. One credit is $0.001.\[1] * The request takes exactly one public HTTP(S) URL. It does not take a prompt, resolution, speed, or parent task ID.\[2] * The operation is asynchronous: submit once, save the returned task ID, and poll the task endpoint. Polling does not consume credits.\[3] * Budget with `total settled cost / accepted outputs`, not the number of files submitted. At an 80% acceptance rate, an $0.088 request becomes **$0.11 per usable image**. * A failed task with `usage.credits: 0` was refunded. A completed result that your team rejects for poor edges was still completed work, so include it in your accepted-image calculation.\[3] * Run a small test set drawn from your own catalog before committing volume. One clean product photo says little about hair, glass, low contrast, or objects with holes. ## Why the quoted price is rarely the useful number If your app removes backgrounds from thousands of uploaded images, how do you compare services when price, edge quality, response time, resolution, and file handoff all affect the result? A sticker price alone cannot answer that question. The useful calculation is narrower: ```text cost per usable image = total settled API cost / images that pass review ``` That denominator changes the decision. A cheap endpoint that damages fine edges can cost more than a higher-priced one once reruns and manual cleanup are included. ## What the current background removal API price buys The live Midjourney V7 model page lists Remove BG as a lightweight edit. The current request estimate settles in whole credits, and the live estimate for the required payload is 88 credits.\[1] Because one credit equals $0.001, use **$0.088** in a budget. | Requests | API subtotal at 88 credits | What the number assumes | | -------: | -------------------------: | ------------------------------------------------ | | 1 | $0.088 | One completed removal request | | 10 | $0.88 | Ten completed requests, before acceptance review | | 100 | $8.80 | No completed output rejected | | 1,000 | $88.00 | No storage, review, or transformation cost | | 10,000 | $880.00 | Same rate and a 100% accepted-output rate | You may see the operation displayed as $0.0873 in a detailed price label. Do not use that fractional figure to reconcile a credit balance. The public pricing table and estimator show the payable unit as 88 whole credits, or $0.088. Check the [live model page](/models/midjourney-v7) again before a large run because pricing can change. The API subtotal excludes the work around the call: * hosting the source at a URL the service can fetch; * downloading and storing the result; * validating transparency, dimensions, and file compatibility; * human review or automated quality checks; * completed outputs that fail your acceptance rules; * resizing, color correction, shadow reconstruction, or later compositing. For a prototype, those costs may be negligible. At catalog scale, they belong in the same spreadsheet as the API line item. ## One source URL, no prompt and no parent task `mj-v7-remove-bg` is simpler than the other Midjourney V7 edit operations. It does not chain from a previous generation. Send the image you already have in `image_urls`.\[2] | Field | Required | Accepted value | | --------------------- | ------------ | -------------------------------------------------------- | | `model` | yes | `mj-v7-remove-bg` | | `image_urls` | yes | An array containing exactly one public HTTP(S) image URL | | `prompt` | not accepted | Do not send it | | `model_params` | not accepted | No speed, task ID, or edit options | | `size` / `resolution` | not accepted | The route exposes no output-size control | The schema is strict. Adding fields copied from another image model is not a harmless no-op; it makes the request invalid. Base64 strings, `data:` URLs, local paths, and authenticated browser-only links are also the wrong input. Upload the source to storage you control and confirm that it loads without a cookie or login. Here is the complete cURL request: ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mj-v7-remove-bg", "image_urls": [ "https://your-cdn.example/catalog/source-product.png" ] }' ``` A valid submission returns a task record in `processing` state. Save its `id`. The final image does not arrive in the POST response. ## Submit once, then poll with a deadline The safest beginner implementation has two separate actions: one POST that creates the job, followed by bounded GET requests that read its state. Do not put the POST inside the polling loop. This Node.js example polls every 2.5 seconds and uses a 15-minute local deadline. The task reference recommends a two-to-three-second cadence and explains that in-flight task reads are cached, so faster polling adds request pressure without making the image finish sooner.\[3] ```javascript const API_BASE = 'https://reapi.ai/api/v1'; const API_KEY = process.env.REAPI_API_KEY; const sourceUrl = process.argv[2]; if (!API_KEY) throw new Error('Set REAPI_API_KEY'); if (!sourceUrl) throw new Error('Pass one public source image URL'); const headers = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }; async function readJson(response) { const body = await response.json(); if (!response.ok) { const code = body.error?.code ?? response.status; const message = body.error?.message ?? 'Request failed'; throw new Error(`${code}: ${message}`); } return body; } const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); async function getTask(taskId) { for (let attempt = 0; attempt < 4; attempt += 1) { let response; try { response = await fetch(`${API_BASE}/tasks/${taskId}`, { headers: { Authorization: `Bearer ${API_KEY}` }, signal: AbortSignal.timeout(15_000), }); } catch (error) { if (attempt === 3) throw error; await sleep(1000 * 2 ** attempt); continue; } if (response.status === 429) { const seconds = Number(response.headers.get('retry-after')); await response.body?.cancel(); await sleep(Number.isFinite(seconds) ? seconds * 1000 : 5000); continue; } if ([502, 503, 504].includes(response.status)) { await response.body?.cancel(); await sleep(1000 * 2 ** attempt); continue; } return readJson(response); } throw new Error(`Task ${taskId} could not be read after transient errors`); } async function removeBackground(imageUrl) { const submitted = await readJson( await fetch(`${API_BASE}/images/generations`, { method: 'POST', headers, body: JSON.stringify({ model: 'mj-v7-remove-bg', image_urls: [imageUrl], }), signal: AbortSignal.timeout(30_000), }) ); const deadline = Date.now() + 15 * 60 * 1000; while (Date.now() < deadline) { await sleep(2500); const task = await getTask(submitted.id); if (task.status === 'completed') { const urls = task.output?.image_urls ?? []; if (urls.length === 0) { throw new Error('Task completed without an image URL'); } return { taskId: task.id, imageUrls: urls, credits: task.usage?.credits, }; } if (task.status === 'failed') { const code = task.error?.code ?? 'UNKNOWN_TASK_ERROR'; const message = task.error?.message ?? 'Background removal failed'; const credits = task.usage?.credits ?? 'unknown'; throw new Error( `${code}: ${message}; task=${task.id}; settled_credits=${credits}` ); } } throw new Error(`Polling deadline reached for task ${submitted.id}`); } removeBackground(sourceUrl) .then(console.log) .catch((error) => { console.error(error.message); process.exitCode = 1; }); ``` Run it with: ```bash REAPI_API_KEY=YOUR_API_KEY node remove-background.mjs \ https://your-cdn.example/catalog/source-product.png ``` In production, write the task ID to your database before returning from the submit handler. A worker can then resume polling after a process restart. Keep the API key on the server; never place it in browser JavaScript or a mobile app bundle. ## What one failed live request actually cost We submitted one `mj-v7-remove-bg` request while checking this guide on September 3, 2026, using an [owned mug photo](https://reapi.ai/images/landing/gpt-image-2/use-case-0.png). The API accepted the strict payload as task `task_01a065b32dbe771eb5babd28de9b38d9`, but it later ended in `failed` state with error code `80003` and the message `Service authentication failed`. It returned no output and `usage.credits: 0`, so its settled cost was **$0**, not $0.088. We did not resubmit the unchanged request just to manufacture a successful example. This single run confirms the task and refund path; it says nothing about cutout quality, file type, dimensions, alpha support, or normal completion time. The 88-credit figure above remains the live estimate for a request that completes. Always read the terminal task instead of multiplying submission count by the advertised rate.\[3] ## Turn request price into cost per usable image Start with an acceptance rule, not a percentage you hope to achieve. Then measure the percentage on a sample from the workload you intend to ship. ![Background-removal API cost funnel from submitted requests through cutout review to accepted images](https://cdn.reapi.ai/media/blog/background-removal-api-pricing/cost-per-usable-image.png) If each completed request produces one candidate, the planning equation is: ```text usable-image cost = $0.088 / acceptance rate ``` The table below contains scenarios, not measured model quality: | Assumed acceptance rate | Requests for 1,000 accepted images | API subtotal | Cost per usable image | | ----------------------: | ---------------------------------: | -----------: | --------------------: | | 100% | 1,000 | $88.000 | $0.0880 | | 95% | 1,053 | $92.664 | $0.0927 | | 90% | 1,112 | $97.856 | $0.0979 | | 80% | 1,250 | $110.000 | $0.1100 | | 50% | 2,000 | $176.000 | $0.1760 | Use settled task data for the numerator. The task response exposes `usage.credits` in every state. `processing` plus zero means billing has not settled. `completed` shows the charged credits. `failed` plus zero means the reservation was refunded; a positive value means a documented charge was retained.\[3] This distinction prevents two accounting errors. Do not count a refunded provider failure as paid output, and do not erase a completed but ugly cutout from spend. It still consumed a paid request. ## Decide what “usable” means before the test A visual glance is too vague for a repeatable benchmark. Write a short rubric before submitting the sample, then apply the same checks to every result. ### Transparency and edge integrity Open the downloaded file in a tool that shows an alpha checkerboard. A white background is not transparency. Inspect the full silhouette at 100% and 400% zoom for white or dark halos, missing pixels, and chunks of the old background. ### Holes, fine detail, and difficult materials Include examples with handle openings, straps, spokes, loose hair, fur, and foliage. Add glass, translucent packaging, glossy metal, and low-contrast subject edges if those appear in your real catalog. A model that passes a dark mug on white may still fail a clear bottle or pale object on beige. ### Product details and shadows Confirm that labels, printed text, thin attachments, and the product outline did not change. Decide whether a contact shadow should be kept, softened, or removed. Different destinations need different answers, so “shadow removed” is not automatically a pass. ### File contract Record MIME type, extension, width, height, byte size, alpha presence, and the number of returned URLs. The public contract returns `output.image_urls`, but it does not promise a specific extension or pixel size for this operation. Test the real file against the next API, design tool, or marketplace importer in your pipeline. A useful pilot is large enough to represent the hard cases, not just the easy ones. Ten to thirty owned images can expose obvious incompatibilities. A final procurement benchmark should follow the distribution of your actual catalog. ## Retry failures without creating a cost loop Retry rules should use the error, not frustration. The public error reference separates invalid input, authentication, insufficient balance, rate limits, capacity failures, and terminal workflow failures.\[4] | Result | What to do | | --------------------------- | --------------------------------------------------------------------------- | | HTTP 400, 401, 402, or 404 | Fix the request, credentials, balance, or task ID. Do not repeat unchanged. | | HTTP 429 | Wait for `Retry-After`, then retry the same read or safe operation. | | HTTP 502, 503, or 504 | Back off exponentially and cap attempts. | | Task `failed` | Read `error.code` and `usage.credits` before deciding whether to resubmit. | | Task `completed`, QA failed | Change the source or route the image to manual cleanup; cap paid reruns. | Keep the submit action outside automatic polling retries. Once a POST returns a task ID, every later check should be a GET for that task. For a completed image that fails your rubric, a second identical request may reproduce the same edge problem. Changing the input crop, contrast, or preprocessing is more useful than an unbounded rerun. Download accepted files to your own storage as soon as the task completes. The task documentation says output URLs are rehosted on the CDN but does not guarantee long-term retention.\[3] ## Hosted route versus an official Midjourney API `mj-v7-remove-bg` is a hosted route exposed through reAPI. It should not be described as Midjourney's official public API. Midjourney's current community guidelines say it does not generally provide an API and prohibits unauthorized automation except for rare, explicitly granted cases.\[5] That distinction matters during procurement. Review the hosted service's own contract and acceptable-use terms instead of assuming that a model label creates an official vendor relationship. The separate guide [Does Midjourney Have an API?](/blog/does-midjourney-have-an-api) covers that question in detail; this article stays focused on the callable route and its cost. ## FAQ ### Does `mj-v7-remove-bg` need a previous Midjourney task? No. It is a direct-image edit. Pass one public image URL in `image_urls`; do not send `task_id` or `model_params`.\[2] ### Can I send a base64 image? No. The request schema accepts one public HTTP(S) URL. Upload the file first, then send a URL that the service can fetch without your browser session. ### Is the current price $0.0873 or $0.088? Use $0.088 for billing estimates. The operation may appear as $0.0873 in a detailed display, but the live estimator returns 88 whole credits and one credit equals $0.001.\[1] ### Does one request return four background-removed images? Do not budget on that assumption. Four images per request describes the base Midjourney V7 generation. The direct Remove BG contract takes one source image and returns an image URL array, but it does not promise four cutouts. Inspect the terminal task's array length in your pilot.\[2] ### Does the API always return a transparent PNG? The current public contract promises image URLs, not a particular extension, MIME type, or alpha-channel guarantee. Download a real result and verify alpha before building a PNG-only downstream workflow. ### Does polling cost credits? No. Polling a task does not consume credits. Poll every two to three seconds and stop at a deadline that suits your application.\[3] ### Are failed background-removal tasks charged? Read `usage.credits` on the terminal task. A failed task with zero credits was fully refunded. The generic task contract allows a positive retained charge in some model-specific post-generation safety cases, so do not infer the bill from status alone.\[3] ### What will 1,000 usable images cost? At a 100% acceptance rate, 1,000 requests cost $88 at the current rate. At 80% acceptance, reaching 1,000 usable files requires 1,250 requests and costs $110, before storage and review. Replace the assumed rate with your measured pilot. ## Choose by accepted cost, not sticker price The current background removal API pricing is straightforward at the request level: 88 credits, or $0.088. The production decision starts after that. Test the edges and file contract your application actually needs, read settled usage from every task, and divide total spend by outputs that pass a fixed rubric. Start with the [Midjourney V7 API reference](/docs/midjourney-v7), run a small owned-image pilot, and keep the [task polling reference](/docs/api/tasks) next to your implementation. That gives you a defensible cost per usable image instead of an unverified headline price. ## References 1. reAPI. *Midjourney V7 model page and live pricing.* Retrieved September 3, 2026 from [reapi.ai/models/midjourney-v7](/models/midjourney-v7) 2. reAPI. *Midjourney V7 API reference.* Retrieved September 3, 2026 from [reapi.ai/docs/midjourney-v7](/docs/midjourney-v7) 3. reAPI. *Tasks: polling, usage, output, and refund semantics.* Retrieved September 3, 2026 from [reapi.ai/docs/api/tasks](/docs/api/tasks) 4. reAPI. *API error codes and retry guidance.* Retrieved September 3, 2026 from [reapi.ai/docs/api/errors](/docs/api/errors) 5. Midjourney. *Community Guidelines: unauthorized automation and third-party apps.* Retrieved September 3, 2026 from [docs.midjourney.com/hc/en-us/articles/32013696484109-Community-Guidelines](https://docs.midjourney.com/hc/en-us/articles/32013696484109-Community-Guidelines) --- # Best AI Video Generation API in 2026: Five Models Compared (https://reapi.ai/blog/best-ai-video-generation-api-2026) **The best AI video generation API depends on the shot: Seedance 2.5 for 16–30-second continuity, MiniMax H3 for short 2K shots and audio references, Kling 3.0 for affordable video with sound, Veo 3.1 for fixed-cost eight-second output, and Vidu Q3 for inexpensive drafts.** No single model wins all five jobs. That answer is less exciting than ranking demo reels, but it survives contact with an API. Duration ceilings, reference inputs, resolution and billing units eliminate most candidates before subjective image quality becomes the deciding factor. ## The five-model decision table | Model | Use it first for | Max clip | Main limitation | | ------------------------------------ | ------------------------------------------ | -----------------: | -------------------------------------- | | [Seedance 2.5](/models/seedance-2-5) | Continuous scenes and large reference sets | 30 s | High-resolution retries get expensive | | [MiniMax H3](/models/minimax-h3) | Short 2K shots and audio references | 15 s | Community-license territory limits | | [Kling 3.0](/models/kling-3-0) | Affordable clips with audio; 4K option | 15 s | Smaller reference set | | [Veo 3.1](/models/veo3-1) | Predictable eight-second jobs | 8 s on common tier | Fixed price does not buy more duration | | Vidu Q3 | Low-cost motion drafts | Tier-dependent | Cheapest tier is 540p | These are API constraints, not quality scores. A five-second product insert and a 30-second dialogue scene should not use the same selection rule. ## Seedance 2.5 is the long-take choice Seedance 2.5 generates from four to 30 seconds in one pass and accepts up to 30 reference images, 10 videos and 10 audio clips on the current route.\[1]\[6] Its timed prompt segments and edit or extend modes are useful when several actions must happen inside one continuous scene. The cost follows that capacity. A plain 720p request on reAPI is currently $0.266824 per output second: $1.335 for five seconds, $2.669 for ten and $8.005 for 30 after credit rounding.\[6] A source video selects a lower rate but adds input duration to the billing clock. The lower rate is not automatically a lower total. Choose Seedance when removing a join is worth paying for. Do not make every social insert pay for a 30-second ceiling it never uses. ## MiniMax H3 is the short 2K and audio-reference choice H3 runs from four to 15 seconds, generates stereo sound and accepts mixed image, video and audio references.\[2] The current reAPI tiers reach 2K, while the 768P tier provides a cheaper place to test motion and prompt timing.\[7] H3 is also the only model in this group with public weights. That does not make it Apache- or MIT-licensed. The MiniMax H3 Community License excludes the United States, European Union, United Kingdom and South Korea from its applicable territory unless separate written authorization is obtained.\[3] Teams considering self-hosting should settle that question before optimizing a ComfyUI workflow. Use H3 for product shots, music-driven scenes and short dialogue where a supplied audio reference matters. Its 15-second ceiling is a problem only when the shot really must remain continuous beyond it. ## Kling 3.0 is the practical budget-with-audio option Kling 3.0 exposes separate tiers for resolution and audio. On reAPI, the current standard 720p tier is about $0.077/s without audio and $0.110/s with it; the 1080p with-audio tier is about $0.149/s, and a listed 4K route is about $0.369/s.\[8] That puts an eight-second 720p clip with sound near $0.88. Kling accepts a smaller reference set than Seedance 2.5 or H3, so the low price should not override a workflow that depends on many identity angles or audio references. ## Veo 3.1 makes the bill easy to predict Several Veo 3.1 routes use flat per-generation billing. reAPI's current Fast route lists about $0.161 per generation at 720p or 1080p, with a common fixed duration of eight seconds.\[9] A four-second idea does not become cheaper on that route, and a longer idea does not fit inside it. That pricing is attractive for a product built around a fixed clip format. Veo also has official per-second tiers with separate resolution and audio prices, so the exact model ID matters. “Veo 3.1 price” is not one number. ## Vidu Q3 is useful before final resolution matters Vidu Q3 Turbo currently starts near $0.037/s at 540p, while Q3 Pro costs more and reaches higher resolutions. Five seconds at the Turbo entry tier is about $0.185.\[10] That is a good unit for testing whether a pan, subject movement or composition works. It is not a reason to deliver 540p when the brief requires 1080p. Draft economics and delivery economics belong in separate rows of the budget. ## Why the price column cannot rank these models Two billing units coexist in this category: per second and per generation. Source-video jobs can introduce a third variable by charging for input duration. | Route | Billing unit | Example | What the number omits | | ---------------------- | -------------- | -----------: | ------------------------------------ | | Veo 3.1 Fast | Per generation | $0.161 | Fixed eight-second format | | Vidu Q3 Turbo 540p | Per second | $0.185 / 5 s | Draft resolution | | Kling 3.0 720p + audio | Per second | $0.88 / 8 s | Smaller reference surface | | Seedance 2.5 720p | Per second | $2.135 / 8 s | Pays for longer/reference-heavy jobs | This is why our separate [AI video API pricing guide](/blog/ai-video-generation-api-pricing) converts every rate into cost per clip before comparing it. ## Run a workload test, not a beauty contest Pick two models that satisfy the hard constraints, then run the same five jobs through both. Record: * completed and accepted outputs; * identity, motion and audio failures; * wall-clock latency; * total charge after retries; * any manual work needed before delivery. The useful metric is cost per accepted clip. A cheap model that takes eight attempts can lose to an expensive one that takes two. Every API here is asynchronous: submission returns a task identifier and completion happens later. Polling or webhooks, retry handling, public input URLs and failed-job billing belong in the architecture from the first prototype. Those details can cost more to change than the model ID. ## Frequently asked questions ### What is the best AI video generation API overall? There is no overall winner. Seedance 2.5 covers the longest continuous scene and largest reference set; H3 offers 2K and audio references; Kling is inexpensive with audio; Veo 3.1 offers predictable fixed-format billing; Vidu Q3 is a cheap draft route. ### Which AI video API is cheapest? At the entry configurations compared here, Veo 3.1 Fast and Vidu Q3 Turbo are the lowest per job. They are different products: Veo is a fixed-format generation, while Vidu's lowest price is a 540p per-second tier. ### Can one API generate a one-minute video? Not as one ordinary text-to-video generation. Seedance 2.5 reaches 30 seconds; longer work is assembled from generated segments or produced through a separate storyboard and editing workflow. The [long-video guide](/blog/ai-video-generator-long-videos) covers chaining and its failure modes. ### Do I need five separate integrations to test five models? Not necessarily. reAPI exposes the linked models through one asynchronous media task pattern. Custom model deployment and fine-tuning are outside that scope; a serverless marketplace is a better fit for those requirements. ## References 1. ByteDance Seed. *One-take Creation, Flexible Referencing: Introducing Seedance 2.5.* Published July 31, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/one-take-creation-flexible-referencing-introducing-seedance-2-5) 2. MiniMax. *MiniMax H3 launch and video generation guide.* Published July 31, 2026. [minimax.io](https://www.minimax.io/blog/minimax-h3) 3. MiniMaxAI. *MiniMax H3 Community License.* Retrieved August 23, 2026. [huggingface.co](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/main/LICENSE) 4. Kling AI. *Developer pricing.* Retrieved August 23, 2026. [klingai.com](https://app.klingai.com/global/dev/pricing) 5. Google AI for Developers. *Generate videos with Veo.* Retrieved August 23, 2026. [ai.google.dev](https://ai.google.dev/gemini-api/docs/video) 6. reAPI. *Seedance 2.5 model page and live pricing.* Retrieved August 23, 2026. [reapi.ai](/models/seedance-2-5) 7. reAPI. *MiniMax H3 model page and live pricing.* Retrieved August 23, 2026. [reapi.ai](/models/minimax-h3) 8. reAPI. *Kling 3.0 model page and live pricing.* Retrieved August 23, 2026. [reapi.ai](/models/kling-3-0) 9. reAPI. *Veo 3.1 model page and billing tiers.* Retrieved August 23, 2026. [reapi.ai](/models/veo3-1) 10. Vidu. *Vidu API documentation.* Retrieved August 23, 2026. [platform.vidu.com](https://platform.vidu.com/docs) --- # Which Claude Model Is Best for Coding and for Writing (https://reapi.ai/blog/best-claude-model-for-coding) "Which Claude model is best for coding" has a different answer depending on whether you mean the highest benchmark score, the best result per dollar, or the model that will not surprise you at 2am. Those are three different models. The published numbers settle more of it than people expect, including one row where Anthropic's own table shows its flagship losing. ## TL;DR * **Highest agentic-coding score**: Claude Fable 5 at 80.3% on SWE-Bench Pro\[1]. * **Best default for most teams**: Claude Opus 5, which Anthropic positions for complex agentic coding and enterprise work\[2]. * **Opus 5 loses one coding row.** GPT-5.6 Sol takes DeepSWE v1.1, 72.7% against 68.8%, in Anthropic's own table\[3]. * **For writing, the ranking inverts toward knowledge work**, where Opus 5 leads GDPval-AA v2 at 1861\[3]. * **Effort matters more than model choice** below the frontier: `low` and `medium` on Opus 5 hold up unusually well\[2]. * **On reAPI, Opus 5 costs less than Fable 5 by a wide margin**, which changes the trade. ## The coding numbers ![Three coding benchmarks with three different winners: Fable 5 on SWE-Bench Pro, Opus 5 on Frontier-Bench, and GPT-5.6 Sol taking DeepSWE, plus the knowledge-work row where the ranking inverts](https://cdn.reapi.ai/media/blog/best-claude-model-for-coding/split.png) Three models are in serious contention. Here is what Anthropic published for each. | Benchmark | Fable 5 | Opus 5 | Opus 4.8 | | -------------------------------------- | ----------- | --------- | -------- | | SWE-Bench Pro (agentic coding) | **80.3%** | n/a | 69.2% | | FrontierCode Diamond (hardest coding) | **29.3%** | 53.4%† | 13.4% | | Terminal-Bench 2.1 | **88.0%**\* | n/a | 82.7% | | Frontier-Bench v0.1 (agentic terminal) | 33.7% | **43.3%** | 21.1% | | DeepSWE v1.1 (agentic coding) | 69.7% | 68.8% | 59.0% | \* A starred row is one where Anthropic notes the public Fable 5 diverges from the unrestricted sibling because safety classifiers trigger; expect the model you can actually call to land closer to Opus 4.8 there\[1]. † FrontierCode v1.1 Main, a different cut of the benchmark than the Diamond subset in the Fable 5 column, so read down the column rather than across this row. Two conclusions survive that table. **Fable 5 is the top of the coding board** where the benchmarks are directly comparable, and by a real margin on SWE-Bench Pro\[1]. **Opus 5 wins the newer agentic-terminal benchmark decisively**, more than doubling Opus 4.8's Frontier-Bench score\[3]. ## The row Anthropic left in On DeepSWE v1.1, Anthropic's own comparison table puts **GPT-5.6 Sol at 72.7% against Opus 5's 68.8%**\[3]. That is the clearest coding loss on the board, and it lands on exactly the workload Opus 5 is marketed for. It is worth taking seriously rather than explaining away. If your evaluation resembles DeepSWE, a competitor scores higher on the vendor's own numbers. If it resembles long-horizon terminal work, Opus 5 wins the same table by nine points over that competitor. The lesson is not that one model is better. It is that "best for coding" resolves differently depending on which coding benchmark matches your work. ## Which one for writing Ask the writing question and the ranking reorganizes, because writing lives closer to knowledge work than to code. | Benchmark | Opus 5 | Fable 5 | Opus 4.8 | | ---------------------------------- | --------- | --------- | -------- | | GDPval-AA v2 (knowledge work, Elo) | **1861** | 1747 | 1593 | | Humanity's Last Exam, no tools | 56.3% | **56.5%** | 49.8% | | Humanity's Last Exam, with tools | **64.7%** | 63.9% | 57.9% | Opus 5 leads knowledge work by 114 Elo over Fable 5\[3]. On reasoning without tools the two are a statistical tie. For drafting, editing, and synthesis, that GDPval gap is the relevant signal, and it points at Opus 5 rather than the model that tops the coding board. ## The variable that beats model choice Below the frontier, effort level moves results more than switching models does. Anthropic describes Opus 5 as converting additional effort into better results more reliably than any earlier Opus model, and separately notes that `low` and `medium` produce strong quality at a fraction of the tokens and latency\[2]. The official guidance is to start at the default `high` and sweep in both directions against your own evaluations. That has a practical consequence for this whole question. A team that picks the "best" model and leaves effort at an inherited default is often getting worse results, more slowly, than a team on the tier below that tuned the dial. ## What it costs on reAPI Model choice is a cost decision as much as a capability one. Rates checked October 22, 2026. | Model | Input / output per 1M tokens | | ----------------- | ---------------------------- | | Claude Fable 5 | $7.00 / $35.00 | | Claude Opus 5 | **$2.40 / $12.00** | | Claude Opus 4.8 | $2.80 / $14.00 | | Claude Sonnet 4.6 | $2.40 / $12.00 | Fable 5 costs almost three times as much as Opus 5 on the same gateway. That reframes the coding question: Fable 5's SWE-Bench Pro lead is real, and you are paying nearly 3x for it, on a model that also carries mandatory 30-day retention and a refusal layer\[1]. For most teams that trade does not clear. For a repo-scale migration where a failed run costs more than the tokens, it can. ## Picking **Default to Opus 5.** Best knowledge-work score, decisive on the newer agentic-terminal benchmark, and the cheapest of the three on this gateway. **Reach for Fable 5** when the task is long-horizon and hard *and* you have measured it winning on your own work. The FrontierCode curve is the honest argument: on the hardest problems, extra effort keeps buying accuracy where other models flatten\[1]. **Stay on Opus 4.8** when your evaluations are already calibrated to it, or when you need thinking disabled at high effort levels, which Opus 5 rejects\[2]. **Consider a non-Claude model** if your workload looks like DeepSWE. The vendor's own table says so. ```python from openai import OpenAI client = OpenAI(api_key="YOUR_REAPI_KEY", base_url="https://api.reapi.ai/v1") resp = client.chat.completions.create( model="claude-opus-5", messages=[{"role": "user", "content": "Refactor this module and add tests."}], max_tokens=16000, stream=True, ) ``` Switching between them is a model-string change on one key. Rates are on [reapi.ai/models](/models). ## FAQ ### Which Claude model is best for coding? Fable 5 tops the directly comparable coding benchmarks, notably SWE-Bench Pro at 80.3%\[1]. Opus 5 wins the newer agentic-terminal benchmark and costs far less, which makes it the better default for most teams\[3]. ### Which Claude model is best for writing? Opus 5. It leads knowledge work on GDPval-AA v2 at 1861 Elo, 114 ahead of Fable 5\[3]. ### Does Claude beat GPT for coding? Not on every benchmark. Anthropic's own table shows GPT-5.6 Sol taking DeepSWE v1.1 at 72.7% against Opus 5's 68.8%, while Opus 5 leads the same table on agentic terminal work\[3]. ### Is Fable 5 worth three times the price? Only when the task is hard enough that its effort curve pays for itself. It also carries mandatory 30-day data retention and a classifier refusal layer that Opus 5 does not\[1]. ### Does effort level matter more than model choice? Below the frontier, often yes. Opus 5 converts extra effort into results more reliably than earlier Opus models, and its `low` and `medium` settings hold up unusually well\[2]. ### Which model should I use for code review specifically? Opus 5, with one caveat from Anthropic's guidance: it follows severity filters literally, so asking only for high-severity issues depresses what it reports. Ask for everything with confidence labels and filter downstream\[2]. ### Is Sonnet good enough for coding? For high-volume work where cost per turn dominates, often yes. On reAPI Sonnet 4.6 costs the same as Opus 5, which removes the price argument for choosing it. ### How do I switch between them? One model string on one key, if you call them through a gateway rather than per-vendor accounts. ## Matching the model to the benchmark that matches your work The honest answer to which Claude model is best for coding is that the question is underspecified. Fable 5 tops the classic coding benchmarks. Opus 5 tops the newer agentic-terminal one, leads knowledge work outright, and costs a third as much. A competitor beats both on one row that Anthropic published anyway. So pick the benchmark that resembles your actual work, then read that row. And before switching models at all, sweep the effort dial on the one you already have, because below the frontier that moves results more than the model name does. ## References 1. reAPI. *How to use Claude Fable 5 — benchmark table, effort curve, refusal layer, and retention.* [reapi.ai/blog/how-to-use-claude-fable-5](/blog/how-to-use-claude-fable-5) 2. Anthropic. *What's new in Claude Opus 5 — effort guidance, behavior changes, and capability improvements.* Retrieved July 2026 from [platform.claude.com/docs/en/about-claude/models/whats-new-opus-5](https://platform.claude.com/docs/en/about-claude/models/whats-new-opus-5) 3. reAPI. *How to use Claude Opus 5 — the full published benchmark table.* [reapi.ai/blog/how-to-use-claude-opus-5](/blog/how-to-use-claude-opus-5) ### Further reading * reAPI. *How to use Claude Opus 4.8.* [reapi.ai/blog/how-to-use-claude-opus-4-8](/blog/how-to-use-claude-opus-4-8) * reAPI. *How to use GPT-5.6.* [reapi.ai/blog/how-to-use-gpt-5-6](/blog/how-to-use-gpt-5-6) * reAPI. *Model catalog.* [reapi.ai/models](/models) --- # Best CometAPI Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-cometapi-alternatives) CometAPI is a unified gateway: one OpenAI-compatible key reaches 500+ models across text, image, video, and audio, priced at least 20% below the providers' official rates\[1]. It is a clean pitch in a crowded category. Teams comparing **CometAPI alternatives** usually want one of a few things: pass-through pricing where they pay the exact provider rate, the option to own inference or fine-tune, deeper media and video coverage, or a specific model CometAPI does not carry. This guide compares five CometAPI alternatives on what moves a decision: model range, pricing model, integration effort, and where each one beats CometAPI. Four are independent platforms. The fifth is reAPI, which we build. CometAPI presents a unified OpenAI-compatible gateway; reAPI separates its OpenAI-compatible chat and REST media workspaces, including their keys and balances. Every figure below came from each vendor's own pricing page or docs on May 30, 2026. ## TL;DR * **CometAPI** unifies 500+ models behind one OpenAI-compatible key at roughly 20% below official rates, with pay-as-you-go credits that do not expire\[1]. * **OpenRouter** is the pass-through option: 400+ models across 60+ providers at provider rates, plus a 5.5% credit-purchase fee, with free model variants\[2]\[3]. * **WaveSpeed** is a speed-first unified API with 1,000+ models, but a $1 trial and prepayment-gated throughput\[4]. * **Together AI** owns its open-model inference and fine-tuning; **Replicate** owns the widest custom-model catalog\[6]\[8]. * **reAPI** is the curated-media pick: 200+ models with deeper video generation and a transparent credit unit; chat and media credentials remain separate. ## What CometAPI does well, and where it leaves gaps CometAPI's strength is consolidation with a built-in discount. Where it is strong: * **One key for 500+ models.** Text, image, video, and audio through a single OpenAI-compatible endpoint\[1]. * **A flat discount.** Models are priced at least 20% below official vendor rates, stated as "customer price = official x 0.8"\[1]. * **Credits that last.** Pay-as-you-go with no subscription and no minimum, and unused credits carry forward indefinitely\[1]. * **Easy entry.** Test credits at signup, no credit card required\[1]. Where teams hit walls: * **Self-reported reliability.** The 99.9% uptime and response-time figures are CometAPI's own numbers, not audited benchmarks\[1]. * **A fixed discount, not the floor.** The roughly 20% cut is off official rates; for some open models, a pass-through router can reach a cheaper third-party provider instead\[3]. * **No fine-tuning or self-hosting.** It is an aggregation layer, so training and dedicated deployment live elsewhere. * **Unpublished free amount.** The trial is "test credits," with no documented dollar figure\[1]. ## How to evaluate a CometAPI alternative Five questions sort the field: * **Pricing shape.** A flat discount off official, pass-through provider rates, or your own compute? * **Model reach.** Does it carry the exact models you need across modalities? * **Media depth.** Is video generation a first-class feature or an afterthought? * **Train vs. call.** Do you need fine-tuning or dedicated hosting? * **Entry cost.** A real free balance, or a token trial? ## The best CometAPI alternatives in 2026 ### 1. OpenRouter: best for pass-through pricing and breadth OpenRouter is the largest aggregator and the transparency option: you pay the provider's rate, not a repriced one\[2]. * **Features:** 400+ models across 60+ providers behind one OpenAI-compatible key, with provider routing, free model variants, and bring-your-own-key support\[2]\[3]. * **Pricing:** Pass-through at the provider's own rate, plus a 5.5% ($0.80 minimum) fee on credit purchases. Rates vary by provider, for example Claude Opus 4.8 at $5 in / $25 out\[3]. * **Performance:** Depends on the routed provider; the schema is normalized across them. * **Best for:** Teams that want provider-exact pricing and the widest model reach. * **Vs CometAPI:** OpenRouter pays provider rate plus a credit fee; CometAPI prices a flat 20% below official with no purchase surcharge. Which is cheaper depends on the model. ### 2. WaveSpeed: best for speed-first media WaveSpeed is another unified, OpenAI-compatible gateway, tuned for low latency on media\[4]. * **Features:** 1,000+ models across image, video, audio, 3D, and language, with sub-second latency claims and Python and JavaScript SDKs\[5]. * **Pricing:** Pay-per-use, for example Seedance 2.0 Fast at $0.10/second and Nano Banana 2 at $0.07/image. New accounts get $1 in trial credits\[4]. * **Performance:** Advertises zero cold starts and images in under two seconds\[5]. * **Best for:** Latency-sensitive media workloads. * **Vs CometAPI:** WaveSpeed leans on raw speed and a larger catalog; throughput is gated behind prepayment tiers rather than a flat discount\[5]. ### 3. Together AI: best for open models and fine-tuning Together AI owns its inference rather than reselling, with fine-tuning on top\[6]. * **Features:** 176 open-weighted models, per-token serverless, dedicated GPUs, fine-tuning, and an OpenAI-compatible API\[6]\[7]. * **Pricing:** Per-token, for example Llama 3.3 70B at $0.88 per million, with dedicated H100s at $6.49/hour. No free trial, $5 minimum\[6]. * **Performance:** Strong for open-model chat, vision, and reasoning. * **Best for:** Open-source-first teams that fine-tune. * **Vs CometAPI:** Together runs its own inference and training; CometAPI aggregates closed and open models without training. ### 4. Replicate: best for custom models Replicate hosts the widest catalog and lets you ship your own model\[8]. * **Features:** Thousands of community models, per-second hardware inference, fine-tuning, and Cog packaging\[8]. * **Pricing:** Hardware per-second, for example A100 80GB at $5.04/hour, or per-output like FLUX 1.1 Pro at $0.04/image\[8]. * **Performance:** Flexible, with cost tied to runtime. * **Best for:** Teams that need a niche model or a custom deploy. * **Vs CometAPI:** Replicate is built for custom and community models; CometAPI is a curated commercial catalog. ### 5. reAPI: best for curated media and transparent credits reAPI combines an OpenAI-compatible chat gateway with a separate media gateway, a deeper curated video catalog, and a transparent credit unit at 1 credit = $0.001. * **Features:** 200+ models with deeper video generation (Veo 3.1, Seedance 2.0, Wan 2.7, Kling, HappyHorse 1.0) plus frontier LLMs (GPT-5, Claude Opus 4.8, Gemini) and image models (GPT-Image-2, Gemini 3 Pro Image). Chat is OpenAI-compatible; image and video use a separate media gateway, key, and balance. * **Pricing:** Pay-as-you-go credits at 1 credit = $0.001, with published model-specific rates. GPT-Image-2 starts at $0.0045/image; Seedance 2.0 Mini at 480p costs (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per output second without source video or (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with one, where billed duration is output plus rounded-up total source-video duration; Veo 3.1 Fast starts at (live price: https://reapi.ai/models/veo3-1/llms.txt)/generation. Free credits to start. * **Performance:** Same upstream frontier models; the win is a tighter media catalog and a clear price unit. * **Best for:** Teams that want serious video generation alongside an OpenAI-compatible chat gateway and can keep the two workspace credentials separate. * **Vs CometAPI:** reAPI pairs OpenAI-compatible chat with a separately keyed media gateway and adds a deeper curated video catalog (Veo 3.1, Seedance 2.0, Wan 2.7, Kling) plus an explicit credit unit at 1 credit = $0.001. ## CometAPI vs. the top alternatives at a glance | Platform | Catalog | Modalities | Pricing model | OpenAI-compatible | Best for | | ----------- | ------------------------- | ---------------------------- | ------------------------------ | ----------------- | ------------------------- | | CometAPI | 500+ models | Text, image, video, audio | \~20% below official | Yes | Unified discounted access | | OpenRouter | 400+ across 60+ providers | Text + some multimodal | Pass-through + 5.5% fee | Yes | Pass-through breadth | | WaveSpeed | 1,000+ models | Image, video, audio, 3D, LLM | Pay-per-use, tiered | Yes | Speed-first media | | Together AI | 176 (open focus) | Chat, vision, image, audio | Per-token + dedicated GPU | Yes | Open models + fine-tuning | | Replicate | Thousands (community) | Image, video, some LLMs | Per-second or per-output | No | Custom + community models | | reAPI | 200+ models | Image, video, audio, chat | Published model-specific rates | Yes (chat) | Curated media + LLMs | Catalog and pricing figures are from each vendor's official pages as of May 2026; rates change, so confirm before you commit. ## What the numbers say about pricing CometAPI, OpenRouter, and reAPI are all multi-model platforms, but their gateway designs and pricing differ, and the cheapest one is model-dependent. * **CometAPI** prices a flat 20% or so below each provider's official rate, with no purchase surcharge and credits that do not expire\[1]. * **OpenRouter** passes the provider's exact rate through unchanged, then adds a 5.5% ($0.80 minimum) fee when you buy credits, so a cheap third-party provider can win on open models while the fee eats into small top-ups\[3]. * **reAPI** uses an explicit credit unit, 1 credit = $0.001, with published rates that vary by model and task, plus free starting credits. * **WaveSpeed** is pay-per-use but gates throughput behind prepayment tiers; **Together** is per-token with a $5 minimum\[5]\[6]. The honest read: against CometAPI, the deciding factors are usually catalog fit and media depth, not a few percent of token cost. Compare the specific models you call, not the headline discount. ## Moving from CometAPI to reAPI Because both speak the OpenAI format, switching text calls is a base-URL change, and media moves to reAPI's REST endpoints: ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Rewrite this paragraph for clarity."}], ) ``` Image and video use `https://reapi.ai/api/v1` with a separate media key and balance. Since both are pay-as-you-go, the low-risk move is to run a real workload through each and compare invoices and model coverage before you consolidate. ## FAQ ### Is CometAPI legit? CometAPI is a working unified gateway for 500+ models at below-official pricing\[1]. Its reliability statistics are self-reported rather than independently audited, which is worth noting but common for the category. The reasons to compare CometAPI alternatives are usually catalog fit, media depth, or a preference for pass-through pricing. ### What is the difference between CometAPI and OpenRouter? CometAPI prices each model around 20% below its official rate with no purchase surcharge. OpenRouter passes the provider's exact rate through unchanged, then charges a 5.5% ($0.80 minimum) fee on credit purchases\[1]\[3]. CometAPI is cheaper on models where the official rate is the reference; OpenRouter can be cheaper where a budget third-party provider hosts an open model. ### Which CometAPI alternative is best for video? reAPI and WaveSpeed both carry serious video catalogs. reAPI lists curated models like Veo 3.1, Seedance 2.0, and Wan 2.7 with published model-specific rates; WaveSpeed leans on low-latency generation\[4]. ### Which CometAPI alternative is OpenAI-compatible? OpenRouter, WaveSpeed, Together AI, and reAPI all expose OpenAI-compatible APIs, so you reuse an existing client by changing the base URL\[2]\[5]\[7]. Replicate uses its own predictions API. ### Can I fine-tune models on a CometAPI alternative? Yes. Together AI and Replicate both support fine-tuning, and RunPod or Hugging Face let you train on your own infrastructure\[6]\[8]. CometAPI itself is a hosted-inference gateway rather than a training platform. ## Choosing a CometAPI alternative CometAPI does the unified-gateway job well: one key, 500+ models, a flat discount off official rates. The case for a CometAPI alternative is rarely the headline price and usually the specifics: pass-through transparency, the option to fine-tune, or deeper video generation. OpenRouter wins on provider breadth and pass-through pricing, WaveSpeed on latency, Together AI on open-model training, and Replicate on custom models. If you want OpenAI-compatible chat alongside a separately keyed curated-media gateway with a transparent per-credit cost, reAPI is the CometAPI alternative built for that. Run a real workload through two of them and let coverage and invoices decide. ## Further reading * [reapi.ai/models](/models) — frontier LLMs plus image, video, and audio. * [Claude Opus 4.8](/models/claude-opus-4-8) — frontier reasoning on the OpenAI-compatible gateway. * [Best Together AI alternatives](/blog/best-together-ai-alternatives) — the same comparison for Together AI. ## References 1. CometAPI. *Pricing and platform overview — 500+ models, below-official rates.* Retrieved May 2026 from cometapi.com/pricing 2. OpenRouter. *Models — provider and modality catalog.* Retrieved May 2026 from openrouter.ai/models 3. OpenRouter. *Docs FAQ — pass-through pricing, fees, and free models.* Retrieved May 2026 from openrouter.ai/docs/faq 4. WaveSpeed AI. *Pricing — pay-per-use rates and trial credits.* Retrieved May 2026 from wavespeed.ai/pricing 5. WaveSpeed AI. *Platform overview, performance, and API.* Retrieved May 2026 from wavespeed.ai/about 6. Together AI. *Pricing — serverless tokens, dedicated GPUs, and minimums.* Retrieved May 2026 from together.ai/pricing 7. Together AI. *OpenAI compatibility and model catalog.* Retrieved May 2026 from docs.together.ai/docs/inference/openai-compatibility 8. Replicate. *Pricing — hardware and per-output model rates.* Retrieved May 2026 from replicate.com/pricing --- # Best Compilatio Alternatives in 2026: 5 Tools Compared (https://reapi.ai/blog/best-compilatio-alternatives) Compilatio is a French ed-tech company that has sold plagiarism detection to schools since 2005, and over the last few years it added AI-text detection to the same platform\[1]. If you are weighing **Compilatio alternatives**, you are usually one of two people: an educator who wants a different academic-integrity tool, or a developer who wants the detection itself as an API to build on. Compilatio serves the first well and the second not at all. This guide compares five Compilatio alternatives on what actually separates them: what they detect (plagiarism, AI text, or both), whether you get a dashboard or an API, how far the LMS integration reaches, and language coverage. Four are detection products in their own right. The fifth is reAPI, which we build, and I will be upfront about it: reAPI is not a classroom plagiarism platform, so if you need similarity-matching against a source database with a teacher dashboard, the honest answer is Compilatio, Turnitin, or Copyleaks, not us. Where reAPI fits is the developer who wants AI detection as an API, with a humanizer and an essay generator under the same key. Everything below came from each vendor's own pages, checked in June 2026. ## TL;DR * **Turnitin** is the institutional standard: Similarity Reports against the largest academic database, comparison across 170 languages, and an AI writing indicator, sold to institutions with no public API\[4]\[5]. * **Copyleaks** does what Compilatio does and exposes it: AI detection across 30+ languages and plagiarism across 100+, in one report, behind a white-labeled API\[6]\[7]. * **GPTZero** is education-first AI detection with sentence-level highlighting, a Chrome extension, and the lowest-friction API of the group\[8]\[9]. * **Originality.ai** is built for web publishers and SEO teams: AI detection, plagiarism, and fact-checking in one suite, with an API on its top plan\[10]\[11]. * **reAPI** gives you AI detection as a single API call that returns a 0–100 score, plus a humanizer and an essay generator on the same key. It is a developer toolkit, not a similarity checker and not a classroom product. ## What Compilatio does well, and where it leaves gaps Compilatio's strength is that it covers both halves of academic integrity inside one workflow built for teachers. Where it is strong: * **Plagiarism and AI in one place.** A similarity report lists sources and locates matches in the text; an AI detector flags passages that read as machine-written and gives an AI-likelihood percentage\[1]. * **Built for the classroom.** Magister and Magister+ are for teachers, Studium is for student self-checks, and an institution's own submissions can be cross-compared against each other\[2]. * **Wired into the LMS.** It plugs into Moodle, Canvas, Brightspace, Blackboard, Microsoft Teams, and Open LMS through an identification key issued per instance\[3]. * **European data posture.** A French company with servers in France, ISO 9001 certification, and use across more than 50 countries\[12]. Where teams hit walls: * **AI detection is tiered, not standard.** The base Magister plan does similarity only. AI detection sits on Magister+, Studium, and the Copyright product, so the feature you came for may not be in the plan you have\[2]. * **No self-serve developer API.** The "API" is an institutional integration key for an LMS, not a public endpoint with docs that any developer can sign up for and call\[3]. * **A European-education center of gravity.** The product interface ships in six languages, French, English, German, Spanish, Italian, and Portuguese, and the whole thing is shaped around schools rather than software teams\[12]. * **A product, not a building block.** You operate Compilatio from its dashboard. You cannot drop its detection inside your own app. ## How to evaluate a Compilatio alternative Five questions sort the field quickly: * **What do you need to detect?** Plagiarism against real sources, AI-generated text, or both. * **Dashboard or API?** A log-in-and-upload product, or an endpoint you call from your own code. * **Who actually uses it?** Teachers and students inside an LMS, or your own users inside your own product. * **How many languages?** English only, the main European languages, or a long tail. * **One job or a toolkit?** Detection alone, or detection plus the text tools that sit next to it. ## The best Compilatio alternatives in 2026 ### 1. Turnitin: best for institutional academic integrity at scale Turnitin is the name most universities already run, and the closest match to Compilatio's institutional side\[4]. * **What it does:** Similarity Reports compare a submission against student archives, paid publications, and more than 20 years of web content. A separate AI writing indicator flags text that is likely AI-generated or AI-paraphrased, including work pushed through "bypass" humanizers\[4]. iThenticate handles publishers and researchers on the same engine\[4]. * **Detection scope:** plagiarism and AI writing, with similarity comparison across 170 languages\[4]. Turnitin reports a document-level false-positive rate under 1% on its AI detection, and is careful to say the tool flags text for a human to judge rather than accusing anyone\[5]. * **Best for:** schools, universities, and journals that want one trusted integrity platform wired into their LMS. * **Vs Compilatio:** the same job with a larger database and a wider footprint. Like Compilatio, Turnitin is institutional-only and sold through sales, with no public developer API\[4]. You adopt the platform; you do not build on it. ### 2. Copyleaks: best for combined AI and plagiarism with an API Copyleaks does roughly what Compilatio does, then hands you an API to embed it\[6]\[7]. * **What it does:** AI content detection, which it claims runs over 99% accuracy on its own English testing across 30+ languages against ChatGPT, Gemini, Claude, and others, plus plagiarism detection across 100+ languages, both in a single report\[6]. It also flags AI in images and video\[6]. * **Developer access:** a white-labeled set of APIs, covering AI detection, plagiarism, grammar, and text moderation, with a developer dashboard and documentation\[7]. * **LMS:** Canvas, Moodle, D2L Brightspace, Schoology, Sakai, Edsby, and Blackboard\[6]. * **Best for:** teams that want both detection types and the option to embed them rather than only logging into a dashboard. * **Vs Compilatio:** the same plagiarism-plus-AI coverage, but with a real public API and multimodal detection that Compilatio does not offer. ### 3. GPTZero: best for education-focused AI detection with a low-friction API GPTZero built its name on AI detection for teachers, and made the API easy to try before you commit\[8]. * **What it does:** AI text detection with sentence-level highlights that explain why a passage reads as AI, alongside a plagiarism checker, a grammar checker, and a "Writing Replay" that reconstructs how a document was actually written\[8]. * **Languages:** full support for English, German, Portuguese, French, and Spanish, with use reported across 100+ countries\[8]. * **Developer access:** a public API that takes a POST with an API key and returns a human, mixed, or AI classification with per-sentence detail, plus a Chrome extension and LMS hooks for Canvas and Google Classroom\[8]\[9]. You can run the API straight from the docs without an account for a few calls\[9]. * **Best for:** educators who want classroom-grade AI detection, and developers who want to test a detection API in minutes. * **Vs Compilatio:** stronger and more transparent AI detection with an open API, though its plagiarism side is lighter than Compilatio's source-matching depth. ### 4. Originality.ai: best for web publishers and content teams Originality.ai aims at a different reader than Compilatio. The buyer here is a publisher or an SEO lead, not a teacher\[10]. * **What it does:** a content-integrity suite combining AI detection, plagiarism, fact-checking, readability scoring, and a full-site bulk scan\[10]. It reports 99% accuracy for its Lite model and over 99% for Turbo on recent models, and 97.8% across 30 languages for its multilingual model\[10]. * **Developer access:** an API with scan endpoints and toggles for AI, plagiarism, and fact checks, offered on its top plan\[11]. * **Best for:** agencies and publishers that verify freelance or AI-written content at scale before it goes live. * **Vs Compilatio:** overlapping detection pointed at content operations instead of academic integrity, with fact-checking that Compilatio does not do. ### 5. reAPI: best for AI detection as an API, with a humanizer and essay generator reAPI is a developer platform, not a checker you log into. The caveat first: it does not match text against a plagiarism database, and it has no teacher dashboard or LMS plugin. What it gives you is AI detection as one API call, plus two adjacent text tools on the same key. * **What it does:** the AI text detector scores any text from 0 to 100 for AI authorship and returns per-engine sub-scores, aggregating several detection engines into one result, up to 30,000 words a call. The same key reaches a humanizer that rewrites AI-sounding text to read more human, and an essay generator that drafts from a topic. * **Developer access:** REST endpoints under one base URL and a bearer key, with an async submit-and-poll pattern. Detection, humanization, and essay generation are three calls against the same account. * **Best for:** developers building AI detection, or a writing tool, into their own product, who want an endpoint rather than a dashboard. * **Vs Compilatio:** opposite ends of the same space. Compilatio is a closed institutional product that does plagiarism and AI detection. reAPI is an open API that does AI detection and the text tools around it, with no plagiarism matching and no classroom layer. ## Compilatio vs. the alternatives at a glance | Tool | Plagiarism | AI detection | Public API | LMS integration | Languages | Best for | | -------------- | ---------- | -------------------- | --------------------------- | --------------------------------- | -------------------- | ------------------------------------- | | Compilatio | Yes | Yes (tiered by plan) | No (institutional key only) | Moodle, Canvas, Brightspace, more | UI in 6 | Classroom integrity, Europe | | Turnitin | Yes | Yes | No (sales-led) | Top LMS platforms | 170 (similarity) | Institutional integrity at scale | | Copyleaks | Yes (100+) | Yes (30+) | Yes (white-label) | Canvas, Moodle, Brightspace, more | 100+ | Both types, with embedding | | GPTZero | Lighter | Yes | Yes | Canvas, Google Classroom | 5 full | Education AI detection plus easy API | | Originality.ai | Yes | Yes (30) | Yes (top plan) | None listed | 30 | Publishers and SEO teams | | reAPI | No | Yes (0–100 score) | Yes | No | Multilingual rewrite | Developer detection plus text toolkit | Capability claims are from each vendor's official pages as of June 2026; features change, so confirm before you commit. ## The split that actually decides it Two questions sort this list faster than any feature table. First, do you need plagiarism, AI detection, or both? Compilatio, Turnitin, Copyleaks, and Originality.ai all match text against real sources. GPTZero's plagiarism is lighter, and reAPI does not do source matching at all. If catching copied passages is the point, those two come off the shortlist. Second, do you want to log in or to call an endpoint? Compilatio and Turnitin are platforms you adopt and run from a dashboard, tied into an LMS. Copyleaks, GPTZero, Originality.ai, and reAPI all let you call detection from your own code, which is what you want the moment detection becomes a feature inside your product rather than a task a teacher does by hand. reAPI takes that one step further by putting the humanizer and the essay generator behind the same key, so the AI-text toolkit is one integration instead of three. ## Calling reAPI's detector Because reAPI is an API rather than a dashboard, wiring it in is a single POST and a poll. Submit returns a task id; you poll the task until it completes, and the score comes back as `output.detection.result` on a 0–100 scale. ```python import requests resp = requests.post( "https://reapi.ai/api/v1/detect", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "ai-text-detector", "text": "Paste the passage you want to score for AI authorship here.", }, ) task = resp.json() # poll GET /api/v1/tasks/{id} until status == "completed" ``` The same base URL and key reach `/v1/humanize` to rewrite AI-sounding text and `/v1/essay` to draft from a topic, so a detect-then-rewrite loop is two calls on one account. Since detection bills on the text you submit and nothing else, the low-risk move is to run a real batch through it and see whether the scores match your own read before you build on it. ## FAQ ### Does Compilatio have an API? Not a public, self-serve one. Compilatio exposes an integration key for institutional LMS connections, but there is no developer endpoint with open documentation you can sign up for and call on your own\[3]. If an API is a hard requirement, Copyleaks, GPTZero, Originality.ai, or reAPI are the alternatives that have one\[7]\[9]\[11]. ### Which Compilatio alternative is best for plagiarism? Turnitin and Copyleaks have the deepest source matching, Turnitin across 170 languages against a very large academic database, Copyleaks across 100+ languages\[4]\[6]. If plagiarism is the real need, those two beat the AI-first tools. ### Does Compilatio detect AI text, not just copied text? Yes, on Magister+, Studium, and the Copyright product, where it flags passages likely written by ChatGPT, Gemini, Claude, and similar models\[1]\[2]. The base Magister plan checks similarity only, so AI detection depends on which plan you hold. ### Is reAPI a plagiarism checker? No. reAPI detects AI-generated text and offers a humanizer and an essay generator, but it does not compare your text against a database of sources. For plagiarism, use Compilatio, Turnitin, or Copyleaks. ### Which Compilatio alternative handles non-English text best? Copyleaks covers 100+ languages for plagiarism and 30+ for AI detection, Turnitin compares similarity across 170 languages, and Originality.ai reports 30 languages for its multilingual AI model\[6]\[4]\[10]. GPTZero fully supports five\[8]. ### Can students self-check the way Compilatio Studium allows? GPTZero and Originality.ai both let an individual scan their own writing, and Copyleaks sells individual plans alongside its institutional ones\[8]\[10]. Compilatio's own answer to this is Studium\[2]. ### Which alternative should a developer pick? If you want detection you can embed, GPTZero has the lowest-friction API and Copyleaks the widest API surface\[7]\[9]. reAPI is the pick when you want AI detection plus a humanizer and an essay generator under one key rather than only a detector. ## Picking the right Compilatio alternative Compilatio does a specific job well: plagiarism and AI detection for European schools, run from a teacher's dashboard and wired into an LMS. The case for a Compilatio alternative is almost always one of the specifics. Turnitin if you want the institutional standard at a larger scale, Copyleaks if you want both detection types with an API, GPTZero if you want transparent AI detection that is easy to drop in, and Originality.ai if you are a publisher checking content rather than grading students. If what you actually need is AI detection as an endpoint, with a humanizer and an essay generator on the same key, reAPI is the Compilatio alternative built for developers rather than classrooms, with the honest caveat that it does not match text against sources. Run a real sample through two of them and trust the scores and coverage you can see for yourself. ## Further reading * [reapi.ai/docs/ai-text-detector](/docs/ai-text-detector) scores any text 0–100 for AI authorship. * [reapi.ai/docs/humanize](/docs/humanize) rewrites AI-sounding text to read human. * [reapi.ai/models](/models) lists the full model catalog. ## References 1. Compilatio. *Plagiarism and AI content detection — product overview.* Retrieved June 2026 from [compilatio.net/en](https://www.compilatio.net/en) 2. Compilatio. *Magister, Magister+, and Studium — plans for teachers and students.* Retrieved June 2026 from [compilatio.net/en/magister-plus](https://www.compilatio.net/en/magister-plus) 3. Compilatio. *LMS integration — connecting via an identification key per instance.* Retrieved June 2026 from [compilatio.net/en/lms-integration](https://www.compilatio.net/en/lms-integration) 4. Turnitin. *AI writing detection and Similarity products.* Retrieved June 2026 from [turnitin.com/solutions/topics/ai-writing](https://www.turnitin.com/solutions/topics/ai-writing/) 5. Turnitin. *Understanding false positives in AI writing detection.* Retrieved June 2026 from [turnitin.com/blog](https://www.turnitin.com/blog/understanding-false-positives-within-our-ai-writing-detection-capabilities) 6. Copyleaks. *AI content detector — accuracy, languages, and plagiarism.* Retrieved June 2026 from [copyleaks.com/ai-content-detector](https://copyleaks.com/ai-content-detector) 7. Copyleaks. *APIs — AI detection, plagiarism, grammar, and moderation.* Retrieved June 2026 from [copyleaks.com/api](https://copyleaks.com/api) 8. GPTZero. *AI detector — features, languages, and integrations.* Retrieved June 2026 from [gptzero.me](https://gptzero.me/) 9. GPTZero. *Developers — API reference and quickstart.* Retrieved June 2026 from [gptzero.me/developers](https://gptzero.me/developers) 10. Originality.ai. *Content integrity suite — AI detection, plagiarism, and fact-checking.* Retrieved June 2026 from [originality.ai](https://originality.ai/) 11. Originality.ai. *API v2 documentation.* Retrieved June 2026 from [docs.originality.ai/api-v2-0-new](https://docs.originality.ai/api-v2-0-new) 12. Compilatio. *Who we are — company, certification, and reach.* Retrieved June 2026 from [compilatio.net/en/who-are-we](https://www.compilatio.net/en/who-are-we) --- # Best Content Moderation API: Text, Image and Video Compared (https://reapi.ai/blog/best-content-moderation-api) The best content moderation API depends less on accuracy claims than on four plain facts: which media it reads, which categories it reports, how it bills, and whether you can run it yourself. OpenAI's `omni-moderation-latest` is free and reads text and images\[1]\[2], but it scores only 6 of its 13 categories on images and does not classify audio\[2]. Amazon Rekognition moderates video by the minute\[3]. Mistral publishes open weights for a multimodal moderation model\[4]. Those differences decide the pick more often than any benchmark. This comparison covers eleven options, each checked against the vendor's own documentation and pricing pages in October 2026. It sticks to what each API covers and how it bills. For the actual per-item prices and a worked cost example, see [Is OpenAI moderation API free?](/blog/is-openai-moderation-api-free). ## TL;DR * **Text and images on a budget:** OpenAI's moderation endpoint, free for OpenAI API users, 13 categories\[1]\[2]. * **Text with PII and jailbreak detection:** Mistral Moderation 2, listed as free, 11 text categories\[5]\[6]. * **Video:** Amazon Rekognition (stored and streaming video, billed per minute) or Sightengine (video on paid plans, live streams on Pro)\[3]\[7]. * **Fine-grained image labels:** Rekognition's three-level taxonomy with 10 top-level categories, or Sightengine's 120+ image classes\[8]\[7]. * **Self-hosting:** Mistral's Shieldstral 1.0 (Apache 2.0 weights, public preview) or Azure's disconnected containers on a commitment plan\[4]\[9]. * **Avoid for new builds:** Perspective API, which stops serving after December 31, 2026\[10]. ## What separates one content moderation API from another Most moderation APIs return the same kind of answer: a set of categories with a score or severity each. The differences that matter in production are elsewhere. **Modality.** Text-only APIs cannot help with uploaded photos, and image APIs do not read captions. Video is rarer still: of the options below, only Amazon Rekognition, Sightengine and Hive list video moderation, and Hive enables it through a contact form\[3]\[7]\[11]. **Category design.** OpenAI returns 13 harm categories as booleans plus 0 to 1 scores\[2]. Azure returns four categories (hate, sexual, violence, self-harm) with a severity level from 0 to 7 for text and 0, 2, 4 or 6 for images\[12]. Google Natural Language returns 16 attributes, several of them sensitive topics rather than harms, such as Health, Finance, Politics and Legal\[13]. Pick the design that matches how your policy is written. **Billing unit.** Vendors count characters, text records, requests, images, minutes or "operations", and the unit changes which inputs are cheap. A 50-character comment is one request at Hive but is billed as 300 characters at Amazon Comprehend\[11]\[14]. The [pricing comparison](/blog/is-openai-moderation-api-free) explains each unit. **Where it runs.** Every hosted API sends your users' content to a third party. If that is not acceptable, the shortlist is the options with downloadable weights or containers. ## Best content moderation API comparison table | API | Text | Image | Video | Categories | Billing unit | Free usage | Self-host | | --------------------------------------- | ------------ | ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | OpenAI `omni-moderation-latest` | Yes | Yes (6 of 13 categories) | Not listed | 13 harm categories, score 0 to 1\[2] | None (free) | Free, within rate limits\[1] | No | | Azure AI Content Safety | Yes | Yes | Not listed | 4 categories, severity 0 to 7\[12] | Text record (1,000 characters), image | 5,000 text records + 5,000 images per month\[9] | Disconnected containers, annual commitment\[9] | | Amazon Rekognition | No | Yes | Yes | 3-level taxonomy, 10 top-level\[8] | Image, video minute | 1,000 images + 60 video minutes per month for 12 months\[3] | No | | Amazon Comprehend toxicity | English only | No | Not listed | 7 labels\[15] | 100 characters, 3-unit minimum | Not on free-tier list\[14] | No | | Google Cloud Vision SafeSearch | No | Yes | Not listed | 5 likelihoods: adult, spoof, medical, violence, racy\[16] | Image | 1,000 units per month\[17] | No | | Google Natural Language Text Moderation | Yes | No | Not listed | 16 attributes, confidence 0 to 1\[13] | 100 characters | 50,000 units per month\[18] | No | | Hive | Yes | Yes | Via contact form | Not listed on pricing page | Request; audio per minute | $50+ credits after adding a payment method\[11] | No | | Sightengine | Yes | Yes (120+ classes) | Yes; live streams on Pro | 120+ image classes\[7] | Operation | 2,000 operations per month\[7] | No | | Mistral Moderation 2 | Yes | No | Not listed | 11, incl. PII and jailbreaking\[6] | None (free) | Listed as free\[5] | No | | Mistral Shieldstral 1.0 | Yes | Yes | Not listed | Your own yes/no policy questions\[4] | Your hardware | Open weights | Yes, Apache 2.0 | | reAPI Content Moderation | Yes | Yes (image URLs) | No | Same 13 as `omni-moderation-latest`\[19] | 1,000 words of text or 1 image | Paid | No | Audio is a separate need. OpenAI's model does not classify it\[2]; Hive prices audio moderation per minute and Sightengine includes it on the Pro plan\[11]\[7]. ## Picking the best content moderation API by use case ### Chat, comments and LLM prompts For text in a chat app, a comment section or an LLM pipeline, start with a free option. OpenAI's endpoint covers harassment, hate, illicit, self-harm, sexual and violence families with sub-categories\[2], and the Responses API can return moderation scores for a model's input and output in the same call\[2]. Mistral Moderation 2 adds categories OpenAI does not have: PII, jailbreaking, and requests for tailored health, financial or legal advice\[6]. If your concern is prompt injection or users fishing for personal data, that list fits better. Choose Azure when you want graded severity instead of a probability, or need to define custom categories (in preview)\[12]\[20]. Azure's Content Safety models are trained and tested on eight languages and may work in others at varying quality\[20]. Amazon Comprehend's toxicity detection is English only\[15]. ### User-uploaded images General-purpose models are thinner on images. OpenAI applies only the self-harm, sexual and violence families to an image; harassment, hate and illicit are text only\[2]. Azure covers its four categories on images\[12]. When your policy names things like swimwear, alcohol, gambling, drugs, rude gestures or hate symbols, use an image specialist. Rekognition has those as top-level categories\[8], and Sightengine lists more than 120 image classes\[7]. Our [image moderation API guide](/blog/image-moderation-api) goes deeper on image inputs, thresholds and code. ### Video and live streams Rekognition analyzes stored video from Amazon S3 and streaming video events, billed per minute processed\[3]. Sightengine handles video files up to 50 MB on Starter and up to 500 MB plus live streams on Pro\[7]. Hive extracts frames at a sampling rate you set, after you enable video through its contact form\[11]. ### Data that cannot leave your infrastructure Mistral's Shieldstral 1.0 is a 3.8B-parameter model released under Apache 2.0 that classifies text and image inputs against natural-language policy questions, with a 32k-token context. It is in public preview\[4]. Azure sells Content Safety as disconnected containers on annual commitment tiers sized in hundreds of millions of records\[9], which suits large enterprises rather than small teams. ### Already on Perspective API Jigsaw is sunsetting Perspective. The service stays active until December 31, 2026, new usage and quota requests were accepted only until February 2026, and there is no migration support\[10]. Plan the move now. If you want toxicity-style attributes, Google Natural Language Text Moderation returns Toxic, Insult and Profanity among its 16\[13]. ### Moderation next to generation on reAPI If you already generate images, video or text through reAPI, Content Moderation runs `omni-moderation-latest` on the same key, credit balance and task contract. It is async: submit to `/api/v1/moderations`, then poll the task\[21]. That differs from OpenAI's synchronous response, so it is not a drop-in for OpenAI SDK integrations. It is billed per moderation unit; the current rate is on the [model page](/models/content-moderation)\[19]. ## Is OpenAI moderation API good enough? The question comes straight from developer forums, and the answer is "for many text workloads, yes". It is free, covers 13 categories and accepts batches of strings\[1]\[2]. Its limits are documented, so you can check them against your case: * Seven categories ignore images, so an image-heavy platform gets partial coverage\[2]. * It does not classify audio, and OpenAI documents text and image input only\[2]. * OpenAI upgrades the model over time, and thresholds built on `category_scores` "may need recalibration"\[2]. * It is not designed for CSAM detection; OpenAI says not to send such material to it\[2]. * Throughput is capped by usage tier, starting at 5,000 requests per day on the Free tier\[22]. If none of those rules it out, it is the default. If one does, the table above shows which API covers the gap. ## FAQ ### Is OpenAI moderation API good enough? For text moderation inside its 13 categories, often yes, and it costs nothing\[1]. It falls short when you need audio or video, image checks beyond the self-harm, sexual and violence families, or categories such as PII and jailbreaking\[2]\[6]. ### Azure content moderation api Azure's current product is Azure AI Content Safety, with separate Analyze Text and Analyze Image APIs that score hate, sexual, violence and self-harm with severity levels\[20]\[12]. It also offers Prompt Shields, protected material detection and custom categories\[20]. The free tier covers 5,000 text records and 5,000 images per month\[9]. ### Content moderation api google Google splits moderation across two APIs: Cloud Vision SafeSearch for images, with five likelihood categories\[16], and Cloud Natural Language Text Moderation for text, with 16 attributes\[13]. Both have monthly free allowances\[17]\[18]. ### Amazon rekognition content moderation api Rekognition moderates images through `DetectModerationLabels` and also moderates stored and streaming video\[3]. Labels follow a three-level taxonomy with 10 top-level categories, from Explicit and Violence to Gambling and Hate Symbols\[8]. For text on AWS, Amazon Comprehend's toxicity detection is the separate, English-only option\[15]. ### Moderation api mistral Mistral offers `mistral-moderation-2603` (Mistral Moderation 2) on `/v1/moderations`, with a 128k context and a free listed price\[5]. It classifies text across 11 categories including PII and jailbreaking\[6]. Its open-weight sibling, Shieldstral 1.0, also reads images\[4]. ### Video moderation api Amazon Rekognition, Sightengine and Hive list video moderation; the OpenAI, Azure Content Safety, Google and Mistral moderation APIs in this comparison document text or image input only\[3]\[7]\[11]. With a text-and-image API you can sample frames yourself and send them as images, which is how Hive describes its own video processing\[11]. ### Best image moderation api For broad image policies with labels like alcohol, gambling or hate symbols, Rekognition or Sightengine\[8]\[7]. For sexual, violence and self-harm only, OpenAI's free endpoint covers images too\[2]. See the [image moderation API guide](/blog/image-moderation-api) for details. ### Open source moderation api Mistral's Shieldstral 1.0 is published with Apache 2.0 weights and handles text and images; it is in public preview\[4]. If you need Azure's models on your own infrastructure instead, Azure sells Content Safety as disconnected containers on annual commitment tiers\[9]. ## Choosing the best content moderation API for your stack Start from the media you have to check. Text-only products can begin with OpenAI's free endpoint or Mistral Moderation 2 and move to Azure when they need severity levels or custom categories. Image-heavy products should look at Rekognition or Sightengine for label depth, and anything with video narrows to Rekognition, Sightengine or Hive. If content may not leave your servers, Shieldstral's open weights are the realistic route. Price usually decides between the survivors, and the [moderation API pricing comparison](/blog/is-openai-moderation-api-free) has the numbers. If you want `omni-moderation-latest` on the same async contract as your other reAPI models, see the [Content Moderation model page](/models/content-moderation). Either way, the best content moderation API is the one whose categories match the policy you actually enforce. ## References 1. OpenAI. *Is the Moderation endpoint free to use?* Retrieved October 2026 from [help.openai.com/en/articles/4936833-is-the-moderation-endpoint-free-to-use](https://help.openai.com/en/articles/4936833-is-the-moderation-endpoint-free-to-use) 2. OpenAI. *Moderation guide.* Retrieved October 2026 from [developers.openai.com/api/docs/guides/moderation](https://developers.openai.com/api/docs/guides/moderation) 3. Amazon Web Services. *Amazon Rekognition pricing.* Retrieved October 2026 from [aws.amazon.com/rekognition/pricing](https://aws.amazon.com/rekognition/pricing/) 4. Mistral AI. *Shieldstral 1.0 model card.* Retrieved October 2026 from [docs.mistral.ai/models/shieldstral-1-0](https://docs.mistral.ai/models/shieldstral-1-0) 5. Mistral AI. *Mistral Moderation 2 model card.* Retrieved October 2026 from [docs.mistral.ai/models/mistral-moderation-26-03](https://docs.mistral.ai/models/mistral-moderation-26-03) 6. Mistral AI. *Moderation and guardrailing.* Retrieved October 2026 from [docs.mistral.ai/studio/conversations/moderation](https://docs.mistral.ai/studio/conversations/moderation) 7. Sightengine. *Pricing.* Retrieved October 2026 from [sightengine.com/pricing](https://sightengine.com/pricing) 8. Amazon Web Services. *Using the image and video moderation APIs, Amazon Rekognition Developer Guide.* Retrieved October 2026 from [docs.aws.amazon.com/rekognition/latest/dg/moderation-api.html](https://docs.aws.amazon.com/rekognition/latest/dg/moderation-api.html) 9. Microsoft Azure. *Content Safety pricing.* Retrieved October 2026 from [azure.microsoft.com/en-us/pricing/details/content-safety](https://azure.microsoft.com/en-us/pricing/details/content-safety/) 10. Jigsaw. *Perspective API sunset announcement.* Retrieved October 2026 from [perspectiveapi.com](https://perspectiveapi.com/) 11. Hive. *Pricing.* Retrieved October 2026 from [thehive.ai/pricing](https://thehive.ai/pricing) 12. Microsoft Learn. *Harm categories in Azure AI Content Safety.* Retrieved October 2026 from [learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/harm-categories](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/harm-categories) 13. Google Cloud. *Moderate text, Cloud Natural Language API.* Retrieved October 2026 from [docs.cloud.google.com/natural-language/docs/moderating-text](https://docs.cloud.google.com/natural-language/docs/moderating-text) 14. Amazon Web Services. *Amazon Comprehend pricing.* Retrieved October 2026 from [aws.amazon.com/comprehend/pricing](https://aws.amazon.com/comprehend/pricing/) 15. Amazon Web Services. *Trust and safety, Amazon Comprehend Developer Guide.* Retrieved October 2026 from [docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html](https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html) 16. Google Cloud. *Detect explicit content (SafeSearch).* Retrieved October 2026 from [docs.cloud.google.com/vision/docs/detecting-safe-search](https://docs.cloud.google.com/vision/docs/detecting-safe-search) 17. Google Cloud. *Cloud Vision API pricing.* Retrieved October 2026 from [cloud.google.com/vision/pricing](https://cloud.google.com/vision/pricing) 18. Google Cloud. *Cloud Natural Language pricing.* Retrieved October 2026 from [cloud.google.com/natural-language/pricing](https://cloud.google.com/natural-language/pricing) 19. reAPI. *Content Moderation model page.* [reapi.ai/models/content-moderation](/models/content-moderation) 20. Microsoft Learn. *What is Azure AI Content Safety?* Retrieved October 2026 from [learn.microsoft.com/en-us/azure/ai-services/content-safety/overview](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/overview) 21. reAPI. *Content Moderation API docs.* [reapi.ai/docs/content-moderation](/docs/content-moderation) 22. OpenAI. *omni-moderation model page.* Retrieved October 2026 from [developers.openai.com/api/docs/models/omni-moderation-latest](https://developers.openai.com/api/docs/models/omni-moderation-latest) --- # Best fal.ai Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-fal-ai-alternatives) fal.ai built its reputation on speed. Its serverless platform runs 1,000+ generative media models for image, video, audio, and 3D, and it returns results fast enough that teams ship real-time features on top of it\[2]. But raw inference speed is not the only thing that decides a stack. Most teams shopping for **fal.ai alternatives** in 2026 want one of a few things fal.ai does not hand them: a platform that also covers text and reasoning models, more predictable per-call pricing, a free balance to test with, or a drop-in that speaks the OpenAI format their code already uses. This guide compares five fal.ai alternatives on the things that actually move a decision: model range, pricing model, integration effort, and where each one beats fal.ai. Four are independent platforms. The fifth is reAPI, which we build. Every price and capability below was pulled from each vendor's own pricing page or docs on May 30, 2026. ## TL;DR * **fal.ai** is the media speed leader: 1,000+ models, output-based pricing (for example Veo 3 at $0.4/second, FLUX Kontext Pro at $0.04/image), prepaid credits, no OpenAI-compatible endpoint\[1]\[2]. * **Replicate** wins on breadth: thousands of community models, per-second hardware billing (A100 80GB at $5.04/hour) plus per-output models, and Cog for custom deploys\[3]. * **Together AI** is the open-LLM pick: 176 models, per-token serverless, and a real OpenAI-compatible API, but no free trial and a $5 minimum\[5]\[6]. * **RunPod** and **Hugging Face** are infrastructure, not managed media APIs: you rent GPUs (RunPod H100 from $1.99/hour) or deploy Hub models on dedicated instances (Hugging Face A100 at $2.50/hour)\[7]\[8]. * **reAPI** spans 200+ image, video, audio, and chat models through separate media and chat gateways, each with its own key and balance. Chat is OpenAI-compatible. As of October 2026, Seedance 2.0 Mini at 480p starts at (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with a source video, while Veo 3.1 Fast starts at (live price: https://reapi.ai/models/veo3-1/llms.txt) per generation. ## What fal.ai does well, and where it leaves gaps fal.ai is a generative media specialist, and it is good at it. The platform is tuned for diffusion and video workloads, and the docs lead with reliability numbers rather than marketing copy. Where it is strong: * **Model depth in media.** 1,000+ optimized endpoints across image, video, audio, music, speech, and 3D\[2]. * **Speed and uptime.** fal.ai bills itself as the fastest inference for generative media and cites 99.99% historical uptime\[2]. * **Pay only for successful output.** Server errors and queue time are not billed; you pay per image, per megapixel, or per second of video\[1]. * **SDKs in five languages.** JavaScript, Python, Swift, Kotlin/Java, and Dart, with a queue API, webhooks, streaming, and WebSockets\[2]. Where teams hit walls: * **It stops at media.** There is no frontier LLM layer. If your app mixes generation with chat, reasoning, or coding models, fal.ai is half the stack. * **No OpenAI-compatible endpoint.** fal.ai uses its own SDKs and `fal-ai/` paths, so existing OpenAI code does not drop in\[2]. * **Prepaid only.** fal.ai runs a prepaid credit model with no documented free trial, so you fund the account before the first call\[2]. * **Per-output cost adds up.** Output pricing is clean until volume climbs; at scale a high-throughput consumer app can pay more than it would on hourly compute. ## How to evaluate a fal.ai alternative Five questions sort the field fast: * **Catalog scope.** Media only, or access to text and media through clearly separated interfaces? * **Pricing model.** Per-output, per-token, per-second compute, or hourly hardware. Each one favors a different workload shape. * **API compatibility.** Does it speak the OpenAI format, or do you rewrite your client? * **Billing entry.** Is there a free balance, or a prepaid minimum before you can test? * **Managed vs. raw.** A ready model API, or GPUs you deploy to yourself. ## The best fal.ai alternatives in 2026 ### 1. Replicate: best for community models and custom deploys Replicate hosts thousands of community-contributed models plus proprietary ones, which makes it the widest catalog of the group\[3]. * **Features:** Per-second hardware inference, per-output models, fine-tuning, webhooks, and Cog for packaging your own models. SDKs for Python, Node, Go, and Swift\[3]\[4]. * **Pricing:** Two modes. Hardware per-second, for example Nvidia A100 80GB at $5.04/hour, H100 at $5.49/hour, T4 at $0.81/hour. Or per-output, for example FLUX 1.1 Pro at $0.04/image and Wan 2.1 i2v 720p at $0.25/second of video\[3]. * **Performance:** Reliable and flexible, but fal.ai is generally faster on its curated media models. * **Best for:** Teams that need variety beyond media, want to deploy a custom model, or experiment with community research models. * **Vs fal.ai:** Replicate wins on selection and custom deploys; fal.ai wins on raw speed for popular media models. ### 2. Together AI: best for open-source LLM inference Together AI is the open-model pick. Its catalog lists 176 models, weighted toward open LLMs with image, vision, audio, and code alongside\[6]. * **Features:** Per-token serverless, dedicated GPU endpoints, fine-tuning (LoRA, full, vision-language), and a genuinely OpenAI-compatible API at `https://api.together.ai/v1`\[6]. * **Pricing:** Per-token, for example Llama 3.3 70B at $0.88 per million tokens in and out, and gpt-oss-20B at $0.05 in / $0.20 out. Dedicated H100 runs $6.49/hour. FLUX images start around $0.0027/megapixel\[5]. * **Performance:** Strong for text and multimodal LLM workloads with research-backed inference tuning. * **Best for:** Open-source-first stacks that lean on chat, vision, and reasoning more than pure media. * **Vs fal.ai:** Together AI is better for LLM-heavy apps and OpenAI compatibility; fal.ai is better for media speed. Note Together has no free trial and requires a $5 minimum to start\[6]. ### 3. RunPod: best for raw GPU control and price RunPod rents GPUs by the second with minimal abstraction. It is the cheapest path if you want to run your own containers\[7]. * **Features:** On-demand GPU pods, serverless workers that scale to zero, 30+ regions, and bring-your-own-container deploys. A separate Public Endpoints line offers some pre-deployed models\[7]. * **Pricing:** Per-second, with no ingress or egress fees. H100 PCIe from $1.99/hour, A100 80GB from $1.19/hour, RTX 4090 from $0.34/hour. Serverless H100 PRO runs $0.00116/second\[7]. * **Performance:** Full control means you can squeeze custom optimizations, but you own the setup. * **Best for:** Cost-sensitive teams comfortable packaging and operating their own model containers. * **Vs fal.ai:** RunPod is cheaper for infrastructure-heavy work; fal.ai is a managed API you call, not a server you run. They solve different problems. ### 4. Hugging Face Inference Endpoints: best for dedicated Hub deploys Hugging Face lets you deploy any model from its Hub onto dedicated, autoscaling instances billed by the minute\[8]. * **Features:** Dedicated and autoscaling instances with scale-to-zero, plus a separate serverless Inference Providers route that passes through provider cost directly\[8]\[9]. * **Pricing:** Dedicated endpoints start at $0.033/hour for CPU; GPU runs T4 at $0.50/hour, L4 at $0.80/hour, A100 80GB at $2.50/hour. Billing is per-minute even though rates are quoted hourly\[8]. * **Performance:** Solid for steady traffic. Scale-to-zero saves money but reintroduces a cold start when an idle endpoint wakes\[8]. * **Best for:** Researchers and teams that want Hub integration plus dedicated infrastructure they control. * **Vs fal.ai:** More model choice and control; fal.ai is faster out of the box for its curated media set with no instance to manage. ### 5. reAPI: best for media and LLM access reAPI gives you access to 200+ models spanning image, video, audio, and chat without separate upstream-provider accounts. Chat and media use different reAPI workspaces, keys, and balances, with published rates that vary by model and task. * **Features:** Curated frontier media models (Veo 3.1, Seedance 2.0, Wan 2.7, Kling, HappyHorse 1.0, Imagen 4, Seedream 5.0, GPT-Image-2, Gemini 3 Pro Image) alongside frontier LLMs (GPT-5, Claude Opus 4.8, Gemini). Chat is OpenAI-compatible; image and video use the separate media REST gateway, key, and balance. * **Pricing:** Pay-as-you-go credits at 1 credit = $0.001, no subscription and no prepaid minimum. Real listed rates: GPT-Image-2 from $0.0045/image, Seedance 2.0 Mini from (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with source video, and Veo 3.1 Fast from (live price: https://reapi.ai/models/veo3-1/llms.txt)/generation. New accounts start with free credits. * **Performance:** Same upstream frontier models, so generation quality matches the source; the win is consolidation, not a different engine. * **Best for:** Teams that want media generation and LLM access from one platform and can keep the two workspace credentials separate. * **Vs fal.ai:** reAPI covers both media and text where fal.ai stops at media, adds an OpenAI-compatible path, and gives you a free balance to start instead of prepaid-only credits. ## fal.ai vs. the top alternatives at a glance | Platform | Catalog | Modalities | Pricing model | OpenAI-compatible | Best for | | ------------ | --------------------- | -------------------------- | --------------------------------- | ----------------- | ---------------------------------- | | fal.ai | 1,000+ media models | Image, video, audio, 3D | Per-output + prepaid credits | No | Pure media speed | | Replicate | Thousands (community) | Image, video, some LLMs | Per-second hardware or per-output | No | Community + custom models | | Together AI | 176 models | Chat, vision, image, audio | Per-token + dedicated GPU/hour | Yes | Open-source LLMs | | RunPod | Bring your own | Anything you deploy | Per-second GPU + serverless | Partial | Raw GPU control | | Hugging Face | Hub models | Anything you deploy | Per-minute instance | No | Dedicated Hub deploys | | reAPI | 200+ models | Image, video, audio, chat | Pay-as-you-go credits | Yes (chat) | Separate chat and media workspaces | Catalog and pricing figures are from each vendor's official pages as of May 2026; rates change, so confirm current numbers before you commit. ## What the numbers say about pricing The platforms do not price the same way, which is why a flat "cheaper" claim is usually noise. Match the pricing model to your workload instead. * **fal.ai** charges per output: roughly $0.05 to $0.4 per second for video and around $0.025 to $0.04 per image, with GPU compute as a fallback (H100 at $1.89/hour)\[1]. Clean for bursty media, but it scales linearly with volume. * **Replicate** is hardware per-second for most models, so an idle-free batch job is cheap and a slow cold model is not\[3]. * **Together AI** is per-token, which is ideal for chat and useless as a comparison point for a 5-second video\[5]. * **RunPod** and **Hugging Face** bill for compute time, not output, so utilization is the whole game; an under-loaded endpoint burns money while it waits\[7]\[8]. * **reAPI** lists flat per-output media rates and has no prepaid minimum. Media renders use the media balance; Claude and GPT-5 calls use the separate chat balance. The honest summary: fal.ai is competitive for pure media, and reAPI's edge is access to media and text without separate upstream-provider accounts, although its chat and media balances remain separate. ## Moving from fal.ai to reAPI reAPI does not replace fal.ai's engine; it consolidates how you buy and call models. Three things change for a team coming from fal.ai. First, the LLM layer arrives. Chat, reasoning, and coding models sit next to your image and video calls instead of in a second vendor account. Second, media billing uses pay-as-you-go credits at 1 credit = $0.001, with free credits to start and no $5 floor before the first request. Chat is billed from its separate workspace balance. Third, text calls are a drop-in for OpenAI code. Point the base URL at reAPI and reuse your existing client: ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Summarize this release."}], ) ``` Image and video use `https://reapi.ai/api/v1` with a separate media key and balance, so a hybrid setup is normal early on: keep fal.ai where its latency matters, route everything else through reAPI, and collapse to one provider once the numbers line up. ## FAQ ### Is fal.ai still worth using in 2026? Yes, for pure generative media where its low-latency engine is the point. The reason to add a fal.ai alternative is scope: text and media from one platform, free credits to test with, or OpenAI-compatible chat. On reAPI, chat uses an OpenAI-compatible gateway while media uses a separate REST/task gateway, and each has its own key and balance. fal.ai gives you none of those, by design\[2]. ### Which fal.ai alternative is cheapest? It depends on the workload. RunPod is cheapest for raw GPU time, Together AI for open LLM tokens, and per-output media pricing on fal.ai or reAPI is cheapest when utilization on a rented GPU would be low\[5]\[7]. Pick the pricing model that matches your traffic before you compare headline rates. ### Does any fal.ai alternative support both image, video, and LLMs? reAPI and Replicate both span media and language models. reAPI adds an OpenAI-compatible chat gateway plus a separate media workspace; Replicate keeps everything per-model on community infrastructure\[3]. ### Is reAPI a drop-in replacement for fal.ai? For text, yes: change the base URL and key and your OpenAI client works. For media, you call reAPI's REST image and video endpoints rather than `fal-ai/` paths, so the calls are similar in shape but not identical, which is why hybrid setups are common during migration. ### Which fal.ai alternatives have a free tier? Hugging Face gives free serverless inference credits ($0.10/month free, $2/month on PRO), and reAPI starts new accounts with free credits\[9]. fal.ai, Together AI, and Replicate are prepaid; Together requires a $5 minimum\[6]. ### Do RunPod and Hugging Face compete with fal.ai directly? Not really. fal.ai is a managed model API you call; RunPod rents raw GPUs and Hugging Face Endpoints deploys Hub models onto instances you scale yourself\[7]\[8]. They are alternatives only if you are willing to operate infrastructure. ## Choosing a fal.ai alternative fal.ai is still excellent at the one thing it set out to do: fast generative media. The case for a fal.ai alternative is almost never speed, and almost always scope or cost structure. If you operate your own infrastructure, RunPod and Hugging Face are cheaper per GPU-hour. If you live in open LLMs, Together AI fits. If you want image, video, audio, and frontier LLMs from one platform, with an OpenAI-compatible chat path and a separate media workspace, reAPI is the fal.ai alternative built for that shape. Test two of them with small pilots and let your own traffic pick the winner. ## Further reading * [reapi.ai/models](/models) — browse image, video, audio, and chat models across both gateways. * [What is reAPI?](/blog/what-is-reapi) — quickstart, pricing, and how the API works. * [Best Replicate alternatives](/blog/best-replicate-alternatives) — the same comparison for Replicate. ## References 1. fal.ai. *Pricing — per-model rates for image and video.* Retrieved May 2026 from fal.ai/pricing 2. fal.ai. *Documentation — platform overview, model APIs, and SDKs.* Retrieved May 2026 from fal.ai/docs 3. Replicate. *Pricing — hardware and per-output model rates.* Retrieved May 2026 from replicate.com/pricing 4. Replicate. *Billing and client libraries.* Retrieved May 2026 from replicate.com/docs/topics/billing 5. Together AI. *Pricing — serverless tokens, dedicated GPUs, and image models.* Retrieved May 2026 from together.ai/pricing 6. Together AI. *OpenAI compatibility and model catalog.* Retrieved May 2026 from docs.together.ai/docs/inference/openai-compatibility 7. RunPod. *Pricing — GPU cloud and serverless rates.* Retrieved May 2026 from runpod.io/pricing 8. Hugging Face. *Pricing — Inference Endpoints instance rates.* Retrieved May 2026 from [huggingface.co/pricing](https://huggingface.co/pricing) 9. Hugging Face. *Inference Providers pricing and free credits.* Retrieved May 2026 from [huggingface.co/docs/inference-providers/pricing](https://huggingface.co/docs/inference-providers/pricing) --- # Best Higgsfield Alternatives for AI Video Creators and APIs (https://reapi.ai/blog/best-higgsfield-alternatives-ai-video) **reAPI is the best Higgsfield alternative for a SaaS team that wants to put selected image and video models behind its own product interface. Atlas Cloud is stronger when maximum catalog breadth or GPU infrastructure is the requirement; Krea is closer to Higgsfield's hands-on creator workflow; Dreamina is the official route to monitor for Seedance rollout.** Higgsfield bundles models with creator tools, subscriptions, and promotional workflows. No alternative replaces all three layers equally. This guide compares platforms by the job they perform instead of pretending that six different billing models are interchangeable. ## TL;DR * **reAPI:** best for SaaS and product teams that want one account, pay-as-you-go credits, live model pages, and a consistent asynchronous media workflow. * **Atlas Cloud:** best API-first alternative when a broad catalog and GPU infrastructure are the deciding requirements. * **fal:** best for serverless developer access with explicit model-level prices. * **Replicate:** best for familiar client libraries, model pages, examples, and rapid prototyping. * **Krea:** best for creators who want a visual workspace and subscription compute instead of raw endpoints. * **Dreamina:** best official ByteDance creator surface to monitor for Seedance 2.5 rollout. ## Best Higgsfield alternatives compared ![A platform map comparing Atlas Cloud, reAPI, fal, Replicate, Krea, and Dreamina by studio versus API and subscription versus pay-as-you-go](https://cdn.reapi.ai/media/blog/best-higgsfield-alternatives-ai-video/best-higgsfield-alternatives-ai-video-platform-map.png) | Platform | Primary user | Interface | Billing shape | Seedance status | | ----------- | -------------------------- | ---------------------- | ------------------------ | ---------------------------------- | | reAPI | Product developers | Unified API | Pay as you go | 2.0 available | | Atlas Cloud | Developer teams | APIs and model catalog | Pay as you go | 2.0 live; 2.5 early-access page | | fal | AI application developers | Serverless APIs | Model-level usage | 2.0 available | | Replicate | Developers and prototypers | Hosted models and SDKs | Per-output usage | 2.0 available | | Krea | Designers and creators | Browser workspace | Subscription compute | 2.0 listed; 2.5 marked soon | | Dreamina | Consumer creators | Browser editor | Product/region dependent | Official 2.5 page says coming soon | This article is published by reAPI, which operates one of the compared gateways. The recommendations use public product pages and state that relationship so you can weigh the comparison appropriately. ## Why creators look for a Higgsfield alternative Higgsfield is compelling because it connects generation with creator-facing features such as reusable identity, camera-oriented presets, advertising formats, and a model picker. It packages those tools into subscription tiers and credits, with exact offers varying by plan, promotion, and region.\[1] That package becomes a mismatch when you need one of four things: 1. an API instead of a visual interface; 2. metered usage instead of monthly credits; 3. a particular model that is not in the current picker; 4. a neutral backend that can switch providers without rebuilding the product. The correct alternative depends on which mismatch you are solving. ## 1. reAPI: best for a SaaS product reAPI provides asynchronous media jobs and live model pages across a curated multi-model catalog. A product team can reuse one credential, credit balance, task status pattern, and error model while keeping the selected model configurable. Choose reAPI when you are building a SaaS product rather than producing clips manually. It does not replace Higgsfield's creator presets or visual project workspace. It replaces the model-integration layer beneath your own interface, with callable options such as [Seedance 2.0](/models/seedance-2-0) and [MiniMax H3](/models/minimax-h3) available now. Because reAPI publishes this article, confirm current availability and pricing on each [live model page](/models) and compare the exact workload with direct providers before committing volume. ## 2. Atlas Cloud: best for catalog breadth and infrastructure Atlas Cloud markets a catalog of more than 400 models behind one account and pay-as-you-go access. It documents an asynchronous Seedance 2.0 image-to-video endpoint and combines its model catalog with broader GPU and infrastructure services.\[2] Its Seedance 2.5 page is an early-access promise, not proof of a callable 2.5 endpoint. Developers can use Atlas Cloud for Seedance 2.0 now and join the 2.5 cohort, but should not hard-code a speculative model identifier. Choose Atlas Cloud when API breadth or GPU infrastructure matters more than a focused product integration. Choose Higgsfield when a creator needs a polished web studio. The direct [Atlas Cloud vs Higgsfield vs reAPI comparison](/blog/atlas-cloud-vs-higgsfield) covers those operational differences. ## 3. fal: best for serverless model endpoints fal exposes individual generative models through hosted endpoints and publishes model-specific prices. Its Seedance 2.0 page, for example, gives separate per-second rates for output mode and resolution, which makes small workload estimates direct.\[3] fal fits developers who want a broad inference platform and are comfortable integrating each model's schema. It is less comparable to Higgsfield for nontechnical creators because the value sits in infrastructure rather than a guided production studio. If provider depth is the deciding issue, read the [best fal alternatives](/blog/best-fal-ai-alternatives) before selecting a gateway. ## 4. Replicate: best for rapid prototypes and documented models Replicate pairs hosted models with web demos, API examples, client libraries, and observable version pages. Its official Seedance 2.0 listing exposes the model as an API and bills by generated output.\[4] Choose Replicate when a developer wants to test a model from a browser and move quickly into code. For high-volume production, compare cold starts, version behavior, support, and actual output cost rather than using public run counts as a quality score. Our [Replicate alternatives guide](/blog/best-replicate-alternatives) goes deeper on provider choice. ## 5. Krea: best visual workspace alternative Krea is the most direct option in this list for creators who still want a browser-based environment. It combines image and video tools, a model catalog, and subscription compute units. Its models page currently lists Seedance 2.0 while marking Seedance 2.5 as “Soon.”\[5] Choose Krea when visual iteration and access to multiple creative tools matter more than raw API control. Subscription compute is not directly comparable to Higgsfield credits: resolution, model, and mode can consume allowances differently. Test the exact workflow before comparing headline monthly prices. ## 6. Dreamina: best official ByteDance creator route Dreamina is relevant because it is ByteDance's creator-facing product, not because it currently guarantees Seedance 2.5 to every account. Its official 2.5 page says “coming soon,” and the access guide tells users to sign in and check account-level rollout.\[6] Choose Dreamina when official Seedance access is the main objective and API automation is not required. Choose Higgsfield or Krea when the surrounding creator workflow matters more than first-party model provenance. ## Higgsfield alternative by use case | If you need… | Start with… | Why | | ---------------------------------- | ----------- | ---------------------------------------------------------- | | A normalized backend for your SaaS | reAPI | Consistent task and billing surface across selected models | | A visual multi-model studio | Krea | Closest creator-first working style | | A broad video API catalog | Atlas Cloud | API-first model discovery and usage billing | | Transparent endpoint-level prices | fal | Public per-model pricing | | Quick browser-to-code prototyping | Replicate | Demo, examples, and SDK path | | Official Seedance creator rollout | Dreamina | ByteDance-owned consumer surface | | Character and marketing presets | Higgsfield | Staying may be better than switching | The last row is important. An alternatives article should not manufacture a reason to migrate. If Higgsfield's studio saves more editing time than another platform saves in generation cost, it remains the better tool. ## How to compare the real cost A $29 subscription and a $0.30-per-second endpoint are different purchasing units. Use one monthly workload: * number of final clips; * average duration and resolution; * average rerenders per accepted clip; * creator time spent outside the generator; * storage, moderation, and delivery costs; * unused subscription credits at month end. Calculate cost per accepted deliverable, not cost per attempted generation. A more expensive model that halves rerolls can be cheaper. A polished studio that removes two manual tools can outperform the lowest endpoint price. ## FAQ ### What is the best free Higgsfield alternative? Free allowances change frequently. Krea and some developer platforms may offer trial capacity, but free tiers usually have queues, watermarks, model limits, or noncommercial restrictions. Verify the current plan before publishing client work. ### Is Atlas Cloud better than Higgsfield? Atlas Cloud is better for API-first applications and metered multi-model access. Higgsfield is better for creators who want a visual studio, presets, and subscription workflow. ### Which Higgsfield alternative supports Seedance? Atlas Cloud, reAPI, fal, and Replicate expose Seedance 2.0. Krea lists 2.0 in its creator catalog. Dreamina is the official consumer route to monitor for 2.5 rollout. ### Does Higgsfield have Seedance 2.5? Higgsfield now has a Seedance 2.5 coming-soon notification page, but that is not a callable model or a published price. See the current [Seedance 2.5 on Higgsfield status](/blog/seedance-2-5-on-higgsfield). ### Which alternative is best for a SaaS product? Start with [reAPI's live model catalog](/models) when you want a focused multi-model backend and one asynchronous media workflow. Choose Atlas Cloud instead when maximum breadth or GPU infrastructure is a hard requirement, fal for a specific optimized endpoint, or Replicate for community-model breadth and rapid prototyping. ## Choose the layer first Higgsfield is a creator studio. reAPI, Atlas Cloud, fal, and Replicate are primarily developer infrastructure. Krea is a creator workspace, and Dreamina is an official model surface. Decide which layer you need before comparing prices; otherwise the cheapest option may require you to rebuild the feature that made Higgsfield useful. If the missing layer is an API beneath your own product, start with a real prompt set on [reAPI](/models), then keep only the provider that performs best on accepted-output cost. ## References 1. Higgsfield. *AI pricing and plans.* Retrieved August 2, 2026. geo.higgsfield.ai 2. Atlas Cloud. *Seedance 2.0 image-to-video API and model catalog.* Retrieved August 2, 2026. atlascloud.ai 3. fal. *ByteDance Seedance 2.0 text-to-video API.* Retrieved August 2, 2026. fal.ai 4. Replicate. *ByteDance Seedance 2.0 API.* Retrieved August 2, 2026. replicate.com 5. Krea. *AI model catalog and pricing.* Retrieved August 2, 2026. krea.ai 6. Dreamina. *Seedance 2.5 generator and access guide.* Retrieved August 2, 2026. [dreamina.capcut.com](https://dreamina.capcut.com/seedance/seedance-2-5) ### Further reading * reAPI. *Atlas Cloud vs Higgsfield.* [reapi.ai/blog/atlas-cloud-vs-higgsfield](/blog/atlas-cloud-vs-higgsfield) * reAPI. *Best Seedance 2.5 alternatives.* [reapi.ai/blog/best-seedance-2-5-alternatives](/blog/best-seedance-2-5-alternatives) * reAPI. *Seedance 2.5 release status.* [reapi.ai/blog/seedance-2-5-release-status](/blog/seedance-2-5-release-status) --- # Best Open-Source AI Video Models for Local GPUs (2026) (https://reapi.ai/blog/best-open-source-ai-video-models-local-gpu-2026) **Wan 2.2 TI2V-5B is the best all-round local AI video model for a 24GB GPU. HunyuanVideo-1.5 is the stronger starting point at 14–16GB, while CogVideoX1.5-5B is the most realistic experiment below that. Mochi 1 remains interesting for its Apache-2.0 license and hackable pipeline, but its memory use and 480p output make it a specialist choice rather than the default.** That answer comes with an important caveat: a published minimum VRAM number usually assumes CPU offloading, tiling, lower precision, or all three. It tells you that a workflow can fit. It does not tell you that the workflow will be fast enough to use every day. This comparison uses the projects' official model cards and repositories, checked on July 30, 2026. The term “open-source AI video model” is used because that is how people search for these models. “Open-weight” is often more precise, especially when a model uses a custom community license. ## Best local AI video models at a glance | Model | Published local VRAM path | Video output | License | Best fit | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------- | --------------------------------------------------- | | Wan 2.2 TI2V-5B | At least 24GB with CPU offloading\[1] | 720p-class, 24fps; text-to-video and image-to-video | Apache-2.0 | Best balance for a single 24GB workstation | | HunyuanVideo-1.5 | 14GB minimum with model offloading\[2] | 480p/720p T2V and I2V, plus a super-resolution path | Tencent Hunyuan Community License | Best documented option for a 14–16GB CUDA GPU | | CogVideoX1.5-5B | Diffusers BF16 from 10GB; INT8 from 7GB\[3] | 1360×768, 5 or 10 seconds | CogVideoX License | Low-VRAM testing when slow generation is acceptable | | Mochi 1 preview | 22GB for the lower-precision Diffusers example; about 60GB for the reference single-GPU repository\[4] | Initial release targets 480p text-to-video | Apache-2.0 | Research, LoRA work, and permissive licensing | These rows are not benchmark-equivalent. CogVideoX's smallest figure uses a different precision and memory strategy from Wan's documented 24GB command. Mochi's 22GB example explicitly accepts a small quality drop. Treat the numbers as deployment routes, not as a quality ranking. ## What your GPU can realistically run ### 8GB VRAM: a technical test, not a comfortable workstation CogVideoX1.5-5B is the only model in this group whose publisher documents an INT8 Diffusers path starting around 7GB. The same model card warns that quantization and sequential CPU offload reduce speed. Its low-memory testing was performed on A100/H100 hardware, although the authors say the approach should generally work on NVIDIA Ampere or newer cards\[3]. An 8GB card may therefore prove that the model runs, but it leaves little room for the display, decoder, longer clips, or another process. Expect dependency tuning and a large system-RAM footprint. For regular production, a hosted job or a larger GPU is usually less frustrating. ### 10–12GB VRAM: CogVideoX becomes usable for patient experiments CogVideoX1.5-5B's optimized BF16 Diffusers path starts around 10GB. This is a better first test than INT8 if the card can hold it. The trade-off is time: the publisher's own 50-step results for a five-second clip are measured in hundreds of seconds even on an H100, and longer on an A100\[3]. Those are not consumer-GPU predictions, but they make the bottleneck clear. CogVideoX also expects English prompts. Teams accepting prompts in other languages need a translation or prompt-rewriting step before inference. ### 14–16GB VRAM: HunyuanVideo-1.5 is the practical step up Tencent publishes a 14GB minimum with model offloading enabled. The official source path targets Linux, Python 3.10 or newer, and an NVIDIA CUDA GPU\[2]. That is a much firmer starting point than an unofficial community claim that a large video model “works on 12GB.” HunyuanVideo-1.5 supports text-to-video and image-to-video checkpoints at 480p and 720p. Its separate super-resolution model can upscale video to 1080p. That last step is extra work; it should not be described as native 1080p generation. The main constraint is legal rather than technical. The Tencent Hunyuan Community License excludes use in the European Union, United Kingdom, and South Korea, includes use restrictions, and requires a separate license for certain products above its stated user threshold\[5]. Read the current license before choosing it for a commercial service. ### 24GB VRAM: the useful local-video tier This is where local generation stops feeling like a memory stunt. Wan 2.2 TI2V-5B has an official single-GPU command for a 24GB RTX 4090-class card. It supports text-to-video and image-to-video in one 5B pipeline and outputs 720p-class video at 24fps\[1]. Wan's model card says the 5B model can generate a five-second 720p video in under nine minutes on a single consumer GPU without special optimization. That is useful for previews and batch work, but it is not interactive editing. Queue design still matters. Mochi 1 can also fit this tier through its 22GB BF16 Diffusers example. Genmo notes a slight quality reduction for that path. With only a small amount of spare VRAM, another application or a different frame count can push the job out of memory\[4]. Choose Mochi here for its research value and license, not because it is the safest 24GB deployment. ### 48–80GB VRAM: fewer compromises, not automatic throughput Mochi's higher-quality Diffusers example requires 42GB, while its reference repository describes about 60GB for single-GPU operation and recommends an H100\[4]. More memory can also reduce offloading for the other models or support more than one worker. It does not remove the compute cost of diffusion. Before buying a larger card, benchmark the number of accepted clips per hour, not the number of prompts submitted. ## Wan 2.2: best overall for a 24GB GPU Wan 2.2 TI2V-5B has the cleanest combination of local practicality and output capability in this group: * official weights and inference code; * a documented single-24GB-GPU path; * text-to-video and image-to-video in the same model; * 720p-class output at 24fps; * an Apache-2.0 license. Be precise about the model name. Wan 2.2 also has larger A14B checkpoints. A tutorial showing TI2V-5B on a 4090 does not prove the larger variants fit the same hardware. Download size, inference arguments, and memory requirements differ. Wan is the sensible first benchmark for an independent creator, research team, or studio with one 4090. Its weakness is latency. A single machine can render a useful batch overnight; it is less convincing as the backend for a product that promises immediate results. ## HunyuanVideo-1.5: best at 14–16GB HunyuanVideo-1.5 packages an 8.3B video model around a surprisingly accessible official minimum. It is the strongest candidate here when the machine cannot reach 24GB but still needs both text-to-video and image-to-video. Its model family is more complicated than one download. Tencent lists separate 480p and 720p checkpoints, distilled variants, and super-resolution weights. Decide which path the product actually needs before provisioning storage or building a container. This model is also the clearest example of why “open” and “permissive” are different questions. The weights and training code are available, but the community license has territory, attribution, distribution, and acceptable-use conditions. Apache-2.0 assumptions do not carry over. ## CogVideoX1.5-5B: best low-VRAM experiment CogVideoX1.5-5B wins the fitting contest. The official table documents 10GB BF16 and 7GB INT8 Diffusers configurations, compared with 76GB for its BF16 SAT route\[3]. That spread shows how much the software path changes the hardware answer. Choose CogVideoX when: * the available GPU has 8–12GB; * generation can run in the background; * prompts can be normalized to English; * the team is comfortable pinning CUDA, PyTorch, Diffusers, and quantization dependencies. Do not choose it solely because “7GB” looks efficient. The INT8 path trades speed for memory, and the model's 5- or 10-second output remains expensive to sample repeatedly. A 12GB installation that completes reliably can be more useful than an 8GB configuration operating at its limit. CogVideoX uses its own license. Review that text for the planned distribution and commercial use instead of treating “downloadable on Hugging Face” as a legal conclusion\[6]. ## Mochi 1: best for permissive research work Mochi 1 is a 10B text-to-video research preview released under Apache-2.0. Genmo publishes the weights, inference code, a programmable pipeline, and a LoRA trainer. That makes it a good base for teams that care about modifying the stack rather than simply producing the highest-resolution clip. Its limitations are unusually well documented. The initial checkpoint targets 480p, is tuned toward photorealism, can show warping under extreme motion, and performs less well on animated styles\[7]. The reference implementation also wants about 60GB of VRAM on one GPU. Diffusers lowers that to 22GB in BF16, but with a stated quality trade-off. Mochi makes sense on a research workstation or multi-GPU server. It is harder to justify for a creator buying a single card specifically for finished 720p output. ## “Runs locally” has four different meanings Model comparisons often collapse four milestones into one: 1. **The process starts.** The weights load with quantization and offloading. 2. **One sample completes.** A short, low-batch job avoids an out-of-memory error. 3. **The workflow is repeatable.** Ten jobs finish without memory fragmentation, driver crashes, or manual cleanup. 4. **The system is useful.** Throughput, accepted-output rate, and operating effort beat the available alternative. Only the fourth milestone supports a production decision. CPU offloading shifts pressure into system RAM and PCIe transfers. Quantization can reduce memory while making inference slower. VAE tiling saves memory but changes the execution profile. A desktop GPU also loses part of its capacity to the display and other applications. Closed hosted models are a separate category: an API or ComfyUI node may expose a familiar model name while all inference happens remotely. For a concrete example of that distinction, see the explanation of [whether Seedance can run locally](/blog/can-you-run-seedance-locally). ## A fair local benchmark takes one afternoon Do not begin with a large prompt library. Use five prompts that expose different failure modes: * a locked camera with one moving subject; * two people interacting; * fast lateral motion; * image-to-video with a face or product that must stay consistent; * a scene containing text, hands, or repeated geometry. Run every model at the resolution, duration, and memory settings you would actually ship. Record: | Metric | Why it matters | | ------------------------------- | ------------------------------------------------------------- | | Peak VRAM | Reveals whether the workflow survives alongside real services | | Peak system RAM | Shows the hidden cost of CPU offloading | | Cold-start time | Matters for serverless workers and restarted queues | | Seconds per clip | Determines capacity, but not quality | | Accepted clips per ten attempts | Captures motion, identity, and prompt failures | | Watt-hours per accepted clip | Makes local operating cost comparable | | Manual interventions | Exposes a brittle pipeline before production | Keep seeds and prompts fixed. If one model needs a prompt rewrite, save that rewrite as part of its pipeline rather than quietly giving it a better prompt during evaluation. ## Before deploying an open-weight video model The checkpoint is only one component. A dependable local service also needs: * enough NVMe space for weights, caches, inputs, and rendered frames; * pinned versions for the NVIDIA driver, CUDA, PyTorch, and attention libraries; * a worker that frees GPU memory after failed jobs; * request limits for duration, resolution, frame count, and batch size; * output moderation and a policy for uploaded faces or copyrighted assets; * model and license notices carried into the product where required; * reproducible benchmark prompts for upgrades. Video diffusion failures are expensive because they arrive late. A worker may spend minutes before returning an out-of-memory error or an unusable clip. Validate inputs and reserve memory before the job enters the generation queue. ## FAQ ### What is the best open-source AI video model for 12GB VRAM? CogVideoX1.5-5B is the clearest documented choice. Its official model card lists an optimized BF16 Diffusers path from 10GB and an INT8 path from 7GB. Both rely on memory-saving techniques and may be slow. ### What is the best local video model for an RTX 4090? Wan 2.2 TI2V-5B is the best starting point in this comparison. The publisher documents a 24GB single-GPU setup, 720p-class output at 24fps, and support for both text-to-video and image-to-video. ### Can HunyuanVideo-1.5 run on 16GB VRAM? Yes, according to Tencent's published 14GB minimum with model offloading. The official setup targets Linux and an NVIDIA CUDA GPU. Available system RAM and storage speed still affect the experience. ### Is Mochi 1 practical on a 24GB GPU? It can fit using the official 22GB BF16 Diffusers example, which notes a slight quality drop. Its reference implementation needs much more memory, and the initial model targets 480p, so Wan 2.2 is usually the more practical 24GB choice. ### Can I use these models commercially? The answer depends on the model. Wan 2.2 TI2V-5B and Mochi 1 use Apache-2.0. HunyuanVideo-1.5 uses Tencent's community license, and CogVideoX1.5 uses the CogVideoX License. Review the current license, acceptable-use rules, territory, and distribution terms for the exact checkpoint. This article is a technical comparison, not legal advice. ### Does minimum VRAM predict generation speed? No. The smallest configurations usually save memory through CPU offloading, tiling, or quantization, all of which can reduce speed. Measure wall-clock time and accepted outputs on the target machine. ## References 1. Wan-AI. *Wan2.2-TI2V-5B model card and official repository.* Weights, Apache-2.0 license, 720p output, 24GB command, and performance guidance. Retrieved July 30, 2026 from [huggingface.co/Wan-AI/Wan2.2-TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B) and [github.com/Wan-Video/Wan2.2](https://github.com/Wan-Video/Wan2.2) 2. Tencent. *HunyuanVideo-1.5 model card.* Official 14GB minimum, system requirements, checkpoints, and output paths. Retrieved July 30, 2026 from [huggingface.co/tencent/HunyuanVideo-1.5](https://huggingface.co/tencent/HunyuanVideo-1.5) 3. Z.ai. *CogVideoX1.5-5B model card.* Diffusers and SAT memory figures, quantization trade-offs, duration, and resolution. Retrieved July 30, 2026 from [huggingface.co/zai-org/CogVideoX1.5-5B](https://huggingface.co/zai-org/CogVideoX1.5-5B) 4. Genmo. *Mochi 1 preview model card.* Diffusers memory examples and lower-precision trade-off. Retrieved July 30, 2026 from [huggingface.co/genmo/mochi-1-preview](https://huggingface.co/genmo/mochi-1-preview) 5. Tencent. *Tencent Hunyuan Community License Agreement.* Territory, distribution, commercial, and use terms. Retrieved July 30, 2026 from [HunyuanVideo-1.5 LICENSE](https://huggingface.co/tencent/HunyuanVideo-1.5/blob/main/LICENSE) 6. Z.ai. *CogVideoX License.* License linked from the official model card. Retrieved July 30, 2026 from [CogVideoX1.5-5B LICENSE](https://huggingface.co/zai-org/CogVideoX1.5-5B/blob/main/LICENSE) 7. Genmo. *Mochi repository.* Hardware guidance, Apache-2.0 license, architecture, and documented limitations. Retrieved July 30, 2026 from [github.com/genmoai/mochi](https://github.com/genmoai/mochi) --- # Best Replicate Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-replicate-alternatives) Replicate lists thousands of models behind one API and prices them two entirely different ways. Community models bill per second of the hardware they run on, up to $5.49 an hour for an H100. Official models carry flat per-output rates instead, like Seedance 2.0 at $0.18 per second of finished video\[1]\[10]. Which of the two you land on decides whether you can quote a price before you make the call. That split is why most searches for **Replicate alternatives** are really two different searches wearing the same words. One group is stuck on the hardware meter and wants a number it can put in a budget. The other needs a model Replicate does not carry, or a tier it caps, and would pay more to get it. Those wants point at different platforms, and a list that ignores the difference sends half its readers to the wrong one. So this guide sorts five alternatives along that line: what each one costs, what it refuses to do, and which of the two problems it actually solves. Four are independent platforms. The fifth is reAPI, which we build, and I have flagged where it loses. If you are comparing the managed-media side specifically, [our fal.ai comparison](/blog/best-fal-ai-alternatives) covers that field in more depth. Replicate's figures were re-read from its own model and pricing pages on August 21, 2026; the other platforms' date from May 30, 2026. reAPI's rates render live from the same source that bills the call. ## TL;DR * **Replicate** has the widest catalog (thousands of models). Community models bill per second of the hardware they run on, for example Nvidia A100 80GB at $5.04/hour, which makes per-call cost hard to forecast; its official models carry flat per-output rates instead, such as Seedance 2.5 at $0.2312 per second of output video at 720p\[1]\[10]. * **fal.ai** is faster and fully managed for media, with output pricing (Veo 3 at $0.4/second, FLUX Kontext Pro at $0.04/image) and no hardware to think about\[3]. * **Together AI** brings a real OpenAI-compatible API and per-token LLM pricing, but no free trial and a $5 minimum\[6]. * **RunPod** is cheaper raw GPU time (H100 from $1.99/hour) and **Hugging Face** deploys Hub models on per-minute instances, both for teams that operate their own serving\[7]\[8]. * **reAPI** spans 200+ media and LLM models through separate media and chat gateways, each with its own key and balance. ## What Replicate does well, and where it leaves gaps Replicate's pitch is range. Thousands of community models plus proprietary ones, more added daily, and Cog to package your own and ship it as an API\[1]. On the official models the meter is flat and honest: FLUX 1.1 Pro at $0.04 an image, Seedance 2.0 at $0.18 per second of 720p video, and a failed run costs nothing\[1]\[2]\[10]. The walls are on the other pricing path. Community models and custom Cog deploys bill by runtime, so a cold or slow model quietly costs more and there is no fixed per-call price to quote\[1]. Official video models hide a second surprise: the video-in variant is priced as its own tier while still metering output seconds only, so Seedance 2.5 at 720p jumps from $0.2312 to $0.9676 per output second, 4.2x for the same finished duration, the moment a request carries a reference clip\[10]. Smaller frictions stack up behind those two. There is no OpenAI-compatible endpoint, so existing OpenAI code will not drop in. Community quality runs from production-ready to abandoned. Prepaid credit expires after a year, and private deployments bill for active instance time even when a run fails\[2]. ## How to evaluate a Replicate alternative Sort candidates by which of the two problems they solve. If forecastable cost is the problem, the only question that matters is whether a platform publishes a billing unit before the call, and whether it does so across its whole catalog or just an official slice. If catalog is the problem, ask instead whether you need to deploy your own model or only call hosted ones, since that single answer eliminates most of the field. Two secondary filters break ties: whether the API takes an OpenAI client as-is, and whether one account also reaches frontier language models. Every Replicate alternative below is strong on one of these axes and weak on another, which is why the list does not have a winner. ## The best Replicate alternatives in 2026 ### 1. fal.ai: best for media speed fal.ai gave up breadth and bought latency with the difference. It runs roughly 1,000 optimized endpoints against Replicate's thousands, all of them image, video, audio or 3D, reachable through a queue API with webhooks, streaming and SDKs in five languages\[4]. Nothing on the platform bills by the hour. Veo 3 is $0.4 per second, Kling 2.5 Turbo Pro $0.07 per second, FLUX Kontext Pro $0.04 per image, and prepaid credits only move when output succeeds\[3]. The company claims the fastest generative-media inference in the market and publishes a 99.99% uptime figure\[4]. The trade cuts both ways. You cannot ship your own model here, so a custom Cog build has nowhere to land, and the catalog will never match Replicate's long tail. What you get back is that no request ever waits on a cold GPU you are still paying for. As a Replicate alternative it fits when the workload is media-heavy and latency is what users notice. ### 2. Together AI: best for open-source LLMs Together AI is the pick when the workload is language rather than pixels. Its 176 models lean open-source, served per token or on dedicated GPU endpoints, with fine-tuning and a genuinely OpenAI-compatible API at `https://api.together.ai/v1` that takes an existing client and a changed base URL\[6]. Llama 3.3 70B runs $0.88 per million tokens in and out; gpt-oss-20B is $0.05 in and $0.20 out; a dedicated H100 is $6.49 an hour\[5]. Token pricing is the right meter for chat and the wrong one for a single render, which is the whole reason this platform and Replicate rarely compete for the same request. Two frictions worth knowing before you sign up: there is no free trial, and the minimum is $5\[6]. ### 3. RunPod: best for raw GPU price RunPod is the same meter as Replicate's community models with the markup taken out. An H100 PCIe starts at $1.99 an hour against Replicate's $5.49, an A100 80GB at $1.19 against $5.04, and an RTX 4090 at $0.34, all billed per second with no egress fees\[1]\[7]. You get on-demand pods, serverless workers that scale to zero, 30-plus regions, and your own container instead of a Cog build\[7]. The gap between $1.99 and $5.49 is what Replicate charges to not make you an infrastructure team. RunPod is the cheapest Replicate alternative on paper and often the most expensive in staff time, because someone now owns images, autoscaling and cold starts. Run that comparison against a salary, not against the hourly rate. ### 4. Hugging Face Inference Endpoints: best for dedicated Hub deploys If your models already live on the Hub, this is the shortest path to serving them. Inference Endpoints put any Hub model on a dedicated autoscaling instance billed by the minute: CPU from $0.033 an hour, T4 at $0.50, L4 at $0.80, A100 80GB at $2.50\[8]. There is also a serverless Inference Providers route that passes provider cost straight through\[9]. Scale-to-zero is the catch. An idle endpoint costs nothing and then makes the next user wait for a cold start, so it suits steady traffic far better than spiky traffic\[8]. Both this and Replicate deploy custom models; the difference is which ecosystem you are already standing in. ### 5. reAPI: best for predictable pricing across media and LLMs reAPI is the one we build, so read this section with that in mind. It carries 200-odd curated models rather than a long tail: Veo 3.1, Seedance 2.0 and 2.5, Wan 2.7, Kling, HappyHorse 1.0, Imagen 4, Seedream 5.0, GPT-Image-2 and Gemini 3 Pro Image on the media side, GPT-5, Claude Opus 4.8 and Gemini on the chat side. Chat is OpenAI-compatible and takes an existing client. Image and video go through a separate REST gateway with its own key and balance, which is one more thing to set up than a single-key platform asks for. Every media model publishes its own unit up front. GPT-Image-2 at 1K is (live price: https://reapi.ai/models/gpt-image-2/llms.txt) per image. Seedance 2.0 Mini at 480p is (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per output second, or (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second once a source video is attached, where billed duration means output plus the rounded-up source clip. Veo 3.1 Fast is (live price: https://reapi.ai/models/veo3-1/llms.txt) per generation at 720p and 1080p. Credits are pay-as-you-go at 1 credit = $0.001, there is no subscription, and a failed generation refunds automatically. Where it loses to Replicate: no custom model deploys, no Cog equivalent, and a catalog roughly two orders of magnitude smaller. If the model you need is an obscure community fine-tune, this platform simply does not have it and will not get it for you. Where it wins is narrower and more boring. Every rate is published before the call, across the whole catalog rather than an official slice of it, and the same account covers frontier language models. ## Replicate vs. the top alternatives at a glance | Platform | Catalog | Modalities | Pricing model | OpenAI-compatible | Best for | | ------------ | --------------------- | -------------------------- | -------------------------------------------------------- | ----------------- | ---------------------------------- | | Replicate | Thousands (community) | Image, video, some LLMs | Per-second hardware (community) or per-output (official) | No | Custom + community models | | fal.ai | 1,000+ media models | Image, video, audio, 3D | Per-output + prepaid credits | No | Media speed | | Together AI | 176 models | Chat, vision, image, audio | Per-token + dedicated GPU/hour | Yes | Open-source LLMs | | RunPod | Bring your own | Anything you deploy | Per-second GPU + serverless | Partial | Raw GPU price | | Hugging Face | Hub models | Anything you deploy | Per-minute instance | No | Dedicated Hub deploys | | reAPI | 200+ models | Image, video, audio, chat | Pay-as-you-go credits | Yes (chat) | Separate chat and media workspaces | Catalog figures are from each vendor's official pages; Replicate's rates were re-read on August 21, 2026 and the other platforms' in May 2026. Rates change, so confirm before you commit. ## What the numbers say about pricing Four meters are in play across these six platforms, and they are not comparable to each other. Replicate charges community models per second of hardware, from CPU at $0.09 an hour to H100 at $5.49, and official models per output unit\[1]. fal.ai and reAPI publish model-specific rates instead of renting you runtime\[3]. Together AI counts tokens, which is right for chat and meaningless for a single render\[5]. RunPod and Hugging Face bill compute time, so a busy endpoint is efficient and an idle one burns money\[7]\[8]. Comparing them on price alone therefore produces nonsense unless you fix the workload first. The one place a clean rate-for-rate comparison exists is where two catalogs carry the identical model, which is what the next section does. ### Where the catalogs overlap: Seedance Seedance is the one place a Replicate alternative can be judged rate-for-rate instead of meter-for-meter, because both platforms carry ByteDance's line at the same tiers. Figures are USD per second of output video at 720p, text-to-video, with Replicate's read from its model pages on August 21, 2026 and reAPI's rendered from the same source that bills the call\[10]. | Tier at 720p | Replicate | reAPI | | ----------------- | --------- | ---------------------------------------------------------------------------- | | Seedance 2.5 | $0.2312 | (live price: https://reapi.ai/models/seedance-2-5/llms.txt) | | Seedance 2.0 | $0.1800 | (live price: https://reapi.ai/models/seedance-2-0/llms.txt) | | Seedance 2.0 Fast | $0.1500 | (live price: https://reapi.ai/models/seedance-2-0-fast/llms.txt) | | Seedance 2.0 Mini | $0.0900 | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) | Replicate is cheaper on 2.5; reAPI is cheaper on the other three. Two things decide which row applies to you. The first is resolution. Replicate caps Seedance 2.5 at 720p, because its `resolution` input accepts 480p and 720p and nothing above\[10]. The 1080p tier that reAPI runs at (live price: https://reapi.ai/models/seedance-2-5/llms.txt) per second has no Replicate equivalent, so the cheaper column ends where the model's top tier begins. The second is how each platform meters a reference video, and the two go opposite directions. Replicate prices a video-in request as a separate tier while still counting output seconds only: Seedance 2.5 at 720p goes from $0.2312 to $0.9676 per output second\[10]. reAPI drops the per-second rate to (live price: https://reapi.ai/models/seedance-2-5/llms.txt) instead, then counts input seconds plus output seconds. Feed an eight-second clip into a five-second 2.5 render and Replicate bills five seconds for $4.84 while reAPI bills thirteen for $2.08. On Seedance 2.0 that flips, because Replicate's video-in premium there is 22% rather than 4.2x: past a reference clip of roughly seven seconds, Replicate is the cheaper meter. Trim the reference clip before you switch platforms over it. ## Moving from Replicate to reAPI Two things change for a team making this particular switch. Cost becomes quotable across the whole catalog rather than an official slice of it, because a flat per-output rate means a GPT-Image-2 render at 1K is (live price: https://reapi.ai/models/gpt-image-2/llms.txt) whether the GPU was warm or cold. And text and media arrive from one account while still using separate workspaces, keys and balances, so chat drops into existing OpenAI code: ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="gpt-5", messages=[{"role": "user", "content": "Draft the changelog entry."}], ) ``` Image and video use `https://reapi.ai/api/v1` with a separate media key and balance. If you depend on a specific community model or a custom Cog deploy, keep that on Replicate and route the rest through reAPI. ## FAQ ### Why look for a Replicate alternative? Usually cost forecasting. On the per-second hardware path you cannot quote a per-call price before you make the call\[1]. The other common triggers are the missing OpenAI-compatible endpoint and community model quality that varies model to model. A Replicate alternative fits when you need a published rate or a vetted set rather than the widest catalog. ### Which Replicate alternative is cheapest? It depends on the workload. RunPod is cheapest for raw GPU time, Together AI for open LLM tokens, and the published model-specific rates on fal.ai or reAPI can be cheaper when a rented GPU would sit underused\[5]\[7]. ### Does Replicate charge for failed runs? For official models, no, a failed run is not billed. But private models and deployments are billed for active instance time even when a run fails or is canceled\[2]. ### Is there an OpenAI-compatible Replicate alternative? Yes. Together AI exposes an OpenAI-compatible API at `api.together.ai/v1`, and reAPI is OpenAI-compatible for chat\[6]. Both let you reuse an existing OpenAI client by changing the base URL. ### Which Replicate alternative is best for video? fal.ai for managed low-latency media, and reAPI if you want published model-specific video rates alongside LLMs\[3]. RunPod is cheaper only if you run the video model on your own container. On the Seedance line specifically, reAPI is cheaper than Replicate on 2.0, 2.0 Fast and 2.0 Mini, and Replicate is cheaper on 2.5 up to its 720p ceiling. ### How much does Seedance cost on Replicate? Per second of output video, read from Replicate's model pages on August 21, 2026: Seedance 2.5 is $0.1028 at 480p and $0.2312 at 720p; Seedance 2.0 is $0.08, $0.18, $0.45 and $1.00 at 480p, 720p, 1080p and 4K; Seedance 2.0 Fast is $0.07 and $0.15 at 480p and 720p; Seedance 2.0 Mini is $0.04 and $0.09 at the same two tiers\[10]. A request carrying a reference video moves to a separate, higher tier that still meters output seconds only, topping out at $0.9676 per second for 2.5 at 720p. ### Does Replicate run Seedance 2.5 at 1080p? No. Replicate's Seedance 2.5 accepts 480p and 720p only\[10]. For 1080p output from that model you need a platform that exposes the tier, such as reAPI at (live price: https://reapi.ai/models/seedance-2-5/llms.txt) per second. ### Can I deploy my own custom model on a Replicate alternative? Yes. Hugging Face Inference Endpoints deploy any Hub model on dedicated instances, and RunPod runs your own containers\[7]\[8]. Neither needs Replicate's Cog format. ## Choosing a Replicate alternative Replicate is still the catalog king, and the right call when you need an obscure community model or a custom Cog deploy. The case for a Replicate alternative is usually predictability or scope: a fixed price per call, an OpenAI-compatible chat path, or access to both media and frontier LLMs. RunPod and Hugging Face win on raw infrastructure cost, fal.ai on managed media speed, Together AI on open LLMs, and reAPI on flat media pricing plus a separately keyed language-model gateway. The right Replicate alternative is the one whose pricing model matches your traffic, so pilot two and let real usage decide. ## Further reading * [reapi.ai/models](/models) — the full curated model catalog. * [What can reAPI do for you?](/blog/what-can-reapi-do) — use cases across image, video, and LLMs. * [Best fal.ai alternatives](/blog/best-fal-ai-alternatives) — the same comparison for fal.ai. ## References 1. Replicate. *Pricing — hardware and per-output model rates.* Retrieved May 2026 from replicate.com/pricing 2. Replicate. *Billing — prepaid credit, failed runs, and client libraries.* Retrieved May 2026 from replicate.com/docs/topics/billing 3. fal.ai. *Pricing — per-model rates for image and video.* Retrieved May 2026 from fal.ai/pricing 4. fal.ai. *Documentation — platform overview, model APIs, and SDKs.* Retrieved May 2026 from fal.ai/docs 5. Together AI. *Pricing — serverless tokens, dedicated GPUs, and image models.* Retrieved May 2026 from together.ai/pricing 6. Together AI. *OpenAI compatibility and model catalog.* Retrieved May 2026 from docs.together.ai/docs/inference/openai-compatibility 7. RunPod. *Pricing — GPU cloud and serverless rates.* Retrieved May 2026 from runpod.io/pricing 8. Hugging Face. *Pricing — Inference Endpoints instance rates.* Retrieved May 2026 from [huggingface.co/pricing](https://huggingface.co/pricing) 9. Hugging Face. *Inference Providers pricing and free credits.* Retrieved May 2026 from [huggingface.co/docs/inference-providers/pricing](https://huggingface.co/docs/inference-providers/pricing) 10. Replicate. *Seedance model pages — per-output rates by resolution and input variant, and the resolution input schema.* Retrieved August 21, 2026 from replicate.com/bytedance/seedance-2.5, /seedance-2.0, /seedance-2.0-fast and /seedance-2.0-mini --- # Best Seedance 2.5 Alternatives: H3, Veo, Sora and More (https://reapi.ai/blog/best-seedance-2-5-alternatives) **The best Seedance 2.5 alternative is MiniMax H3 when you need 2K output, or Seedance 2.0 when you need 4K and lower-cost tiers.** Veo 3.1, Runway Gen-4.5, and Kling 3 remain stronger choices for specific ecosystems and creative workflows. The availability problem that originally motivated this guide has been resolved. As of August 17, 2026, Seedance 2.5 is live on reAPI as `doubao-seedance-2.5-face`, with 480p/720p/1080p output, documented reference limits, and published pricing.\[9]\[10] The alternatives below now matter when another model's resolution, price, or surrounding workflow fits better. ## TL;DR * **MiniMax H3:** best callable alternative for mixed media, 2K output, native stereo audio, and clips up to 15 seconds.\[2] * **Seedance 2.0:** best continuity option for an existing Seedance pipeline; its API and limits are already documented. * **Veo 3.1:** best fit for Google Cloud and Gemini teams that value native audio, references, and scene extension.\[3] * **Sora 2:** API removal scheduled for 2026-09-24; migrate existing workloads and choose another model for new integrations.\[4] * **Runway Gen-4.5:** focused text-to-video and image-to-video option for teams already using Runway's production tools.\[5] * **Kling 3:** a practical creator-facing alternative when motion control and an established web workflow matter. * **For API access:** reAPI lets a product team test [Seedance 2.5](/models/seedance-2-5), [MiniMax H3](/models/minimax-h3), and [Seedance 2.0](/models/seedance-2-0) through one media task workflow. ## Best Seedance 2.5 alternatives compared ![A decision map for choosing between MiniMax H3, Seedance 2.0, Veo 3.1, Sora 2, Runway Gen-4.5, and Kling 3](https://cdn.reapi.ai/media/blog/best-seedance-2-5-alternatives/best-seedance-2-5-alternatives-selection-map.png) | Alternative | Best for | Verified strength | Main trade-off | | -------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | --------------------------------------------------- | | MiniMax H3 | Multimodal API projects | 4–15 seconds, up to 2K, native stereo audio | Shorter than Seedance 2.5's demonstrated 30 seconds | | Seedance 2.0 | Existing Seedance workflows | Shipping API and familiar model family | Earlier generation with shorter clips | | Veo 3.1 | Google/Gemini stacks | Native audio, references, first/last frame, scene extension | Access and billing follow Google's ecosystem | | Sora 2 | API removal scheduled for 2026-09-24; migrate existing workloads and choose another model for new integrations. | Videos API | 2026-09-24 | | Runway Gen-4.5 | Runway production workflow | Text-to-video and image-to-video API | 2–10-second output window | | Kling 3 | Creator UI and motion work | Established generation and editing workflow | Provider capabilities and prices vary | These are model alternatives. Higgsfield, Atlas Cloud, fal, Replicate, and reAPI are **access platforms** that can expose one or more models. Comparing a studio subscription with a model is useful only after naming the underlying model. For “Seedance 2.5 alternatives to Dreamina,” first decide whether the limitation is Dreamina’s studio or the model itself. If it is access or workflow, keep Seedance 2.5 and evaluate another platform; if it is output behavior or model capability, compare the models below. ## Where reAPI fits in this model shortlist reAPI is not a seventh video model, so ranking it beside H3 or Veo would be misleading. It is the access layer for a product team that wants to evaluate more than one callable model without rebuilding authentication, task polling, and billing each time. Start with [Seedance 2.5 on reAPI](/models/seedance-2-5) when 30-second takes, larger mixed-reference sets, or video editing matter. Start with [MiniMax H3](/models/minimax-h3) for 2K, or [Seedance 2.0](/models/seedance-2-0) for 4K and cheaper tiers. All three use reAPI's asynchronous media task workflow, while their model-specific fields still need separate validation. This is also the boundary: reAPI does not replace Higgsfield's finished studio, Google's native Cloud integration, or Runway's creator suite. It is the recommended starting point when the search for a “Seedance 2.5 alternative” is really a search for an API your own product can call. ## 1. MiniMax H3: best immediate Seedance 2.5 alternative MiniMax H3 is the closest match to the reason many teams are watching Seedance 2.5: one model can interpret text, images, video, and audio as connected references. Its public video API accepts clips from four to 15 seconds, renders up to 2K, and generates native stereo audio.\[2] H3 also publishes its reference budget: up to nine images, three videos, and three audio files. That makes form validation and cost planning possible. MiniMax lists direct output pricing at $0.09 per second for 768p and $0.13 per second for 2K, before applicable input-media charges.\[6] Choose H3 when 2K output or its lower direct rate matters. Choose Seedance 2.5 when a single 30-second shot, second-level direction, or selective video editing removes more work than the rate difference adds. See the full [MiniMax H3 vs Seedance 2.5 comparison](/blog/minimax-h3-vs-seedance-2-5). ## 2. Seedance 2.0: best low-risk replacement Seedance 2.0 is less exciting than changing vendors, but it is often the correct production answer. It preserves the prompt style and model family while providing a callable API with known duration and input rules. It is available through several providers, including [Seedance 2.0 on reAPI](/models/seedance-2-0), fal, Replicate, Atlas Cloud, and ByteDance's own cloud surfaces. fal, for example, publishes per-second rates for standard and fast variants, while Replicate provides hosted endpoints and client libraries.\[7]\[8] Choose Seedance 2.0 when 4K output, lower-cost Fast or Mini tiers, or an established 2.0 workflow matters more than 2.5's longer takes and editing. Keep the model identifier behind configuration so switching remains a controlled test. ## 3. Veo 3.1: best for Google Cloud and Gemini workflows Google positions Veo 3.1 as a video model with native audio, reference-image guidance, first-and-last-frame control, and scene extension. It is available through the Gemini API and Vertex AI, making it a natural choice for teams already managing access, observability, and billing in Google Cloud.\[3] Its most useful distinction is ecosystem fit. If your media assets already live in Google Cloud and Gemini handles adjacent reasoning tasks, Veo can reduce platform sprawl. If you primarily want Seedance-style camera behavior or a broad multi-provider gateway, the operational advantage is smaller. Read [Veo 3.1 vs Seedance](/blog/veo-3-1-vs-seedance-2-0-2026) for a more detailed workflow comparison. ## 4. Sora 2: migration before September 24 OpenAI has scheduled the Videos API and `sora-2` / `sora-2-pro` aliases for removal on **September 24, 2026**. As of this September 8 update, that date is still ahead; Sora 2 belongs in a migration discussion, not the shortlist for a new integration. OpenAI’s deprecation table lists no recommended replacement.\[4] For an existing Sora queue, compare Seedance 2.5, MiniMax H3, Veo, or Runway against the actual required duration, references, audio, and delivery workflow before cutting over. None is a drop-in Sora replacement: adapt request fields, polling, and output handling, and validate representative jobs before the shutdown deadline. ## 5. Runway Gen-4.5: best for a focused production suite Runway added Gen-4.5 text-to-video and image-to-video to its API in February 2026, with two-to-ten-second generation documented in the changelog.\[5] Its advantage is not a single specification. It is the surrounding Runway workflow for generating, reviewing, and continuing creative work in one environment. Choose it when artists already use Runway and short shots are the unit of production. A developer building a model-agnostic backend may prefer H3 or a gateway with normalized job handling. ## 6. Kling 3: best for an established creator workflow Kling 3 is a practical alternative for creators who prioritize visual motion, image-led generation, and a mature web workflow. Exact capabilities, queues, and prices can vary by product surface and provider, so verify the model name and settings at checkout rather than treating every “Kling” option as identical. Kling becomes more compelling when the desired clip is short and motion-heavy. Seedance becomes more compelling when camera direction and continuity across a longer scene are the deciding factors. Our [Seedance 2.0 vs Kling 3 comparison](/blog/seedance-2-0-vs-kling-3-0-2026) covers that difference, while the live 2.5 request behavior is documented separately.\[10] ## How to choose without guessing Use one representative prompt set and score the outputs on the failure that costs your team the most: 1. **Continuity:** identity, wardrobe, props, lighting, and screen direction. 2. **Instruction timing:** whether actions occur in the requested order and window. 3. **Audio:** speech intelligibility, synchronization, ambience, and unwanted sound. 4. **Recovery cost:** rerender time, failed-job billing, and manual editing. 5. **Integration:** request validation, webhooks or polling, storage, and rate limits. Do not average everything into a vague “quality” score. An ecommerce team may value product fidelity above cinematic motion. A narrative team may accept more rerolls to preserve character continuity. The best alternative is the one that removes the most expensive failure. ## FAQ ### What is the closest alternative to Seedance 2.5? MiniMax H3 is the closest newly released multimodal API alternative. Seedance 2.0 is the closest operational alternative because it belongs to the same model family. ### Is Seedance 2.5 available through an API? Yes. reAPI exposes it as `doubao-seedance-2.5-face`, with 480p / 720p / 1080p output and published live rates.\[9]\[10] ### Which alternative creates the longest clips? This changes by model and product surface. Seedance 2.5 supports up to 30 seconds on reAPI, H3 documents up to 15 seconds, Sora 2 up to 12 seconds in its API, and Runway Gen-4.5 up to 10 seconds.\[10] **Sora 2:** API removal scheduled for 2026-09-24; migrate existing workloads and choose another model for new integrations.\[4] ### Which alternative has native audio? MiniMax H3, Veo 3.1, and Sora 2 all document video generation with audio. Test your language, voice, and synchronization needs rather than assuming every audio feature performs equally. **Sora 2:** API removal scheduled for 2026-09-24; migrate existing workloads and choose another model for new integrations.\[4] ### Is Higgsfield a Seedance 2.5 alternative? Higgsfield is a creator platform that currently offers Seedance 2.5, not a different model. The September 8 check found 4–30-second controls and output through 1080p; account and plan permissions apply. See [Seedance 2.5 on Higgsfield](/blog/seedance-2-5-on-higgsfield). ## The practical shortlist Start with Seedance 2.5 when its 30-second takes and edit workflows fit, H3 for 2K, Seedance 2.0 for higher-resolution or lower-cost Seedance output, and Veo 3.1 for a Google-native stack. Product teams can run the first three from [reAPI's model catalog](/models) and compare accepted outputs under one task workflow. Add Runway Gen-4.5 or Kling 3 only when their particular workflow matches the project. ## References 2. MiniMax. *MiniMax H3 launch and Video Generation Guide.* Published July 31, 2026. [minimax.io](https://www.minimax.io/blog/minimax-h3) 3. Google Developers Blog. *Introducing Veo 3.1 and new creative capabilities in the Gemini API.* [developers.googleblog.com](https://developers.googleblog.com/en/introducing-veo-3-1-and-new-creative-capabilities-in-the-gemini-api/) 4. OpenAI. *Videos API / Sora deprecation schedule.* Checked September 8, 2026. [developers.openai.com](https://developers.openai.com/api/docs/deprecations) 5. Runway. *API changelog: Gen-4.5 text-to-video and image-to-video.* Updated February 10, 2026. [docs.dev.runwayml.com](https://docs.dev.runwayml.com/api-details/api_changelog/) 6. MiniMax API. *Pay-as-you-go pricing.* Retrieved August 2, 2026. [platform.minimax.io](https://platform.minimax.io/docs/guides/pricing-paygo) 7. fal. *ByteDance Seedance 2.0 text-to-video API.* Retrieved August 2, 2026. fal.ai 8. Replicate. *ByteDance Seedance 2.0 API.* Retrieved August 2, 2026. replicate.com 9. reAPI. *Seedance 2.5 — live production pricing.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-5](/models/seedance-2-5) 10. reAPI. *doubao-seedance-2.5-face — model ID, request limits, resolutions, and billing.* Retrieved August 17, 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5) ### Further reading * reAPI. *Seedance 2.5 launch status.* [reapi.ai/blog/seedance-2-5-release-status](/blog/seedance-2-5-release-status) * reAPI. *MiniMax H3 vs Seedance 2.5.* [reapi.ai/blog/minimax-h3-vs-seedance-2-5](/blog/minimax-h3-vs-seedance-2-5) * reAPI. *Best Higgsfield alternatives.* [reapi.ai/blog/best-higgsfield-alternatives-ai-video](/blog/best-higgsfield-alternatives-ai-video) ## More Posts * [Seedance 2.5 vs Kling 3.0: Length, Audio, and API Cost](/blog/seedance-2-5-vs-kling-3-0) * [Seedance 2.5 vs Veo 3.1: Clip Length, Audio, and Cost](/blog/seedance-2-5-vs-veo-3-1) * [Seedance 2.5 vs Wan 3.0: References, Length, and Cost](/blog/seedance-2-5-vs-wan-3-0) --- # Best Together AI Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-together-ai-alternatives) Together AI is one of the strongest places to run open models. Its catalog lists 176 models weighted toward open-source LLMs, with per-token serverless, dedicated GPUs, fine-tuning, and a real OpenAI-compatible API\[1]\[2]. But it is open-model first, and that shapes where teams go looking for **Together AI alternatives**: there is no free trial and a $5 minimum to start, closed frontier models like GPT-5 and Claude are not on its serverless tier, and dedicated GPU time runs $6.49/hour for an H100\[1]. This guide compares five Together AI alternatives on what moves a decision: model range, pricing model, integration effort, and where each one beats Together. Four are independent platforms. The fifth is reAPI, which we build. Every figure below came from each vendor's own pricing page or docs on May 30, 2026. ## TL;DR * **Together AI** is the open-LLM and fine-tuning specialist: 176 models, per-token serverless (Llama 3.3 70B at $0.88 per million), OpenAI-compatible, but no free trial and a $5 minimum\[1]\[2]. * **OpenRouter** aggregates 400+ models across 60+ providers at pass-through pricing, plus a 5.5% credit-purchase fee, and includes free model variants\[3]\[4]. * **Replicate** spans community models and custom Cog deploys, billed per second of hardware\[5]. * **RunPod** and **Hugging Face** let you host your own model: raw GPUs from $1.99/hour, or Hub deploys on per-minute instances\[6]\[7]. * **reAPI** adds curated frontier closed models and media that Together's serverless does not host. Chat and media use separate gateways, keys, and balances. ## What Together AI does well, and where it leaves gaps Together is built for teams that run open models seriously and sometimes train their own. Where it is strong: * **Open-model depth.** 176 models across chat, vision, image, audio, and code, tuned for inference\[2]. * **Fine-tuning.** LoRA, full, and vision-language fine-tuning with hosting for the result\[2]. * **OpenAI-compatible.** A drop-in endpoint at `https://api.together.ai/v1`\[2]. * **Per-token clarity.** Serverless rates like gpt-oss-20B at $0.05 in / $0.20 out, with dedicated H100s at $6.49/hour when you need them\[1]. Where teams hit walls: * **No free trial.** Together does not offer a free trial, and access requires a $5 minimum credit purchase\[1]. * **Open models only on serverless.** Closed frontier models like GPT-5 and Claude are not on the serverless tier, so a multi-vendor app still needs another provider. * **No media generation depth.** Image is supported, but Together is not a video-generation platform. * **Dedicated GPUs are pricey.** $6.49/hour for an H100 is fine for steady load and expensive for bursty traffic\[1]. ## How to evaluate a Together AI alternative Five questions sort the field: * **Open vs. closed.** Do you need GPT-5 and Claude alongside open models? * **Free entry.** A free balance to test, or a prepaid minimum? * **Train or just infer.** Is fine-tuning a requirement? * **Media.** Do you need image and video, not just text? * **Host vs. call.** A managed API, or your own GPU? ## The best Together AI alternatives in 2026 ### 1. OpenRouter: best for breadth across providers OpenRouter is the widest aggregator: 400+ models across 60+ providers behind one OpenAI-compatible key, including closed frontier models Together's serverless lacks\[3]. * **Features:** One API for open and closed models, automatic provider routing, free model variants, and bring-your-own-key support\[3]\[4]. * **Pricing:** Pass-through provider rates, so you pay the provider's own rate, plus a 5.5% ($0.80 minimum) fee on credit purchases. Rates vary by provider, for example Claude Opus 4.8 at $5 in / $25 out and Llama 3.3 70B from $0.10 in / $0.32 out\[4]. * **Performance:** Depends on the routed provider; OpenRouter normalizes the schema across them. * **Best for:** Teams that want to reach many open and closed models behind one key. * **Vs Together:** OpenRouter has far more models and closed frontier access; Together owns its inference and fine-tuning rather than reselling. ### 2. Replicate: best for custom models and media Replicate hosts thousands of community models and lets you deploy your own\[5]. * **Features:** Per-second hardware inference, per-output models, fine-tuning, and Cog packaging for custom models\[5]. * **Pricing:** Hardware per-second, for example A100 80GB at $5.04/hour, or per-output like FLUX 1.1 Pro at $0.04/image\[5]. * **Performance:** Flexible, with cost tied to runtime. * **Best for:** Teams that need custom models or media beyond Together's catalog. * **Vs Together:** Replicate is broader on media and custom deploys; Together is cleaner for open-LLM tokens and fine-tuning. ### 3. RunPod: best for hosting your own model RunPod rents GPUs by the second, the cheapest way to self-host an open model\[6]. * **Features:** GPU pods, serverless workers, 30+ regions, and bring-your-own-container deploys\[6]. * **Pricing:** Per-second, no egress fees. H100 PCIe from $1.99/hour, A100 80GB from $1.19/hour\[6]. * **Performance:** Full control over the serving stack. * **Best for:** Teams that want the lowest GPU-hour and will run their own inference. * **Vs Together:** RunPod is cheaper raw compute; Together gives you a managed endpoint and fine-tuning without ops. ### 4. Hugging Face Inference Endpoints: best for dedicated deploys Hugging Face deploys any Hub model onto dedicated, autoscaling instances billed by the minute\[7]. * **Features:** Dedicated and autoscaling instances with scale-to-zero, plus a serverless route that passes provider cost through directly\[7]\[8]. * **Pricing:** CPU from $0.033/hour; GPU runs T4 at $0.50/hour and A100 80GB at $2.50/hour, billed per minute\[7]. * **Performance:** Solid for steady traffic; scale-to-zero adds a cold start\[7]. * **Best for:** Hub-centric teams that want dedicated infrastructure. * **Vs Together:** Both deploy open models; Hugging Face is tied to the Hub, Together bundles fine-tuning and serverless tokens. ### 5. reAPI: best for frontier models plus media reAPI covers what Together's serverless does not: curated frontier closed models through an OpenAI-compatible chat gateway, plus a separately keyed media gateway. * **Features:** Frontier LLMs (GPT-5, Claude Opus 4.8, Gemini) plus curated media models (Veo 3.1, Seedance 2.0, Wan 2.7, Kling, GPT-Image-2, Gemini 3 Pro Image). Chat is OpenAI-compatible; image and video use a separate media gateway, key, and balance. * **Pricing:** Pay-as-you-go credits at 1 credit = $0.001, no subscription, free credits to start, so there is no $5 floor before the first call. Media uses model-specific units, for example GPT-Image-2 from $0.0045/image and Seedance 2.0 Mini from (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with source video. * **Performance:** Same upstream frontier models; the win is unified access plus media. * **Best for:** Teams that want closed frontier LLMs and video generation alongside open models. * **Vs Together:** reAPI reaches closed frontier models like GPT-5 and Claude plus video generation that Together's serverless does not host. Chat and media use separate reAPI workspaces, keys, and balances. ## Together AI vs. the top alternatives at a glance | Platform | Catalog | Closed frontier models | Pricing model | Free to start | Best for | | ------------ | ------------------------- | ---------------------- | ------------------------- | ----------------------- | ------------------------- | | Together AI | 176 (open focus) | No (serverless) | Per-token + dedicated GPU | No ($5 min) | Open LLMs + fine-tuning | | OpenRouter | 400+ across 60+ providers | Yes | Pass-through + 5.5% fee | Small free allowance | Provider breadth | | Replicate | Thousands (community) | Some | Per-second or per-output | Limited free | Custom + community models | | RunPod | Bring your own | Self-hosted | Per-second GPU | No | Self-hosting open models | | Hugging Face | Hub models | Self-hosted | Per-minute instance | Serverless free credits | Dedicated Hub deploys | | reAPI | 200+ models | Yes | Pay-as-you-go credits | Free credits | Frontier models + media | Catalog and pricing figures are from each vendor's official pages as of May 2026; rates change, so confirm before you commit. ## What the numbers say about pricing Together's per-token rates are competitive for open models, so the comparison is less about cents and more about what you can reach and how you start. * **Together** is per-token serverless plus dedicated GPUs, but you prepay a $5 minimum and there is no trial\[1]. * **OpenRouter** passes provider rates through unchanged, then adds a 5.5% ($0.80 minimum) fee when you buy credits, so the headline rate is not the final cost\[4]. * **reAPI** uses separate chat and media balances; the media workspace is pay-as-you-go with free starting credits and no minimum. * **RunPod** and **Hugging Face** bill for compute time, so they win only when you keep a GPU busy\[6]\[7]. The honest read: Together is excellent for open-model inference and fine-tuning. If you need closed frontier models, media, or a free way to start, an alternative fits better. ## Moving from Together AI to reAPI Both chat surfaces are OpenAI-compatible, so text uses a base-URL and key change; image and video move to reAPI's separate REST media endpoints: ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="gpt-5", messages=[{"role": "user", "content": "Classify this support ticket."}], ) ``` If fine-tuning open models is core to your stack, keep that on Together and route frontier and media calls through reAPI. The OpenAI-compatible surface on both sides makes a hybrid setup low-effort. ## FAQ ### Does Together AI have a free trial? No. Together does not offer a free trial, and access requires a $5 minimum credit purchase\[1]. OpenRouter gives a small free allowance plus free model variants, and reAPI starts new accounts with free credits\[4]. ### Which Together AI alternative has GPT-5 and Claude? OpenAI's and Anthropic's closed models are not on Together's serverless tier. OpenRouter and reAPI both carry them behind one key; OpenRouter lists Claude Opus 4.8 at $5 in / $25 out, for example\[4]. ### Which Together AI alternative is cheapest? For open LLM tokens, Together and OpenRouter are close, though OpenRouter adds a 5.5% credit fee\[4]. For self-hosting, RunPod is cheapest per GPU-hour\[6]. Match the pricing model to your traffic before comparing rates. ### Can I fine-tune models on a Together AI alternative? Yes. Replicate supports fine-tuning with Cog, and Hugging Face and RunPod let you train and deploy on your own infrastructure\[5]\[6]. ### Does any Together AI alternative also do video? reAPI and Replicate both generate video; reAPI carries curated models like Veo 3.1 and Seedance 2.0 on its media gateway, which uses a different key and balance from its LLM gateway\[5]. Together is text and image, not video. ## Choosing a Together AI alternative Together AI is a top choice for open-model inference and fine-tuning, and worth keeping if that is your core. The case for a Together AI alternative is usually reach or entry cost: closed frontier models, video generation, or a free way to start without a $5 floor. OpenRouter wins on provider breadth, Replicate on custom models, RunPod and Hugging Face on self-hosting, and reAPI on frontier and media access from one platform with separate workspaces and free starting credits. The right Together AI alternative is the one that matches the models and pricing model your app actually needs, so pilot two and compare real usage. ## Further reading * [reapi.ai/models](/models) — frontier LLMs plus image and video across separate chat and media gateways. * [Claude Opus 4.8](/models/claude-opus-4-8) — frontier reasoning on the OpenAI-compatible gateway. * [Best CometAPI alternatives](/blog/best-cometapi-alternatives) — another unified-gateway comparison. ## References 1. Together AI. *Pricing — serverless tokens, dedicated GPUs, and minimums.* Retrieved May 2026 from together.ai/pricing 2. Together AI. *OpenAI compatibility, model catalog, and fine-tuning.* Retrieved May 2026 from docs.together.ai/docs/inference/openai-compatibility 3. OpenRouter. *Models — provider and modality catalog.* Retrieved May 2026 from openrouter.ai/models 4. OpenRouter. *Docs FAQ — pass-through pricing, fees, and free models.* Retrieved May 2026 from openrouter.ai/docs/faq 5. Replicate. *Pricing — hardware and per-output model rates.* Retrieved May 2026 from replicate.com/pricing 6. RunPod. *Pricing — GPU cloud and serverless rates.* Retrieved May 2026 from runpod.io/pricing 7. Hugging Face. *Pricing — Inference Endpoints instance rates.* Retrieved May 2026 from [huggingface.co/pricing](https://huggingface.co/pricing) 8. Hugging Face. *Inference Providers pricing and free credits.* Retrieved May 2026 from [huggingface.co/docs/inference-providers/pricing](https://huggingface.co/docs/inference-providers/pricing) --- # Best Venice.ai Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-venice-ai-alternatives) Venice.ai is a privacy-first, uncensored AI platform: one OpenAI-compatible key reaches text, image, video, audio, and embeddings, with a four-tier privacy architecture and a crypto economy on top\[1]\[2]. Its text side runs open-weight models like venice-uncensored, GLM, Qwen, Llama, DeepSeek, and Kimi, and its pitch is blunt: your prompts stay yours, and the models will not refuse you\[2]. Teams comparing **Venice.ai alternatives** usually want one of a few things: frontier commercial models Venice does not lead with, a cheaper open-weight API without a subscription or token, stronger or simpler privacy, or a unified gateway they can pay for in plain dollars. This guide compares five Venice.ai alternatives on what actually moves a decision: model range, privacy posture, pricing shape, and integration effort. Four are independent platforms. The fifth is reAPI, which we build, and I will be straight about it: reAPI is not a privacy or uncensored play, so if those are your hard requirements, the honest answer is Venice itself or a local model, not us. reAPI instead pairs OpenAI-compatible chat with a separately keyed media gateway for commercial frontier models. Every figure below came from each vendor's own pages or docs on June 7, 2026. ## TL;DR * **OpenRouter** is the breadth option: 400+ models across 60+ providers behind one OpenAI-compatible key, pass-through pricing plus a 5.5% fee, with data-policy filters and zero-data-retention routes\[5]\[6]. * **Together AI** runs open-weight models with fine-tuning, OpenAI-compatible, per token\[7]. * **DeepInfra** is the cheapest open-weight API: OpenAI-compatible, pay-as-you-go, no subscription or token\[8]. * **Ollama and LM Studio** are the maximal-privacy answer: run open weights locally so nothing leaves your device\[9]\[10]. * **reAPI** is the commercial-media pick: 200+ models with deep video generation, OpenAI-compatible chat, and a separate media gateway. As of October 2026, Seedance 2.0 Mini at 480p starts at (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with a source video, and GPT Image 2 starts at $0.0045 per image. reAPI has no privacy tiers or uncensored stance. ## What Venice.ai does well, and where it leaves gaps Venice's strength is privacy and permissionless access wrapped in a standard API. Where it is strong: * **One private API for every modality.** Text, image, video, audio, embeddings, and tools behind one OpenAI-compatible key, base URL `https://api.venice.ai/api/v1`\[2]. * **Real privacy architecture.** Four tiers: anonymized third-party models, zero-retention self-hosted models, TEE hardware enclaves, and end-to-end encryption\[1]. * **Uncensored by default.** Open-weight models with a `text:uncensored` trait and no content filtering\[2]. * **Agent-native.** MCP tools, wallet (x402) payments, and agents that can mint their own API key by staking VVV on Base\[2]. Where teams hit walls: * **Subscription-led access.** The free tier caps you at 10 text and 15 image prompts per day; deeper use means a $18-$200/month plan or staking the VVV token\[3]\[4]. * **Open-weight-first text.** The text catalog leans on open models; if you need a frontier commercial LLM as your default, that is not the center of gravity here\[2]. * **A crypto layer to learn.** VVV, DIEM, staking, and burns are optional but front-and-center, which is friction if you just want an API key\[4]. * **Tied to one provider's stack.** Privacy tiers are Venice-specific, so you cannot mix in another vendor's routing under the same roof. ## How to evaluate a Venice.ai alternative Five questions sort the field: * **Privacy requirement.** Do you need zero retention and uncensored output, or just a normal hosted API? * **Model reach.** Open-weight models, frontier commercial models, or both? * **Pricing shape.** Subscription plus credits, pass-through per token, or pay-as-you-go credits? * **Crypto or dollars.** Are you fine with a token economy, or do you want plain USD billing? * **Local vs. hosted.** Would running on your own hardware solve the privacy question outright? ## The best Venice.ai alternatives in 2026 ### 1. OpenRouter: best for model breadth and routing control OpenRouter is the largest aggregator and the closest match to Venice's API shape, with far more models and explicit privacy routing\[5]. * **Features:** 400+ models across 60+ providers behind one OpenAI-compatible key, with provider routing, free model variants, bring-your-own-key, data-policy filters, and zero-data-retention (ZDR) routes you can require\[5]\[6]. * **Pricing:** Pass-through at the provider's own rate, plus a 5.5% ($0.80 minimum) fee on credit purchases. Rates vary by provider, for example Claude Opus 4.8 at $5 in / $25 out per million\[5]. * **Performance:** Depends on the routed provider; the schema is normalized across them. * **Best for:** Teams that want the widest reach plus the ability to filter who can log or train on their data. * **Vs Venice:** Both are unified OpenAI-compatible APIs. Venice self-hosts open models with zero-retention and TEE tiers; OpenRouter routes to 60+ third-party providers and lets you filter by data policy, but it does not run its own private enclaves. ### 2. Together AI: best for open-weight inference and fine-tuning Together AI runs the same class of open weights Venice self-hosts, and lets you fine-tune them\[7]. * **Features:** Serverless inference for open-weight models (Llama, Qwen, DeepSeek, GLM, gpt-oss) across chat, vision, image, audio, video, and embeddings, plus fine-tuning, dedicated GPUs, and a batch API at lower cost, all OpenAI-compatible\[7]. * **Pricing:** Per token, for example Llama 3.3 70B at $1.04 per million in and out, gpt-oss-120B at $0.15 / $0.60, and GLM-5.1 at $1.40 / $4.40\[7]. * **Performance:** Strong on open-model chat and reasoning; Together owns its inference stack. * **Best for:** Open-weight-first teams that want to fine-tune rather than just call models. * **Vs Venice:** Together runs and trains the same open weights, but as a standard cloud, without Venice's TEE/E2EE tiers or its uncensored-by-default posture. ### 3. DeepInfra: best for a cheap open-weight API with no subscription DeepInfra delivers Venice's open-weight API value as pure pay-as-you-go, no plan and no token\[8]. * **Features:** OpenAI-compatible chat completions for open-source models ("just change the base URL and model name"), plus vision/OCR, embeddings, rerank, image, text-to-video, and speech, with private model deploys and LoRA on top\[8]. * **Pricing:** Per token with no contracts or upfront costs, for example DeepSeek-V4-Flash at $0.10 / $0.20, DeepSeek-V3.2 at $0.26 / $0.38, and Qwen3-VL-30B at $0.15 / $0.60 per million\[8]. * **Performance:** Tuned for low-cost open-source inference at scale. * **Best for:** Developers who used Venice's API mainly for cheap open-weight calls and want billing in plain dollars. * **Vs Venice:** DeepInfra matches the cheap, OpenAI-compatible open-weight API without a subscription or crypto, but has no privacy-tier architecture and no uncensored stance. ### 4. Ollama and LM Studio: best for fully private, local AI If your real requirement is that prompts never leave your machine, local inference solves it outright\[9]. * **Features:** Download and run open weights (Llama, Mistral, Qwen, DeepSeek, including uncensored fine-tunes) entirely on your own hardware. Ollama exposes an OpenAI-compatible server at `http://localhost:11434/v1`; LM Studio exposes `/v1/chat/completions`, `/v1/responses`, and `/v1/embeddings`\[9]\[10]. * **Pricing:** Free software; you pay only for your own hardware and electricity. * **Performance:** Bounded by your GPU and RAM, but with no network latency and no rate limits. * **Best for:** Anyone whose privacy bar is absolute, where there is no remote prompt to retain in the first place. * **Vs Venice:** Local tools are the maximal-privacy answer, since nothing leaves your device, but you give up Venice's hosted frontier and media models, managed scaling, and one-click access. ### 5. reAPI: best for curated commercial media, pay-as-you-go reAPI pairs an OpenAI-compatible chat gateway with a separate media gateway, each with its own key and balance. To be clear up front: it is not a privacy or uncensored product, and it carries mainstream commercial models with their own content policies. * **Features:** 200+ models, including frontier LLMs (GPT-5, Claude Opus 4.8, Gemini), image models (GPT-Image-2, Gemini 3 Pro Image), and a deep video catalog (Veo 3.1, Seedance 2.0, Wan 2.7, Kling, HappyHorse 1.0), several of which (Seedance 2.0, Wan 2.7, Kling) Venice also carries. Chat is OpenAI-compatible; image and video use a separate media gateway, key, and balance. * **Pricing:** Pay-as-you-go credits at 1 credit = $0.001, with model-specific rates and billing units. Current examples include GPT-Image-2 from $0.0045/image, Seedance 2.0 Mini at 480p from (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with source video, and Veo 3.1 Fast from (live price: https://reapi.ai/models/veo3-1/llms.txt)/generation. * **Performance:** Same upstream frontier models; the win is a curated commercial catalog and an explicit price unit. * **Best for:** Teams that used Venice's API for its frontier and media models and want them in plain USD credits with no plan to manage. * **Vs Venice:** Venice uses one OpenAI-compatible key across modalities; reAPI separates OpenAI-compatible chat from its REST media gateway. reAPI goes deeper on commercial media but does not offer Venice's privacy tiers, uncensored models, or crypto payments. If privacy or uncensored output is the requirement, Venice or a local model is the fit. ## Venice.ai vs. the top alternatives at a glance | Platform | Models | Pricing model | Privacy posture | OpenAI-compatible | Best for | | ------------------ | --------------------------------- | ------------------------------------ | ------------------------------------------------- | ----------------- | ----------------------------------- | | Venice.ai | 100+ text, plus image/video/audio | Subscription + credits, or stake VVV | Anonymized / private / TEE / E2EE, zero retention | Yes | Private, uncensored AI | | OpenRouter | 400+ across 60+ providers | Pass-through + 5.5% fee | Data-policy filters + ZDR routes | Yes | Breadth + routing control | | Together AI | Open-weight catalog | Per token + dedicated GPU | Standard hosted cloud | Yes | Open-weight inference + fine-tuning | | DeepInfra | Open-weight catalog | Per token, pay-as-you-go | Standard cloud, private deploys | Yes | Cheapest open-weight API | | Ollama / LM Studio | Open weights you download | Free (your own hardware) | Fully local, nothing leaves device | Yes (local) | Maximal privacy | | reAPI | 200+ models | Published model-specific rates | Standard hosted gateway | Yes (chat) | Curated commercial media + LLMs | Model and pricing figures are from each vendor's official pages as of June 2026; rates change, so confirm before you commit. ## What the numbers say about pricing Venice and these alternatives price on different axes, and the cheapest one depends on what you call. * **Venice** is subscription-led: a free tier with daily caps, then Pro at $18, Plus at $68, and Max at $200 a month, each bundling monthly credits at 100 credits = $1; or you stake 100 VVV for Pro access instead of paying cash\[3]\[4]. * **OpenRouter** passes the provider's exact rate through unchanged, then adds a 5.5% ($0.80 minimum) fee on credit purchases\[5]. * **DeepInfra** and **Together** are per-token pay-as-you-go, where open models like DeepSeek and Qwen cost cents per million tokens and there is no plan to buy\[7]\[8]. * **Ollama and LM Studio** are free beyond the hardware you already own\[9]. * **reAPI** uses an explicit credit unit, 1 credit = $0.001, with published model-specific rates, no subscription, and free starting credits. The honest read: the deciding factor against Venice is rarely a few cents of token cost. It is whether you actually need the privacy tiers and uncensored stance, in which case Venice or a local model wins, or whether you mainly want a curated commercial catalog and can manage separate chat and media credentials, in which case reAPI may fit better. ## Moving from Venice.ai to reAPI Because both speak the OpenAI format, switching text calls is a base-URL change, and media moves to reAPI's REST endpoints: ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Rewrite this paragraph for clarity."}], ) ``` Image and video use `https://reapi.ai/api/v1` with a separate media key and balance. Since reAPI is pay-as-you-go with free starting credits, the low-risk move is to run a real workload through it and compare model coverage and invoices before you consolidate. Keep in mind that reAPI does not replace Venice's privacy tiers or uncensored models, so split your traffic accordingly. ## FAQ ### Is Venice.ai legit and safe? Venice.ai is a working privacy-first, uncensored AI platform with an OpenAI-compatible API and a four-tier privacy architecture\[1]\[2]. The reasons to compare Venice.ai alternatives are usually wanting frontier commercial models, a cheaper open-weight API without a subscription, or fully local privacy, not doubts about whether it works. ### What is the most private Venice.ai alternative? Running models locally with Ollama or LM Studio is the most private option, because the prompt never leaves your device and there is no remote service to retain it\[9]\[10]. Venice's own zero-retention and TEE tiers are the strongest hosted answer\[1]. ### Which Venice.ai alternative is OpenAI-compatible? OpenRouter, Together AI, DeepInfra, local Ollama and LM Studio, and reAPI (for chat) all expose OpenAI-compatible APIs, so you reuse an existing client by changing the base URL\[5]\[7]\[8]\[9]. ### Do I need the VVV crypto token to use Venice? No. Venice sells standard USD subscriptions and credits; staking 100 VVV is an optional alternative route to Pro access\[4]. Alternatives like DeepInfra and reAPI bill in plain dollars with no token at all. ### Which Venice.ai alternative is best for uncensored models? Venice itself, local open-weight models via Ollama or LM Studio, or open-weight hosts like Together, DeepInfra, and select OpenRouter routes\[7]\[8]\[9]. Mainstream commercial gateways, reAPI included, apply each provider's content policies. ### Which Venice.ai alternative is cheapest for open-weight models? DeepInfra and Together AI price open models per token pay-as-you-go, for example DeepSeek and Qwen at cents per million tokens\[7]\[8]. Local inference with Ollama or LM Studio is free beyond your own hardware\[9]. ## Choosing a Venice.ai alternative Venice.ai does a specific job well: a private, uncensored, OpenAI-compatible API with a real privacy architecture and an optional crypto economy. The case for a Venice.ai alternative is usually the specifics: OpenRouter for the widest reach and routing control, Together AI for open-weight fine-tuning, DeepInfra for the cheapest pay-as-you-go open-weight API, and Ollama or LM Studio when privacy has to be absolute and local. If you want frontier commercial and media models and can use separate chat and media workspaces, reAPI is the alternative built for that, with the honest caveat that it does not match Venice on privacy or uncensored output. Run a real workload through two of them and let coverage, privacy needs, and invoices decide. ## Further reading * [reapi.ai/models](/models) — frontier LLMs plus image, video, and audio. * [Claude Opus 4.8](/models/claude-opus-4-8) — frontier reasoning on the OpenAI-compatible gateway. * [Best CometAPI alternatives](/blog/best-cometapi-alternatives) — the same comparison for a unified gateway. ## References 1. Venice AI. *Homepage — privacy architecture and capabilities.* Retrieved June 2026 from venice.ai 2. Venice AI. *API docs — OpenAI compatibility, endpoints, and models.* Retrieved June 2026 from docs.venice.ai 3. Venice AI. *Pricing — tiers, daily limits, and credits.* Retrieved June 2026 from venice.ai/pricing 4. Venice AI. *Venice Token (VVV) and DIEM — staking and access.* Retrieved June 2026 from venice.ai/lp/vvv 5. OpenRouter. *Models and pricing — provider catalog and fees.* Retrieved June 2026 from openrouter.ai/models 6. OpenRouter. *Privacy and provider logging — ZDR and data policy.* Retrieved June 2026 from openrouter.ai/docs/features/privacy-and-logging 7. Together AI. *Pricing — serverless tokens, dedicated GPUs, and fine-tuning.* Retrieved June 2026 from together.ai/pricing 8. DeepInfra. *Docs and pricing — OpenAI-compatible API and per-token rates.* Retrieved June 2026 from deepinfra.com/docs 9. Ollama. *OpenAI compatibility — local OpenAI-compatible API.* Retrieved June 2026 from [ollama.com/blog/openai-compatibility](https://ollama.com/blog/openai-compatibility) 10. LM Studio. *OpenAI compatibility endpoints.* Retrieved June 2026 from [lmstudio.ai/docs/app/api/endpoints/openai](https://lmstudio.ai/docs/app/api/endpoints/openai) --- # Best WaveSpeed Alternatives in 2026: 5 Options Compared (https://reapi.ai/blog/best-wavespeed-alternatives) WaveSpeed AI is fast. The platform runs 1,000+ models across image, video, audio, 3D, and language behind one OpenAI-compatible API, and it markets sub-second latency with no cold starts\[2]. If speed is the entire requirement, it delivers. Teams looking for **WaveSpeed alternatives** usually want something else: a larger free balance than the $1 trial, throughput that is not gated behind a four-figure prepayment, pricing that does not shift with resolution, or a different model curation. This guide compares five WaveSpeed alternatives on what moves a real decision: model range, pricing model, integration effort, and where each one beats WaveSpeed. Four are independent platforms. The fifth is reAPI, which we build. Every figure below came from each vendor's own pricing page or docs on May 30, 2026. ## TL;DR * **WaveSpeed** is the speed-first unified API: 1,000+ models, sub-second latency claims, pay-per-use (Seedance 2.0 Fast at $0.10/second, Nano Banana 2 at $0.07/image), but only $1 in trial credits and throughput tiers gated behind large prepayments\[1]\[2]. * **fal.ai** is the other fast managed media API, with output pricing and 1,000+ models, but no LLM layer and no OpenAI-compatible endpoint\[4]. * **Replicate** has the widest catalog and custom Cog deploys, billed per second of hardware\[5]. * **Together AI** and **RunPod** cover the edges: open LLM tokens, and raw GPU rental from $1.99/hour\[6]\[8]. * **reAPI** provides chat and media through separate gateways, keys, and balances without gating throughput behind prepayment tiers. ## What WaveSpeed does well, and where it leaves gaps WaveSpeed is built around one promise: minimal latency on a broad, unified catalog. Where it is strong: * **Speed.** WaveSpeed advertises sub-second inference latency, zero cold starts, and images in under two seconds\[2]. * **Breadth and modalities.** 1,000+ models spanning image, video, audio, 3D, and language, including avatar and speech generators\[2]. * **OpenAI-compatible.** WaveSpeed positions its API as a drop-in replacement for the OpenAI SDK, with Python and JavaScript clients, webhooks, and ComfyUI and n8n integrations\[2]. * **Pay-per-use.** No subscription; you pay per image, per second of video, or per token, and new accounts get $1 in free credits\[1]. Where teams hit walls: * **The free trial is tiny.** $1 in trial credits, and some premium models are not available on trial credit at all\[1]. * **Throughput is gated by prepayment.** Default accounts are rate-limited; lifting limits means prepaying into tiers, for example $100 for Silver and $1,000 for Gold\[2]. * **Prices vary by parameters.** Listed rates are base prices that move with resolution and generation settings, so the headline number is a floor\[1]. * **Media-first.** The LLM catalog is a subset bolted onto a media platform, not the core. ## How to evaluate a WaveSpeed alternative Five questions sort the field: * **Free balance.** Enough to actually test, or a token trial? * **Throughput terms.** Is real concurrency gated behind a large prepayment? * **Pricing stability.** A flat per-output price, or one that drifts with parameters? * **API compatibility.** OpenAI format, or a bespoke client? * **Scope.** Unified media plus LLMs, or one or the other? ## The best WaveSpeed alternatives in 2026 ### 1. fal.ai: best for media speed fal.ai is WaveSpeed's closest match on the media side: a fast, managed API with 1,000+ optimized endpoints\[4]. * **Features:** Image, video, audio, and 3D, with a queue API, webhooks, streaming, and SDKs in five languages\[4]. * **Pricing:** Output-based, for example Veo 3 at $0.4/second and FLUX Kontext Pro at $0.04/image. Prepaid credits, billed only on success\[3]. * **Performance:** Claims the fastest inference for generative media, with 99.99% uptime\[4]. * **Best for:** Media-heavy apps that want speed without managing hardware. * **Vs WaveSpeed:** Comparable media speed and catalog, but fal.ai has no LLM layer and no OpenAI-compatible endpoint. ### 2. Replicate: best for catalog and custom models Replicate hosts thousands of community and proprietary models, the widest catalog of the group\[5]. * **Features:** Per-second hardware inference, per-output models, fine-tuning, and Cog for deploying your own models\[5]. * **Pricing:** Hardware per-second, for example A100 80GB at $5.04/hour, or per-output like FLUX 1.1 Pro at $0.04/image\[5]. * **Performance:** Reliable and flexible, though not tuned for WaveSpeed-style latency. * **Best for:** Teams that need an obscure model or want to ship a custom one. * **Vs WaveSpeed:** Far more models and custom deploys; slower and harder to forecast on per-second billing. ### 3. Together AI: best for open-source LLMs Together AI is the language-model pick, with 176 models weighted toward open LLMs and a real OpenAI-compatible API\[7]. * **Features:** Per-token serverless, dedicated GPUs, fine-tuning, and an OpenAI-compatible endpoint at `https://api.together.ai/v1`\[7]. * **Pricing:** Per-token, for example Llama 3.3 70B at $0.88 per million in and out. Dedicated H100 runs $6.49/hour\[6]. * **Performance:** Strong for chat, vision, and reasoning. * **Best for:** Open-source-first language stacks. * **Vs WaveSpeed:** Deeper on LLMs, but weaker on media generation, and it has no free trial and a $5 minimum\[7]. ### 4. RunPod: best for raw GPU control RunPod rents GPUs by the second, the cheapest route if you run your own containers\[8]. * **Features:** GPU pods, serverless workers that scale to zero, 30+ regions, and bring-your-own-container deploys\[8]. * **Pricing:** Per-second, no egress fees. H100 PCIe from $1.99/hour, A100 80GB from $1.19/hour, RTX 4090 from $0.34/hour\[8]. * **Performance:** Full control, at the cost of operating it yourself. * **Best for:** Teams that want the lowest GPU-hour and can do their own serving. * **Vs WaveSpeed:** Cheaper raw compute, but you build the latency that WaveSpeed sells out of the box. ### 5. reAPI: best for a curated media and LLM catalog reAPI provides 200+ image, video, audio, and chat models without the prepayment gates. Chat and media use separate gateways, keys, and balances; rates vary by model and task, so use the live rate card for the current comparison. * **Features:** Curated frontier media models (Veo 3.1, Seedance 2.0, Wan 2.7, Kling, HappyHorse 1.0, Imagen 4, Seedream 5.0, GPT-Image-2, Gemini 3 Pro Image) plus frontier LLMs (GPT-5, Claude Opus 4.8, Gemini). Chat is OpenAI-compatible; image and video use a separate media gateway, key, and balance. * **Pricing:** Model-specific output units: GPT-Image-2 from $0.0045/image; Seedance 2.0 Mini at 480p is (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per output second without source video or (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second with source video (output duration plus the total source-video duration, rounded up); Veo 3.1 Fast from (live price: https://reapi.ai/models/veo3-1/llms.txt)/generation. Pay-as-you-go credits at 1 credit = $0.001, no subscription, free credits to start. * **Performance:** Same upstream frontier models, so quality matches the source; the win is a simpler cost and access model. * **Best for:** Teams that want media and LLM access from one platform without juggling throughput tiers, while keeping the two workspace credentials separate. * **Vs WaveSpeed:** reAPI has no prepayment tiers gating concurrency. Its chat and media workspaces use separate keys and balances, with OpenAI compatibility on the chat gateway. ## WaveSpeed vs. the top alternatives at a glance | Platform | Catalog | Modalities | Pricing model | OpenAI-compatible | Best for | | ----------- | --------------------- | ---------------------------- | --------------------------------- | ----------------- | ------------------------------ | | WaveSpeed | 1,000+ models | Image, video, audio, 3D, LLM | Pay-per-use, tiered throughput | Yes | Speed-first unified API | | fal.ai | 1,000+ media models | Image, video, audio, 3D | Per-output + prepaid credits | No | Media speed | | Replicate | Thousands (community) | Image, video, some LLMs | Per-second hardware or per-output | No | Custom + community models | | Together AI | 176 models | Chat, vision, image, audio | Per-token + dedicated GPU/hour | Yes | Open-source LLMs | | RunPod | Bring your own | Anything you deploy | Per-second GPU + serverless | Partial | Raw GPU control | | reAPI | 200+ models | Image, video, audio, chat | Pay-as-you-go credits | Yes (chat) | Published model-specific rates | Catalog and pricing figures are from each vendor's official pages as of May 2026; rates change, so confirm before you commit. ## What the numbers say about pricing WaveSpeed and reAPI price the same way on the surface, both pay-per-use with per-image and per-second rates. The difference is the terms around the number. * **WaveSpeed** is pay-per-use, but real throughput is gated: default accounts are rate-limited, and lifting the cap means prepaying into $100, $1,000, or higher tiers\[2]. Listed prices are also base rates that move with resolution\[1]. * **reAPI** media runs on a pay-as-you-go credit balance with no prepayment tier gating concurrency; chat uses its separate workspace balance. * **fal.ai** is output-based and prepaid; **Replicate** is per-second hardware; **Together AI** is per-token; **RunPod** is per-second GPU\[3]\[5]\[6]\[8]. The honest read: WaveSpeed is a strong pick when latency is the priority and you will prepay for throughput. If you want published model-specific rates without the tier ladder, reAPI is simpler to evaluate. ## Moving from WaveSpeed to reAPI For text, both platforms offer an OpenAI-compatible path, so a move is mostly a base-URL and key swap. Media calls move to reAPI's separate REST gateway. ```python from openai import OpenAI client = OpenAI( base_url="https://api.reapi.ai/v1", api_key="YOUR_CHAT_API_KEY", ) resp = client.chat.completions.create( model="claude-opus-4-8", messages=[{"role": "user", "content": "Write the product blurb."}], ) ``` Image and video use `https://reapi.ai/api/v1` with a separate media key and balance. Because both are pay-per-use, a hybrid trial is easy: keep latency-critical jobs on WaveSpeed, route the rest through reAPI, and compare real invoices before committing. ## FAQ ### Is WaveSpeed AI good? For latency-sensitive generation, yes. WaveSpeed advertises sub-second inference and zero cold starts across a 1,000+ model catalog\[2]. The reasons to consider a WaveSpeed alternative are the $1 trial, the prepayment-gated throughput tiers, and pricing that moves with parameters\[1]. ### Which WaveSpeed alternative is OpenAI-compatible? Together AI and reAPI's chat gateway expose OpenAI-compatible APIs, so you can reuse an existing OpenAI client for chat by changing the base URL\[7]. fal.ai and Replicate use their own clients. ### Which WaveSpeed alternative has the best free tier? reAPI starts new accounts with free credits, and Hugging Face offers free serverless inference credits. WaveSpeed's own trial is $1\[1]. fal.ai, Replicate, and Together AI are prepaid, with Together requiring a $5 minimum\[7]. ### Does any WaveSpeed alternative cover both media and LLMs? reAPI does, through an OpenAI-compatible chat gateway and a separately keyed media gateway. Replicate spans both as well, per-model on community infrastructure\[5]. fal.ai is media-only. ### Which is cheaper, WaveSpeed or its alternatives? It depends on volume and throughput needs. RunPod is cheapest for raw GPU time, while reAPI publishes model-specific rates without WaveSpeed's prepayment tiers\[8]. Compare the pricing model against your traffic, not just the headline rate. ## Choosing a WaveSpeed alternative WaveSpeed earns its niche on speed, and it is a fair pick if low latency justifies prepaying for throughput. The case for a WaveSpeed alternative is usually the terms: a real free balance, no tier ladder gating concurrency, or stable per-call pricing. fal.ai matches it on managed media, Replicate on catalog, Together AI on open LLMs, and RunPod on raw GPU cost. If you want media and LLM access from one platform and can keep their workspace credentials separate, reAPI is the WaveSpeed alternative built for that. Pilot two, and let your own invoices decide. ## Further reading * [reapi.ai/models](/models) — image, video, audio, and chat models across separate gateways. * [What is reAPI?](/blog/what-is-reapi) — quickstart, pricing, and how the API works. * [Best fal.ai alternatives](/blog/best-fal-ai-alternatives) — the same comparison for fal.ai. ## References 1. WaveSpeed AI. *Pricing — pay-per-use rates and trial credits.* Retrieved May 2026 from wavespeed.ai/pricing 2. WaveSpeed AI. *Platform overview, performance, and API.* Retrieved May 2026 from wavespeed.ai/about 3. fal.ai. *Pricing — per-model rates for image and video.* Retrieved May 2026 from fal.ai/pricing 4. fal.ai. *Documentation — platform overview, model APIs, and SDKs.* Retrieved May 2026 from fal.ai/docs 5. Replicate. *Pricing — hardware and per-output model rates.* Retrieved May 2026 from replicate.com/pricing 6. Together AI. *Pricing — serverless tokens and dedicated GPUs.* Retrieved May 2026 from together.ai/pricing 7. Together AI. *OpenAI compatibility and model catalog.* Retrieved May 2026 from docs.together.ai/docs/inference/openai-compatibility 8. RunPod. *Pricing — GPU cloud and serverless rates.* Retrieved May 2026 from runpod.io/pricing --- # How to Control AI Video Camera Movement with Blender Previz (https://reapi.ai/blog/blender-ai-video-camera-previs) **Blender camera previz gives an AI video model a visible path, spatial layout, and timing reference before generation begins.** You build the scene from boxes, move a camera through it, export an intentionally rough preview, then ask the video model to preserve that choreography while replacing the gray geometry with the final world. “Previz” means previsualization. It is not the finished 3D shot. A beginner can make a useful blockout without modeling, materials, rigging, or photorealistic rendering. ## TL;DR * Use cubes and simple figures to represent the set and subject. * Match the final aspect ratio and choose a real delivery duration first. * Animate one camera move with keyframes or a Follow Path constraint. * Use a target object to keep framing stable when the camera travels. * Export a fast viewport preview with clear depth and subject placement. * Tell the video model to copy camera, blocking, and timing but ignore the gray materials. * Review trajectory and contact before color, texture, or cinematic polish. ![Blender-to-AI-video workflow showing gray-box blocking, constrained camera path, preview export, generated shot, and comparison review](https://cdn.reapi.ai/media/blog/blender-ai-video-camera-previs/blender-camera-previs-workflow.png) ## When Blender is worth using Use Blender previz when the camera move must be repeatable or when text leaves too much room for interpretation. It is especially useful for: * an orbit that stops on an exact angle; * a reveal around foreground geometry; * a crane or dolly move with several height changes; * a subject moving through doorways or around obstacles; * a sequence of shots that should share camera language; * impossible virtual moves that are difficult to record physically. For loose handheld work, a [phone camera motion reference](/blog/phone-camera-motion-ai-video) is faster. Blender earns its setup time when you want reusable geometry, controlled paths, and the ability to change one camera parameter without recording again. ## What to install and prepare You need: * Blender from the official project; * a mouse with a scroll wheel, if available; * a written start frame and end frame; * approximate scene dimensions; * the final aspect ratio and shot duration; * a still image that defines the final subject or style; * a public HTTPS location for the exported preview when calling an API. Do not begin by downloading complex assets. Simple geometry keeps the reference legible and avoids wasting time on details the video model will replace. ## Step 1: Set the timeline and camera format Open a new Blender scene. In **Output Properties**, set the resolution to a 16:9 size such as 1280 × 720 for a landscape preview. Set the frame rate to 24 or 30 fps and choose the final frame from the intended duration. For example: ```text 6 seconds × 24 fps = 144 frames ``` Use a low preview resolution because the purpose is motion guidance. The final video model, not Blender, will produce the detailed image. ## Step 2: Build the scene with gray boxes Keep the default cube and resize it into a table, wall, or product stand. Add more cubes for doors, counters, foreground shapes, and obstacles. Use a simple cylinder or mannequin-like stack of primitives for the subject. Three depth layers make the camera path easier to read: 1. **Foreground:** an object the camera passes or reveals around. 2. **Midground:** the subject or product. 3. **Background:** a wall, doorway, or large object that shows parallax. Give major categories different flat colors if the gray scene becomes hard to read. Keep the subject one color and the environment another. Avoid detailed textures and reflective materials. ## Step 3: Place the camera and save the starting composition Add or select the camera. Use `Numpad 0` to enter camera view. If you do not have a number pad, use **View → Cameras → Active Camera**. Choose the start composition before animating: * Is the subject the correct size in frame? * Is the foreground object visible enough to create a reveal? * Is there room in the direction of movement? * Is the camera height plausible for the intended shot? * Does the horizon match the mood? Set the camera focal length in **Camera Properties**. Do not animate focal length yet. A fixed lens makes it easier to understand whether the motion comes from camera travel or zoom. ## Step 4: Animate the simplest useful path There are two beginner methods. ### Method A: two or three camera keyframes At frame 1, position the camera and insert a location and rotation keyframe with `I`. Move to the final frame, reposition the camera, and insert another keyframe. Add a middle keyframe only when the path needs a deliberate bend or height change. Open the Graph Editor and use smooth interpolation when you want gradual starts and stops. Use linear interpolation when the camera should travel at a constant speed. ### Method B: a Follow Path constraint Add a Bézier curve and shape it into the travel path. Select the camera, add a **Follow Path** constraint, and choose the curve as the target. Blender's manual describes Follow Path as a constraint that places an object on a curve and can orient it along the curve's bends.\[1] This method is useful when the move arcs around a subject. It also makes the path visible and reusable. Keep the curve simple: too many control points create small speed and direction changes that the final model may exaggerate. ## Step 5: Add a target for stable framing A camera can follow a good path and still point in the wrong direction. Add an Empty at the subject's chest or product center, then use a **Track To** or **Locked Track** constraint so the camera continues to face that target. The target may move if the subject moves. Animate the Empty with the subject rather than changing camera rotation on every frame. This separation gives you two independent controls: * the curve or location keyframes control where the camera travels; * the target controls what it looks at. For a reveal, target the subject from the start even while the foreground object occludes it. For a planned reframing, animate the target from one object to another gradually. ## Step 6: Add subject motion only when necessary If the shot tests camera movement, keep the subject still. Add subject motion only when camera and subject interaction is essential—for example, following a person through a doorway. Represent walking with a sliding block or simple mannequin. The preview does not need a walk cycle. It only needs to communicate location, speed, direction, and contact with the floor. Use clear constraints: ```text Subject begins at X marker. Subject walks left to right from frames 30-110. Camera begins moving at frame 1 and stops at frame 132. Subject reaches the doorway before the camera crosses the foreground pillar. Frames 132-144 are a stable end hold. ``` ## Step 7: Preview and simplify Play the timeline in camera view. Watch at normal speed and answer: * Does the move communicate one clear idea? * Does the subject stay framed? * Does the camera collide with geometry? * Is the speed readable rather than frantic? * Does the final hold last long enough for an edit? If the path feels wrong in gray boxes, generation will not fix it. Simplify the curve, move the target, or adjust timing before exporting. ## Step 8: Export a fast reference video Use Blender's viewport render or a low-quality Eevee render. The preview should show clean silhouettes, depth, and camera movement. It does not need shadows or materials. Export an MP4 at the same aspect ratio as the intended result. Confirm that it begins and ends on stable frames. Then upload it to a location the video API can read over HTTPS. ## Step 9: Tell the AI model what the previz controls Pair the preview with a final look image and assign roles explicitly. ```text Video 1 is a gray-box camera and blocking reference. Match its camera path, timing, subject position, foreground reveal, scale changes, and ending hold. Ignore its materials, colors, primitive shapes, and lack of detail. Image 1 defines the final character, wardrobe, lighting, and cinematic style. Replace the gray-box environment with a small live-music room while preserving the same spatial layout. Keep the subject centered after the reveal. No cuts, no digital zoom, no additional people, and no camera path changes. ``` ByteDance describes multimodal video references as control for composition, camera language, and motion rhythm, which is the reason the blockout can remain visually crude.\[2] ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedance-2.5-face", "prompt": "Video 1 is gray-box camera and blocking guidance. Match path, timing, spatial layout, reveal, and ending hold. Ignore primitive appearance. Image 1 defines the performer, room style, and lighting. No cuts or digital zoom.", "video_urls": ["https://example.com/blender-previs.mp4"], "image_urls": ["https://example.com/final-look.jpg"], "resolution": "720p", "size": "16:9", "duration": 6, "generate_audio": false }' ``` Check the [Seedance 2.5 API documentation](/docs/seedance-2-5) for current input limits, task behavior, and rates before production use. ## Step 10: Compare the generated shot with the blockout Review both clips side by side at the same speed. | Element | Accept when | Repair when | | -------------- | ------------------------------------------------------- | ----------------------------------------- | | Camera path | Direction and arc match | Camera shortcuts or reverses | | Timing | Reveal and stop occur at intended moments | Move starts or ends too early | | Framing | Subject stays in planned region | Target drifts or leaves frame | | Spatial layout | Foreground, subject, background keep their relationship | Geometry collapses or swaps depth | | Contact | Subject remains grounded and avoids obstacles | Feet slide or body crosses objects | | End state | Final composition holds cleanly | Camera continues moving through cut point | If the camera path fails, revise the blockout or reduce its complexity. If the look fails, keep the approved blockout and change the style reference. This is the practical benefit of previz: movement and appearance no longer have to be debugged in the same artifact. ## Common beginner mistakes ### Building a detailed set before testing the camera Detail hides the real question. Start with boxes, approve the path, and only add geometry when it changes occlusion or navigation. ### Using too many path control points Each point can introduce a turn or speed change. Use the minimum needed to describe the path. ### Animating path, target, lens, and subject at once You cannot tell which layer caused the failure. Lock the lens, test the camera, then add subject or target changes. ### Exporting without an end hold The generated shot may continue moving until the last frame. Add a deliberate hold in the preview and repeat it in the prompt. ### Treating previz as a native Blender integration The video model receives a rendered reference clip, not the `.blend` scene or its constraints. Blender creates the instruction layer; the model interprets the rendered result. ## FAQ ### Do I need to know Blender animation? Only basic object movement, camera view, keyframes, and optionally a Follow Path constraint. You can ignore character rigging and final rendering. ### Should the blockout use realistic materials? No. Flat colors and clear silhouettes are usually easier to interpret and faster to change. ### Can an AI agent operate Blender for this workflow? Yes, tools can automate scene construction and parameter changes, but beginners should understand the path, target, timing, and export steps first. Automation does not remove the need to inspect the preview. ### Is a camera path deterministic after generation? No. It is a strong visual reference, not an exported animation curve inside the video model. Expect interpretation and review the result. ### When should I use phone recording instead? Use a phone when natural handheld feel matters and the move can be performed in physical space. Use Blender when the path must be reusable, impossible to film, or coordinated with virtual geometry. ## Conclusion Blender camera previz turns camera direction into an asset you can see, edit, and reuse. Build only the geometry that affects space, separate travel from targeting, export a clear low-detail preview, and tell the AI model exactly what that clip controls. The final output remains generative, but the camera no longer starts from a paragraph and a guess. ## References 1. Blender Foundation. *Follow Path Constraint — Blender Manual.* Retrieved August 27, 2026. [docs.blender.org](https://docs.blender.org/manual/en/latest/animation/constraints/relationship/follow_path.html) 2. ByteDance Seed. *Seedance 2.0 Official Launch.* February 12, 2026. [seed.bytedance.com](https://seed.bytedance.com/en/blog/seedance-2-0-%E6%AD%A3%E5%BC%8F%E5%8F%91%E5%B8%83) 3. reAPI. *Seedance 2.5 API — Parameters, Modes & Billing.* Retrieved August 27, 2026. [reapi.ai](/docs/seedance-2-5) --- # Seedance 2.5 Local Use: Can You Run 2.0 or 2.5 Offline? (https://reapi.ai/blog/can-you-run-seedance-locally) A **Seedance 2.5 local installation is not available from the official download sources checked on September 12, 2026**. The ByteDance and ByteDance Seed Hugging Face model listings returned no Seedance matches, while the official 2.5 model page directed users to an app and an API.\[1]\[2] The same listing check did not identify downloadable Seedance 2.0 checkpoints. You can still use Seedance from software running on your computer. ComfyUI, for example, added Seedance 2.5 through a Partner Node.\[3] The distinction is where generation happens: a local interface can send a request to a hosted model without downloading that model's weights. If offline inference is your requirement, choose a model that actually publishes checkpoints and a local inference implementation. ## TL;DR * No Seedance checkpoints appeared in the two official Hugging Face model searches checked on September 12. This is a dated, scoped finding, not a claim about every file on the internet.\[1] * Seedance 2.5 is available in ComfyUI through Partner Nodes, announced August 8. Partner Nodes call external APIs and require a Comfy account, credits, and network access.\[3]\[4] * Wan 2.2 TI2V-5B has downloadable weights and a documented single-GPU command requiring at least 24GB VRAM with its listed memory-saving options.\[5] * HunyuanVideo-1.5 documents a minimum of 14GB GPU memory with model offloading, an NVIDIA CUDA GPU, Linux, and Python 3.10 or later.\[6] * If the required model is Seedance itself, [reAPI's hosted API](/models/seedance-2-5) provides a documented request and polling workflow. Running the client locally does not move inference onto your GPU.\[7] ## What Seedance 2.5 local deployment would require Local inference needs the model's weights and compatible software that loads them. A prompt library, a web interface, and an API client can all be useful, but none supplies the missing checkpoint. A model name in a repository title is not enough to establish that the model can run offline. For this update, we checked the official Seedance 2.5 page and the Seedance-filtered model lists under both `ByteDance` and `ByteDance-Seed` on Hugging Face. The model lists showed no match. The model page's access buttons pointed to Dreamina and BytePlus.\[1]\[2] That evidence supports a practical answer: there is no official Seedance 2.0 or 2.5 checkpoint installation to recommend from those sources today. It does not support claims that every third-party repository is malicious, that no private deployment exists, or that ByteDance will never release weights. Use four questions to evaluate a future download announcement: | Question | Evidence to look for | | ----------------------- | ---------------------------------------------------------------------------------- | | Who published it? | A model developer's official account or a download linked from its model page. | | What is downloaded? | Model checkpoints, not only workflow JSON, prompts, sample videos, or client code. | | How does inference run? | Documented code that loads those checkpoints and executes the model. | | What use is permitted? | The model's own license and any conditions attached to its weights. | The same checks help answer searches for Seedance 2.5 open source. Open-source software around a model does not establish an open-weight release of that model. A client can have a permissive software license while still depending on a paid remote service. ## What Seedance repositories on GitHub actually contain Read the installation and configuration instructions before drawing conclusions from a GitHub title. The ByteDance Seed repository search inspected for this article did not produce a Seedance inference repository. Its results are useful evidence about that particular organization, not a census of all third-party projects.\[8] ByteDance's own AgentKit sample gives a concrete example of the distinction. Its video-generation skill asks for an API key and exposes an API base URL configuration. The repository includes a change updating its default Seedance model to 2.5, but the published instructions still describe a client that calls a video service.\[9] Official client code and downloadable model weights are different deliverables. For a third-party project, inspect the same parts: its configuration, the actual inference command, and the files the command loads. If it asks for a hosted-service key, determine what it sends and where. If it includes checkpoint links, identify the publisher and exact model family before treating them as Seedance. A useful label for an API integration is “run a Seedance client locally.” Calling it “run Seedance locally” leaves out the part that matters to someone choosing hardware, planning offline work, or deciding where source media will be processed. There is also no responsible Seedance 2.5 model size estimate to derive from these repositories. Without a published checkpoint and configuration, a claimed download size or GPU requirement would be speculation. Do not buy a GPU around a number attached to an unverified installer. ## ComfyUI runs Seedance 2.5 through a hosted Partner Node ComfyUI's August 8 announcement explicitly describes the integration as a Partner Node and provides text-to-video and reference-to-video workflow templates.\[3] The templates connect workflow nodes; they do not contain the underlying Seedance weights. Comfy's documentation explains the runtime boundary: Partner Nodes connect to external model APIs. They require a logged-in Comfy account with a positive credit balance, along with connectivity to the service.\[4] Installing ComfyUI locally therefore gives you a local workflow editor while the Seedance request remains hosted. If you already work in ComfyUI, follow these setup steps: 1. Update ComfyUI to a version containing the relevant Partner Nodes. 2. Sign in using the Comfy account controls and confirm the available credits. 3. Load the official Seedance 2.5 template from the template panel or the announcement. 4. Inspect the nodes that will call external services before adding source material. 5. Set the inputs and review the generation charge before submitting. The version, account, and network requirements come from Comfy's Partner Node guide.\[4] We reviewed the documentation without submitting a charged Comfy generation. Hybrid workflows can still be valuable. You might prepare an image with local tools, send selected references to Seedance, and process the returned video with local nodes. Comfy documents this combination of external and local components.\[4] If the requirement is that source files never leave the machine, inspect the entire workflow rather than assuming that a localhost address guarantees it. ## Two downloadable video models with documented hardware Wan 2.2 TI2V-5B and HunyuanVideo-1.5 provide concrete starting points for local video generation. Both publish model downloads and inference instructions. They are alternatives to hosted generation, not local editions of Seedance or evidence of equivalent output quality.\[5]\[6] | Local model | Published hardware guidance | Qualification that matters | | ---------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | Wan 2.2 TI2V-5B | At least 24GB VRAM for the documented single-GPU command.\[5] | The command uses model offloading, dtype conversion, and the text encoder on CPU. | | HunyuanVideo-1.5 | Minimum 14GB GPU memory with model offloading enabled.\[6] | The official environment uses an NVIDIA CUDA GPU, Linux, and Python 3.10 or later. | For Wan, choose the exact variant before using the memory figure. The TI2V-5B instructions support text-to-video and image-to-video in one model. Its documented landscape size is 1280×704, described as the model's 720p setting. The larger T2V-A14B reference command instead lists at least 80GB VRAM.\[5] “Wan 2.2 needs 24GB” is therefore too broad. The Hunyuan figure also depends on configuration. Its 14GB minimum is explicitly measured with offloading enabled. The documentation says users with sufficient memory can disable offloading for faster inference.\[6] That is not a guarantee that every resolution, duration, optimization, and operating system will fit the minimum. Start with the project's documented example and keep the variant, checkpoint, resolution, and offloading settings together in your notes. Then change one setting at a time. This makes an out-of-memory result useful: you know which change caused it instead of comparing unrelated minimum-memory claims. We retrieved these hardware instructions on September 12; we did not benchmark either model on the reader's hardware. Check each project's current license before distributing a packaged application or using its weights commercially. ## Choose local inference for the requirement it actually solves Choose a downloadable model when operating without a hosted generation service is part of the requirement. Examples include working offline after setup, controlling the inference environment, or experimenting with the model's published training and adaptation tools. Confirm that any optional prompt-rewriting or enhancement components also run where you expect. Choose a hosted Seedance route when using the specific Seedance model is the requirement. The [reAPI API quickstart](/blog/seedance-2-5-api-quickstart) covers the first request, and the [model page](/models/seedance-2-5) shows the playground and live rates. Its published contract supports text, image, first/last-frame, and reference-driven jobs, with asynchronous result retrieval.\[7] Hardware ownership also changes the cost question. Local generation consumes hardware capacity, electricity, storage, and maintenance time. A hosted request has a listed charge and service-specific billing rules. Compare the costs over the amount of work you actually expect to complete, rather than dividing a GPU price by a guessed cost per clip. If you already own suitable hardware, a local model may be worth trying before buying anything else. If you specifically need Seedance, purchasing more VRAM does not supply the missing official checkpoints. Keep the model requirement and the deployment requirement separate. ## FAQ ### Seedance 2.5 open source No Seedance checkpoints were found in the official ByteDance and ByteDance Seed Hugging Face listings checked on September 12, 2026. The official 2.5 page directs users to app and API access.\[1]\[2] ### Seedance 2.5 local You can run an API client or workflow editor locally. That does not run the Seedance model on your GPU; Comfy's official integration uses external Partner Node APIs.\[4] ### Seedance 2.5 GitHub Check what a repository contains. ByteDance's own sample configures a video-service API key, so it demonstrates API integration rather than a local checkpoint installation.\[9] ### Seedance 2.5 Hugging Face The Seedance-filtered model lists under ByteDance and ByteDance Seed returned no matches during this review. A Space, demo, or third-party upload needs separate verification of where inference happens.\[1] ### Seedance 2.5 ComfyUI Yes, through the official Partner Node integration announced August 8, 2026. It requires the account, credits, and connectivity described in Comfy's documentation.\[3]\[4] ### Seedance 2.5 system requirements There is no official local-checkpoint requirement to recommend from the sources checked. For API access, follow the client or interface requirements. For local alternatives, use the exact model's published hardware configuration.\[1]\[4] ### Seedance 2.5 model size The checked official pages did not provide a downloadable Seedance 2.5 checkpoint size. A workflow file's size or an API client's package size cannot be used to estimate the model's weights.\[1]\[2] ### Seedance 2.5 open weight An official open-weight release was not found in the checked sources as of September 12. This finding does not predict whether ByteDance will release weights later.\[1] ## Match the deployment to the job For Seedance 2.5 local use, decide whether you need a local interface or local inference. The first has a documented ComfyUI route; the second needs a downloadable model such as the alternatives above. To use Seedance itself through a documented service, start with [Seedance 2.5 on reAPI](/models/seedance-2-5). ## References 1. ByteDance and ByteDance Seed. *Official Hugging Face model listings filtered for Seedance.* Retrieved September 12, 2026 from [huggingface.co/ByteDance/models](https://huggingface.co/ByteDance/models?search=seedance) and [huggingface.co/ByteDance-Seed/models](https://huggingface.co/ByteDance-Seed/models?search=seedance). 2. ByteDance Seed. *Seedance 2.5 official model page and access buttons.* Retrieved September 12, 2026 from [seed.bytedance.com/en/seedance2\_5](https://seed.bytedance.com/en/seedance2_5). 3. Comfy. *Seedance 2.5 is now available via Partner Nodes.* Published August 8, 2026; retrieved September 12, 2026 from [blog.comfy.org/p/seedance-25-is-now-available-via](https://blog.comfy.org/p/seedance-25-is-now-available-via). 4. Comfy. *Partner Nodes: external API services, account requirements, credits, and network access.* Retrieved September 12, 2026 from [docs.comfy.org/tutorials/partner-nodes/overview](https://docs.comfy.org/tutorials/partner-nodes/overview). 5. Wan-Video. *Wan2.2: model downloads and single-GPU inference instructions.* Retrieved September 12, 2026 from [github.com/Wan-Video/Wan2.2](https://github.com/Wan-Video/Wan2.2). 6. Tencent Hunyuan. *HunyuanVideo-1.5: system requirements and checkpoint instructions.* Retrieved September 12, 2026 from [github.com/Tencent-Hunyuan/HunyuanVideo-1.5](https://github.com/Tencent-Hunyuan/HunyuanVideo-1.5). 7. reAPI. *Seedance 2.5 API documentation.* Retrieved September 12, 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5). 8. ByteDance Seed. *Official GitHub organization repository search.* Retrieved September 12, 2026 from [github.com/orgs/ByteDance-Seed/repositories](https://github.com/orgs/ByteDance-Seed/repositories?q=seedance). 9. ByteDance. *AgentKit samples: Seedance video-generation skill.* Retrieved September 12, 2026 from [github.com/bytedance/agentkit-samples](https://github.com/bytedance/agentkit-samples/blob/main/skills/byted-seedance-video-generate/SKILL.md). --- # Can You Tell If a Writer Used ChatGPT? Patterns, Not Proof (https://reapi.ai/blog/can-you-tell-if-writer-used-chatgpt) You probably cannot prove that a writer used ChatGPT by circling one sentence. You can, however, notice when an article repeatedly chooses the safest possible opening, the neatest possible transition, and the vaguest possible conclusion. That distinction matters. A cluster of predictable writing habits may justify a closer read. It does not establish who—or what—wrote the page. Even purpose-built classifiers can produce false positives, and ordinary readers are less consistent than classifiers. The better question is not “Which forbidden phrase gives ChatGPT away?” It is “Does this article contain enough specific thought, evidence, and editorial judgment to earn trust?” This guide answers that question without pretending style is forensic evidence. ## TL;DR * **No single word, transition, metaphor, or punctuation mark proves ChatGPT use.** Human writers share every commonly cited “AI phrase.” * Suspicion usually comes from a **repeated combination**: interchangeable opening, over-signposting, symmetrical lists, vague authority, inflated significance, and a conclusion that restates rather than decides. * A polished article can be human, AI-assisted, heavily edited, or fully generated. The finished text rarely reveals a clean binary history. * AI detectors are useful as screening signals, not verdicts. OpenAI withdrew its own classifier in 2023 because of low accuracy, and published research has found false-positive risks for non-native English writers.\[2]\[3] * For editorial review, test **claims, sources, specificity, provenance, and revision history** before arguing over “AI-sounding” vocabulary. ## Why readers think they can spot ChatGPT writing Once a verbal habit has been labeled “AI,” it becomes difficult to stop seeing it. A transition such as “However, it is important to note” feels diagnostic because it is common, formal, and easy to remember. The same happens with em dashes, three-part lists, rhetorical questions, and endings about “the future.” The trouble is base rates. Those devices were common in corporate copy, student essays, journalism, and search-optimized articles long before ChatGPT. Language models learned them because people wrote them. Finding one in a new article is therefore compatible with several explanations: * the writer used ChatGPT and pasted the result; * the writer used an AI draft, then revised it; * the writer used AI only for grammar or structure; * the writer follows a conventional editorial template; * the writer simply likes that phrase. Matt Lillywhite's essay about commenters acting as “AI detectives” captures the social version of the problem: once someone learns a few supposed tells, almost any polished sentence can be made to look suspicious.\[1] The observation is useful. The certainty is not. ## Seven patterns that make writing feel AI-generated These are editorial symptoms, not proof of authorship. One occurrence means little. Repetition across the whole page is what makes the prose feel manufactured. ### 1. The opening could introduce almost any topic An interchangeable introduction announces that a subject is changing the world, asks whether the reader has ever wondered about it, then promises a comprehensive exploration. Replace the topic with cloud computing, espresso, or retirement planning and the paragraph still works. A stronger opening spends its first lines on a claim the article can actually defend: | Interchangeable opening | Specific opening | | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | “In today's rapidly evolving digital landscape, AI is transforming how we write.” | “A reader cannot prove ChatGPT use from one phrase; the useful evidence is a repeated lack of specificity.” | | Announces a broad trend | Makes a contestable claim | | Delays the answer | Starts with the answer | ### 2. Every paragraph arrives with a signpost Transitions are helpful until they begin narrating the existence of the article: “First and foremost,” “It is also worth noting,” “On the other hand,” “Ultimately,” “In conclusion.” The reader can feel the outline under every paragraph. Human editing often removes half of these bridges. When the next sentence logically follows, it does not need a crossing guard. ### 3. The rhythm never changes Generated prose often settles into similarly sized paragraphs and similarly balanced sentences. Each section explains a point, adds a caveat, and closes with a tidy implication. Nothing is technically wrong. Nothing surprises the ear. Good prose is not random, but it has pressure. A short sentence can stop an argument. A longer one can carry evidence and qualification together. A fragment, used deliberately, can change pace. Uniform rhythm makes even accurate information feel preassembled. ### 4. Lists are suspiciously complete Three benefits. Five challenges. Seven best practices. The number is chosen before the reporting is done, so every item receives equal visual weight even when only two matter. This is not an argument against lists. It is an argument for hierarchy. If one finding changes the decision and four are minor, the article should say so instead of presenting five democratic bullets. ### 5. Authority is invoked but never located Phrases such as “experts agree,” “studies show,” and “research suggests” create the shape of evidence without giving the reader anything to inspect. This problem is more serious than style because it can hide a fabricated or distorted claim. Replace vague authority with a named source, date, method, and limit. “A 2023 study tested seven detectors on TOEFL essays” is auditable. “Research proves AI detectors are biased” is a slogan. ### 6. Every observation becomes historic AI drafts are prone to significance inflation: a feature is “groundbreaking,” a workflow is a “game changer,” and every launch “marks a pivotal moment.” When every paragraph reaches for consequence, none of the consequences feel earned. Concrete effects are more persuasive. Say that a change removes one API call, cuts a batch from 20 minutes to 12, or lets an editor verify a source. Scale the adjective to the evidence. ### 7. The conclusion summarizes but never chooses Weak conclusions repeat the headings, say the future is exciting, and advise readers to embrace innovation responsibly. Strong conclusions resolve the tension introduced at the start. For this article, the resolution is simple: readers can recognize weak, generic writing, but should not convert that editorial judgment into a confident claim about authorship. ![A visual framework separating writing signals from evidence of authorship](https://cdn.reapi.ai/media/blog/can-you-tell-if-writer-used-chatgpt/can-you-tell-if-writer-used-chatgpt-signals-vs-proof.png) ## What is not reliable evidence of ChatGPT use Online checklists often treat ordinary language features as fingerprints. None of the following is reliable on its own: * em dashes or semicolons; * words such as “delve,” “nuanced,” “landscape,” or “tapestry”; * a three-item list; * grammatically clean prose; * headings and bullet points; * an analogy or decorative metaphor; * a low or high score from one detector; * publication frequency without access to the writer's workflow. The last item deserves care. Publishing several researched pieces every day may raise a reasonable operational question, especially for a solo author. It still does not tell you whether the work was generated, dictated, ghostwritten, collaboratively edited, or assembled from prior research. Ask for provenance rather than inventing it. ## Why AI detectors should not be treated as verdicts AI-text detection is classification under uncertainty. A tool estimates whether statistical patterns resemble examples in its training data. It does not recover a document's revision history. OpenAI retired its public AI-writing classifier after reporting a low accuracy rate. In its own challenge set, it caught only 26% of AI-written text as “likely AI-written” and mislabeled 9% of human text.\[2] Those figures describe one old classifier, not every current product, but they illustrate why a score needs context. A peer-reviewed 2023 study also found that several detectors disproportionately mislabeled writing by non-native English speakers.\[3] Later detector designs and evaluations may perform differently. The responsible conclusion is not “all detectors are useless.” It is that consequences should not rest on one opaque score. Use a detector to prioritize review, compare passages, or evaluate your own content pipeline. The [reAPI AI text detector](/docs/ai-text-detector), for example, returns a score that can be combined with editorial checks. Do not describe that score as proof. ## A fairer five-step review for suspicious writing ### 1. Separate quality from authorship Mark generic claims, repetition, weak sourcing, and factual errors without guessing how they were produced. A poor article remains poor even if a human wrote every word. A useful, accurately sourced article does not become useless merely because software assisted with a draft. ### 2. Verify the consequential claims Open the sources. Check whether the cited page supports the number, whether the date is current, and whether a comparison uses the same conditions. Fabricated references and confident mismatches are stronger editorial evidence of an unreliable process than any transition word. ### 3. Look for information gain Ask what the page contributes beyond the first five search results. Original testing, a worked example, a decision framework, a primary-source comparison, or a clear limitation all count. A beautifully formatted summary of summaries does not. Google's current guidance takes the same practical position: generative AI can help with research and structure, but scaled pages without added value may violate its spam policy; accuracy, quality, relevance, and context matter more than the mere presence of automation.\[4] ### 4. Check provenance when stakes are high For a newsroom, school, regulated workflow, or competition, ask for outlines, source notes, version history, or a disclosure of allowed tools. Process evidence is more useful than stylistic intuition because it addresses what actually happened. ### 5. Use a human decision Treat tool output and stylistic patterns as inputs. Let a qualified reviewer weigh the stakes, policy, evidence, and the author's response. If a false accusation could affect a grade, job, or reputation, the review threshold should be correspondingly high. ## A compact editor's checklist Before publishing, ask: * Does the first paragraph make a claim specific to this topic? * Does each section add evidence or a decision, rather than restate the premise? * Can the reader identify the source behind every important number? * Are limitations stated next to the claims they limit? * Does sentence length and paragraph shape vary naturally? * Have decorative transitions and inflated adjectives been cut? * Does the conclusion decide something? * If AI assisted the work, has a human verified every factual claim? If the answer is no, improve the article. Do that regardless of who drafted it. ## FAQ ### Can people accurately tell when writing is from ChatGPT? People can notice generic or repetitive prose, but style alone cannot reliably establish authorship. Human and AI writing overlap, and many documents are produced through mixed workflows. ### What words make writing look AI-generated? Words such as “delve,” “landscape,” and “nuanced” are frequently cited online, but no word proves AI use. Repetition, vagueness, weak evidence, and uniform structure are more useful editorial signals than vocabulary blacklists. ### Are AI detectors accurate? Accuracy varies by detector, text length, language, model, editing, and evaluation set. Use detector scores as screening signals and combine them with source checks and process evidence, especially when a false positive has consequences. ### Does Google penalize AI-written content? Google's guidance focuses on whether content is accurate, useful, original, and made for people. It warns against scaled generation without added value rather than declaring all AI-assisted content ineligible.\[4] ### Should writers disclose ChatGPT use? Follow the policy of the publisher, employer, school, or platform. When automation materially shaped reporting or the final text, a clear disclosure can give readers useful context. Grammar assistance may be treated differently from generated claims or passages. ## The useful tell is editorial, not forensic You may instantly know that a page is generic. You may know that it lacks sources, flattens every idea into the same cadence, and reaches a conclusion without making a decision. Those are valid reasons to stop reading or send the draft back. They are not proof that ChatGPT wrote it. The fairest standard is also the more demanding one: inspect what the article claims, what it adds, and how its author can support the process. That catches low-value content whether it came from a model, a content farm, or a tired human working from a template. ## References 1. Matt Lillywhite. *I'll Instantly Know A Writer Used ChatGPT When I See This.* The Daily Draft, July 2026. [medium.com](https://medium.com/the-daily-draft/ill-instantly-know-a-writer-used-chatgpt-when-i-see-this-7130506fe37e) 2. OpenAI. *New AI classifier for indicating AI-written text.* Updated July 2023. [openai.com](https://openai.com/index/new-ai-classifier-for-indicating-ai-written-text/) 3. Weixin Liang et al. *GPT detectors are biased against non-native English writers.* Patterns, 2023. [pubmed.ncbi.nlm.nih.gov](https://pubmed.ncbi.nlm.nih.gov/37521038/) 4. Google Search Central. *Guidance on using generative AI content on your website.* Updated December 2025. [developers.google.com](https://developers.google.com/search/docs/fundamentals/using-gen-ai-content) ### Further reading * reAPI. *AI text detector API.* [reapi.ai/docs/ai-text-detector](/docs/ai-text-detector) * reAPI. *Humanize API.* [reapi.ai/docs/humanize](/docs/humanize) * reAPI. *Best Compilatio alternatives.* [reapi.ai/blog/best-compilatio-alternatives](/blog/best-compilatio-alternatives) --- # Best-Value Seedance 2.0 API in 2026: Prices Compared (https://reapi.ai/blog/cheapest-seedance-2-0-2026) Among the third-party APIs checked on August 17, 2026, reAPI had the lowest total for a matched 5-second, 720p request at each provider's corresponding Standard, Fast, and Mini tier. The three reAPI totals were $0.769, $0.561, and $0.180.\[1]\[2]\[4]\[5]\[6]\[7] For that matched request, the [live reAPI rate card](/models/seedance-2-0#pricing) is our best-value third-party pick. ## TL;DR * **Best-value third-party API: reAPI.** In a matched 720p, 16:9, 5-second test with no source video, reAPI was 15% to 58% cheaper than the next-lowest verified gateway across Standard, Fast, and Mini.\[1]\[2]\[4]\[5]\[6]\[7] * **reAPI's lowest rate is (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt) per billed second** for Mini at 480p with a source video. Without source video, Mini costs (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s at 480p and (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s at 720p.\[1] * **A video reference changes the clock.** reAPI bills output duration plus the total source-video duration rounded up to the next whole second. Images, first or last frames, and audio do not trigger the lower video-reference rate.\[1]\[2] * **reAPI supports 4K.** The full Face route is (live price: https://reapi.ai/models/seedance-2-0/llms.txt) per output second without source video and (live price: https://reapi.ai/models/seedance-2-0/llms.txt) per billed second with one.\[2] ## reAPI had the lowest matched third-party price Published rates use different baselines: some start at 480p, while others use 720p or bill source and output duration differently. We normalized the public prices to one ordinary request: 5 seconds, 720p, 16:9, no source video, audio included where the provider includes it by default. **Disclosure:** reAPI publishes this comparison. The ranking below uses public prices and billing rules retrieved on August 17, 2026; it does not score output quality. | Corresponding tier | reAPI | Replicate | Atlas Cloud | WaveSpeed | fal | | ------------------ | ---------: | --------: | ----------: | --------: | -------: | | Standard / Face | **$0.769** | $0.900 | $1.21968 | $1.200 | \~$1.517 | | Fast / Fast Face | **$0.561** | $0.750 | $0.780595 | $1.000 | \~$1.210 | | Mini | **$0.180** | $0.450 | $0.426888 | $0.600 | \~$0.774 | Sources: each provider's model page or live calculator, retrieved August 17, 2026.\[1]\[2]\[4]\[5]\[6]\[7] These are price comparisons between the providers' corresponding named tiers, not an independent output-quality benchmark. reAPI leads the next-lowest gateway by 14.6% on the full tier, 25.2% on Fast, and 57.8% on Mini. Even after Atlas Cloud's 30% Mini promotion, reAPI was about 58% lower on Mini. Against fal, the difference is larger still: reAPI is about 49% lower on Standard and 54% lower on Fast for this exact job. ### Why Atlas Cloud's $0.072 headline is not a 720p price Atlas Cloud currently shows Seedance 2.0 “from $0.072/s” after a 20% discount. That number belongs to Fast at 480p. It should not be placed beside a 720p rate. For the matched 5-second 720p request, Atlas Cloud's own live calculator returned $1.21968 for Standard, $0.780595 for Fast after the promotion, and $0.426888 for Mini. We ran the calculator twice and received the same totals. reAPI remained lower in all three rows.\[6] ## reAPI's current Seedance 2.0 prices The base column applies to text, images, first or last frames, and audio without a source video. The source-video column applies only when an actual video reference is uploaded. | reAPI route | Resolution | Base rate | Source-video rate | | ----------- | ---------- | -----------------------------------------------------------------------------------------------: | -----------------------------------------------------------------------------------------------------: | | Mini | 480p | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/billed s | | Mini | 720p | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0-mini/llms.txt)/billed s | | Fast Face | 480p | (live price: https://reapi.ai/models/seedance-2-0-fast/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0-fast/llms.txt)/billed s | | Fast Face | 720p | (live price: https://reapi.ai/models/seedance-2-0-fast/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0-fast/llms.txt)/billed s | | Face | 480p | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/billed s | | Face | 720p | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/billed s | | Face | 1080p | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/billed s | | Face | 4K | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/s | (live price: https://reapi.ai/models/seedance-2-0/llms.txt)/billed s | Those are the raw rates used for the bill, read live from reAPI's production pricing snapshot on every page render — the same source the model pages and `/models/seedance-2-0/llms.txt` serve.\[1]\[2] The page may display a rounded whole-credit rate—for example, $0.15375 appears as 154 credits per second—but the final request is rounded once: ```text credits = ceil(rate × billable_seconds × 1,000) ``` A 5-second Face job at 720p is therefore `ceil(0.15375 × 5 × 1,000)`, or 769 credits ($0.769), not $0.770. ## How source-video billing changes the total The source-video rate is not a blanket discount for attaching media. A reference image, product shot, first frame, last frame, or audio track stays on the base rate. Only a source video selects the lower rate. reAPI rounds the total source-video duration up to a whole second before adding the output duration.\[1]\[2] ![Seedance 2.0 billing compares output-only seconds with input-plus-output seconds when a source video is attached](https://cdn.reapi.ai/media/blog/cheapest-seedance-2-0-2026/cheapest-seedance-2-0-2026-billing-clocks.png) For the current reAPI Seedance 2.0 routes, the practical formulas are: ```text no source video: rate × output seconds source video: lower rate × (output seconds + ceil(total source-video seconds)) ``` That produces a counterintuitive result at 720p Face: | Request | Calculation | Final cost | | -------------------------- | ------------- | ---------: | | 5s output, no source video | $0.15375 × 5 | $0.769 | | 5s source + 5s output | $0.09375 × 10 | $0.938 | The second request has the lower headline rate and the higher final bill. A table that multiplies the source-video rate by output duration alone would understate the final bill. The same-spec gateway ranking still favors reAPI for a common 5-second source plus 5-second output at 720p: $0.938 on reAPI Face versus $1.10 on Replicate Standard; $0.680 on reAPI Fast Face versus $0.85 on Replicate Fast; and $0.219 on reAPI Mini versus about $0.512 on Atlas Cloud.\[1]\[2]\[4]\[6] ## Best value by workflow | Your workload | Best price choice from this check | Why | | -------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | Third-party API, 720p, no source video | **reAPI** | Lowest matched Standard, Fast, and Mini total | | Third-party API, 5s source + 5s output | **reAPI** | Lowest matched 720p total in all three tiers | | Existing multi-model production stack | **reAPI** | One media balance and key cover Seedance within a 109-ID public media/task catalog\[3] | Here, “best value” means the lowest matched gateway price plus one balance and API key across the wider model catalog. ## FAQ ### What is the best Seedance 2.0 API provider in 2026? For third-party pay-as-you-go access, reAPI is our pick. On August 17, 2026, it had the lowest matched 5-second 720p price across Standard, Fast, and Mini among Replicate, fal, Atlas Cloud, and WaveSpeed.\[1]\[2]\[4]\[5]\[6]\[7] ### Is reAPI the cheapest Seedance 2.0 API? Yes, in the matched third-party 720p test used here. reAPI had the lowest Standard, Fast, and Mini total among the gateways checked. The claim applies to the request shape and retrieval date stated in the comparison. ### How much is a 5-second Seedance 2.0 video on reAPI? At 720p with no source video: $0.180 on Mini, $0.561 on Fast Face, and $0.769 on Face. At 1080p Face it is $1.913; at 4K Face it is $3.900.\[1]\[2] ### Does an image reference lower the reAPI price? No. Images, first or last frames, and audio stay on the base rate. An actual source video is required to select the lower rate, and its duration becomes billable.\[1]\[2] ### Does reAPI support Seedance 2.0 at 4K? Yes. The Face route supports 4K at (live price: https://reapi.ai/models/seedance-2-0/llms.txt) per output second without source video or (live price: https://reapi.ai/models/seedance-2-0/llms.txt) per billed second with one. Fast Face and Mini stop at 720p.\[1]\[2] ### Why can the lower source-video rate cost more? Because it runs on a longer clock. A plain job bills output duration. A source-video job bills source duration plus output duration. Compare the final request total, not the rate in isolation.\[1]\[2] ### Are failed Seedance generations charged? reAPI reserves credits when the task starts and refunds failed tasks automatically, so only completed generations keep the charge.\[1]\[2] ## The practical recommendation Use reAPI if you want the best verified third-party price at 720p, a rate card that maps directly to your key, and one integration that can move from [Mini](/models/seedance-2-0-mini) to [Face or Fast Face](/models/seedance-2-0) without opening another provider account. Start with a 5-second Mini or Fast test on your own footage. Then price the exact source duration before scaling. The [Seedance 2.0 API reference](/docs/seedance-2-0) has the request fields and model IDs. Check the live model page before a large run; it remains the source of truth when this dated comparison becomes stale. ## Method and disclosure reAPI publishes this article and sells the service recommended here. “Best value” is our editorial judgment based on matched public prices, billing rules, credit terms, and integration scope; it is not an independent visual-quality benchmark. Competitor figures were retrieved from their official model pages or calculators on August 17, 2026. Promotions and rate cards can change, so verify the checkout or live model page before sending a large batch. ## References 1. reAPI. *Seedance 2.0 Mini — live model page, pricing, task lifecycle, and refunds.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-0-mini](/models/seedance-2-0-mini) 2. reAPI. *Seedance 2.0 — live Face and Fast Face rates, resolutions, billing dimensions, and refunds.* Retrieved August 17, 2026 from [reapi.ai/models/seedance-2-0](/models/seedance-2-0) 3. reAPI. *Pricing — credit value, minimum top-up, expiration, refunds, and catalog scope.* Retrieved August 17, 2026 from [reapi.ai/pricing](/pricing) 4. Replicate. *bytedance/seedance-2.0, bytedance/seedance-2.0-fast, and bytedance/seedance-2.0-mini — public model pricing tables for 5-second 720p output.* Retrieved August 17, 2026. 5. fal.ai. *Seedance 2.0 Standard, Fast, and Mini — 720p public rate cards and token formulas for 5-second output.* Retrieved August 17, 2026. 6. Atlas Cloud. *Seedance 2.0 endpoint rate notes, tier-specific promotions, and live calculator.* Calculator settings: 5 seconds, 16:9, 720p, no source video; Standard had no discount, Fast was 20% off, and Mini was 30% off when checked twice on August 17, 2026. 7. WaveSpeed. *Seedance 2.0 Standard, Fast, and Mini — public pricing tables for 5-second 720p output.* Retrieved August 17, 2026. --- # Cheapest Seedance 2.5 in 2026: Compare Real API Costs (https://reapi.ai/blog/cheapest-seedance-2-5-2026) The cheapest Seedance 2.5 quote depends on resolution and source material. Among the seven no-video-reference rate cards compared here, [TokLab](https://toklab.ai) lists the lowest 480p and 720p rates, Replicate is a fraction of a cent behind, and [reAPI's Seedance 2.5](/models/seedance-2-5) is next at both. At native 1080p, reAPI lists the lowest rate among the providers that publish one; Replicate does not list a 1080p tier. reAPI's exact 720p rate is $0.266824 per second, giving a rounded $2.669 charge for a 10-second request\[1]\[2]\[3]\[8]\[9]\[10]. This is a comparison of public quotes, first checked on September 12, 2026, with the Replicate, Kie.ai, and WaveSpeed rows added on October 22, 2026, and the TokLab row on November 4, 2026. It is not a claim about the entire market. Atlas Cloud supplied a separate five-second quote, and subscription pricing lacked a complete current credit conversion. Video-input billing and token-based estimates also need different calculations. Compare the full quote for the clip you intend to generate. ## TL;DR * TokLab lists $0.1026/s at 480p, $0.2307/s at 720p, and $0.5672/s at 1080p without video input, the lowest 480p and 720p rates in this comparison\[12]. * Replicate lists $0.1028/s at 480p and $0.2312/s at 720p without video input, just above TokLab at both. It lists no 1080p tier\[8]. * reAPI's no-video-reference rates are $0.118589/s at 480p, $0.266824/s at 720p, and $0.461856/s at 1080p: third at 480p and 720p, and the lowest native 1080p rate here. The complete request rounds up to whole credits\[1]. * Kie.ai lists $0.140/s, $0.315/s, and $0.790/s, and WaveSpeed's standard tier lists $0.18/s, $0.36/s, and $0.90/s at 480p, 720p, and 1080p\[9]\[10]. * fal publishes roughly $0.4730/s at 720p, while its token formula gives $4.6224 for an explicit 1280×720, 10-second output. Use the token calculation when precision matters\[2]. * PiAPI's standard rates are $0.15/s, $0.35/s, and $0.80/s at 480p, 720p, and 1080p. Its separately named Less Restriction task has different prices\[3]. * Atlas Cloud's native 720p playground showed a five-second quote of approximately $1.514799 with a 20% label. That single configuration does not establish a complete comparable rate card\[4]. * On reAPI, a 10-second output with a three-second reference video bills 17 seconds. The lower reference-video rate therefore does not guarantee a lower total bill\[5]. ## Cheapest Seedance 2.5 depends on resolution and inputs Match the output before sorting by price. A 480p draft, native 1080p generation, and an enhanced 1080p file are different purchases. A prompt-only request and a request guided by source footage also have different billing shapes. The following table shows public Seedance 2.5 text/image prices without reference videos, sorted by 720p rate. Replicate publishes 480p and 720p only; the other five full rows have rates at all three native resolutions. WaveSpeed's Turbo tier is listed separately because its own pricing includes an output-upscale charge, and Atlas Cloud's row preserves its narrower observed quote instead of inventing missing tiers. | Platform | 480p quote | 720p quote | 1080p quote | Basis | | ------------------ | ------------------------------: | ---------------------------: | ------------------------------: | ----------------------------------------------------------------------------------------------- | | TokLab | $0.1026/s | $0.2307/s | $0.5672/s | Per-second rates without video input\[12] | | Replicate | $0.1028/s | $0.2312/s | Not listed | Output-second rates without video input\[8] | | reAPI | $0.118589/s | $0.266824/s | $0.461856/s | Exact public rate, total rounded to credits\[1] | | Kie.ai | $0.140/s | $0.315/s | $0.790/s | Credit rates without video input\[9] | | PiAPI standard | $0.15/s | $0.35/s | $0.80/s | Output-second rates\[3] | | WaveSpeed standard | $0.18/s | $0.36/s | $0.90/s | Output-only rates\[10] | | fal | \~$0.2205/s | \~$0.4730/s | \~$1.164/s | Advertised token-based approximations\[2] | | WaveSpeed Turbo | Not offered | $0.20/s | $0.22/s | Turbo tier; its pricing includes an output-upscale charge\[11] | | Atlas Cloud | Not verified in this comparison | \~$1.514799 per 5-second run | Not verified in this comparison | Native 720p playground estimate, 20% label\[4] | The rows support a limited conclusion. TokLab is the lowest listed rate at 480p and 720p, Replicate is second, reAPI is third at both, and reAPI is the lowest listed native 1080p rate among the providers that publish one. WaveSpeed's Turbo tier quotes less at 720p and 1080p, but its pricing bills an output upscale, so it is not a native-resolution quote. None of this establishes the lowest available rate across every seller, plan, region, or negotiated agreement. PiAPI also lists a Less Restriction task at $0.165, $0.385, and $0.88 per second. Its page describes an asset-library review process for face references. Keep that product separate from the standard quote when comparing the access conditions for your material\[3]. Atlas Cloud's model page distinguishes native 480p, 720p, and 1080p from separate upscaling and enhancement modes. In particular, its 4K enhancement starts from a native 1080p source. A lower price for an enhanced output should not be placed under a native-resolution heading as though the two were the same product\[4]. The existing [Seedance 2.5 API pricing comparison](/blog/seedance-2-5-api-pricing-compared) explains billing units in more detail. This article focuses on the purchase decision: which matching quote is worth testing, and which missing condition could change the bill. For the preceding model, use the separate [Seedance 2.0 cost comparison](/blog/cheapest-seedance-2-0-2026). ## What a 10-second 720p clip costs Ten seconds at 720p provides a common comparison for requests without video references. The figures below are calculations from published rates, not invoices from paid test generations. | Platform and method | Calculation | Estimated or rounded cost | | ---------------------------------------- | ------------------------------------ | ------------------------: | | TokLab | 10 × $0.2307/s | $2.307 | | Replicate | 10 × $0.2312/s | $2.312 | | reAPI | ceil(10 × $0.266824 × 1,000) credits | $2.669 | | Kie.ai | 10 × $0.315/s | $3.15 | | PiAPI standard | 10 × $0.35/s | $3.50 | | WaveSpeed standard | 10 × $0.36/s | $3.60 | | fal, advertised approximation | 10 × \~$0.4730/s | \~$4.73 | | fal, explicit 1280×720 token calculation | 216,000 tokens × $0.0214/1,000 | $4.6224 | The model pages supply the rates and billing units\[1]\[2]\[3]\[8]\[9]\[10]. Atlas Cloud's observed five-second estimate is kept out of this 10-second table because one quote is not enough to verify every duration rule. WaveSpeed Turbo ($2.00 for the same clip) is left out because it is an upscaled tier\[11]. fal gives two ways to estimate the same output. Its page labels the per-second figure approximate and makes the token formula authoritative. At 1280×720, 24 frames per second, and 10 seconds, the formula gives 216,000 tokens. Multiplying by $0.0214 per 1,000 yields $4.6224. A universal “$4.73 per video” statement would erase that difference\[2]. reAPI has a different rounding issue. One credit equals $0.001, and the full request rounds up to a whole credit. Multiplying the visible one-second amount of $0.267 by ten gives $2.67; using the exact rate and rounding once gives $2.669. Preserve the latter method when calculating batches\[1]\[5]. Set duration, resolution, and aspect ratio explicitly for your first quote. An automatic setting makes the output another variable. After generation, record the actual output length and settled charge before using the estimate as a recurring budget. At other reAPI resolutions, the same no-video-reference calculation gives $1.186 for 10 seconds at 480p and $4.619 at 1080p. These numbers apply to the chosen request, not to a subscription allowance or a task containing source footage\[1]\[5]. ## A reference-video discount can still increase the bill A lower reference-video rate is not an output-only price. reAPI publishes the following exact rates, with the reference column applied to its documented billing window\[1]\[5]. | reAPI resolution | No reference video | With reference video | | ---------------- | -----------------: | ----------------------------: | | 480p | $0.118589/s | $0.071153 per billable second | | 720p | $0.266824/s | $0.160094 per billable second | | 1080p | $0.461856/s | ≈$0.276 per billable second | For video-input requests, reAPI documents this rule: billable seconds = max(ceil(reference seconds) + output seconds, ceil(5 × output seconds / 3)) A 10-second output with a three-second source bills 17 seconds. At 720p, the rounded charge is $2.722. The same output without a video reference costs $2.669. With a 12-second source, the billing window becomes 22 seconds and the rounded charge becomes $3.523\[1]\[5]. The source clip may still be worth supplying because it communicates a motion or composition you need. The mistake is adding one solely to unlock a smaller unit price. Other providers calculate video input differently. PiAPI charges output duration at the selected rate and input video at half that rate. fal counts both input and output video tokens, then applies a 0.6 price multiplier when video references are present\[3]\[6]. Kie.ai bills input plus output seconds at $0.085, $0.190, or $0.475 per second for 480p, 720p, or 1080p. WaveSpeed's standard tier bills normalized reference duration plus output at $0.11, $0.22, or $0.55 per second, counting each reference clip as at least two seconds. Replicate switches to a separate video-input rate of $0.4304 or $0.9676 per output second at 480p or 720p\[8]\[9]\[10]. Those rules cannot be compared by sorting the discounted rate column. Use the same source files, selected resolution, and output length, then calculate each complete bill. Keep image and audio references separate from video input when reading those terms. The [Seedance 2.5 token-pricing guide](/blog/seedance-2-5-pricing-per-token) covers the token calculation behind that comparison. ## What subscription credits can and cannot tell you A subscription is cheaper only if its usable allowance covers enough of the work you will actually make. Monthly price and monthly credits alone do not establish a Seedance 2.5 cost per second. Higgsfield's pricing page, checked on September 12, displayed Plus at $47 per month billed annually with 1,200 credits per month, and Ultra at $99 per month billed annually with 3,000 credits. Those are annual-plan monthly equivalents, not month-to-month commitments. The page advertised Seedance 2.5 access, but the retrieved consumption table did not supply a current Seedance 2.5 credits-per-clip value\[7]. That missing value prevents a defensible dollar-per-second conversion. Use the current 2.5 consumption rate for the selected resolution and duration. An older model or promotion may charge differently. Once all the inputs are available, use: included clips = floor(monthly credits / credits per chosen clip) full-use cost per clip = monthly equivalent / included clips full-use cost per second = cost per clip / seconds per clip This calculation assumes the entire allowance goes to the selected clip type and is fully used. Repeat it with the number of clips you expect to make. If you also spend credits on other models or tools, allocate only the portion intended for Seedance. Compare the actual payment commitment too. A lower monthly equivalent on an annual plan may require a larger payment upfront. That can be a poor fit for a one-off job even if the theoretical full-use cost per second is attractive. An “unlimited” label requires a separate reading of eligible models, modes, and queue rules. It does not supply a denominator for the formula above. The existing [Seedance 2.5 unlimited-plan analysis](/blog/seedance-2-5-unlimited-plans-math) covers those terms, while [the free-or-paid guide](/blog/is-seedance-2-5-free) addresses trial eligibility. ## Buy the configuration you need, then measure usable output Start with the conditions you cannot change: required duration, native output resolution, audio, and source material. Obtain a complete quote for that combination. Leave incomplete quotes outside the ranking until their missing conditions are resolved. Then define what would make the output usable. A product might need to retain its shape; a subject might need to finish a particular action; the camera might need to end at an agreed position. These are suggested review criteria, not claims that one provider passes them more often. After a test, record the completed-generation charge and the total amount spent to obtain an accepted result. A completed clip may still need to be discarded because it misses the action or framing. Count that spending too. This article compares quoted costs; it does not measure acceptance rates. reAPI is a practical starting point within this comparison because its page combines the reference controls, first/last-frame options, generated audio, and current pricing. It accepts real-person reference material subject to review and documents automatic refunds for failed tasks. Those facts explain the available workflow; they do not promise that every upload will be accepted or every output will suit your project\[1]. ## FAQ ### Seedance 2.5 cheapest Without video input, TokLab lists the lowest 480p and 720p rates in this comparison ($0.1026/s and $0.2307/s), with Replicate second ($0.1028/s and $0.2312/s) and reAPI third. At native 1080p, reAPI lists the lowest rate among the providers that publish one. The conclusion excludes incomplete quotes, upscaled tiers, subscriptions, and unexamined sellers; it is not a market-wide lowest-price claim\[1]\[8]\[9]\[10]. ### Seedance 2.5 best price Match resolution, output duration, audio, and source-video length first. A lower unit rate can produce a larger bill when it applies to more billable seconds\[5]. ### cheapest Seedance 2.5 reddit Use a Reddit recommendation to identify a quote to check. Reproduce its settings on the current provider page before buying. This article uses provider pages retrieved on September 12, 2026; it does not claim a Reddit consensus. ### Seedance 2.5 price per second reAPI's exact no-video-reference rates are $0.118589 at 480p, $0.266824 at 720p, and $0.461856 at 1080p. Video-reference rates apply to the larger documented billing window\[1]\[5]. ### Seedance 2.5 cost per video A 10-second 720p request on reAPI without a reference video costs 2,669 credits, or $2.669 after rounding. Adding source footage changes the calculation\[1]\[5]. ### What is the cheapest Seedance subscription? The retrieved subscription page did not provide a complete current Seedance 2.5 credit conversion, so this comparison does not establish a subscription winner. Confirm the payment commitment, allowance, and credits per selected clip before comparing with API prices\[7]. ## Choose from a matched quote Start with the complete rate cards, then check the exact request before buying. In this comparison, TokLab is the lowest listed 480p and 720p option without video input, Replicate is second, reAPI is third at both and the lowest listed native 1080p option, and Kie.ai, PiAPI, WaveSpeed, and fal follow at 720p. A partial quote, upscaled tier, or different input mode needs its own calculation. The cheapest Seedance 2.5 decision should name the clip: resolution, duration, references, audio, and settled cost. Use the [current Seedance 2.5 price card](/models/seedance-2-5) to configure that request, then judge the cost of the footage you can use. ## References 1. reAPI. *Seedance 2.5: live price table and public pricing data.* Retrieved September 12, 2026 from [reapi.ai/models/seedance-2-5](/models/seedance-2-5). 2. fal. *Seedance 2.5 Text to Video: pricing, token formula, and examples.* Retrieved September 12, 2026. 3. PiAPI. *Seedance 2.5 API: standard and Less Restriction pricing.* Retrieved September 12, 2026. 4. Atlas Cloud. *Seedance 2.5 Text-to-Video: five-second native 720p quote and resolution provenance.* Retrieved September 12, 2026. 5. reAPI. *Seedance 2.5 API reference: pricing and billable seconds.* Retrieved September 12, 2026 from [reapi.ai/docs/seedance-2-5](/docs/seedance-2-5). 6. fal. *Seedance 2.5 Reference to Video: input/output token billing.* Retrieved September 12, 2026. 7. Higgsfield. *Pricing: annual-plan monthly equivalents and credit allowances.* Retrieved September 12, 2026. 8. Replicate. *bytedance/seedance-2.5: per-second pricing with and without video input.* Retrieved October 22, 2026. 9. Kie.ai. *Seedance 2.5: credit pricing with and without video input.* Retrieved October 22, 2026. 10. WaveSpeed. *Seedance 2.5 Text-to-Video: output-only and reference-video pricing.* Retrieved October 22, 2026. 11. WaveSpeed. *Seedance 2.5 Text-to-Video Turbo: pricing and output-upscale charge.* Retrieved October 22, 2026. 12. TokLab. *Seedance 2.5 per-second pricing.* Retrieved November 4, 2026 from [toklab.ai](https://toklab.ai) --- # Cheapest Veo 3.1 API in 2026: Every Provider's Real Price (https://reapi.ai/blog/cheapest-veo-3-1-api-2026) Search for the cheapest Veo 3.1 API and most roundups land you on $0.40 per second. That's Google's Standard tier on the Gemini API, and it's the most expensive way to call the model. If you don't need audio, 4K, or precise first/last-frame control, the same Veo 3.1 weights run for under 5 cents per 8-second 1080p clip on third-party gateways. Roughly a 95% cut. Google opened Veo 3.1 to the Gemini API in October 2025 and added Veo 3.1 Lite on March 31, 2026\[6]. Below is what every public tier actually costs in May 2026, with citations to each provider's pricing page. ## TL;DR * **Google Gemini API direct (audio bundled):** $0.05/sec (Lite 720p), $0.10–$0.12/sec (Fast 720p/1080p), $0.40/sec (Standard 1080p), $0.60/sec (Standard 4K)\[1]. * **fal.ai (audio toggleable):** $0.10/sec (Fast 1080p no audio), $0.20/sec (Standard 1080p no audio)\[2]. * **Replicate:** Veo 3.1 Fast at $0.10/sec without audio\[3]. * **reAPI per-generation tier:** $0.046 flat for an 8-second 1080p Lite clip, $0.092 flat for an 8-second 1080p Fast clip. Lowest rates I could find anywhere in May 2026\[4]. * The cheap rate forces a fixed 8-second clip with no audio. If you need audio, 4 or 6-second cuts, or first/last-frame control, you'll pay per second instead. The per-second tiers still beat Google's Standard rate by 20–60% on most providers. ## How Google prices Veo 3.1 Google bills per second of generated video. Three things change the rate: which model tier you pick (Standard, Fast, or Lite), the output resolution (720p, 1080p, or 4K), and whether audio is bundled. On Google direct, audio is always bundled; on most gateways, it's a toggle. Google's per-second rates from the Gemini API docs\[1]: | Tier | 720p | 1080p | 4K | | -------- | ----- | ----- | ------------- | | Standard | $0.40 | $0.40 | $0.60 | | Fast | $0.10 | $0.12 | $0.30 | | Lite | $0.05 | $0.08 | not supported | Audio is bundled in every cell. You can't strip it out to save money on Google direct. There's no free tier either; every successful generation gets billed from second one. Eight seconds is what most users actually generate. At that length: * Standard 1080p with audio: **$3.20** per video * Fast 1080p with audio: **$0.96** per video * Lite 720p with audio: **$0.40** per video That's the floor going through Google. The third-party gateways are cheaper. ## What gateways charge ### fal.ai fal.ai breaks the price down by tier and an audio on/off toggle\[2]: | Tier | Audio | 720p / 1080p | 4K | | -------- | ----- | -------------------- | -------------------- | | Standard | off | $0.20/s → $1.60 / 8s | $0.40/s → $3.20 / 8s | | Standard | on | $0.40/s → $3.20 / 8s | $0.60/s → $4.80 / 8s | | Fast | off | $0.10/s → $0.80 / 8s | $0.30/s → $2.40 / 8s | | Fast | on | $0.15/s → $1.20 / 8s | $0.35/s → $2.80 / 8s | Stripping audio saves 50% on Standard and about 33% on Fast. Google doesn't expose that control. ### Replicate Replicate charges $0.10/sec for Veo 3.1 Fast without audio\[3]. Same as fal.ai's no-audio Fast rate. The Standard tier and 4K cells aren't listed publicly on Replicate. ### OpenRouter OpenRouter shows "from $0.40/sec" and routes the call to whatever underlying provider it picks\[5]. The floor lines up with Google's Standard tier. ### reAPI reAPI runs two billing modes side by side\[4]. **Per-generation tier — flat price for one 8-second clip, no audio:** | Tier | 720p / 1080p | 4K | | ------- | ------------ | ------ | | Lite | **$0.046** | $0.138 | | Fast | **$0.092** | $0.276 | | Quality | $0.69 | $1.725 | **Per-second tier — same billing model as Google, with first/last-frame control and optional audio:** | Tier | 720p no audio | 1080p no audio | 720p audio | 1080p audio | 4K (audio) | | ---------------- | ------------- | -------------- | ---------- | ----------- | ---------- | | Fast Official | $0.0736/s | $0.092/s | $0.092/s | $0.1104/s | $0.276/s | | Quality Official | $0.184/s | $0.184/s | $0.368/s | $0.368/s | $0.552/s | The Quality 4K and Fast Official cells above were re-checked on October 22, 2026. $0.046 for an 8-second 1080p Lite clip on the per-generation tier is the lowest Veo 3.1 rate I could find publicly listed anywhere in May 2026. ## What 1,000 videos a month costs Take a workload that's actually common: 1,000 eight-second 1080p clips, no audio. Think ads, social loops, B-roll for voice-over. | Provider | Tier | 1,000 × 8s 1080p | Notes | | ----------------- | ---------------------- | ---------------- | -------------------------------------- | | Google Gemini API | Fast (audio mandatory) | **$960** | Cheapest Google option; audio bundled. | | fal.ai | Fast (no audio) | $800 | | | Replicate | Fast (no audio) | $800 | | | reAPI | Fast (per-generation) | **$92** | Fixed 8s, no audio. | | reAPI | Lite (per-generation) | **$46** | 720p ceiling at this rate. | If you can live with a fixed 8-second clip and no audio, the per-generation tiers run 88–95% cheaper than the next-cheapest option. ## When you'll need the per-second tier The per-generation rate has limits. If any of these matter, price on per-second: * **Audio.** Per-generation tiers don't include synthesized audio. A Fast Official 1080p run with audio comes out to $0.1104 × 8 = $0.884 — 72% below Google Standard, 26% below fal.ai's Fast with audio, and 8% below Google Fast. * **Variable duration.** Per-generation locks at 8 seconds. Per-second exposes 4 / 6 / 8 second outputs. * **First/last-frame interpolation.** Per-generation Fast supports up to 3 reference frames for image-to-video. First-frame plus last-frame anchoring is per-second only. * **4K resolution.** Per-generation 4K cells exist at $0.138 (Lite), $0.276 (Fast), $1.725 (Quality). For 4K with audio, the Fast Official per-second 4K cell at $0.276/s × 8 = $2.21 is the comparable choice. * **Negative prompts, seed, sample\_count, person\_generation.** Per-second only. Even on the per-second side, reAPI's Fast Official 1080p no-audio cell at $0.092/sec is 8% cheaper than fal.ai or Replicate, and 23% cheaper than Google's $0.12/sec 1080p Fast (which forces you to pay for audio). ## Faceless-channel math Picture a daily 90-second video stitched from twelve 8-second 1080p clips, audio dubbed in post. That's 360 clips a month: * Google Gemini API Fast: 360 × $0.96 = **$345.60 / month** * fal.ai Fast (no audio): 360 × $0.80 = **$288.00 / month** * reAPI Fast (per-generation): 360 × $0.092 = **$33.12 / month** * reAPI Lite (per-generation, 720p): 360 × $0.046 = **$16.56 / month** reAPI Lite is 95% cheaper than Google direct for this exact workload. The 720p ceiling stings less than it sounds: Shorts, Reels, and TikTok all re-encode aggressively at delivery and most strip down to 1080p × 30fps no matter what you fed in. Paying for 4K on short-form vertical content is mostly dead money. ## When Google direct still wins Some workloads still belong on Google's first-party API: 1. You're inside an enterprise contract with negotiated Vertex AI rates. 2. You need data residency guarantees Vertex offers and gateways don't. 3. You're using Veo 3.1 alongside Gemini text models in a single billable account for procurement reasons. 4. You need the latest preview model the same hour Google ships it. Gateways generally catch up within hours, occasionally a day or two. ## Calling the cheapest Veo 3.1 API tier reAPI exposes Veo 3.1 through one REST media endpoint: ```bash curl https://reapi.ai/api/v1/videos/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "veo3.1-lite", "prompt": "A dolphin leaping through cobalt ocean waves at sunrise", "aspect_ratio": "16:9", "resolution": "720p" }' ``` The endpoint returns a `task_id` immediately; poll `GET /api/v1/tasks/{task_id}` until status is `completed`. Full schema and SDK examples in Python, Node.js, and Go are on the [Veo 3.1 docs page](/docs/veo3-1). To switch to Fast per-generation, change `"model": "veo3.1-lite"` to `"veo3.1-fast"` and bump `resolution` to `1080p`. The request shape is identical across the family. ## FAQ ### What's the absolute cheapest Veo 3.1 API price in 2026? $0.046 for an 8-second 1080p Veo 3.1 Lite clip on reAPI's per-generation tier (no audio, fixed duration). I could not find a lower per-second or per-generation listed rate across Google, fal.ai, Replicate, or OpenRouter in May 2026. ### Does Veo 3.1 have a free tier? No. Veo 3.1 is paid-tier only on the Gemini API and Vertex AI. New Google Cloud accounts get a $300 / 90-day credit that can be applied to Veo, which works out to roughly 6,000 seconds of Lite 720p generation. Third-party gateways generally don't offer free Veo generations either. ### Why is the per-generation rate so much cheaper than the per-second rate? Per-generation pricing locks the output to the most common shape: 8 seconds, 1080p or below, no audio. That fixed shape lets the gateway batch and forecast compute differently. You give up flexibility (variable duration, audio, first/last-frame anchoring) for the lower headline price. If your product only ever needs an 8-second clip, per-generation is the cheaper math. ### Can I get Veo 3.1 with audio under $0.10/second? Yes, on reAPI: Fast Official with audio is $0.092/sec at 720p and $0.1104/sec at 1080p (re-checked October 22, 2026). Among the other providers checked in May 2026, Google Gemini API Fast at $0.10–$0.12/sec for 720p–1080p was the cheapest public per-second rate that bundles audio; fal.ai's Fast with audio is $0.15/sec. ### How does Veo 3.1 Lite compare to Veo 3.1 Fast on quality? Google's release post says Lite delivers "the same speed" as Fast at "less than 50% of the cost," and supports both Text-to-Video and Image-to-Video at 720p and 1080p\[6]. Lite caps at 1080p (no 4K). Subjective output is about a half-tier below Fast on motion fidelity and physical plausibility. Fine for short loops and B-roll. Less ideal for hero shots. ### Do third-party gateways add latency vs Google direct? Barely. Generation itself takes 60 to 180 seconds for an 8-second clip, so the API hop is noise compared to that. Gateway overhead is single-digit percent of wall-clock time, mostly job queueing rather than network round-trip. ### What happens if a Veo 3.1 generation fails? On Google direct, you're not billed for failed generations. Same on reAPI: failed jobs trigger an automatic credit refund. Confirm the failure semantics on your provider before scaling, because client-side retry loops on partial failures can stack costs if the provider charges for upstream-attempted-but-failed jobs. ### Is there a way to mix tiers in one application? Yes. Default to the cheapest tier that satisfies your output spec, then upgrade per-request when needed. On reAPI, the same endpoint serves all five Veo 3.1 model strings — switching from `veo3.1-lite` to `veo3.1-fast-official` is a one-field change, no SDK swap. ## Picking a tier in practice Most product workloads can live with a fixed 8-second clip and no audio. For those, reAPI's per-generation Lite or Fast tier ($0.046–$0.092 per 8-second 1080p clip) runs 88–95% cheaper than Google direct, fal.ai, or Replicate. If you need audio, variable duration, or first/last-frame anchoring, you're on a per-second tier across all providers. reAPI's Fast Official no-audio cells, $0.0736/sec at 720p and $0.092/sec at 1080p, are still the cheapest of those. The Standard tier at $0.40/sec really only makes sense inside an enterprise Vertex contract. The cheapest Veo 3.1 API path for almost every other workload is one of the per-generation tiers above. ## References 1. Google. *Gemini API pricing — Veo 3.1 per-second rates by tier and resolution.* Retrieved May 2026 from [ai.google.dev/gemini-api/docs/pricing](https://ai.google.dev/gemini-api/docs/pricing) 2. fal.ai. *Veo 3.1 — Text to Video.* Retrieved May 2026 from fal.ai/models/fal-ai/veo3.1 3. Replicate. *Google Veo 3.1.* Retrieved May 2026 from replicate.com/google/veo-3.1 4. reAPI. *Veo 3.1 — Model page (live pricing).* Retrieved May 2026 from [reapi.ai/models/veo3-1](/models/veo3-1) 5. OpenRouter. *Veo 3.1 — API pricing & providers.* Retrieved May 2026 from openrouter.ai/google/veo-3.1 6. Google. *Build with Veo 3.1 Lite, our most cost-effective video generation model.* The Keyword (Google blog), March 31, 2026. [blog.google/innovation-and-ai/technology/ai/veo-3-1-lite](https://blog.google/innovation-and-ai/technology/ai/veo-3-1-lite/) ### Further reading * Google Cloud. *Vertex AI generative AI pricing.* [cloud.google.com/vertex-ai/generative-ai/pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) * Google Cloud. *Veo 3.1 — Vertex AI model documentation.* [docs.cloud.google.com/vertex-ai/.../veo/3-1-generate](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/models/veo/3-1-generate) * fal.ai. *Veo 3.1 Fast — Text to Video.* fal.ai/models/fal-ai/veo3.1/fast * reAPI. *Veo 3.1 — API reference.* [reapi.ai/docs/veo3-1](/docs/veo3-1) --- # Claude API pricing (https://reapi.ai/blog/claude-api-pricing) **Claude API pricing starts at $0.10 per million input tokens and $0.50 per million output tokens for Haiku 5.5 prompts of up to 100,000 tokens.** Sonnet 5.5 costs $2/$10, Opus 5.5 $4/$20, and Fable 5.1 $10/$50 at Anthropic's standard direct rates. Input and output are separate charges, and cache use changes the calculation.\[1] On reAPI, the public [Sonnet 5.5 page](/models/claude-sonnet-5-5) shows $1.40/$7.00 and the [Opus 5.5 page](/models/claude-opus-5-5) $2.80/$14.00 per million input/output tokens.\[2]\[3] reAPI is not cheaper in every category: direct Haiku short-context pricing and some direct cache-read rates are lower. The tables and calculations below keep those differences visible. **All prices were checked on October 23, 2026 and are in USD.** ## claude api pricing per million tokens Anthropic's standard rate card separates ordinary input, generated output, cache creation and cache reads. One million tokens is abbreviated MTok. A cache-write token uses its applicable write rate; do not also count it as ordinary uncached input in your worksheet.\[1] | Claude model | Input / MTok | Output / MTok | 5-minute cache write / MTok | 1-hour cache write / MTok | Cache read / MTok | | -------------------------------------- | -----------: | ------------: | --------------------------: | ------------------------: | ----------------: | | Haiku 5.5, prompt up to 100,000 tokens | $0.10 | $0.50 | $0.125 | $0.20 | $0.01 | | Haiku 5.5, prompt over 100,000 tokens | $0.50 | $2.50 | $0.625 | $1.00 | $0.05 | | Sonnet 5.5 | $2.00 | $10.00 | $2.50 | $4.00 | $0.10 | | Sonnet 5 | $2.00 | $10.00 | $2.50 | $4.00 | $0.20 | | Sonnet 4.6 | $3.00 | $15.00 | $3.75 | $6.00 | $0.30 | | Opus 5.5 | $4.00 | $20.00 | $5.00 | $8.00 | $0.20 | | Opus 5 | $5.00 | $25.00 | $6.25 | $10.00 | $0.50 | | Opus 4.8 | $5.00 | $25.00 | $6.25 | $10.00 | $0.50 | | Opus 4.7 | $5.00 | $25.00 | $6.25 | $10.00 | $0.50 | | Fable 5.1 | $10.00 | $50.00 | $12.50 | $20.00 | $0.25 | | Fable 5 | $10.00 | $50.00 | $12.50 | $20.00 | $1.00 | These are the official rates for the models covered here, not every historical Claude model. Fast mode, US-only inference and separately billed tools can change the total; the ordinary rates above should not be presented as an all-inclusive quote.\[1] **The reAPI snapshot below comes from the rendered model-detail pages, not from a calculated discount.** A dash means the page did not display that cache category. It does not mean the category is free. The displayed cache-write rows do not specify a lifetime, so they are not labeled as one-hour rates here. | reAPI model page | Input / MTok | Output / MTok | Displayed cache write / MTok | Displayed cache read / MTok | Workspace | | ----------------------------------------------------------------------------- | -----------: | ------------: | ---------------------------: | --------------------------: | --------- | | [Haiku 5.5](/models/claude-haiku-5-5)\[4] | $0.3500 | $1.7500 | $0.4375 | $0.0350 | Unified | | [Sonnet 5.5](/models/claude-sonnet-5-5)\[2] | $1.40 | $7.00 | $1.75 | $0.14 | Unified | | [Opus 5.5](/models/claude-opus-5-5)\[3] | $2.80 | $14.00 | $3.50 | $0.14 | Unified | | [Fable 5](/models/claude-fable-5)\[5] | $7.000 | $35.000 | $8.750 | $0.175 | Unified | | [Fable 5.1](/models/claude-fable-5-1)\[6] | $7.00 | $35.00 | $8.75 | $0.70 | Unified | | [Opus 4.8](/models/claude-opus-4-8)\[7] | $2.8 | $14.0 | — | — | Unified | | [Opus 4.7](/models/claude-opus-4-7)\[8] | $2 | $10 | — | — | Legacy | | [Opus 5](/models/claude-opus-5)\[9] | $2.4 | $12.0 | — | — | Legacy | | [Sonnet 4.6](/models/claude-sonnet-4-6)\[10] | $2.4 | $12.0 | — | — | Legacy | The current unified Chat Completions service covers the six rows labeled Unified. Native Messages covers Haiku 5.5, Sonnet 5.5, Opus 5.5, Fable 5 and Fable 5.1; Opus 4.8 uses Chat Completions. The three legacy rows have separate `api.reapi.ai` credentials. Follow the exact model's API documentation before choosing a key or endpoint.\[11] Haiku's reAPI page displays one rate pair without prompt-length labels. Its $0.3500/$1.7500 pair is above Anthropic's short-context $0.10/$0.50 pair. Do not infer a cheaper unlisted reAPI tier or describe the model as universally discounted. This is a comparison of public price displays; no billable requests were run for this article. ## claude api cache pricing On Anthropic's direct API, a five-minute cache write costs 1.25 times base input and a one-hour write costs twice base input. Read multipliers vary: Fable 5.1 uses 0.025 times base input; Opus 5.5 and Sonnet 5.5 use 0.05; the other models in the official table use 0.1.\[1] That distinction changes a model comparison. Fable 5 and Fable 5.1 have identical ordinary input/output rates, but their direct cache-read rates are $1.00 and $0.25. The existing [Fable 5.1 cache-cost analysis](/blog/is-claude-fable-5-1-cheaper) explains why a large read discount can produce a much smaller reduction in the cost of a whole task. For reAPI, use the displayed category rather than multiplying every official price by a single percentage. Fable 5 shows $0.175 for cache reads, while Fable 5.1 shows $0.70. Sonnet 5.5 shows $0.14, compared with $0.10 direct. These differences do not establish a billing defect; they establish that the published schedules differ.\[2]\[5]\[6] Budget a first cache write separately from subsequent reads. If your estimate assumes reuse, record the actual cache-creation and cache-read counts when evaluating your application. An accepted cache setting alone does not prove a hit; the [Sonnet 5.5 API reference](/docs/claude-sonnet-5-5) distinguishes accepted parameters from observed cache behavior.\[11] ## claude api pricing calculator Use the token counts for each charge category, then multiply by that category's USD-per-million rate: ```text cost = (uncached_input × input_rate + cache_write_5m × write_5m_rate + cache_write_1h × write_1h_rate + cache_reads × read_rate + output × output_rate) / 1,000,000 ``` This formula uses Anthropic's separately published cache lifetimes. For another service, substitute its documented categories instead of assuming both lifetimes have the same rate. Add any separately billed tools or other applicable modifiers. The examples below are hypothetical arithmetic from the dated tables, not measured invoices or performance tests. **Sonnet 5.5, ordinary uncached requests.** Assume 20,000 input tokens and 5,000 billed output tokens per request, with no cache or extra tool charges: | Calculation | Direct Anthropic | reAPI displayed rates | | ------------------------ | ------------------: | --------------------: | | Input | 0.02 × $2 = $0.04 | 0.02 × $1.40 = $0.028 | | Output | 0.005 × $10 = $0.05 | 0.005 × $7 = $0.035 | | One request | $0.09 | $0.063 | | 1,000 identical requests | $90 | $63 | That workload costs 30% less at the displayed reAPI rates. The conclusion is specific to these input/output quantities and exclusions; it is not a promise about every Sonnet task. **Fable 5.1, a cache-heavy request.** Assume 500,000 cache-read tokens, 10,000 fresh input tokens and 2,000 output tokens, with no new cache writes: ```text Direct = 0.5 × $0.25 + 0.01 × $10 + 0.002 × $50 = $0.325 reAPI = 0.5 × $0.70 + 0.01 × $7 + 0.002 × $35 = $0.490 ``` Here direct Anthropic is cheaper by $0.165 per request despite reAPI's lower ordinary input/output rates. Reusing an existing cache changes which column matters most. A new cache write would need its own additional calculation. **Haiku 5.5 at the direct long-context boundary.** With 1,000 output tokens and no caching, a 100,000-token prompt costs `0.1 × $0.10 + 0.001 × $0.50 = $0.0105`. At 100,001 prompt tokens, the higher tier applies: `0.100001 × $0.50 + 0.001 × $2.50 = $0.0525005`. The threshold changes the rates for the request, not just the final token.\[1] ## claude api pricing batch Anthropic's Batch API discounts input and output tokens by 50%. For example, Sonnet 5.5 becomes $1/$5 per MTok, Opus 5.5 $2/$10 and Fable 5.1 $5/$25. Cache modifiers can stack with the Batch discount.\[1] For the earlier Sonnet example, direct Batch input/output would total $0.045 per request, or $45 for 1,000 requests. That is below the $63 reAPI illustration, but Batch is asynchronous processing. Choose it when your workload can use that delivery model. A live chat turn and a queued background job have different requirements. This article does not establish reAPI Batch support or entitlement to Anthropic's Batch discount through reAPI. Sending many ordinary requests is not itself a Batch API submission. ## claude api pricing and limits Anthropic's pricing guide says Claude 4.6 and later models, except Haiku 5.5, include the full one-million-token context window at standard token rates. For those models, a 900,000-token input has the same unit rate as a 9,000-token input; it still contains 100 times as many tokens.\[1] Haiku 5.5 is the exception. The higher tier begins **over 100,000 prompt tokens**, counting ordinary input, cache reads and cache writes together. Each request is priced independently. Splitting a conversation across calls does not justify applying a previous call's lower rate to a later larger prompt. Other modifiers deserve separate budget lines. Anthropic's US-only inference adds a 1.1 multiplier to token categories for supported models. Its Opus 5.5 fast mode is $8/$40 per MTok and cannot be combined with Batch. These are direct-service rules, not a claim that every option is available on reAPI.\[1] ## sonnet 5 pricing Claude Sonnet 5 currently appears in Anthropic's official table at $2 input and $10 output per MTok, with $2.50 five-minute writes, $4 one-hour writes and $0.20 cache reads.\[1] Sonnet 5.5 shares the $2/$10 headline pair but has a lower $0.10 direct cache-read rate. The current reAPI unified registry does not include `claude-sonnet-5`, and there is no corresponding model-detail page. An existing Sonnet 5 blog is not evidence of a callable model. If you need a documented unified reAPI route, review [Sonnet 5.5](/models/claude-sonnet-5-5) and its own request contract rather than silently replacing one model ID with another.\[11] ## claude api pricing vs subscription Keep API token charges separate from Claude app and Claude Code plan allowances, but account for current subscription benefits. Anthropic now documents monthly API credits for eligible Max and Team subscribers. Max 5x includes $100 and Max 20x $200; Free, Pro and Enterprise are not eligible for that particular program.\[12] Credits require linking a Console organization and claiming them. New eligible subscribers can claim after seven days. Credits expire at the end of each billing cycle, or monthly on annual plans, without rolling over. They apply to the specified Claude Platform services and do not cover Claude Code, extra usage in the Claude apps, or reAPI. They do not change the subscription's Claude or Claude Code usage limits.\[12] ### How much does each Claude API call cost? There is no single per-call fee in the token rate card. Multiply each billed token category by the selected model's rate. For 20,000 uncached input and 5,000 output tokens, the Sonnet 5.5 example above is $0.09 direct or $0.063 at the observed reAPI prices, excluding other charges. ### How to calculate API pricing? Keep uncached input, cache writes, cache reads and output separate. Apply the correct model and prompt-length tier, then add any applicable tool fees or modifiers. For a multi-call task, sum all its calls; the price of one response is not the price of the entire workflow. ### Can I have Claude API for free? Do not assume a Claude Free account includes API credit. The current subscriber API-credit program excludes Free and Pro; eligible Max and Team plans have a separate claim process.\[12] Check the Console balance and the terms of any account-specific offer before treating API usage as funded. For a usable Claude API pricing estimate, choose the exact model, workspace and token mix first. Follow the linked model page for its current quote and API reference, then compare direct, Batch and reAPI costs for the same workload. The lowest input price alone cannot answer that decision. ### References 1. Anthropic. *Pricing: models, caching, Batch and long context.* Checked October 23, 2026. [platform.claude.com/docs/en/about-claude/pricing](https://platform.claude.com/docs/en/about-claude/pricing) 2. reAPI. *Claude Sonnet 5.5: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-sonnet-5-5](/models/claude-sonnet-5-5) 3. reAPI. *Claude Opus 5.5: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-opus-5-5](/models/claude-opus-5-5) 4. reAPI. *Claude Haiku 5.5: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-haiku-5-5](/models/claude-haiku-5-5) 5. reAPI. *Claude Fable 5: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-fable-5](/models/claude-fable-5) 6. reAPI. *Claude Fable 5.1: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-fable-5-1](/models/claude-fable-5-1) 7. reAPI. *Claude Opus 4.8: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-opus-4-8](/models/claude-opus-4-8) 8. reAPI. *Claude Opus 4.7: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-opus-4-7](/models/claude-opus-4-7) 9. reAPI. *Claude Opus 5: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-opus-5](/models/claude-opus-5) 10. reAPI. *Claude Sonnet 4.6: rendered pricing.* Checked October 23, 2026. [reapi.ai/models/claude-sonnet-4-6](/models/claude-sonnet-4-6) 11. reAPI. *Model-specific API contracts.* Checked October 23, 2026. [Sonnet 5.5](/docs/claude-sonnet-5-5), [Haiku 5.5](/docs/claude-haiku-5-5), [Opus 5.5](/docs/claude-opus-5-5), [Fable 5](/docs/claude-fable-5), [Fable 5.1](/docs/claude-fable-5-1), [Opus 4.8](/docs/claude-opus-4-8), [Opus 4.7](/docs/claude-opus-4-7), [Opus 5](/docs/claude-opus-5), [Sonnet 4.6](/docs/claude-sonnet-4-6). 12. Anthropic. *API credits for subscribers.* Checked October 23, 2026. [platform.claude.com/docs/en/about-claude/api-credits-for-subscribers](https://platform.claude.com/docs/en/about-claude/api-credits-for-subscribers) --- # What Is the Context Window in Claude, and What Counts (https://reapi.ai/blog/claude-context-window) The context window is everything Claude can reference while generating a response, including the response itself. Anthropic calls it working memory, as distinct from the training corpus\[1]. The part worth internalizing is the sentence Anthropic puts right after that definition: **more context is not automatically better**. As token count grows, accuracy and recall degrade, a phenomenon the documentation names *context rot*\[1]. Curating what goes in matters as much as how much room there is. ## TL;DR * **1M tokens on current models**: Opus 5, Opus 4.8/4.7/4.6, Sonnet 5, Sonnet 4.6, Fable 5, Mythos 5. Others including Sonnet 4.5 are 200k\[1]. * **1M is the default.** No beta header, and long-context requests bill at standard pricing\[1]. * **Output counts too**, including extended thinking. On these 1M-window models, synchronous Messages requests cap `max_tokens` at 128k\[1]. * **Everything in the request counts**: system prompt, every message, tool results, images, documents, and tool definitions\[1]. * **Newer models keep previous thinking blocks** by default, so they bill as input on later turns\[1]. * **Sonnet models get a live token budget injected; Opus and Fable do not**\[1]. ## What actually counts ![What occupies a Claude context window: system prompt, tool definitions, messages with tool results and images, retained thinking blocks billed as input again, and this turn output capped at 128k](https://cdn.reapi.ai/media/blog/claude-context-window/counts.png) The common mistake is budgeting only for the conversation. The full list\[1]: * The **system prompt** * Every message in `messages`, including **tool results, images, and documents** * Your **tool definitions** * The **output** Claude generates this turn, including its extended thinking Every response reports what the request consumed in its `usage` field. With prompt caching the input count splits across `input_tokens`, `cache_read_input_tokens`, and `cache_creation_input_tokens`, and **all three count toward the window**\[1]. Cached does not mean free of the window; it means cheaper per token. To size a request before sending it, use the token counting API rather than estimating from character count. ## Sizes, and what 1M actually costs | Models | Context window | | ------------------------------------ | -------------- | | Opus 5, Opus 4.8, Opus 4.7, Opus 4.6 | 1M | | Sonnet 5, Sonnet 4.6 | 1M | | Fable 5, Mythos 5 | 1M | | Sonnet 4.5 and other earlier models | 200k | Two details that save money and confusion\[1]: **1M is the default on those models.** There is no beta header to send, and a 900k-token request bills at the same per-token rate as a 9k one. There is no long-context surcharge. **Synchronous Messages requests are capped at 128k output tokens** on these 1M-window models, regardless of unused input capacity. The native Message Batches API has a separate extension: supported models, including Opus 5 and Opus 4.8, can request up to 300,000 tokens with the `output-300k-2026-03-24` beta header. That batch-only feature does not raise the synchronous limit\[2]. A single request can carry up to **600 images or PDF pages** (100 on 200k-window models), and large payloads can hit request-size limits before they hit the token limit\[1]. ## Thinking changes the arithmetic Thinking tokens are a subset of `max_tokens`, bill as output, and count toward rate limits. With adaptive thinking the allocation varies per request, so the usage is not predictable from prompt length alone\[1]. The behavior that surprises people is what happens to *previous* turns' thinking. **On Opus 4.5 and later, Sonnet 4.6 and later, Fable 5, and Mythos 5, the API keeps previous thinking blocks by default**, and they count toward the window like any other input tokens. They were billed once as output when generated, and the kept blocks are then billed as input on every later request that carries them\[1]. On earlier Opus and Sonnet models and all Haiku models, the API strips them automatically when you pass them back. If a long agentic conversation is consuming context faster than the visible transcript explains, retained thinking is usually why. Thinking block clearing overrides the default in either direction. ## Context awareness: some models know, some do not This is the split most people are unaware of\[1]. **Sonnet 5, Sonnet 4.6, Sonnet 4.5, and Haiku 4.5 track their remaining budget.** The API injects the total into the system prompt of every request: ```xml 200000 ``` and updates it after each tool call: ```xml Token usage: 35000/200000; 165000 remaining ``` This is automatic. You never send these tags yourself, and image tokens are included in the counts. **Opus 4.7 and later, Fable 5, and Mythos 5 do not receive these tags.** For those, give the model an explicit budget with task budgets, currently in beta. The practical consequence: a Sonnet model can pace a long task against the space that remains, while an Opus model cannot unless you tell it. That is a real behavioral difference between tiers that has nothing to do with capability scores. ## When conversations outgrow the window Two server-side mechanisms, both worth knowing before you build your own truncation\[1]. **Compaction** automatically summarizes earlier parts of the conversation on the server so it can continue past the limit. Beta, on Claude 4.6 and later. **Context editing** offers more targeted strategies, including clearing old tool results in agentic workflows, which is usually where the bulk of a long conversation's tokens actually live. Reaching for either is better than a homegrown "drop the oldest messages" loop, which tends to discard the system-level context that made the conversation coherent. ## Working with it **Curate, do not fill.** Context rot is documented behavior, not a rumor. A 900k-token prompt is not automatically better than a well-chosen 90k one. **Count tool definitions.** They are in every request, and a large tool schema is a fixed tax on every turn. **Watch retained thinking** on newer models during long agentic runs. **Pick the tier with the behavior you need.** If a model needs to pace itself across a long task, Sonnet's injected budget does that natively. ```python from openai import OpenAI client = OpenAI(api_key="YOUR_REAPI_KEY", base_url="https://api.reapi.ai/v1") resp = client.chat.completions.create( model="claude-opus-5", messages=[{"role": "user", "content": "Read this repository and summarize the architecture."}], max_tokens=16000, ) print(resp.usage) # the number to reconcile against ``` Rates for the 1M-window models are on [reapi.ai/models](/models). ## FAQ ### What is the context window in Claude? All the text the model can reference while generating a response, including the response itself. It is working memory, not training data\[1]. ### How big is Claude's context window? 1M tokens on Opus 5, Opus 4.8/4.7/4.6, Sonnet 5, Sonnet 4.6, Fable 5, and Mythos 5. Earlier models including Sonnet 4.5 are 200k\[1]. ### Does using the full 1M window cost extra? No. On models with a 1M window, 1M is the default and requests bill at standard pricing with no long-context surcharge\[1]. ### What counts toward the context window? System prompt, all messages including tool results and images and documents, tool definitions, and the output including extended thinking. Cached input counts too\[1]. ### Why is my context filling faster than the conversation suggests? On newer models the API keeps previous thinking blocks by default, and they count as input on later turns\[1]. ### Is more context always better? No. Anthropic documents that accuracy and recall degrade as token count grows, a phenomenon called context rot\[1]. ### How many images can one request carry? Up to 600 images or PDF pages on 1M-window models, 100 on 200k-window models, subject to request size limits\[1]. ### What happens when a conversation exceeds the window? Use server-side compaction, which summarizes earlier turns so the conversation continues, or context editing to clear old tool results\[1]. ## Budgeting the window instead of filling it The number everyone quotes about the context window in Claude is 1M, and it is the least interesting fact about it. What decides whether a long-context integration works is the accounting: tool definitions riding along on every turn, retained thinking blocks billing as input, cached tokens still consuming space, and output competing for the same budget. Anthropic's own framing is the right one to adopt. The window is working memory, more of it is not automatically better, and what you choose to put in it matters more than how much room is left. ## References 1. Anthropic. *Context windows — sizes by model, what counts, thinking behavior, context awareness, compaction, and overflow.* Retrieved July 2026 from [docs.claude.com/en/docs/build-with-claude/context-windows](https://docs.claude.com/en/docs/build-with-claude/context-windows) 2. Anthropic. *Batch processing — extended output beta.* Retrieved September 8, 2026 from [platform.claude.com/docs/en/build-with-claude/batch-processing#extended-output-beta](https://platform.claude.com/docs/en/build-with-claude/batch-processing#extended-output-beta) ### Further reading * reAPI. *How to use Claude Opus 5.* [reapi.ai/blog/how-to-use-claude-opus-5](/blog/how-to-use-claude-opus-5) * reAPI. *Which Claude model is best for coding.* [reapi.ai/blog/best-claude-model-for-coding](/blog/best-claude-model-for-coding) * reAPI. *Model catalog.* [reapi.ai/models](/models) --- # Claude Fable 5.1 Migration Guide: Fix Tool-Choice 400s (https://reapi.ai/blog/claude-fable-5-1-migration-guide) Migrating from Claude Fable 5 to Claude Fable 5.1 is not always a one-line model-name change. The new model rejects forced tool choice, binds preserved thinking blocks to the conversation prefix that produced them, and cannot send its thinking blocks back to older Claude models. An integration can therefore pass a single-turn smoke test and still fail on its first structured-output request, compacted conversation, or fallback. The safe migration has three parts: replace forced tool calls with automatic selection plus schema enforcement, keep multi-turn history append-only, and test every route that can switch the conversation back to an older model. If you use the OpenAI-compatible route, start with the [Claude Fable 5.1 request guide](/docs/claude-fable-5-1); the native examples below use Anthropic's Messages API so each breaking change is visible. ## Quick answer * Change the native model ID to `claude-fable-5-1`, then remove forced `tool_choice` modes; `any` and named tools return HTTP 400.\[1] * Keep the system prompt, tools, and earlier message prefix unchanged after a Fable 5.1 thinking block. Append new instructions instead of rewriting history.\[1] * Test every fallback: older Claude models cannot read Fable 5.1 thinking blocks, so the API drops them before continuing.\[1] * Adaptive thinking stays on. Replace manual token budgets with `effort`, and exercise prefix mismatches in CI before rollout.\[1] ## First, inventory the code path you are actually migrating Search more widely than the literal model ID. A wrapper may translate a generic “required tool” setting into Anthropic's `tool_choice: {"type":"any"}`, retain thinking blocks in a conversation store, or alter the system prompt on every request. The OpenCode issue that surfaced shortly after release is a useful example: its structured-output adapter selected required tool use, which became Anthropic's unsupported `any` mode and produced a 400.\[6] That issue demonstrates a real integration pattern; Anthropic's migration guide is the authority for the API behavior. Audit these components before editing: | Component | What to search for | Failure to expect | | ------------------ | --------------------------------------------------- | ---------------------------------------- | | Model selection | `claude-fable-5`, aliases, fallback lists | Old model still receives some traffic | | Tool adapter | `tool_choice`, `required`, `any`, named tools | `400 invalid_request_error` | | Structured output | synthetic tools, schema wrappers | Wrapper silently forces a tool | | Conversation store | `thinking`, `redacted_thinking`, signatures | Invalid thinking signature after an edit | | Compaction | summary injection, tail retention, message deletion | Later blocks bound to the old prefix | | Dynamic prompts | current date, permissions, enabled tools | System or tool prefix changes each turn | | Retry and fallback | older Claude model IDs | Fable 5.1 thinking is removed on switch | | Retention policy | ZDR workspace or organization | Request rejected before generation | Do the inventory at the serialized request boundary if possible. Application objects can look unchanged even when an SDK or provider adapter rewrites them. ## Step 1: update the model ID, but keep the rest observable The native ID is `claude-fable-5-1`. Fable 5.1 retains the one-million-token context window, supports up to 128,000 output tokens, and uses always-on adaptive thinking.\[2] Start with the same production traffic shape and log request IDs, status codes, stop reasons, token usage, tool calls, and fallbacks. Do not use this migration to change effort, compaction, prompt wording, and the tool framework at the same time. A narrow first deployment makes a 400 or behavior shift attributable. Once compatibility is established, sweep `low`, `medium`, `high`, `xhigh`, and `max` on the workload rather than assuming the old setting is optimal. Anthropic documents `high` as the default.\[1] Also remove either of these configurations if a predecessor integration supplies them: ```python # Both are invalid for Claude Fable 5.1. thinking={"type": "disabled"} thinking={"type": "enabled", "budget_tokens": 12000} ``` Fable 5.1 decides when and how much to think. A trailing assistant message used as a prefill also returns a 400, so express output instructions in the system or user content instead.\[1] ## Step 2: replace forced tool choice The compatibility boundary is exact: | `tool_choice` value | Fable 5 | Fable 5.1 | | ----------------------------------------- | --------: | --------: | | `{"type":"auto"}` | Supported | Supported | | `{"type":"none"}` | Supported | Supported | | `{"type":"any"}` | Supported | HTTP 400 | | `{"type":"tool","name":"record_summary"}` | Supported | HTTP 400 | The check applies to Messages, Message Batches, and token counting. The reported error says that tool-choice types `tool` and `any` are unsupported for this model.\[1] Retrying the same body will not help. Here is the common pre-migration pattern: ```python response = client.messages.create( model="claude-fable-5", max_tokens=4096, tools=[record_summary_tool], tool_choice={"type": "tool", "name": "record_summary"}, messages=[ {"role": "user", "content": "Summarize the meeting notes."} ], ) ``` For Fable 5.1, use automatic selection, put the requirement in the current instruction, and make the tool strict: ```python record_summary_tool = { "name": "record_summary", "description": "Record the structured meeting summary.", "strict": True, "input_schema": { "type": "object", "properties": { "summary": {"type": "string"}, "action_items": { "type": "array", "items": {"type": "string"}, }, }, "required": ["summary", "action_items"], "additionalProperties": False, }, } response = client.messages.create( model="claude-fable-5-1", max_tokens=4096, tools=[record_summary_tool], tool_choice={"type": "auto"}, messages=[{ "role": "user", "content": ( "Summarize the meeting notes, then call record_summary " "with the summary and action items." ), }], ) ``` `strict: true` constrains the arguments if the model calls the tool; it does not recreate a transport-level guarantee that the tool must be called. Your application must still verify that the response contains the required tool-use block. Anthropic also recommends JSON outputs through `output_config.format` when the forced tool existed only to obtain schema-valid JSON.\[1] If the application must require one named tool halfway through a conversation, append a `role: "system"` message after the latest user message. Name the tool, state that it is required for this turn, and tell the model to begin with the call. Keep that system message in later history. This preserves the earlier prefix; rewriting the top-level system prompt would not.\[1] Treat “the model ignored the instruction” as a handled outcome. Reject the turn, retry under a bounded policy, or fail safely. Do not describe prompting as an absolute enforcement mechanism. ## Step 3: preserve thinking in the direction the API supports Every Fable 5.1 thinking block carries model and conversation binding information. Compatibility is one-way: ```text Fable 5 thinking ───────► Fable 5.1 can read it Opus 5 thinking ───────► Fable 5.1 can read it Fable 5.1 thinking ──X──► Fable 5 cannot read it Fable 5.1 thinking ──X──► Opus 5 cannot read it ``` Claude Mythos 5.1 is the documented exception that can read Fable 5.1 blocks. When a router, refusal fallback, or client retry sends the conversation to an older model, the API removes blocks that the target cannot read. The request can still succeed, and the removed input tokens are not billed, but the target must plan again without that reasoning.\[1] This matters for fallback evaluation. A first request on Fable 5 and a first request on Fable 5.1 are not equivalent to a mid-conversation switch from 5.1 to 5. Measure both. Log `input_transformations` with the thinking-binding beta enabled; `model_binding_mismatch` identifies blocks dropped because the model changed. ## Step 4: make the conversation prefix append-only A Fable 5.1 thinking block is valid against the exact system prompt, tool set, and message history that preceded it. Changing any of them before replaying the block can produce a 400 for an invalid thinking signature.\[1] Common accidental edits include: * rebuilding the system prompt with a fresh timestamp; * adding or removing a tool from the top-level `tools` array; * deleting an old tool result to save tokens; * inserting a summary before recent turns while retaining their thinking blocks; * removing a per-turn reminder on the next request; * fetching different image or document bytes from the same URL. The last case is easy to miss: the binding covers file bytes rather than only the URL string. For a file reused across turns, Anthropic recommends a stable Files API `file_id` or base64 content.\[1] Prefer these patterns: * append new turns without altering earlier bytes; * append mid-conversation system messages for changed instructions; * use supported tool-addition and tool-removal blocks for tool changes; * use server-side compaction or context editing; * if compacting on the client, replace the entire history with one summary and the new user turn, carrying no old thinking blocks. That final client-side shape is deliberately simple. Keeping recent turns behind a new summary is safe only if their `thinking` and `redacted_thinking` blocks are stripped, because those blocks were created against the pre-summary history.\[1] ## Diagnose prefix mismatches before users do Anthropic enforces the conversation-prefix check by default for accounts created on or after August 31, 2026. Older accounts may not fail unless they opt into the control, which creates a dangerous “works with our key” test gap for libraries used with customer keys.\[1] Use the beta control in a staging session: ```python response = client.beta.messages.create( model="claude-fable-5-1", max_tokens=4096, thinking={ "type": "adaptive", "block_binding": { "prefix_mismatch_behavior": "drop_block" }, }, messages=conversation, betas=["thinking-binding-controls-2026-08-01"], ) for change in response.input_transformations or []: print(change.path, change.reason) ``` With `drop_block`, the API removes the first mismatched thinking block and every later thinking block, then reports `prefix_binding_mismatch`. With the default `error`, it rejects the request. Use `drop_block` when a degraded continuation is preferable to failure; use `error` in CI to expose a history mutation immediately.\[1] An automatic retry of an identical invalid body cannot repair the mismatch. Either restore the original prefix, remove the affected thinking blocks, or explicitly request drop behavior once. ## Recheck behavior that does not produce a 400 Compatibility tests should also cover quieter changes. Anthropic says Fable 5.1 may issue fewer parallel tool calls in long agent loops, produce fewer progress messages, and call search or retrieval less often at `low` effort.\[3] None of these necessarily indicates a defect, but each can alter latency or product behavior. Build assertions around what the application needs: * For parallelizable reads, record calls per turn and total round trips. * For a progress UI, require user-facing updates at defined intervals rather than assuming they appear. * For retrieval-grounded answers, make retrieval criteria explicit and fail answers that lack required evidence. * For edit agents, verify the changed-file list and discourage whole-file rewrites when a small patch is required.\[4] Keep refusal handling too. Fable 5.1 can return `stop_reason: "refusal"` with a `stop_details.category`; do not treat empty answer text as a transport failure. Any fallback must account for the one-way thinking compatibility.\[2] ## FAQ ### Why does Fable 5.1 return a 400 for my structured-output request? Inspect the serialized Anthropic request. A framework may implement structured output by forcing a synthetic tool with `tool_choice: any`. Fable 5.1 rejects both `any` and a named `tool` choice. Switch to automatic tool choice plus a strict schema and explicit instruction, or use Anthropic's JSON output mechanism. ### Does `strict: true` guarantee that Claude calls the tool? No. It guarantees schema-conformant arguments when the tool is called. The instruction can require a call, but your application still needs to confirm that the expected tool-use block exists and handle its absence. ### Can Fable 5.1 continue a Fable 5 conversation? Yes. Fable 5.1 can read preserved thinking from Fable 5 and other documented earlier Claude models. The reverse direction is not compatible: the older target receives the conversation after Fable 5.1 thinking blocks are dropped. ### Can I change the system prompt between turns? Not by rewriting the prefix while replaying later Fable 5.1 thinking blocks. Append a mid-conversation system message and retain it in history. If the application intentionally starts a new conversation, it can use a new system prompt because there are no old thinking blocks to preserve. ### What is the safest client-side compaction strategy? Replace all prior history with one summary message plus the new user turn, and do not replay old thinking blocks. If you retain a recent tail, remove thinking and redacted-thinking blocks from that tail or use documented drop behavior. ### Does the migration lower every API bill? No. Input and output list prices remain $10 and $50 per million tokens. Cache reads are cheaper, but task cost also depends on output, number of turns, effort, retries, and whether the cache remains valid.\[5] The [Fable 5.1 cost breakdown](/blog/is-claude-fable-5-1-cheaper) handles that calculation separately. ## Release gate: do not deploy until every row passes | Gate | Pass condition | | ----------------- | ----------------------------------------------------------------------------------------- | | Model route | Every production alias resolves to `claude-fable-5-1` where intended | | Forced tools | No serialized request contains `tool_choice: any` or a named forced tool | | Required output | Missing tool calls and invalid data fail safely in application code | | Thinking history | Multi-turn, tool-change, and compaction tests show no unexplained prefix mismatch | | Fallback | Downgrade tests tolerate dropped 5.1 thinking and do not double-execute side effects | | Retention | The target workspace permits the model's required retention policy | | Behavioral checks | Retrieval, progress, tool batching, refusals, and file-edit scope meet the product rubric | A green single-turn response proves only that the model ID and credentials work. A green migration exercises the conversation after a tool call, after a history change, and after the fallback that usually runs only when production is already under stress. ## References 1. Anthropic, [Migrating to Claude Fable 5.1 and Claude Mythos 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide), accessed September 7, 2026. 2. Anthropic, [Claude Fable 5.1 overview](https://platform.claude.com/docs/en/models/fable-5-1/overview), accessed September 7, 2026. 3. Anthropic, [What's new in Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1), accessed September 7, 2026. 4. Anthropic, [Prompting Claude Fable 5.1](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-fable-5-1), accessed September 7, 2026. 5. Anthropic, [API pricing](https://platform.claude.com/docs/en/about-claude/pricing), accessed September 7, 2026. 6. OpenCode, [Issue #46735: Claude Fable 5.1 structured output tool-choice error](https://github.com/anomalyco/opencode/issues/46735), accessed September 7, 2026. The issue is cited as an integration example; API behavior is sourced from Anthropic. --- # Claude Fable 5.1 vs GPT-6 Astra: Choose by Workload (https://reapi.ai/blog/claude-fable-5-1-vs-gpt-6-astra) Claude Fable 5.1 and GPT-6 Astra have the same headline API prices and similarly large context windows, but they are not interchangeable. Fable 5.1 is usually the cleaner choice for an existing Anthropic Messages workflow, a cache-heavy long-running agent, or a job that regularly sends more than 272,000 input tokens. Astra deserves the first trial for Responses API agents, computer-use work, asynchronous tool loops, and workflows that benefit from steering while the model is still working. Neither is the automatic winner for coding, research, or “hard tasks” in general. The useful question is therefore not “Which model is smarter?” It is “Which model completes this workload with fewer human interventions, at an acceptable latency and cost?” The [Claude Fable 5.1 API guide](/docs/claude-fable-5-1) and [GPT-6 Astra API guide](/docs/gpt-6-astra) show the request details; this comparison supplies the routing decision around them. ## astra vs fable * Start with **Claude Fable 5.1** for an established Anthropic Messages agent, large reusable prompt prefixes, or strict thinking-block continuity. * Start with **GPT-6 Astra** for a Responses API agent that needs asynchronous tools, mid-turn steering, or computer use. * Both list **$10/MTok input and $50/MTok output**. Fable has cheaper cache reads; Astra charges a long-context premium above 272K input tokens.\[2]\[5] * Treat that as a shortlist, not a verdict. Route only after repeated tests show a lower cost per accepted task. These recommendations compare the vendors' documented API surfaces. On reAPI, Claude Fable 5.1 supports native Anthropic Messages at `https://reapi.ai/api/v1/messages`, while GPT-6 Astra uses Chat Completions at `https://reapi.ai/api/v1/chat/completions`. reAPI does not expose a public Responses endpoint, so Astra's Responses-only tools and controls described below are not available through this route. Check the provider's actual request contract before choosing an agent integration\[8]. For current vendor and reAPI rates, including cache categories and long-context conditions, see the [Claude API pricing guide](/blog/claude-api-pricing) and [GPT-6 Astra pricing guide](/blog/gpt-6-astra-pricing). The headline list-price comparison here is not a gateway quote. ## The shortest useful decision table | Your actual constraint | Start with | Reason to test it first | | ------------------------------------------------------------------------------ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | Existing production flow uses Anthropic Messages and preserved thinking blocks | Fable 5.1 | The migration path and history rules are documented for that stack | | Agent uses Responses API tools, background work, or mid-turn steering | Astra | Those controls are central to Astra's official API guidance | | Most requests reuse a large, stable prefix | Fable 5.1 | Its published cache-read rate is lower | | Requests often cross 272K input tokens | Fable 5.1 | Astra reprices the entire long request above that threshold | | Computer interaction is the dominant job | Astra | OpenAI positions it for computer use and exposes computer-use tooling | | Zero Data Retention eligibility is mandatory | Astra, subject to approval | OpenAI lists ZDR support for eligible API customers; Anthropic lists Fable 5.1 as a Covered Model with default 30-day retention and only limited exceptions | | Output quality is hard to describe before seeing it | Test both | A task-specific acceptance rubric is more useful than category labels | “Start with” is intentional. It identifies the sensible first branch, not the final production verdict. ## What is actually comparable? The specification sheets make these models look unusually close. | Specification | Claude Fable 5.1 | GPT-6 Astra | | -------------------------- | --------------------------------------: | --------------------------------------: | | API model ID | `claude-fable-5-1` | `gpt-6-astra` | | Context window | 1,000,000 tokens | 1,050,000 tokens | | Maximum output | 128,000 tokens | 128,000 tokens | | Input modalities | Text and images | Text and images | | Output modality | Text | Text | | Reasoning controls | `low`, `medium`, `high`, `xhigh`, `max` | `low`, `medium`, `high`, `xhigh`, `max` | | Headline input price | $10 / 1M tokens | $10 / 1M tokens | | Headline output price | $50 / 1M tokens | $50 / 1M tokens | | Published cache-read price | $0.25 / 1M tokens | $1 / 1M tokens | Those figures come from the vendors' model and pricing documentation.\[1]\[2]\[4]\[5] They do not tell you how many tool turns a task will take, how often a reviewer will reject the answer, or whether an agent will damage an existing repository. Those variables usually determine the bill. There is also one deceptively important difference in the pricing table. For Astra, an input longer than 272,000 tokens is charged at twice the standard input and cached-input rates, while output is charged at 1.5 times the standard output rate. The higher rates apply to the whole request, not only the portion above 272,000 tokens.\[5] A 300,000-token repository task therefore does not follow the $10/$50 headline curve on Astra. Fable 5.1's published pricing page does not list an equivalent long-context multiplier.\[2] ## The API surface can decide before model quality does Fable 5.1 uses the Anthropic Messages API and always-on adaptive thinking. It no longer accepts forced tool selection: `tool_choice` values that require any tool or name one specific tool return an HTTP 400 error. Automatic and disabled tool choice remain supported. Anthropic recommends strict tool schemas, an explicit instruction to call the tool, or Structured Outputs when the application needs valid structured data.\[3] Astra supports both Chat Completions and Responses, but OpenAI's model page says tool calling for Astra requires the Responses API. The Responses route also carries the model's asynchronous tool calling, mid-turn steering, and configuration updates.\[4]\[6] An application that remains on Chat Completions cannot fairly evaluate those agent features. This means a “same prompt” comparison may be operationally unfair. The text can match while the surrounding contract differs: tool schema, history representation, reasoning controls, retry behavior, and instructions injected by the agent framework. Compare complete working paths, not isolated request bodies. ## Route by workload, not by company label ### Long-lived coding agents Start by asking what the agent must remember and what it is allowed to change. Fable 5.1 has precise rules for carrying thinking blocks across turns. It can read compatible thinking blocks from earlier Claude models, but older models cannot consume Fable 5.1 thinking blocks. The conversation must also remain append-only: changing the system prompt, tool definitions, or earlier messages can invalidate later thinking blocks.\[3] That is manageable when the agent already uses Anthropic's history model, but it can complicate fallback routing between model generations. Astra is attractive when the coding harness is Responses-first and benefits from steering a long run without discarding work. OpenAI also describes configuration updates that can change reasoning effort between turns.\[6] Do not infer that these controls automatically produce safer edits. Your evaluation still needs checks for scope creep, unnecessary rewrites, test failures, and reviewer corrections. For either model, include maintenance tasks rather than only greenfield puzzles. A useful coding set contains: 1. a one-file bug with a clear failing test; 2. a cross-file change in an unfamiliar module; 3. a request with an explicit “do not touch” boundary; 4. a regression diagnosis where implementation is not authorized; 5. a long-context task that requires finding one relevant fact among many files. ### Research and professional documents Astra's announcement emphasizes research and the creation of spreadsheets, presentations, documents, and other professional artifacts.\[6] That makes it a sensible first candidate when the output is an artifact produced through OpenAI's supported tools rather than plain prose. Fable 5.1 is a strong first candidate when the research agent already relies on a large, repeatedly cached source packet. Its cheaper cache reads can matter more than a small difference in the number of uncached prompt tokens. The model's one-million-token context also stays on the standard published rate card, even when a source bundle passes Astra's 272K threshold.\[1]\[2] Judge research outputs on citation coverage, whether claims are supported by the cited passages, and how the system behaves when sources disagree. Fluency should not outrank traceability. ### Computer use OpenAI presents computer use as a core Astra workload and publishes results for its computer-use evaluations.\[6] That supports putting Astra in the first evaluation slot for browser and desktop control. It does not remove the need for a sandbox, confirmation gates, domain restrictions, and a record of every action. Fable 5.1 can still participate in tool-driven workflows, but its inability to force a named tool changes how deterministic action steps must be designed. If every turn must emit one validated action, test strict schemas and explicit instructions under failure conditions before considering the migration complete. ### Very long prompts The context windows differ by only 50,000 tokens, but the billing curves differ earlier. Evaluate at three bands: * below 100K, where ordinary task quality and output length dominate; * 200K–272K, where cache behavior becomes increasingly important; * above 272K, where Astra's long-context multiplier changes the economics. Do not fill the context window merely because it exists. Retrieval, compaction, and a stable cached prefix can reduce both distraction and cost. A model comparison should include the same relevant evidence, not the same maximal dump of files. ### Retention and governance Anthropic lists Fable 5.1 as a Covered Model with default 30-day API retention. Zero Data Retention is not generally available for it, although Anthropic documents a narrow path for eligible enterprise customers that receive express authorization.\[1] OpenAI lists Astra as supporting Zero Data Retention for eligible API customers.\[4] If retention policy is a hard procurement requirement, settle eligibility in writing before spending time on output comparisons. “Supports ZDR” is not the same as “every account has ZDR enabled.” ## What the launch benchmarks can and cannot tell you OpenAI's Astra announcement reports 64.6% for Astra and 52.6% for Claude Fable 5.1 on Terminal-Bench Science 0.1, alongside an estimate of roughly 31% lower API cost for Astra on that evaluation.\[6] Anthropic's own Fable 5.1 announcement also reports 52.6% for its model on that benchmark.\[7] That is a relevant signal for tasks resembling the benchmark. It is not a neutral audit and it does not establish a lower cost for unrelated work. The cost estimate depends on the benchmark's token and tool-use pattern; a cache-heavy 400K-token agent can face the opposite pricing geometry. Record the publisher, model configuration, harness, date, and workload whenever a benchmark informs routing. ## A fair test takes accepted work as its unit Build a small evaluation from production tasks before changing the default model. Twenty carefully chosen tasks are often more informative than hundreds of synthetic prompts if they cover the costly failure modes. Use a record like this for every run: | Field | Why it matters | | -------------------------------------------- | ---------------------------------------------------- | | Task ID and input snapshot | Makes both paths receive the same evidence | | Model, API, and effort | Prevents hidden configuration differences | | Total input, cached input, and output tokens | Allows billing reconstruction | | Tool calls and failed tool calls | Exposes orchestration overhead | | Wall-clock time | Captures the user-visible delay | | Human interventions | Counts clarification, steering, and recovery | | Automated checks | Records tests, schema validation, or artifact checks | | Reviewer verdict | Defines whether the output is accepted | Run each task more than once. Then calculate: ```text acceptance_rate = accepted_runs / total_runs cost_per_accepted_task = total_API_cost / accepted_runs interventions_per_accepted_task = total_human_interventions / accepted_runs ``` Keep the rubric fixed before reading model names. For code, an accepted result might require all tests to pass, no prohibited files to change, and no high-severity review finding. For research, it might require complete citation support and zero fabricated sources. Latency and style can be secondary scores, but they should not silently override correctness. The result may be a router rather than a winner. A practical policy could send ordinary repository edits to the cheaper accepted path, very long cached contexts to Fable 5.1, and computer-use tasks to Astra. Recheck the [current Fable 5.1 model route](/models/claude-fable-5-1) and [current Astra model route](/models/gpt-6-astra) when deploying; gateway availability and rates should not be inferred from upstream list prices. ## FAQ ### Is GPT-6 Astra better than Claude Fable 5.1 for coding? Not as a general rule. Astra's official results support testing it for difficult coding and computer-use work, while Fable 5.1 may fit an Anthropic-native, cache-heavy, long-context repository agent better. Use several representative maintenance tasks and score accepted changes, not prose preference. ### Which model is cheaper? They share the same standard input and output list prices. Fable 5.1 has the cheaper published cache-read rate, while Astra applies a long-context multiplier above 272K input tokens. Astra can still cost less on a particular task if it uses fewer tokens, tools, retries, or reviewer interventions. ### Can I use the same tool-calling code for both? No. Fable 5.1 rejects forced `tool_choice`, and Astra requires the Responses API for its tool-calling path. Normalize the application-level tool contract, then write and test a separate adapter for each API. ### Which one has the larger context window? Astra lists 1,050,000 tokens and Fable 5.1 lists 1,000,000. That 5% difference is less important than relevance, caching, history handling, and Astra's price change above 272,000 input tokens. ### Does Fable 5.1 support Zero Data Retention? Not by default. Anthropic documents a default 30-day retention period and says ZDR is unavailable except for expressly authorized eligible enterprise cases. Confirm the contract for the exact account and model. ### Should I switch every request to the winner of my evaluation? Only if the workload is genuinely uniform. Most production systems benefit from a default plus a few evidence-based exceptions. A routing rule is easier to audit when each exception names a measurable constraint: context size, tool surface, retention, latency, or acceptance rate. ## Route the exception, not every request A model switch becomes easier to defend when it is written as a narrow rule: “Use Fable 5.1 when cached input exceeds 200K,” or “Use Astra for the computer-use queue after the reviewer gate passes.” Those rules can be measured, priced, and reversed. “Use Astra because it won a benchmark” and “use Fable because it feels better in our codebase” cannot. Keep one ordinary default, route the expensive exceptions, and rerun the acceptance set when either vendor changes the model, pricing, or API contract. ## References 1. Anthropic, [Claude Fable 5.1 overview](https://platform.claude.com/docs/en/models/fable-5-1/overview), accessed September 7, 2026. 2. Anthropic, [API pricing](https://platform.claude.com/docs/en/about-claude/pricing), accessed September 7, 2026. 3. Anthropic, [Migrating to Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide), accessed September 7, 2026. 4. OpenAI, [GPT-6 Astra model documentation](https://developers.openai.com/api/docs/models/gpt-6-astra), accessed September 7, 2026. 5. OpenAI, [API pricing](https://openai.com/api/pricing/), accessed September 7, 2026. 6. OpenAI, [Introducing GPT-6 Astra](https://openai.com/index/gpt-6-astra/), September 3, 2026. 7. Anthropic, [Introducing Claude Fable 5.1 and Mythos 5.1](https://www.anthropic.com/claude-fable-and-mythos-5-1), September 1, 2026. 8. reAPI. *Current request contracts.* Checked October 23, 2026. [Claude Fable 5.1 documentation](/docs/claude-fable-5-1), [GPT-6 Astra documentation](/docs/gpt-6-astra). --- # Claude Haiku 5.5 vs Sonnet 5.5: Tools, Thinking, and Cost (https://reapi.ai/blog/claude-haiku-5-5-vs-sonnet-5-5) Claude Haiku 5.5 and Claude Sonnet 5.5 both have a documented one-million-token context window and a 128,000-token standard output limit. Their controls differ: Haiku defaults to medium effort and permits forced tool selection, while Sonnet defaults to high effort and uses automatic tool selection\[1]\[2]. That makes **Haiku 5.5 vs Sonnet 5.5** a question about the workflow you need to run. This guide compares their documented request behavior, describes our small reAPI capability checks, and gives you a practical way to evaluate your own tasks. It does not rank coding quality or claim a latency advantage from a handful of requests. ## TL;DR * Both models accept text and images and return text, with the same documented context and ordinary output ceilings\[1]\[2]. * Haiku can disable thinking at low, medium, or high effort and can force a named tool. These are useful control differences for a defined extraction or routing step\[3]. * Sonnet offers between-tools thinking at low, medium, or high effort. It can skip initial thinking while retaining thinking between tool calls\[4]. * Our October 9 checks observed structured JSON, tool-result continuation, document citations, streaming, and cache reads on both models. The API docs record the test scope\[5]\[6]. * Compare current [Haiku pricing](/models/claude-haiku-5-5) and [Sonnet pricing](/models/claude-sonnet-5-5) using a representative request. Official direct prices and reAPI prices are separate schedules\[7]. ## Haiku 5.5 vs Sonnet 5.5: controls that change the workflow A model switch can change more than the model ID. In a Haiku 5.5 vs Sonnet 5.5 migration, review thinking and tool selection before assuming an existing request has the same meaning. | Documented property | Claude Haiku 5.5 | Claude Sonnet 5.5 | | ----------------------- | ------------------------------------- | ------------------------------------------ | | Model ID | `claude-haiku-5-5` | `claude-sonnet-5-5` | | Context window | 1 million tokens | 1 million tokens | | Standard output ceiling | 128,000 tokens, including thinking | 128,000 tokens, including thinking | | Default effort | Medium | High | | Effort choices | Low, medium, high, xhigh, max | Low, medium, high, xhigh, max | | Skip initial thinking | Disabled mode at low, medium, or high | Between-tools mode at low, medium, or high | | Forced tool selection | Supported | Use automatic selection | | Release date | October 7, 2026 | September 28, 2026 | The table summarizes Anthropic's model and migration documentation, checked October 9, 2026\[1]\[2]\[3]\[4]. The limits are specifications, not a claim that our tests exercised maximum-size conversations. For Haiku 5.5 vs Sonnet 5.5, equal context limits don't establish equal answer quality. A long request still needs a clear question and relevant evidence. Keep the input fixed when comparing the two models, and judge the answer against the same requirements. ## Thinking settings in Haiku 5.5 vs Sonnet 5.5 Both models use adaptive thinking by default. Haiku's native default effort is medium; Sonnet's is high. Thinking consumes the output allowance, so a very small `max_tokens` budget can leave little room for a visible answer\[3]\[4]. For a Haiku 5.5 vs Sonnet 5.5 evaluation, decide whether you're comparing each model's default experience or a common effort setting. Those are different experiments. Record the choice with your results so a later change to the prompt or effort doesn't look like an unexplained quality regression. Haiku's documented `thinking.type: "disabled"` is available at low, medium, and high effort. Sonnet uses `thinking.type: "between_tools"` at those levels instead. The latter skips thinking before the initial response while permitting it between tool calls; it is not a general off switch\[3]\[4]. This distinction matters if the first action should be a lookup. Your application may already know which record to retrieve and need the model to reason only after the result arrives. Test that sequence directly instead of using a single conversational answer as a proxy for the whole workflow. ## Haiku 5.5 vs Sonnet 5.5 for tools and structured results Haiku supports both any-tool selection and a named forced tool. Sonnet's migration guidance directs callers to automatic selection or no tools; our named-tool probe returned an upstream error for Sonnet\[3]\[4]\[6]. In Haiku 5.5 vs Sonnet 5.5, this is a concrete integration difference. Consider a synthetic support workflow with one classification function. If every request must produce that function call, Haiku's forced selection is a feature to evaluate. If the application only needs a category record, structured JSON may be a simpler fit than treating classification as a tool. Both models support structured JSON through `output_config.format`. A schema controls the output shape, while a tool definition describes a function your application may execute. Neither removes the need to check business facts: a correctly shaped date can still be the wrong date\[8]. For a Haiku 5.5 vs Sonnet 5.5 tool comparison, keep execution in your application. Return the result with the matching tool-use ID and preserve the assistant's complete content, including signed thinking blocks. Flattening the previous reply to visible text loses state needed for a faithful conversation\[3]\[4]. ## What our reAPI checks actually observed We made 40 direct, bounded requests across the two models on October 9, 2026. They used synthetic text and tool fixtures, with no customer records or real tool actions. These were protocol and feature checks, not a coding benchmark or a load test. The individual model docs describe the observed features and untested scope\[5]\[6]. | Check | Observed on both models | | --------------------------------- | --------------------------------------------------------------- | | Basic text and system instruction | Expected synthetic marker returned | | Streaming | Native message and content events returned | | Structured JSON | Requested schema prevailed over a conflicting plain-text prompt | | Strict client tool | Expected tool name and structured input returned | | Tool-result continuation | Next response used the supplied synthetic tool result | | Stop sequence | Stop reason matched; text after the marker was absent | | Text-document citation | Answer included a citation block | | Prompt cache | Cache-creation counters followed by cache-read counters | For Haiku 5.5 vs Sonnet 5.5, these checks establish a useful starting set of application features. They don't tell you which model produces a better patch, how long a large PDF takes, or how either behaves under your production concurrency. All five official effort values were accepted. We did not infer relative reasoning depth from that acceptance. Likewise, a response without a thinking block doesn't reveal every detail of the model's internal computation. Native parameters pass through reAPI, including unknown extension fields. An HTTP 200 response is a normal accepted response, even if the upstream ignores a setting. Testing Haiku 5.5 vs Sonnet 5.5 therefore requires an observable outcome: a cache counter, the requested output shape, a stop reason, or a tool result that affects the next answer. Parameter acceptance and demonstrated behavior are separate facts\[5]\[6]. ## Haiku 5.5 vs Sonnet 5.5 costs depend on the request A Haiku 5.5 vs Sonnet 5.5 cost comparison needs input size, generated output, and cache use. Start with the current rates on the two model pages, then run a small representative sample and inspect its actual usage. Avoid multiplying only the visible answer length: thinking is part of output usage\[3]\[4]. Anthropic's direct Haiku price schedule changes above 100,000 prompt tokens, with cached input included in the threshold. Sonnet's documented one-million-token window has no corresponding long-context premium in the current direct schedule. These conditions belong to Anthropic's pricing; do not silently apply them to a different service's quote\[7]. Caching is worth evaluating when requests repeatedly share a stable prefix. Both models document a 512-token minimum cacheable prefix and support five-minute and one-hour cache lifetimes. A cache setting in an accepted request is not evidence of a hit; inspect creation and read counters\[9]. For Haiku 5.5 vs Sonnet 5.5, keep the cache conditions comparable. Mixing a warm repeated prompt on one model with a new prompt on the other makes the cost comparison difficult to interpret. Record whether you're measuring a first request or repeated use, and don't describe one sample as an account-wide saving. ## Build a small evaluation around an actual decision Use a workload you can grade without relying on another model's opinion. For extraction, prepare source notes with known fields and deliberate omissions. For code review, use a defect with a failing test. For a research brief, prepare a source set with at least one unresolved question that the answer should preserve. Haiku 5.5 vs Sonnet 5.5 becomes easier to assess when the failure criteria are explicit. An extraction answer fails if it invents a missing date. A proposed patch fails if it changes unrelated behavior. A research answer fails if its cited passage doesn't support the claim. These are suggested evaluation rules, not claims about either model's observed performance. Run Haiku 5.5 vs Sonnet 5.5 with the same inputs, recorded effort, and output budget. Keep the returned content, usage, and stop reason. If you add a tool, test the complete loop: a correct initial call is only one step, and the useful result arrives after the application returns data. Use the [Haiku Messages examples](/docs/claude-haiku-5-5) and [Sonnet Messages examples](/docs/claude-sonnet-5-5) to keep the transport format consistent. The [Claude context guide](/blog/claude-context-window) offers additional background; check exact model documentation for version-specific limits. ## Haiku 5.5 vs Sonnet 5.5 FAQ ### Is Haiku 5.5 better than Sonnet 5.5? There is no universal winner established by these checks. Haiku offers forced tool selection and a disabled-thinking mode; Sonnet has different default effort and between-tools behavior. Compare the result against your workload's requirements before choosing\[3]\[4]. ### Is the context window the same in Haiku 5.5 vs Sonnet 5.5? Yes. Both document one million tokens of context and 128,000 tokens of standard output, including thinking. Equal limits do not demonstrate equal retrieval or reasoning quality on a long input\[1]\[2]. ### Which one should I use for coding? Evaluate both on a change with a known acceptance test. Our Haiku 5.5 vs Sonnet 5.5 checks tested API features, not coding quality. The [Sonnet page](/models/claude-sonnet-5-5) includes a code-review starting prompt; adapt it to the modules and constraints in your project. ### Do both Haiku 5.5 and Sonnet 5.5 support structured JSON? Yes. Both support `output_config.format` with a JSON schema. Our small tests observed schema-conforming output despite a conflicting plain-text instruction. Evaluate your actual schemas separately, including missing values and any domain-specific validation\[5]\[6]. ### Can I use document citations with JSON output? Anthropic documents citations and structured JSON as incompatible in the same request. Choose a cited narrative when source review matters, or structured JSON when your application needs fields; design a separate verification step if you need both outcomes\[8]. ### Are Claude subscriptions and reAPI calls billed together? No. Calls made with a reAPI key use your reAPI account's billing. Check the model page for current token rates. A separate Claude subscription does not pay for those requests\[5]\[6]. ## Choose with a result you can check Begin your Haiku 5.5 vs Sonnet 5.5 comparison with a bounded extraction task, a reproducible code issue, or a source-backed decision. Keep the prompt and evaluation criteria fixed, then inspect correctness and actual usage before changing settings. Documented controls help you select a Haiku 5.5 vs Sonnet 5.5 candidate; the complete workflow tells you whether it fits. Open [Claude Haiku 5.5](/models/claude-haiku-5-5) or [Claude Sonnet 5.5](/models/claude-sonnet-5-5), try a representative task, and use the linked Messages examples when you are ready to integrate. ## References 1. Anthropic. *Claude Haiku 5.5 overview.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/models/haiku-5-5/overview](https://platform.claude.com/docs/en/models/haiku-5-5/overview). 2. Anthropic. *Claude Sonnet 5.5 overview.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/models/sonnet-5-5/overview](https://platform.claude.com/docs/en/models/sonnet-5-5/overview). 3. Anthropic. *Haiku 5.5 migration guidance.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/models/haiku-5-5/migration-guide](https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide). 4. Anthropic. *Sonnet 5.5 migration guidance.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/models/sonnet-5-5/migration-guide](https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide). 5. reAPI. *Haiku 5.5 API documentation and observed capabilities.* October 9, 2026. [reapi.ai/docs/claude-haiku-5-5](/docs/claude-haiku-5-5). 6. reAPI. *Sonnet 5.5 API documentation and observed capabilities.* October 9, 2026. [reapi.ai/docs/claude-sonnet-5-5](/docs/claude-sonnet-5-5). 7. Anthropic. *Pricing.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/about-claude/pricing](https://platform.claude.com/docs/en/about-claude/pricing). 8. Anthropic. *Structured outputs.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/build-with-claude/structured-outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs). 9. Anthropic. *Prompt caching.* Retrieved October 9, 2026 from [platform.claude.com/docs/en/build-with-claude/prompt-caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching). --- # CLAUDE.md: The Simple File That Makes Coding Agents Better (https://reapi.ai/blog/claude-md-coding-agent-guide) A good `CLAUDE.md` does not make the model smarter. It makes the assignment less ambiguous every time the agent enters your repository. That modest mechanism explains why a repository built around four plain-language coding rules became one of 2026's most visible agent projects. The instructions tell the agent to surface assumptions, prefer simple implementations, keep changes surgical, and define verifiable success. None is novel software engineering. Putting all four into context before every task is the useful part. The viral headline said one file reached 91,000 GitHub stars. By August 2, 2026, the repository had moved from `forrestchang` to `multica-ai`, grown into plugins and editor rules, and reached **198,529 stars** according to GitHub's API.\[1] The number will keep changing. The durable lesson is how small, persistent instructions change agent behavior. ## TL;DR * `CLAUDE.md` is a Markdown file containing persistent instructions that Claude Code loads as context.\[2] * The viral repository condensed common agent failures into four rules: **think before coding, simplicity first, surgical changes, and goal-driven execution**.\[3] * The file works best when it contains facts and rules needed in almost every session: commands, architecture, conventions, boundaries, and verification. * `CLAUDE.md` is context, not enforcement. Use permissions or hooks for actions that must be technically blocked.\[2] * Keep task-specific procedures in skills and file-specific guidance in `.claude/rules/`; loading everything globally wastes context. * A useful file is short enough to maintain, specific enough to test, and revised whenever the agent repeats a mistake. ## What is CLAUDE.md? `CLAUDE.md` is Claude Code's project instruction file. It is ordinary Markdown, usually committed at the repository root, that gives the agent durable context such as: * how to install, test, build, and format the project; * the parts of the architecture that are not obvious from filenames; * naming and code-style conventions; * which generated files should not be edited manually; * which checks must pass before a task is complete; * repository-specific safety boundaries. Claude Code reads the file at the beginning of a session. Anthropic describes it as one of two memory mechanisms: people write `CLAUDE.md` instructions, while Claude's auto memory stores patterns it learns from corrections.\[2] That sounds like configuration, but Anthropic makes an important distinction. These instructions enter the model's context; they are not hard controls. If “never deploy production” must be guaranteed, a `PreToolUse` hook or permission boundary is the appropriate layer. A sentence in Markdown can guide behavior. It cannot provide a security guarantee. ## Why the four-rule file went viral The repository now called `multica-ai/andrej-karpathy-skills` says its guidelines were derived from Andrej Karpathy's public observations about coding-model failure modes.\[3] Its popularity is easy to overcomplicate. Each rule maps a familiar frustration to a behavior the agent can perform. | Common failure | Persistent instruction | Observable result | | ----------------------------------------- | ---------------------- | ---------------------------------------------- | | Agent silently guesses what you meant | Think before coding | Assumptions and ambiguity surface before edits | | Small request turns into a framework | Simplicity first | Fewer speculative abstractions and less code | | Unrelated files change “while we're here” | Surgical changes | Smaller diffs that trace to the request | | Agent declares success without proving it | Goal-driven execution | Tests and success criteria close the loop | These rules do not teach TypeScript, database design, or debugging. They shape how the model approaches uncertainty and scope. That makes them reusable across repositories. The simplicity is also social. A team can read four principles in two minutes, disagree with one, edit it, and review the change in Git. There is no hidden prompt platform to administer. ## The four principles, translated into project behavior ### 1. Think before coding The original guideline asks the agent to state assumptions, present multiple interpretations when necessary, push back on unnecessary complexity, and stop when genuinely confused.\[3] Project-specific wording makes it stronger: ```md Before changing an API contract, identify every in-repo consumer and state whether the change is backward compatible. If product behavior is ambiguous, stop and ask; do not choose a behavior silently. ``` The generic principle sets posture. The concrete addition tells the agent where wrong assumptions are expensive. ### 2. Simplicity first “Do not overengineer” is directionally useful but difficult to verify. Add the repository's local definition of simple: ```md Prefer an existing utility over a new abstraction. Do not introduce a service, factory, or configuration flag for one call site. Implement only the requested behavior; list optional follow-ups instead of building them. ``` This reduces a predictable model tendency: solving a hypothetical family of future problems instead of the current one. ### 3. Surgical changes Agents see nearby cleanup opportunities because they read broadly. That does not mean a task authorizes every cleanup. ```md Every changed line must trace to the request. Preserve surrounding formatting and naming. Remove imports made unused by your edit, but report unrelated dead code instead of deleting it. ``` Small diffs are easier to review, test, revert, and assign. They also reduce the chance that an agent breaks something whose purpose it did not understand. ### 4. Goal-driven execution An instruction such as “make it work” leaves the end state undefined. Translate the task into a result the agent can check: ```md For bug fixes, reproduce the failure with a test before changing production code. Run the narrowest relevant checks during iteration and the required project checks before completion. Report commands and outcomes. ``` This is where autonomy becomes useful. When success is observable, the agent can iterate on failures instead of stopping after the first plausible edit. ![A project-instruction map showing commands, boundaries, style, and verification flowing into coding-agent behavior](https://cdn.reapi.ai/media/blog/claude-md-coding-agent-guide/claude-md-coding-agent-guide-instruction-map.png) ## What belongs in CLAUDE.md Anthropic recommends keeping facts in `CLAUDE.md` that Claude should hold in every session, and moving multi-step or narrow procedures to more targeted mechanisms.\[2] A useful test is: “Would I repeat this during onboarding for almost every task?” ### Put these in the root file * one-paragraph project and architecture description; * package manager and canonical install, dev, test, type-check, and build commands; * directory ownership and generated-file boundaries; * rules that apply across languages or packages; * definition of done; * high-frequency mistakes and their correction; * where to find deeper instructions. ### Put these somewhere else | Information | Better location | Why | | ---------------------------------------- | ----------------------------------- | ------------------------------------------------------------- | | Personal sandbox URL or local preference | `CLAUDE.local.md` | Applies to one developer and should usually be ignored by Git | | Rules only for `src/api/**` | `.claude/rules/api.md` with `paths` | Loads when relevant instead of every session | | A release or migration procedure | Skill | Multi-step workflow is invoked only when needed | | A command that must never run | Permission or hook | Enforcement should not depend on model compliance | | Temporary task details | Current prompt or issue | They will become stale in persistent context | | Long design documentation | Existing docs, linked concisely | Avoid paying the context cost on every task | ## A concise CLAUDE.md template Copy this as a starting point, then replace every bracketed item. Delete sections that do not constrain your project. ```md # Project instructions ## Project [One paragraph: what this repository ships, its main runtime, and the most important architectural boundary.] ## Commands - Install: `[command]` - Develop: `[command]` - Focused test: `[command with file or pattern]` - Full test: `[command]` - Type-check: `[command]` - Build: `[command]` ## Before editing - Read the nearest existing implementation and tests before proposing a change. - State assumptions that affect public behavior, data, security, or compatibility. - If the request has multiple materially different interpretations, ask. ## Scope - Implement only the requested behavior. - Prefer existing patterns and utilities over new abstractions. - Keep diffs surgical; do not refactor adjacent code unless required. - Remove only dead code created by your change. ## Project boundaries - `[path]` is generated; change `[source path or command]` instead. - `[package]` owns `[responsibility]`; do not duplicate it in `[other package]`. - Never expose `[secret or private data category]` in logs or fixtures. ## Style - [Two to five rules that differ from formatter defaults or are easy to miss.] - Match the surrounding file when no explicit rule applies. ## Verification - For a bug fix, add or update a test that fails before the fix. - During iteration, run the narrowest relevant check. - Before completion, run: `[required commands]`. - Report changed files, commands run, outcomes, and any unverified risk. ## Deeper instructions - API work: `.claude/rules/api.md` - Database changes: `[skill or documentation path]` - Releases: `[skill or documentation path]` ``` The template is intentionally plain. A `CLAUDE.md` should not read like a motivational manifesto. It should reduce decisions the agent would otherwise have to guess. ## How Claude Code loads multiple instruction files Claude Code walks up the directory tree from the current working directory and loads `CLAUDE.md` and `CLAUDE.local.md` files it finds. Instructions closer to the launch directory appear later in context. Nested files below the working directory load when Claude reads files in those subdirectories.\[2] For a monorepo, that allows a useful hierarchy: ```text repo/ ├── CLAUDE.md # Organization-wide project facts ├── .claude/ │ └── rules/ │ ├── testing.md # Unscoped shared rule │ └── api.md # paths: packages/api/** ├── packages/ │ ├── web/ │ │ └── CLAUDE.md # Web-specific architecture and checks │ └── worker/ │ └── CLAUDE.md # Worker runtime constraints └── CLAUDE.local.md # Developer-only local notes ``` Files are concatenated as context rather than behaving like a strict configuration override. Contradictory rules may therefore produce inconsistent behavior. Review the hierarchy periodically and remove stale instructions. ## How to improve the file from real failures Do not attempt to predict every possible mistake on day one. Start small and use repeated friction as the backlog. 1. **Record the failure.** What did the agent do, and what did you expect? 2. **Find the right layer.** Is this a universal instruction, path-specific rule, task procedure, or hard safety control? 3. **Write an observable rule.** Replace “be careful” with the action and condition. 4. **Test it on a similar task.** Confirm behavior improves without blocking trivial work. 5. **Delete stale rules.** Context has a cost; an obsolete instruction can be worse than no instruction. Anthropic's practical trigger is memorable: add something when Claude makes the same mistake a second time, when code review catches knowledge the agent should have had, or when you repeat the same correction across sessions.\[2] ## Five CLAUDE.md mistakes to avoid ### Writing aspirations instead of instructions “Write excellent, robust code” gives no new information. “Run `pnpm test --filter api` after changes under `packages/api`” can be followed and checked. ### Copying a giant generic rulebook A public template can provide ideas, but every unconditional line consumes context and may conflict with the project. Keep the four broad behavioral principles if they help; replace generic technology advice with local facts. ### Encoding facts the agent can cheaply discover You rarely need to list every directory. Explain boundaries that filenames do not reveal, such as which package owns authorization or which source generates a checked-in client. ### Treating instructions as security controls Never rely on “do not read secrets” or “do not deploy” as the only protection. Use scoped credentials, permissions, sandboxing, and hooks for hard boundaries. ### Never reviewing the file Commands change, packages move, and old exceptions become default behavior. Assign ownership and review `CLAUDE.md` like code. ## How to know whether it is working Avoid judging the file by whether one demo looks impressive. Measure work the team already reviews: * median changed lines per completed task; * unrelated files touched; * review comments caused by repository-convention violations; * first-pass test success; * tasks reopened after a claimed completion; * repeated clarifications that should become persistent context. The viral repository suggests the same outcome-level tests: fewer unnecessary diff changes, fewer rewrites caused by overcomplication, and clarification before implementation rather than after mistakes.\[3] ## FAQ ### Where should CLAUDE.md go? For team-shared project instructions, place it at `./CLAUDE.md` or `./.claude/CLAUDE.md` and commit it. Use `~/.claude/CLAUDE.md` for personal instructions across projects and `CLAUDE.local.md` for personal notes in one project.\[2] ### Does CLAUDE.md work with Cursor or other coding agents? `CLAUDE.md` is a Claude Code convention. The viral repository also ships Cursor rules and a plugin, while other agents may use files such as `AGENTS.md` or product-specific rule directories. Keep a canonical source and adapt it deliberately rather than assuming every tool loads the same file. ### How long should CLAUDE.md be? There is no universal line count. It should contain only information valuable in nearly every session. If a section applies to one directory or one workflow, move it to a path-scoped rule or skill. ### Can CLAUDE.md stop destructive commands? It can instruct Claude not to run them, but Anthropic explicitly describes the file as context rather than enforced configuration. Use permissions or hooks for reliable prevention.\[2] ### How do I create the first file? Run `/init` in Claude Code to generate a starter `CLAUDE.md`, or create the Markdown file manually. Then run `/context` to confirm it loaded and `/memory` to inspect or edit memory files.\[4] ## The file is simple because the problem is repetitive Coding agents do not need a 500-line constitution before they can fix a bug. They need a few project facts they cannot infer, a clear boundary around the requested change, and a check that distinguishes completion from confidence. That is why four ordinary rules traveled so far. They address mistakes developers see every day, live in a format the whole team can edit, and load before the agent starts making decisions. Begin there. Add project knowledge only when it prevents a real failure, and enforce critical boundaries outside the prompt. If you are new to the tool itself, start with the broader [guide to using Claude Code](/blog/how-to-use-claude-code). Use this article when the installation is finished and the next question is what your agent should know every time it enters the repo. ## References 1. GitHub REST API. *multica-ai/andrej-karpathy-skills repository metadata.* Retrieved August 2, 2026. [api.github.com](https://api.github.com/repos/multica-ai/andrej-karpathy-skills) 2. Anthropic. *How Claude remembers your project.* Claude Code Docs. Retrieved August 2026. [code.claude.com](https://code.claude.com/docs/en/memory) 3. multica-ai. *Karpathy-Inspired Claude Code Guidelines.* GitHub. Retrieved August 2026. [github.com](https://github.com/multica-ai/andrej-karpathy-skills) 4. Anthropic. *Claude Code commands.* Retrieved August 2026. [code.claude.com](https://code.claude.com/docs/en/commands) 5. Sumit Pandey. *A Single CLAUDE.md File Went Viral. The Reason Is Embarrassingly Simple.* Towards Deep Learning, May 2026. [towardsdeeplearning.com](https://www.towardsdeeplearning.com/a-single-claude-md-file-went-viral-the-reason-is-embarrassingly-simple-5b515c9e4cca) ### Further reading * reAPI. *How to use Claude Code.* [reapi.ai/blog/how-to-use-claude-code](/blog/how-to-use-claude-code) * reAPI. *How to get a Claude API key.* [reapi.ai/blog/how-to-get-claude-api-key](/blog/how-to-get-claude-api-key) * reAPI. *Claude model catalog.* [reapi.ai/models](/models) --- # Claude Opus 5 vs GPT-5.6 Sol: Which Is Better for Coding? (2026) (https://reapi.ai/blog/claude-opus-5-vs-gpt-5-6-sol) **Claude Opus 5 is the better default for long-running software work, while GPT-5.6 Sol has the stronger result on one important agentic coding benchmark and a more ambitious orchestration stack.** That is the practical answer to Claude Opus 5 vs GPT-5.6 Sol. It is also less decisive than either vendor's launch page makes it sound. Anthropic's own comparison has Opus 5 ahead on Frontier-Bench, computer use, knowledge work, and business automation. The same table has GPT-5.6 Sol ahead on DeepSWE v1.1. Prices split differently depending on where you call them: at official list prices Sol is currently cheaper on both dimensions under an OpenAI promotion; on reAPI, Opus 5 is 25% less expensive on both.\[1]\[2] ## TL;DR * **Choose Claude Opus 5 for long-horizon coding, code review, computer use, and workflows that benefit from careful self-verification.** * **Choose GPT-5.6 Sol when DeepSWE-style repository work, OpenAI's Responses API tools, or native multi-agent orchestration matter most.** * **The benchmark result is split.** Opus 5 leads Frontier-Bench 43.3% to 34.4%; Sol leads DeepSWE v1.1 72.7% to 68.8%.\[1] * **Official prices:** Opus 5 is $5 input / $25 output; Sol is $4 / $20 per million tokens under a promotion OpenAI says runs at least through November 21, 2026.\[2]\[3] * **Current reAPI prices:** Opus 5 is $2.40 / $12; Sol is $3.20 / $16 per million tokens (checked October 22, 2026). * **Do not pick from one score.** Run the same repository tasks at the same effort level and compare accepted-result cost, not token rate alone. ## Claude Opus 5 vs GPT-5.6 Sol at a glance | Category | Claude Opus 5 | GPT-5.6 Sol | | --------------------- | ------------------------------------------------- | ----------------------------------------------------------- | | Best fit | Long-running coding, review, enterprise workflows | Frontier coding, tool-heavy agents, orchestration | | Context window | 1M tokens | 1.05M tokens | | Max output | 128K tokens | 128K tokens | | Reasoning controls | `low` through `max`; default `high` | `none` through `max`; Pro mode and multi-agent in Responses | | Thinking default | Adaptive thinking on | Medium reasoning when omitted | | Official input/output | $5 / $25 per MTok | $4 / $20 per MTok (promotional) | | reAPI input/output | $2.40 / $12 per MTok | $3.20 / $16 per MTok | | Clear benchmark win | Frontier-Bench, OSWorld, AutomationBench | DeepSWE v1.1 | Both accept text and image input and expose tool calling. Both also have a million-token-class context window, so context size is not a useful tie-breaker by itself.\[3]\[4] ## What the official coding benchmarks actually show Anthropic published a direct table containing both models. It is vendor-run, and several rows use different harnesses or fallback behavior, so the numbers are evidence—not a neutral final verdict.\[1] | Evaluation | Opus 5 | GPT-5.6 Sol | Lead | | ------------------------ | -----------: | ----------: | ----------- | | Frontier-Bench v0.1 | **43.3%** | 34.4% | Opus 5 | | GDPval-AA v2 | **1861 Elo** | 1736 Elo | Opus 5 | | ARC-AGI-3 | **30.2%** | 7.8% | Opus 5 | | BrowseComp | **90.8%** | 90.4% | Near tie | | OSWorld 2.0 | **70.6%** | 62.6% | Opus 5 | | DeepSWE v1.1 | 68.8% | **72.7%** | GPT-5.6 Sol | | AutomationBench | **26.0%** | 18.1% | Opus 5 | | HealthBench Professional | 59.8% | **60.5%** | GPT-5.6 Sol | The split is useful. Frontier-Bench measures long, open-ended engineering tasks; Opus 5's lead supports Anthropic's positioning around persistence and self-verification. DeepSWE is closer to autonomous repository-level software engineering, where Sol holds a 3.9-point lead. BrowseComp differs by 0.4 points and should be treated as a tie. A purchasing decision built on that margin would be false precision. ![Decision matrix for choosing Claude Opus 5 or GPT-5.6 Sol by coding workflow, cost, and tool orchestration](https://cdn.reapi.ai/media/blog/claude-opus-5-vs-gpt-5-6-sol/claude-opus-5-vs-gpt-5-6-sol-decision-matrix.png) ## Which model is better for real coding work? ### Feature development and difficult debugging: Opus 5 Opus 5 is the safer first choice when the job lasts many turns and the model must keep checking its own work. Anthropic specifically designed it for complex agentic coding and long-horizon tasks, and its largest official gains appear on evaluations that reward persistence rather than a single answer.\[1] That makes it well suited to code review, root-cause debugging, migrations, and feature work where requirements change during implementation. Thinking is on by default, and effort is the main cost dial. Start at `high`, then compare `medium` and `xhigh` against your own acceptance tests. ### Repository agents and OpenAI-native tooling: GPT-5.6 Sol Sol deserves the first test when DeepSWE-style performance or the Responses API ecosystem is the priority. GPT-5.6 adds Programmatic Tool Calling, persisted reasoning controls, Pro mode, and beta multi-agent orchestration.\[3] Those features matter when one agent must coordinate searches, shell work, file operations, and subagents without an orchestration layer built entirely in application code. They do not make every coding answer better, but they change what one API request can coordinate. ### Frontend and computer use: Opus 5 Opus 5 leads OSWorld 2.0 by eight points in Anthropic's table and is also ahead on the vendor's Frontier-Bench and automation results. For browser-based QA, visual debugging, and workflows that alternate between code and UI inspection, the evidence points toward Opus 5.\[1] Still test your own stack. Browser harnesses, screenshot resolution, tool latency, and retry rules can move the result more than a small model upgrade. ## Price comparison: official API and reAPI | Route | Input / MTok | Output / MTok | | ----------------------- | -----------: | ------------: | | Anthropic Claude Opus 5 | $5.00 | $25.00 | | OpenAI GPT-5.6 Sol | $4.00 | $20.00 | | reAPI Claude Opus 5 | **$2.40** | **$12.00** | | reAPI GPT-5.6 Sol | **$3.20** | **$16.00** | Prices checked October 22, 2026. At official list prices, Sol is now 20% cheaper than Opus on both input and output, because OpenAI's GPT-5.6 Sol rate is a promotion that it says runs at least through November 21, 2026. On reAPI the order is reversed: Opus costs 25% less than Sol for both input and output. That changes the default for high-volume agent loops, where reasoning and tool transcripts create a large output bill. Price per token is only the first layer. The useful metric is: ```text cost per accepted task = token cost × attempts + tool fees + human review ``` If Sol solves a repository task once and Opus needs two attempts, the cheaper rate loses. If both pass, Opus has the clearer cost advantage. ## Reasoning controls are not interchangeable Claude Opus 5 exposes `low`, `medium`, `high`, `xhigh`, and `max`, defaulting to `high`. Thinking is adaptive and on by default. Disabling it while asking for `xhigh` or `max` returns an error, and `max_tokens` must cover hidden thinking plus visible text.\[4] GPT-5.6 supports `none`, `low`, `medium`, `high`, `xhigh`, and `max`, with `medium` as the default. OpenAI recommends preserving the current effort during migration and testing one level lower because the new family can maintain quality with fewer output tokens.\[3] For a fair evaluation, match by cost or latency—not by identical setting names. `high` on one vendor is not a standardized amount of compute on the other. ## Calling both models through one API reAPI exposes both models through an OpenAI-compatible Chat Completions endpoint. The integration difference is the model string: ```python from openai import OpenAI client = OpenAI( api_key="YOUR_REAPI_KEY", base_url="https://api.reapi.ai/v1", ) def run(model: str, prompt: str): return client.chat.completions.create( model=model, messages=[{"role": "user", "content": prompt}], max_tokens=16000, ) opus = run("claude-opus-5", "Review this migration for rollback risks.") sol = run("gpt-5.6-sol", "Review this migration for rollback risks.") ``` Use the same prompt, repository snapshot, tools, timeout, and acceptance rubric. Record total tokens and retries rather than comparing two attractive outputs by eye. ## FAQ ### Is Claude Opus 5 better than GPT-5.6 Sol for coding? For long-horizon coding and computer use, the official evidence favors Opus 5. For DeepSWE v1.1 repository tasks, GPT-5.6 Sol leads. The better production model depends on your task distribution and agent harness. ### Which model is cheaper? On reAPI, Opus 5: it is $2.40/$12 and Sol is $3.20/$16 per million input/output tokens, 25% less on both (checked October 22, 2026). At official list prices it is the other way round while OpenAI's promotion lasts: Sol is $4/$20 against Opus 5's $5/$25. ### Do both models support one-million-token context? Yes. Opus 5 has a 1M window and Sol has a 1.05M window. Long-context pricing and performance still depend on the route and request size. ### Which model is better for multi-agent workflows? Sol has native beta multi-agent orchestration in OpenAI's Responses API. Opus 5 can work in multi-agent systems, but orchestration is generally supplied by the application or Claude tooling. ### Can I switch between them without rewriting my app? On reAPI, yes for standard Chat Completions workloads. Keep one OpenAI SDK client and change `model` between `claude-opus-5` and `gpt-5.6-sol`. Vendor- specific reasoning and tool features still need conditional request fields. ## Verdict The Claude Opus 5 vs GPT-5.6 Sol decision is conditional, but it is not vague. Start with Opus 5 for long-running development, review, computer use, and lower token cost. Start with Sol for DeepSWE-like repository agents and workflows that benefit from OpenAI's native orchestration features. Then keep the winner only if it reduces cost per accepted task on your own code. ## References 1. Anthropic. *Introducing Claude Opus 5 — official benchmark table and methodology notes.* [anthropic.com/news/claude-opus-5](https://www.anthropic.com/news/claude-opus-5) 2. Anthropic. *Claude model pricing.* [platform.claude.com/docs/en/about-claude/pricing](https://platform.claude.com/docs/en/about-claude/pricing) 3. OpenAI. *GPT-5.6 model guidance, pricing, and Responses API features.* [developers.openai.com/api/docs/guides/latest-model](https://developers.openai.com/api/docs/guides/latest-model) 4. Anthropic. *What's new in Claude Opus 5.* [platform.claude.com/docs/en/about-claude/models/whats-new-opus-5](https://platform.claude.com/docs/en/about-claude/models/whats-new-opus-5) ### Further reading * reAPI. *How to use Claude Opus 5.* [reapi.ai/blog/how-to-use-claude-opus-5](/blog/how-to-use-claude-opus-5) * reAPI. *How to use GPT-5.6.* [reapi.ai/blog/how-to-use-gpt-5-6](/blog/how-to-use-gpt-5-6) * reAPI. *Claude Opus 5 model page.* [reapi.ai/models/claude-opus-5](/models/claude-opus-5) --- # Consistent 3D-Style Character Images via API for $0.143 (https://reapi.ai/blog/consistent-3d-character-images-api) **Yes—an API workflow for consistent 3D-style character images can produce one character master and five scene candidates for less than fifteen cents.** In our September 3 test, the master image completed in 32.1 seconds for 24 credits. A second Wan 2.7 Image request returned five scene files in 59.0 seconds for 119 credits. The total was 143 credits, or **$0.143**.\[1] There is an important limit to that result. The test logged task status, output count, timing, and credits; it did not include a visual review. This is therefore a measured generation-and-cost test, not a claim that five images passed character review. The tutorial below shows how to run the same workflow and calculate the cost per *accepted* image after a human checks the results. ## TL;DR * The workflow uses `wan2.7-image` twice: once for a candidate character master, then, after approval, once for a five-image connected series. * Wan 2.7 Image group mode is enabled with `enable_sequential: true`; it raises the `n` limit from four to twelve images in one task.\[3] * The measured API charge was **24 credits for the master + 119 credits for five scenes = 143 credits ($0.143)**.\[1] * [Download the dated test record](/data/consistent-3d-character-images-api-test-2026-09-03.json), which lists both task IDs, settings, completion times, and settled credits without relying on temporary output URLs. * The five-scene batch cost $0.0238 per completed candidate. Including the master, the effective cost is $0.0286 per scene only if the master is approved and all five scenes pass review. * “3D-style” means flat image files rendered with a dimensional cartoon look. This workflow does not create a mesh, skeleton, rig, or editable 3D model. * Consistency is not guaranteed. A reference image, fixed identity contract, group generation, and a review gate reduce drift; none is a permanent character lock. ## What the consistent-character API test answers Can an API keep a 3D-style cartoon character stable across scenes, and what does each image or batch cost? If a reference image already defines the character, the remaining problem is automation with a review gate. A completed task and a useful creative asset are not the same thing. The test keeps three numbers separate: API completion, cost per returned candidate, and cost per accepted scene. The first two come from the task and billing records. The third requires someone to look at the images. ## Why Wan 2.7 Image fits a five-scene character set Wan's official product page describes sequential storytelling with up to twelve images and subject/style continuity.\[2] The reAPI route exposes that feature directly: set `enable_sequential` to `true`, set `n` to the number of images, and poll one task for the ordered URL array.\[3] That request shape gives one task the character reference, identity contract, and complete scene list. Five unrelated text-to-image calls would have to rediscover the character from prose five times. This is a workflow choice, not a universal quality claim. Wan provides the group-series control needed for this test. ## Before making the first API request You need four things: * a reAPI key stored in `REAPI_API_KEY`; * an original fictional character you have the right to use; * a short list of visual traits that must survive every scene; * somewhere to retain approved files, because generated URLs are temporary. Use an original character you have the right to reproduce, rather than a famous character or a named studio's house style. It is also easier to evaluate. For this test, the character contract is deliberately concrete: ```text CHARACTER: an original adult anthropomorphic warm orange fox explorer FACE: cream muzzle, small notch in the left ear CLOTHING: teal scarf with exactly two white stripes ACCESSORIES: round brass goggles on forehead, navy cross-body satchel ANCHORS: yellow triangle patch on satchel, two dark tail rings, cream tail tip DO NOT CHANGE: warm orange fur, cream muzzle, ear-notch side, scarf pattern, goggles, satchel patch, tail markings, compact athletic body proportions ``` Descriptions such as “cute,” “cinematic,” and “premium” are too broad to audit. An ear notch or a two-stripe scarf gives the reviewer something observable. ## Step 1: Generate a neutral character master The master should explain the character, not tell a story. Use even light, a plain background, and angles that reveal the face, clothing, bag, and tail. Keep it at the same aspect ratio planned for the scene set; in reference-driven mode, Wan follows the last input image's ratio.\[5] ```bash curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "wan2.7-image", "prompt": "Original stylized 3D cartoon character reference sheet for an adult anthropomorphic fox explorer. The same character shown in a clean front view and two three-quarter views. Identity anchors: a small notch in the left ear, teal scarf with exactly two white stripes, round brass goggles resting on the forehead, navy cross-body satchel with one yellow triangle patch, two dark rings on the tail and a cream tail tip. Warm orange fur, cream muzzle, compact athletic proportions, friendly alert expression. Neutral warm-gray studio background, soft even product lighting, full body visible, no text, no labels, no logo, no second character, no collage borders.", "size": "16:9", "resolution": "1K", "n": 1, "watermark": false }' ``` The POST returns a task ID rather than the image itself. Poll `GET /api/v1/tasks/{id}` until the status becomes `completed` or `failed`. Polling does not consume credits.\[5] In a production workflow, stop here and inspect the master before generating the series. Reject it if the three views disagree, an anchor is missing, or a feature would be hard to recognize in another pose. The measured test continued without a visual approval gate, so its master remains a completed candidate. ## Step 2: Request five connected scenes Take the first URL from the completed master's `output.image_urls` array and place it in `MASTER_IMAGE_URL`. Wan accepts public HTTPS reference images; base64 and `data:` URLs are not accepted by this route.\[3] ```bash export MASTER_IMAGE_URL="https://your-temporary-or-hosted-url.example/master.png" curl https://reapi.ai/api/v1/images/generations \ -H "Authorization: Bearer $REAPI_API_KEY" \ -H "Content-Type: application/json" \ -d @- <\[3] ## Step 3: Run the approval gate safely in Node.js Save the complete example below as `character-series.mjs` and use Node.js 18 or newer. The first run generates only the master, prints and records its task ID, then stops. Review that image before setting `APPROVED_MASTER_URL` and running the script again for the five-scene group. The script retries transient GET failures, but it never retries a POST. If the connection drops during submission, the provider may still have received the request; check the task log or dashboard instead of blindly creating another billable task. ```js import { appendFile } from 'node:fs/promises'; const baseUrl = 'https://reapi.ai'; const apiKey = process.env.REAPI_API_KEY; const approvedMasterUrl = process.env.APPROVED_MASTER_URL?.trim(); const taskLogUrl = new URL( './character-series-task-ids.jsonl', import.meta.url, ); const masterPrompt = process.env.MASTER_PROMPT ?? 'Original stylized 3D cartoon character reference sheet for an adult anthropomorphic fox explorer. The same character shown in a clean front view and two three-quarter views. Identity anchors: a small notch in the left ear, teal scarf with exactly two white stripes, round brass goggles resting on the forehead, navy cross-body satchel with one yellow triangle patch, two dark rings on the tail and a cream tail tip. Warm orange fur, cream muzzle, compact athletic proportions, friendly alert expression. Neutral warm-gray studio background, soft even product lighting, full body visible, no text, no labels, no logo, no second character, no collage borders.'; const groupPrompt = process.env.GROUP_PROMPT ?? "Use the reference image only to preserve the identity of the original adult fox explorer. Create a connected five-image story sequence, one separate scene per output, in the same polished stylized 3D cartoon rendering language. Preserve all identity anchors exactly: left-ear notch, teal scarf with exactly two white stripes, round brass forehead goggles, navy cross-body satchel with one yellow triangle patch, two dark tail rings, cream tail tip, muzzle shape and body proportions. Scene 1: dawn railway platform, medium-wide view, holding one red paper ticket. Scene 2: sunlit workshop, medium view, repairing a small wooden toy airplane. Scene 3: rainy night market, full-body view, carrying one yellow umbrella. Scene 4: snowy wooden footbridge at dusk, three-quarter view, holding a small warm lantern. Scene 5: rooftop at blue hour, rear three-quarter view with face still visible, looking across the city. One fox only in every image. No text, no logo, no wardrobe change, no extra limbs, no duplicate character, and do not combine scenes into a collage."; if (!apiKey) { throw new Error('Set REAPI_API_KEY before running this script.'); } for (const [name, value] of [ ['MASTER_PROMPT', masterPrompt], ['GROUP_PROMPT', groupPrompt], ]) { if (!value.trim()) throw new Error(`${name} cannot be empty.`); } const headers = { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', }; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); async function readJson(response) { const text = await response.text(); if (!text) return {}; try { return JSON.parse(text); } catch { return { raw: text }; } } async function submitGeneration(body) { let response; try { response = await fetch(`${baseUrl}/api/v1/images/generations`, { method: 'POST', headers, body: JSON.stringify(body), }); } catch (error) { const detail = error instanceof Error ? error.message : String(error); throw new Error( `POST outcome is uncertain; do not submit it again automatically. ${detail}`, ); } const result = await readJson(response); if (!response.ok) { throw new Error(`${response.status}: ${JSON.stringify(result)}`); } if (!result.id) { throw new Error( 'POST returned no task ID; do not resubmit automatically until checked.', ); } return result; } function retryDelayMs(response, attempt) { const retryAfter = response?.headers.get('retry-after'); if (retryAfter) { const seconds = Number(retryAfter); if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000); const retryAt = Date.parse(retryAfter); if (Number.isFinite(retryAt)) return Math.max(0, retryAt - Date.now()); } return Math.min(1000 * (2 ** Math.min(attempt, 5)), 30000); } async function getTaskWithRetry(id, attempt) { let response; try { response = await fetch(`${baseUrl}/api/v1/tasks/${id}`, { headers }); } catch (error) { const delay = retryDelayMs(null, attempt); console.warn(`Task GET failed; retrying in ${delay}ms.`); await sleep(delay); return null; } if (response.status === 429 || response.status >= 500) { const delay = retryDelayMs(response, attempt); await response.text(); console.warn(`Task GET returned ${response.status}; retrying in ${delay}ms.`); await sleep(delay); return null; } const task = await readJson(response); if (!response.ok) { throw new Error(`${response.status}: ${JSON.stringify(task)}`); } return task; } async function waitForTask(id, timeoutMs = 10 * 60 * 1000) { const deadline = Date.now() + timeoutMs; let transientAttempt = 0; while (Date.now() < deadline) { const task = await getTaskWithRetry(id, transientAttempt); if (!task) { transientAttempt += 1; continue; } transientAttempt = 0; if (task.status === 'completed') return task; if (task.status === 'failed') { console.error(JSON.stringify({ taskId: id, status: task.status, usageCredits: task.usage?.credits ?? null, error: task.error ?? null, }, null, 2)); throw new Error(`Task ${id} failed; see the record above.`); } await sleep(5000); } throw new Error( `Polling timed out for ${id}. The task was not cancelled; resume GET polling instead of submitting another POST.`, ); } async function recordSubmission(stage, taskId) { const record = { stage, taskId, submittedAt: new Date().toISOString(), }; console.log(`Submitted ${stage}: ${taskId}`); try { await appendFile(taskLogUrl, `${JSON.stringify(record)}\n`, 'utf8'); } catch (error) { console.warn(`Could not write ${taskLogUrl.pathname}; keep task ID ${taskId}.`); } } function requirePublicHttpsUrl(value) { let parsed; try { parsed = new URL(value); } catch { throw new Error('APPROVED_MASTER_URL must be a valid public HTTPS URL.'); } if (parsed.protocol !== 'https:') { throw new Error('APPROVED_MASTER_URL must use HTTPS.'); } } async function main() { if (!approvedMasterUrl) { const submission = await submitGeneration({ model: 'wan2.7-image', prompt: masterPrompt, size: '16:9', resolution: '1K', n: 1, watermark: false, }); await recordSubmission('character_master', submission.id); const task = await waitForTask(submission.id); const masterUrl = task.output?.image_urls?.[0]; if (!masterUrl) throw new Error('Master task returned no image URL.'); console.log(JSON.stringify({ nextStep: 'Review this master. Rerun only after setting APPROVED_MASTER_URL.', masterTaskId: task.id, usageCredits: task.usage?.credits ?? null, masterUrl, }, null, 2)); return; } requirePublicHttpsUrl(approvedMasterUrl); const submission = await submitGeneration({ model: 'wan2.7-image', prompt: groupPrompt, image_urls: [approvedMasterUrl], size: '16:9', resolution: '1K', n: 5, enable_sequential: true, watermark: false, }); await recordSubmission('five_scene_group', submission.id); const task = await waitForTask(submission.id); const sceneUrls = task.output?.image_urls ?? []; console.log(JSON.stringify({ groupTaskId: task.id, usageCredits: task.usage?.credits ?? null, returnedSceneCount: sceneUrls.length, sceneUrls, }, null, 2)); } main().catch((error) => { console.error(error instanceof Error ? error.message : error); process.exitCode = 1; }); ``` Run `node character-series.mjs` first. After reviewing the returned master, rerun with `APPROVED_MASTER_URL="https://..." node character-series.mjs`. The script writes task IDs to `character-series-task-ids.jsonl`; its stage results include settled `usageCredits`. You may override either embedded prompt with `MASTER_PROMPT` or `GROUP_PROMPT`, but an empty override is rejected. In n8n, keep the same approval boundary: the master branch should end at a human-review step, and only an approved URL should enter the group-generation branch. ## What the measured API run returned The two requests completed as follows:\[1] | Stage | Task ID | Time | Credits | Files returned | | ---------------- | --------------------------------------- | ----: | ------: | -----------------: | | Character master | `task_01a065451919736985878cfcbd2eb8a8` | 32.1s | 24 | 1 | | Five-scene group | `task_01a06545f23474bca896f6b98ee252bc` | 59.0s | 119 | 5 | | Total | — | — | **143** | 6 including master | These are two observed task times, not a latency benchmark. They say nothing about p95 performance, another region, a different prompt, or future capacity. The output URLs are also omitted because they are temporary. Most importantly, “files returned: 5” means five completed candidates. It does not prove that every output depicts the fox correctly, maps to the intended scene, or avoids visual defects. ## How to review character consistency scene by scene Open the master beside each scene. Do not judge from small thumbnails; inspect the face, outfit, accessories, silhouette, and requested action at a useful zoom. | Review area | Pass condition | Typical failure | | ----------------------- | ----------------------------------------------------------- | -------------------------------------------------------------- | | Fur, face, and species | Warm orange fur, cream muzzle, and fox proportions match | Fur color drifts or the face becomes another species | | Left-ear anchor | Notch remains on the left ear when that ear is visible | Notch disappears or swaps sides | | Scarf | Teal color and two white stripes remain | Color shifts, stripe count changes, scarf vanishes | | Goggles and proportions | Brass goggles stay on the forehead; body proportions match | Goggles move to the eyes or the body is redesigned | | Satchel | Navy cross-body satchel and yellow triangle patch remain | Patch changes shape or the satchel changes sides without cause | | Tail | Two dark rings and cream tip remain when visible | Markings change between full-body scenes | | Scene instruction | Setting, prop, action, and framing match the assigned scene | Two scenes merge or an output becomes a collage | | Structural quality | No duplicate limbs, fused props, or extra main character | Umbrella, hands, or tail merge into the body | Mark an anchor `N/A` when the framing genuinely hides it. Do not award a pass for a hidden trait, but do not call it a contradiction either. An image is accepted only when every visible identity anchor is correct, the requested scene is present, and there is no major structural defect. This rubric is intentionally plain. Automated vision scoring can help sort a large batch, but it should not silently replace the release decision for a new character. ## Calculate cost per completed and accepted image The current Wan 2.7 Image rate is $0.0238 per generated Standard image on reAPI. Credits settle once at the task total and round up to a whole credit: `ceil($0.0238 × 1 × 1,000) = 24` for the master, while `ceil($0.0238 × 5 × 1,000) = 119` for the group.\[3]\[4] For this run: ```text group candidate cost = $0.119 / 5 = $0.0238 project cost = $0.024 + $0.119 = $0.143 accepted-image cost = $0.143 / accepted scene count ``` | Accepted scenes from the five candidates | Effective cost per accepted scene | | ---------------------------------------: | --------------------------------: | | 5 | $0.0286 | | 4 | $0.0358 | | 3 | $0.0477 | | 2 | $0.0715 | | 1 | $0.1430 | If none passes, the project produced no accepted image, so a per-accepted-image figure is undefined rather than zero. The $0.143 also covers generation only. Storage, orchestration, human review, and later animation belong in a complete production budget. Rates change. The figures above were checked and tested on September 3, 2026; use the live [Wan 2.7 Image model page](/models/wan-2-7-image) before placing a price in your own product. ## Fix the smallest failed part If the master is wrong, stop and regenerate it. Paying for a five-image series based on a weak reference only multiplies the problem. If one scene misses its prop but the character remains stable, try a single `n: 1` reference-driven replacement with a shorter scene prompt. At the tested rate, that adds about 24 credits. If several frames redesign the character, revise the master or remove conflicting instructions, then rerun the connected group. Wan's current model documentation says failed and rejected requests are not charged. Still, read `usage.credits` on every terminal task: the canonical Tasks API allows a positive value on a failed task when a model-specific policy keeps a post-generation charge.\[3]\[5] A completed image that your team rejects creatively remains billable, which is why accepted-image cost is the useful production metric. Once a scene passes, retain it with its task ID, prompt version, reference version, and review result. Generated URLs expire, so move approved assets into storage you control as soon as practical.\[3] ## Common beginner mistakes **Generating every scene from text.** Repeating a detailed description does not make five independent samples share an identity. Reuse approved pixels. **Changing the character contract inside scene prompts.** “Add a winter coat” may be a reasonable story change, but it removes an easy continuity anchor. Test stable identity first; introduce deliberate wardrobe changes later. **Supplying too many references.** References that disagree about the face, tail, or clothing give the model several valid answers. Begin with one approved master. **Calling every completed file usable.** Completion is a system state. Creative approval is a review decision. **Publishing only the headline price.** State whether the figure covers the master, retries, creatively rejected completed outputs, storage, and human review. ## FAQ ### Does this API generate a real 3D character model? No. It returns image files with a stylized 3D appearance. It does not return a mesh, rig, texture package, skeleton, or editable scene. ### Does Wan 2.7 guarantee the same character in every image? No. Group mode and a reference image give the model stronger continuity signals, but they do not create a permanent character ID. Every scene still needs review. ### How much did the five-scene batch cost? The group task used 119 credits, or $0.119, and returned five completed candidates. The separately generated master used 24 credits, bringing the test total to $0.143.\[1] ### Why is the effective cost not simply $0.0238 per image? $0.0238 is the group cost per completed candidate. A project also needs a master, and some candidates may fail visual review. Divide total project spend by the number of accepted scenes to get the useful figure. ### Can I use my own character reference image? Yes, if you own or have permission to use it and it is available through a public HTTPS URL. Wan 2.7 Image accepts up to nine reference images, although a single clear master is a sensible starting point.\[3] ### Should I use the same seed for every scene? Wan exposes a seed, but it is not an identity lock. For a connected series, the approved reference and group request are more important. A repeated seed with changed inputs does not guarantee the same face or accessories. ### Can I generate more than five scenes in one request? Yes. With `enable_sequential: true`, `n` can be as high as twelve. Start with a smaller set because review and prompt complexity both grow with the sequence. ### How do I turn the accepted images into video? Use each approved scene as a controlled start frame for an image-to-video model. The [GPT Image 2 + Seedance 2.0 character workflow](/blog/gpt-image-2-seedance-2-0-character-workflow) explains the separate animation stage; keeping it separate prevents motion failures from forcing a redesign of the character. ## Record what you would actually ship The API record contains one master, one five-image group, six returned files, and a total charge of $0.143. It does not contain a creative acceptance rate because visual scoring was outside this test. Keep completion, cost, and human acceptance as separate fields. After applying the rubric, divide the full project cost by the number of scenes you would actually ship. For the complete request schema, limits, and current billing behavior, use the [Wan 2.7 Image API documentation](/docs/wan-2-7-image). ## References 1. reAPI. [*Wan 2.7 Image character-series test record.*](/data/consistent-3d-character-images-api-test-2026-09-03.json) September 3, 2026. Master task `task_01a065451919736985878cfcbd2eb8a8`; group task `task_01a06545f23474bca896f6b98ee252bc`. 2. Alibaba Wan. *Wan official product page — Multi-Image Editing and Sequential Storytelling.* Retrieved September 3, 2026. [wan.video](https://wan.video/) 3. reAPI. *Wan 2.7 Image API — group mode, reference inputs, resolution limits, task response, and errors.* Retrieved September 3, 2026. [reapi.ai/docs/wan-2-7-image](/docs/wan-2-7-image) 4. reAPI. *Wan 2.7 Image live model page and price estimator.* Retrieved September 3, 2026. [reapi.ai/models/wan-2-7-image](/models/wan-2-7-image) 5. reAPI. *Tasks API — asynchronous status and polling behavior.* Retrieved September 3, 2026. [reapi.ai/docs/api/tasks](/docs/api/tasks) ### Further reading * reAPI. *GPT Image 2 + Seedance 2.0: A Character Consistency Workflow.* [Read the video workflow](/blog/gpt-image-2-seedance-2-0-character-workflow) * reAPI. *AI Image Generation Cost vs Video: 2–9x More Per Frame.* [Read the cost analysis](/blog/ai-image-generation-cost-vs-video) --- # How Much Does Daily AI Video Cost? A 30-Day API Budget (https://reapi.ai/blog/daily-ai-video-cost-30-day-api-budget) For the configuration tested here, **a one-video-per-day schedule costs $2.52 in generation fees over 30 days**. Each attempt is one five-second, 480p, 9:16 clip with `seedance-2.0-mini`. The single smoke test cost 84 reAPI credits, or $0.084, completed in 107.2 seconds, and returned one video URL.\[6] That is the simple answer, but it is not yet a production budget. A completed API task is not necessarily a clip you will publish. If review rejects half of your completed attempts, the generation budget doubles to $5.04 per month. Storage, scheduling, editing, and human review sit outside that figure. This guide calculates the honest number and builds a single-worker example that stops for manual reconciliation instead of guessing whether an uncertain POST should be repeated. ## TL;DR * One tested 5-second, 480p, 9:16 Seedance 2.0 Mini task used **84 credits = $0.084**. Thirty identical completed attempts would cost **$2.52**. * Budget by **completed attempts per accepted video**, not just scheduled posts. At 1.5 attempts per accepted clip, the 30-day generation budget is $3.78; at two attempts, it is $5.04. * Eligible new accounts may receive promotional test credits, but the public pricing page does not promise a fixed amount or daily reset.\[3] Treat them as prototype runway, not recurring capacity. * Save the task ID immediately. Every accepted repeated `POST` creates a separate task and credit reservation; each completed task settles its own usage. `Idempotency-Key` records a trace value but does not deduplicate video requests.\[4] * Poll the task with `GET` about every five seconds, archive the returned file to storage you control, and keep publishing behind a manual review step.\[5] * The 107.2-second result is one smoke test, not a claim about average speed, uptime, or visual quality. ## The daily video question people are actually asking Do you need a real REST API that can make one or two short vertical clips each day, return a public HTTPS URL, and fit an automated posting flow? For a four-to-five-second 9:16 prototype, cost is only half the question. Recovery matters as soon as the prototype becomes a schedule: the workflow needs durable state and a deliberate retry policy before it needs a clever prompt. ## One 107-second run, with a narrow conclusion The test used the least expensive current reAPI configuration we found that accepts a text prompt and explicitly supports both 9:16 and a four-to-five second duration: Seedance 2.0 Mini at 480p.\[1] The model documentation allows 480p or 720p, 9:16 output, and durations from 4 to 15 seconds.\[2] | Test field | Recorded value | | --------------- | --------------------------------------- | | Date | September 3, 2026 | | Task ID | `task_01a06547163473ecb7dab4478ee1abaa` | | Model | `seedance-2.0-mini` | | Request | 480p, 9:16, 5 seconds | | Audio | Off | | Watermark | Off | | Submissions | 1 | | Final status | Completed | | Elapsed time | 107.2 seconds | | Reported usage | 84 credits / $0.084 | | Returned output | 1 video URL |