DEVELOPER DOCUMENTATION · V1.0

FusionAI Open APIImage and video generation, ready to integrate

One API key for published image and video models. Generate images, edit references and submit asynchronous video tasks with account-specific pricing.
API BASE URLhttps://www.fusionai.tv
HTTPS

Use GET /v1/models for currently published API models, supported video operations and account pricing. Only models explicitly published for the API can be called.

01

Quick start#

Sign in with your FusionAI account. After your access is approved, create your own API key.

1

Apply for access

Sign in to the developer console and describe your use case.

2

Create a key

After approval, create a key starting with sk-fusion-.

3

Call from your server

Send a Bearer token in the request header.

Prefer a ready-to-run client? Explore FusionAI Skills: image generation, reference editing and tested product-photo workflows.

General request conventions

TransportHTTPS only
AuthenticationAuthorization: Bearer $FUSIONAI_API_KEY
JSON requestsContent-Type: application/json
File uploadsmultipart/form-data, with a recommended maximum request size of 100 MB
TimeoutImage generation may take several minutes. A 10-minute client timeout is recommended.
Request tracingThe X-Request-Id response header helps identify requests and troubleshoot issues.
An API key is shown only when created. Store it in server environment variables or a secret manager. Never embed it in browser code, mobile packages or a public repository.
02

Available API models#

Models currently published in the Open API catalog. Availability is independent of the website workspace.

openai-images

GPT Image 2

gpt-image-2

Image generation and editing

gemini-generate-content

Gemini 3 Pro Image

gemini-3-pro-image

Image generation and editing

openai-images

GPT Image 2.5 Flare

gpt-image-2.5-flare

Image generation and editing

gemini-generate-content

Gemini 3.1 Flash Image

gemini-3.1-flash-image

Image generation and editing

openai-images

GPT Image 2.5 Sunburst

gpt-image-2.5-sunburst

Image generation and editing

gemini-generate-content

Gemini 3.1 Flash Lite Image

gemini-3.1-flash-lite-image

Image generation and editing

midjourney-async

Midjourney

midjourney

Image generation

List models

GET/v1/models
curl "https://www.fusionai.tv/v1/models" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY"

Response example

{
  "object": "list",
  "data": [
    {
      "id": "gpt-image-2",
      "object": "model",
      "display_name": "GPT Image 2",
      "protocol": "openai-images",
      "capabilities": { "resolutions": ["1K", "2K", "4K"] }
    }
  ]
}
03

API key authentication#

All model interfaces use the same API key authentication.

Authorization: Bearer sk-fusion-xxxxxxxxxxxxxxxxxxxxxxxx

Keys are bound to a developer account. A disabled key, disabled account or unapproved account returns 401 invalid_api_key. Keep separate keys for testing, production and different workloads; the existing account limit is five active keys.

04

GPT Image 2 family · image generation#

Use JSON requests for GPT Image 2, GPT Image 2.5 Flare and GPT Image 2.5 Sunburst.

POST/v1/images/generations

Request fields

FieldTypeRequiredDescription
modelstringYesgpt-image-2、gpt-image-2.5-flare or gpt-image-2.5-sunburst
promptstringYesImage description or editing instruction
nintegerNoCurrently recommended: 1
sizestringNoauto or WIDTHxHEIGHT, for example 2048x2048
qualitystringNoauto、low、medium、high; GPT Image 2.5 also supports xhigh (extra high), max (maximum)
resolutionstringRecommendedBilling and provider-key routing resolution: 1K、2K、4K. When omitted, infer it from size; autouses 1K
output_formatstringNoFixed value: png
response_formatstringNob64_json or url
Custom width and height must not exceed 3840 and must be multiples of 16. The aspect ratio must not exceed 3:1. Total pixel count must be between 655,360 and 8,294,400.

cURL example

curl "https://www.fusionai.tv/v1/images/generations" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A premium skincare bottle on white marble, studio lighting",
    "n": 1,
    "size": "2048x2048",
    "resolution": "2K",
    "quality": "high",
    "output_format": "png",
    "response_format": "b64_json"
  }'

Node.js example

const response = await fetch('https://www.fusionai.tv/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.FUSIONAI_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ model: 'gpt-image-2', prompt: 'A product poster', size: '1024x1024', resolution: '1K', response_format: 'b64_json' })
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result.data[0].b64_json);

Response example

{
  "created": 1786400000,
  "data": [{ "b64_json": "iVBORw0KGgoAAA..." }]
}
05

GPT Image 2 family · image editing#

Upload one or more reference images and an optional mask.

POST/v1/images/editsmultipart/form-data
FieldTypeRequiredDescription
modelstringYesgpt-image-2、gpt-image-2.5-flare or gpt-image-2.5-sunburst
promptstringYesEditing instruction
image[]fileYesReference images; repeat the field for multiple files. Up to four is recommended.
maskfileNoPNG mask; transparent regions mark the area to edit.
sizestringNoauto or custom width and height
resolutionstringRecommended1K、2K or 4K, used for billing and key routing
qualitystringNoauto、low、medium、high; GPT Image 2.5 also supports xhigh (extra high), max (maximum)
response_formatstringNob64_json or url
curl "https://www.fusionai.tv/v1/images/edits" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Replace the background with a minimal luxury showroom" \
  -F "image[]=@product.png" \
  -F "mask=@mask.png" \
  -F "size=2048x2048" \
  -F "resolution=2K" \
  -F "quality=high" \
  -F "response_format=b64_json"
