Endpoints
Base URL:Authentication
UseAuthorization: Bearer YOUR_API_KEY. POST requests also require Content-Type: application/json. Query a task using an API key belonging to the account that created it.
Request Body
generation_mode explicitly for video, references or first-and-last frames. AI callers can also use the advanced calling guide.
Parameters
string
default:"async"
Supported values:
async, callback. Use async for polling or callback for final notification. Sync and streaming are unsupported.object
required
Prompt optimization returns text, not generated images or videos. AI callers: preserve the full user request in prompt, choose target_model and generation_mode, attach ordered image_urls, describe only known reference uses in reference_notes, then optionally extract protected_text and creative_brief. These optional fields use the same endpoint and identity as ordinary requests; do not require users to fill them. Never remove requirements from prompt after extracting them. Do not invent image contents, reference permissions, names, camera moves, plot events or audio. Preserve conditions, exceptions, quantities and the scope of restrictions: no dialogue does not mean silence, and no new text does not remove existing labels. Submit once, save data.taskId, then poll or await callback; check an existing task before resubmitting after a timeout. Poll with an API key belonging to the creating account. data.state is processing, success or failed. Only on success, parse data.resultJson once and read outputs[0], a single prompt string (possibly containing named sections), not a media URL. The result has a 16000-character limit. A successful status query can have code=200 while data.state=failed; inspect state, failCode and failMsg. Charged failed tasks are refunded. Review the output before a separate generation request; optimization does not guarantee semantic correctness or media quality.
Generation modes and image order
Writing reference notes
Number images from 1 in the order ofimage_urls. Explain what each contributes, what must remain unchanged and what must not be copied. Notes cannot reverse editing-base or start/end responsibilities. If the order changes, update all image numbers in the instructions. Unknown reference uses should remain unspecified.
Targets with expression guidance
This list is guidance coverage, not an input allowlist. Other target names also work through general optimization. The optimizer accepts at most 4 images; a later generation request has its own independent limits.
Target-specific expression guidance is selected automatically. The optimized result has the optimizer’s own 16000-character budget; generation-model image counts, native modes and prompt lengths do not block optimization.
Image language selection and preservation
The following targets use image-specific preservation checks in every supported output language:seedream-5-0-pro, seedream-4-5, gpt-image-2, nano-banana-2, seedream-5-0 (Seedream 5.0 Lite), nano-banana-pro, gpt-image-2.5-sunburst, and qwen-image-edit-LoRA in its editing mode.
- An explicit
languagetakes priority. Withauto, an explicit request for the final prompt’s language is considered next, followed by the main descriptive language. Exact labels, quoted text, URLs and supplied coordinates do not determine that language. - For
seedream-4-5,seedream-5-0andqwen-image-edit-LoRA,autoconservatively uses English when the description is recognized as a supported language other than Chinese or English. This does not override an explicitly selected language. When no descriptive language can be identified, Chinese is used. - Same-language source instructions remain complete in the final prompt. Translations retain exact lettering, supplied coordinate tags and numeric constraints. Each reference keeps its stated responsibility; local edits preserve everything outside the authorized change.
- Other image targets retain their existing language behavior. Generation-model limits do not become optimizer input restrictions.
Video language selection and preservation
- An explicit
languagetakes priority. Withauto, an explicit request for the final prompt’s language in the original text is considered next. - For the listed Seedance and Wan video targets,
autofollows the main descriptive language among supported languages. When it cannot be identified, Chinese is used. Quoted text, exact labels and URLs do not determine the descriptive language. - For
minimax-h3-LoRA,autootherwise uses English. Explicitly selected languages remain supported. Descriptive language does not translate supplied dialogue, lyrics or visible lettering. - Image targets outside the image-specific list above and unregistered targets retain the general Chinese/English inference.
- Wan 2.7 and Wan 2.7 LoRA share expression guidance. No custom LoRA trigger words are added.
- Conditions, exceptions and the scope of restrictions must remain intact. No dialogue does not mean silence; no background music does not remove ambient sound; no additional text does not remove existing labels.
- H3 returns one prompt string with three named sections for base/frame tasks or six for reference tasks. Section identifiers remain in English. No unspecified music or sound is invented to fill empty sections.
Example
Response
Accepted task:data.state becomes success, read JSON.parse(data.resultJson).outputs[0]. The result is one text string, at most 16000 characters, with no generated media URLs or separate analysis fields. A clear original prompt may be retained when it already meets the requirements.
Status Response Fields
The outer
code: 200 means the query succeeded; inspect data.state for the task outcome. A failed task does not return a successful resultJson. For callback delivery, set request_type="callback" and a top-level callback_url; the final notification uses the same result envelope. See Webhooks.
Error Codes
Unknown target names are accepted; they are not validation errors. See Common errors.
Billing
New non-LLM requests use 1 credit =$0.001. Calculate the full amount, including billable quantity and add-ons, apply the applicable account discount, then round the request total upward to the next whole credit. Agreed fixed unit prices retain their precision and replace the standard price and discount; final rounding still applies. See credit conversion and rounding.
The standard price is USD $0.002 per optimization task (PER_USE). Image count, intended video duration and reference mode do not add pricing tiers. Account pricing and discounts may affect the actual quote. Charged tasks that fail are refunded. Image/video generation is a separate request and is not included. See API pricing.
Latency and polling
Account and API-key limits apply. No fixed throughput or completion-time guarantee is specified. Use callback mode for backend workflows. Save the task ID and check its status instead of repeatedly creating a new task.
Related
MCP integration
The complete model schema declares result decoding inmcp.result and supported file bindings in mcp.attachments. These are client integration metadata, not generation input parameters. Attachment paths: image_urls. Preserve the user’s file order. Model parameter validation remains on the API.