開発者向けドキュメント · 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 ベース 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

クイックスタート#

FusionAI アカウントでサインインします。 アクセスが承認されたら、独自の API キーを作成します。

1

アクセスを申し込む

デベロッパー コンソールにサインインし、使用例を説明してください。

2

キーを作成します

承認後、 で始まるキーを作成します sk-fusion-.

3

サーバーから呼び出します

リクエスト ヘッダーでベアラー トークンを送信します。

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

一般的な要求規則

輸送HTTPS のみ
認証Authorization: Bearer $FUSIONAI_API_KEY
JSON リクエストContent-Type: application/json
ファイルのアップロードmultipart/form-data、推奨される最大リクエスト サイズは 100 MB です。
タイムアウト画像の生成には数分かかる場合があります。 10分のクライアント タイムアウトをお勧めします。
トレースをリクエストしますというもの X-Request-Id レスポンスヘッダーはリクエストの識別や問題のトラブルシューティングに役立ちます。
API キーは、作成時にのみ表示されます。 サーバー環境変数またはシークレット マネージャーに保存します。 ブラウザ コード、モバイル パッケージ、または公開リポジトリに埋め込まないでください。
02

API で利用できるモデル#

現在 公開 API カタログに掲載されているモデル。 可用性は、Web サイト ワークスペースとは無関係です。

OpenAI-images

GPT Image 2

gpt-image-2

画像の生成と編集

gemini-generate-content

Gemini 3 Pro Image

gemini-3-pro-image

画像の生成と編集

OpenAI-images

GPT Image 2.5 Flare

gpt-image-2.5-flare

画像の生成と編集

gemini-generate-content

Gemini 3.1 Flash Image

gemini-3.1-flash-image

画像の生成と編集

OpenAI-images

GPT Image 2.5 Sunburst

gpt-image-2.5-sunburst

画像の生成と編集

gemini-generate-content

Gemini 3.1 Flash Lite Image

gemini-3.1-flash-lite-image

画像の生成と編集

midjourney-async

Midjourney

midjourney

画像生成

モデルをリストします

取得する/v1/models
curl "https://www.fusionai.tv/v1/models" \
  -H "Authorization: Bearer $FUSIONAI_API_KEY"

応答例

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

API キー認証#

すべてのモデル インターフェイスは、同じ API キー認証を使用します。

Authorization: Bearer sk-fusion-xxxxxxxxxxxxxxxxxxxxxxxx

キーはデベロッパー アカウントにバインドされています。 無効なキー、無効なアカウント、または承認されていないアカウントが返されます 401 invalid_api_key。 テスト、本番環境、さまざまなワークロード用に別のキーを保持します。 既存のアカウント制限は 5 つのアクティブ キーです。

04

GPT Image 2ファミリー · 画像生成#

GPT Image 2、GPT Image 2.5 Flare、および GPT Image 2.5 Sunburst の JSON リクエストを使用します。

役職/v1/images/generations

リクエストフィールド

フィールドタイプ必須デスクリプション
modelストリングはいgpt-image-2、gpt-image-2.5-flare 又は gpt-image-2.5-sunburst
promptストリングはい画像の説明または編集手順
n整数いいえ現在推奨されている: 1
sizeストリングいいえauto 又は WIDTHxHEIGHT、たとえば 2048x2048
qualityストリングいいえauto、low、medium、high; GPT Image 2.5 もサポートしています xhigh (非常に高い)、 max (最大)
resolutionストリング推奨課金とプロバイダ キーのルーティングの解決方法: 1K、2K、4K。 省略された場合は、 から推測してください size; auto1Kを使用
output_formatストリングいいえ固定値: png
response_formatストリングいいえb64_json 又は url
カスタムの幅と高さは 3840 を超えてはならず、16 の倍数である必要があります。 アスペクト比は 3:1 を超えてはなりません。 合計ピクセル数は 655,360 から 8,294,400 の間である必要があります。

カールの例

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 の例

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);

応答例

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

GPT Image 2ファミリー · 画像編集#

1 つ以上の参照画像とオプションのマスクをアップロードします。

役職/v1/images/editsマルチパート/フォーム データ
フィールドタイプ必須デスクリプション
modelストリングはいgpt-image-2、gpt-image-2.5-flare 又は gpt-image-2.5-sunburst
promptストリングはい編集指示
image[]ファイルはい参照画像; 複数のファイルに対してフィールドを繰り返します。 4 つまでが推奨されます。
maskファイルいいえPNGマスク; 透明なリージョンは、編集する領域をマークします。
sizeストリングいいえauto またはカスタム幅と高さ
resolutionストリング推奨1K、2K 又は 4K、請求およびキー ルーティングに使用されます
qualityストリングいいえauto、low、medium、high; GPT Image 2.5 もサポートしています xhigh (非常に高い)、 max (最大)
response_formatストリングいいえb64_json 又は 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 · 生成と編集#

画像 API JSON 形式の画像を使用して、画像へのテキストと画像の編集、およびアクセス可能な画像 URL による参照編集を使用します。

役職/v1/images/generationsアプリケーション/JSON

テキストから画像へ