06

Grok Image 2 · generation and editing#

Use the Images API JSON format for text-to-image and reference editing with accessible image URLs.

POST/v1/images/generationsapplication/json

Text-to-image

FieldTypeRequiredDescription
modelstringYesFixed value: grok-imagine-image-quality
promptstringYesDescribe the subject, setting, composition, lighting and style.
nintegerNoOutput count from 1 to 10
aspect_ratiostringNo1:1、16:9、9:16、4:3、3:4
resolutionstringNo1k or 2k
response_formatstringNourl or b64_json
curl "https://www.fusionai.tv/v1/images/generations" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-image-quality",
    "prompt": "A luxury perfume campaign, dramatic studio light",
    "n": 1,
    "aspect_ratio": "4:3",
    "resolution": "2k",
    "response_format": "url"
  }'
POST/v1/images/editsapplication/json

Reference image editing

Place reference images in the images array. Images must be accessible HTTPS URLs. Up to four is recommended.

curl "https://www.fusionai.tv/v1/images/edits" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-image-quality",
    "prompt": "Keep the product unchanged and replace the background with a luxury showroom",
    "images": [
      { "type": "image_url", "url": "https://example.com/product.png" }
    ],
    "n": 1,
    "resolution": "2k",
    "response_format": "url"
  }'

URL response example

{
  "created": 1786400000,
  "data": [{ "url": "https://example.com/generated-image.png" }]
}
07

Midjourney · asynchronous image generation#

Submit a prompt and poll the task status. Each successful task returns four candidate images.

POST/v1/midjourney/imagineapplication/json
FieldTypeRequiredDescription
modelstringNoFixed value: midjourney; used automatically when omitted
promptstringYesImage description, up to 6,000 characters. An existing --ar is overridden by aspect_ratio.
aspect_ratiostringNo1:1、16:9、9:16、4:3、3:4、3:2、2:3; default: 1:1
curl "https://www.fusionai.tv/v1/midjourney/imagine" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "midjourney",
    "prompt": "A futuristic fashion campaign in Shanghai, cinematic lighting",
    "aspect_ratio": "3:2"
  }'

Submission response (HTTP 202)

{
  "id": "req_7f2b1d6f03c84d679bfe2a8c",
  "object": "image.generation.task",
  "model": "midjourney",
  "status": "queued",
  "progress": 0,
  "created_at": "2026-09-17T06:30:00.000Z"
}
GET/v1/midjourney/tasks/{task_id}

Poll every 3–5 seconds. status may be queued、processing、succeeded or failed. The reserved charge is refunded if the task fails.

curl "https://www.fusionai.tv/v1/midjourney/tasks/req_7f2b1d6f03c84d679bfe2a8c" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY"

Successful response

{
  "id": "req_7f2b1d6f03c84d679bfe2a8c",
  "object": "image.generation.task",
  "model": "midjourney",
  "status": "succeeded",
  "progress": 100,
  "data": [
    { "url": "https://example.com/candidate-1.png" },
    { "url": "https://example.com/candidate-2.png" },
    { "url": "https://example.com/candidate-3.png" },
    { "url": "https://example.com/candidate-4.png" }
  ]
}
The current Midjourney API provides text-to-image only, without reference images, editing or masks. Poll tasks with a key belonging to the account that created the task.
08

Gemini image generation and editing#

Use the native generateContent request format. Text and references are supplied in parts。

POST/v1beta/models/{model}:generateContent
FieldTypeRequiredDescription
modelpathYesA Gemini model ID from the console catalog
contentsarrayYesConversation contents, normally with a user role
parts[].textstringYesGeneration or editing instruction
parts[].inlineDataobjectNoReference image with mimeType and raw Base64 data
generationConfig.responseModalitiesarrayYesFor image generation, use ["IMAGE"]
generationConfig.imageConfig.aspectRatiostringNo1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9
generationConfig.imageConfig.imageSizestringNoUse a size supported by the selected model: 512、1K、2K or 4K

Text-to-image

curl "https://www.fusionai.tv/v1beta/models/gemini-3.1-flash-image:generateContent" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role":"user","parts":[{"text":"Generate a cinematic product poster"}]}],
    "generationConfig": {
      "responseModalities": ["IMAGE"],
      "imageConfig": {"aspectRatio":"16:9","imageSize":"1K"}
    }
  }'

Include reference images

{
  "contents": [{
    "role": "user",
    "parts": [
      { "text": "Keep the product unchanged and replace the background" },
      { "inlineData": { "mimeType": "image/png", "data": "BASE64_WITHOUT_DATA_URL_PREFIX" } }
    ]
  }],
  "generationConfig": {
    "responseModalities": ["IMAGE"],
    "imageConfig": { "aspectRatio": "1:1", "imageSize": "2K" }
  }
}

Response example

{
  "candidates": [{
    "content": {
      "role": "model",
      "parts": [{ "inlineData": { "mimeType": "image/png", "data": "iVBORw0KGgoAAA..." } }]
    },
    "finishReason": "STOP"
  }]
}
09

Billing and request records#

Requests are billed using their settings and the CNY prices configured in the platform.

  • The estimated charge is reserved before the provider request. Generation is not submitted when the account balance is insufficient.
  • The reserved charge is returned when the provider connection fails, returns a non-2xx response, or an asynchronous task ultimately fails.
  • The console shows request ID, model, status, duration, charges and balance entries.
  • Synchronous request parameters are stored in redacted form. Midjourney tasks cache final candidate URLs so results can be retrieved again.
09

Video generation · asynchronous tasks#

One API key, a published video catalog and account-specific per-second pricing.

POST/v1/videos
ParameterTypeDescription
modelstringRequired. Use a published video model ID from /v1/models; do not assume every workbench model is available.
promptstringRequired. Describe the subject, action, setting and camera movement. Follow the returned prompt limits.
modestringtext_to_video (default), image_to_video, first_last_frame or reference_images. Check capabilities.operations for supported modes.
secondsintegerOutput duration. Use durationsByQuality[quality] or durations for the selected operation; defaults to defaultDuration.
qualitystringUse an exact value from the selected operation qualities; defaults to defaultQuality.
aspect_ratiostringAn enabled aspect ratio; defaults to defaultRatio.
audiobooleanDefault false. true requires supportsAudio and uses the separate quality:audio price.
reference_imagesstring[]Public HTTPS image URLs in order. Text: none; image: at least one; first/last: exactly two, first then last. Other limits follow the selected operation. Local files and Base64 are not accepted.

First call GET /v1/models. Replace PUBLISHED_VIDEO_MODEL_ID with a returned model whose protocol is video-async. Leaving optional parameters out uses that model’s defaults.

curl "https://www.fusionai.tv/v1/videos" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: product-video-001" \
  -d '{"model":"PUBLISHED_VIDEO_MODEL_ID","prompt":"A slow camera orbit around a ceramic cup in warm studio light","mode":"text_to_video"}'

Idempotent submission

Use a unique Idempotency-Key for each new video. Retrying the same key with the same normalized parameters returns the existing task without another charge. Changed parameters return 409. If a request times out or needs_attention is true, reuse the key and contact support with the task ID; do not create a new paid request.

{
  "id": "vid_TASK_ID",
  "object": "video.generation.task",
  "model": "PUBLISHED_VIDEO_MODEL_ID",
  "status": "processing",
  "created_at": "2026-11-24T00:00:00.000Z"
}
GET/v1/videos/{task_id}
curl "https://www.fusionai.tv/v1/videos/vid_TASK_ID" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY"

Poll about every 10 seconds. Pending tasks return HTTP 202 (queued or processing); terminal tasks return HTTP 200 (completed or failed). Tasks can only be queried by their owning API account. Model unpublishing does not prevent retrieval of an existing task.

{
  "id": "vid_TASK_ID",
  "object": "video.generation.task",
  "model": "PUBLISHED_VIDEO_MODEL_ID",
  "status": "completed",
  "data": [
    {
      "url": "https://fusionaitv.oss-cn-hongkong.aliyuncs.com/open-api/example/video.mp4"
    }
  ]
}

Billing, results and failures

The selected quality:silent or quality:audio unit price × output seconds is reserved from the separate API wallet on submission, with the account discount or model-specific rate applied. Confirmed generation failures are refunded once. Status checks do not charge generation fees. Transient query or storage failures remain processing and are retried; they do not trigger a new generation. Completed videos are stored in FusionAI international OSS before the result URL is returned.

This API currently supports text and image reference inputs. Reference video/audio, video editing, extensions, callbacks and multipart uploads are not part of this endpoint. Unsupported parameters are rejected before billing.
10

Errors and retries#

Non-2xx responses return a JSON error object.

HTTPtypeMeaningRecommended
401invalid_api_keyInvalid or disabled key, or unavailable accountCheck the Authorization header and account status
402insufficient_balanceInsufficient account balanceAdd funds before retrying
403model_not_allowedModel is unpublished or the protocol does not matchQuery the model catalog again
403model_not_pricedThis specification has no configured priceChange the specification or contact an administrator
405method_not_allowedHTTP method not supportedUse the documented HTTP method
502upstream_unavailableModel service temporarily unavailableRetry with exponential backoff
503provider_not_configuredProvider configuration unavailableContact the platform administrator

Error response example

{
  "error": {
    "code": 402,
    "type": "insufficient_balance",
    "status": "INSUFFICIENT_BALANCE",
    "message": "Insufficient account balance"
  }
}
Retry network failures and 5xx responses a limited number of times, using exponential backoff such as 2, 4 and 8 seconds. Do not automatically retry account or billing errors such as 401, 402 or 403.