フィールドタイプ必須デスクリプション
modelストリングはい固定値: grok-imagine-image-quality
promptストリングはい主題、設定、構図、照明、スタイルを説明してください。
n整数いいえからの出力カウント 1 に 10
aspect_ratioストリングいいえ1:1、16:9、9:16、4:3、3:4
resolutionストリングいいえ1k 又は 2k
response_formatストリングいいえurl 又は 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"
  }'
役職/v1/images/editsアプリケーション/JSON

参照画像編集

参照画像を に配置します images 配列。 画像にアクセスできる HTTPS URL が必要です。 4 つまでが推奨されます。

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 応答の例

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

Midjourney · 非同期画像生成#

プロンプトを送信し、タスクのステータスをポーリングします。 タスクが成功するたびに、4 つの候補画像が返されます。

役職/v1/midjourney/imagineアプリケーション/JSON
フィールドタイプ必須デスクリプション
modelストリングいいえ固定値: midjourney; 省略すると自動的に使用されます
promptストリングはい画像の説明、6,000 文字まで。 既存の --ar によってオーバーライドされます aspect_ratio.
aspect_ratioストリングいいえ1:1、16:9、9:16、4:3、3:4、3:2、2:3; デフォルト: 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"
  }'

提出応答 (http 202)

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

3–5 秒ごとにポーリングします。 status かもしれません queued、processing、succeeded 又は failed。 タスクが失敗した場合は、予約料金が払い戻されます。

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

成功した応答

{
  "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" }
  ]
}
現在の Midjourney API では、参照画像、編集、またはマスクを使用しないテキストから画像へののみを提供します。 タスクを作成したアカウントに属するキーを使用して、タスクをポーリングします。
08

Geminiによる画像生成と編集#

ネイティブを使用します generateContent リクエスト形式。 テキストと参照は で提供されます parts。

役職/v1beta/models/{model}:generateContent
フィールドタイプ必須デスクリプション
modelパスはいコンソール カタログからの Gemini モデル ID
contentsアレイはい会話の内容。通常は user 役割
parts[].textストリングはい生成または編集の指示
parts[].inlineData対象いいえ参照画像 mimeType そして生のベース64 data
generationConfig.responseModalitiesアレイはい画像生成には、 を使用します ["IMAGE"]
generationConfig.imageConfig.aspectRatioストリングいいえ1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9
generationConfig.imageConfig.imageSizeストリングいいえ選択したモデルでサポートされているサイズを使用します。 512、1K、2K 又は 4K

テキストから画像へ

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"}
    }
  }'

参照画像を含めます

{
  "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" }
  }
}

応答例

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

課金とリクエスト記録#

リクエストは、その設定と、プラットフォームで設定された CNY 価格を使用して請求されます。

  • 見積もり料金は、プロバイダの要求の前に予約されます。 口座残高が不十分な場合、世代は提出されません。
  • プロバイダ接続が失敗した場合、2xx 以外の応答を返す場合、または最終的に非同期タスクが失敗した場合に予約済みの料金が返されます。
  • コンソールには、リクエスト ID、モデル、ステータス、期間、料金、および残高エントリが表示されます。
  • 同期要求パラメータは、編集された形式で保存されます。 Midjourney タスクは最終候補 URL をキャッシュして、結果を再度取得できるようにします。
09

Video generation · asynchronous tasks#

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

役職/v1/videos
Parameterタイプデスクリプション
modelストリングRequired. Use a published video model ID from /v1/models; do not assume every workbench model is available.
promptストリングRequired. Describe the subject, action, setting and camera movement. Follow the returned prompt limits.
modeストリングtext_to_video (default), image_to_video, first_last_frame or reference_images. Check capabilities.operations for supported modes.
seconds整数Output duration. Use durationsByQuality[quality] or durations for the selected operation; defaults to defaultDuration.
qualityストリングUse an exact value from the selected operation qualities; defaults to defaultQuality.
aspect_ratioストリングAn 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"
}
取得する/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

エラーと再試行#

2xx 以外の応答では、JSON エラー オブジェクトが返されます。

httpタイプ意味推奨
401invalid_api_key無効または無効なキー、または利用できないアカウント承認ヘッダーとアカウントのステータスを確認してください
402insufficient_balance口座残高が不足しています再試行する前に資金を追加してください
403model_not_allowedモデルが公開されていないか、プロトコルが一致していませんモデル カタログを再度照会します
403model_not_pricedこの仕様には、価格が設定されていません仕様を変更するか、管理者に連絡してください
405method_not_allowedHTTP メソッドはサポートされていません文書化された HTTP メソッドを使用します
502upstream_unavailableモデル サービスは一時的に利用できません指数関数的バックオフで再試行してください
503provider_not_configuredプロバイダー構成は利用できませんプラットフォーム管理者に連絡してください

エラー応答の例

{
  "error": {
    "code": 402,
    "type": "insufficient_balance",
    "status": "INSUFFICIENT_BALANCE",
    "message": "Insufficient account balance"
  }
}
次のような指数関数的バックオフを使用して、ネットワーク障害と 5xx 応答を限られた回数再試行します。 2, 4 そして 8 秒。 アカウントや請求エラーなどを自動的に再試行しないでください。 401, 402 又は 403.