FluxMedia
  • Model Marketplace
  • API Docs
FluxMedia

An AI generation platform for image and video creation.

Product

  • Models
  • Docs
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
  • Cookie Policy

© 2026 FluxMedia. All rights reserved.

FluxMedia External API

API Integration Guide

Media API reference for server-side integrations. Discover models and credit quota first, then create images or videos and poll task status.

Base URL

https://media.flux-code.cc

Authentication

Authorization: Bearer <API_KEY>

Endpoint directory

Expand a module, then select an endpoint to jump.

GETList available models/v1/modelsGETGet credits and key quota/v1/credits
POSTCreate image/v1/images/generationsPOSTEdit image/v1/images/editsGETGet image task/v1/images/{task_id}
POSTCreate video/v1/videos/generationsGETList video model capabilities/v1/videos/capabilitiesGETGet video task/v1/videos/{id}
Image Size Table

Endpoint reference

01

Integration basics

Confirm the models, account credits, and key quota available to the current API key.

01GET/v1/modelsmodels

List available models

List the image and video models actually available to the current API key's bound backend group.

No request body

Request example

BASH
curl https://media.flux-code.cc/v1/models \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY"

Response example

JSON
{  "object": "list",  "data": [    {      "id": "gpt-image-2",      "object": "model",      "created": 0,      "owned_by": "gpt2image"    },    {      "id": "seedance2",      "object": "model",      "created": 0,      "owned_by": "gpt2image"    }  ]}

Request parameters

Parameter
Requirement
Default
Description
AuthorizationRequired headerDefault:—Bearer <API_KEY>.

Response fields

Field
Description
objectAlways list.
data[].idReal model IDs schedulable by this key. The list can be empty when no reachable member is configured.
data[].object / created / owned_byFixed metadata compatible with an OpenAI model object.

Usage notes

  • Results are filtered by system capability switches, the API key's backend group, and the explicit model lists of enabled group members.
  • Only model listing is available; /v1/models/{model} is not implemented.
  • Responses use Cache-Control: no-store. Query again before generation instead of maintaining a fixed client-side model list.
02GET/v1/creditscredits

Get credits and key quota

Return the current API key's credit limit, usage, remaining quota, and owning account balance.

No request body

Request example

BASH
curl https://media.flux-code.cc/v1/credits \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY"

Response example

JSON
{  "object": "credit_balance",  "account": {    "balance": 15702.45,    "total_earned": 20000,    "total_spent": 4297.55,    "status": "active"  },  "api_key": {    "id": "key_...",    "name": "Production",    "key_prefix": "fm_live_",    "last_four": "a1b2",    "is_active": true,    "credit_limit": 1000,    "credits_used": 12.7,    "credits_remaining": 987.3,    "unlimited": false,    "last_used_at": "2026-08-03T01:02:03.000Z",    "created_at": "2026-08-01T01:02:03.000Z"  }}

Request parameters

Parameter
Requirement
Default
Description
AuthorizationRequired headerDefault:—Bearer <API_KEY>.

Response fields

Field
Description
account.balanceCurrent available credits on the owning account.
account.total_earned / total_spent / statusCumulative credits earned, cumulative credits spent, and current account status.
api_key.id / name / key_prefix / last_four / is_activeSafe summary and activation state for the current API key; the full key is never returned.
api_key.credit_limit / credits_used / credits_remaining / unlimitedThe key limit, used quota, remaining quota, and unlimited flag.
api_key.last_used_at / created_atLast-use and creation timestamps. last_used_at is null before the first use.

Usage notes

  • When credit_limit is null, the key is unlimited, credits_remaining is null, and unlimited is true.
  • Both key quota and account balance gate requests; insufficient value in either can reject a generation request.
  • Responses use Cache-Control: no-store and must not be retained by shared caches.
02

Generate images

Create or edit images, then query image task status and results.

03POST/v1/images/generationsimage_generation

Create image

Generate images from a text prompt using an OpenAI Images generation-compatible request.

application/json

Request example

BASH
curl https://media.flux-code.cc/v1/images/generations \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-image-2",    "prompt": "A quiet reading room in the morning sun",    "size": "1024x1024",    "quality": "medium",    "response_format": "url",    "output_format": "png",    "background": "auto"  }'

Response example

JSON
{  "created": 1713833628,  "data": [    {      "url": "https://media.flux-code.cc/api/storage/generations/...",      "revised_prompt": "..."    }  ]}

Request parameters

Parameter
Requirement
Default
Description
promptRequiredDefault:—Image prompt, up to 32,000 characters.
modelRequiredDefault:—Image model ID available to the current API key.
sizeOptionalDefault:1024x1024Target image size. Standard enum values: auto, 1248x1248, 1248x832, 832x1248, 1248x704, 704x1248, 1248x944, 944x1248, 1248x528, 2048x2048, 2048x1360, 1360x2048, 2048x1152, 1152x2048, 2048x1536, 1536x2048, 2048x880, 2880x2880, 3520x2352, 2352x3520, 3840x2160, 2160x3840, 3312x2496, 2496x3312, 3840x1648. Omission defaults to 1024x1024; custom WIDTHxHEIGHT values that satisfy the site constraints are also accepted. See the “Image Size Table” below.
qualityOptionalDefault:autoauto, low, medium, or high; currently supported only by gpt-image-2. Do not send it for other image models.
response_formatOptionalDefault:b64_jsonurl or b64_json; defaults to b64_json.
output_formatOptionalDefault:Unset (upstream decides)png, jpeg, or webp.
output_compressionOptionalDefault:Unset (upstream decides)Controls the output image compression level from 0 to 100. Higher values apply stronger compression, typically producing smaller files with more quality loss; 0 means no compression and 100 means maximum compression. It only applies when output_format is jpeg or webp, and exact results may vary by upstream provider.
backgroundOptionalDefault:Unset (upstream decides)transparent, opaque, or auto; support depends on the model.
streamOptionalDefault:falseReturn an event stream when true or when Accept is text/event-stream.

Response fields

Field
Description
createdUnix timestamp in seconds.
data[].b64_json / data[].urlBase64 image or image URL selected by response_format.
data[].revised_promptThe upstream revised prompt, when available.
SSE image_generation.partial_imagePartial image event in streaming mode.
SSE image_generation.completedSignals that one image has completed in streaming mode.

Usage notes

  • response_format selects URL or base64 output; output_format selects the image file format.
  • Supported sizes, transparent backgrounds, and output formats vary by model.
04POST/v1/images/editsimage_edit

Edit image

Edit one or more input images from a prompt using an OpenAI Images edit-compatible request.

multipart/form-data 或 application/json

Request example

BASH
curl https://media.flux-code.cc/v1/images/edits \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY" \  -F "model=gpt-image-2" \  -F "prompt=Replace the sky with a clear sunset" \  -F "image=@./input.png" \  -F "size=1024x1024" \  -F "quality=medium" \  -F "response_format=url"

Response example

JSON
{  "created": 1713833628,  "data": [    {      "url": "https://media.flux-code.cc/api/storage/generations/...",      "revised_prompt": "..."    }  ]}

Request parameters

Parameter
Requirement
Default
Description
promptRequiredDefault:—Edit prompt, up to 32,000 characters.
image / image[] / image_*Required for multipartDefault:—Uploaded image files, up to 16 images.
imagesRequired for JSONDefault:—Image reference array in a JSON request.
maskOptionalDefault:NoneMask image whose transparent area indicates the edit region.
modelRequiredDefault:—Image model ID available to the current API key.
sizeOptionalDefault:1024x1024Target image size. Standard enum values: auto, 1248x1248, 1248x832, 832x1248, 1248x704, 704x1248, 1248x944, 944x1248, 1248x528, 2048x2048, 2048x1360, 1360x2048, 2048x1152, 1152x2048, 2048x1536, 1536x2048, 2048x880, 2880x2880, 3520x2352, 2352x3520, 3840x2160, 2160x3840, 3312x2496, 2496x3312, 3840x1648. Omission defaults to 1024x1024; custom WIDTHxHEIGHT values that satisfy the site constraints are also accepted. See the “Image Size Table” below.
qualityOptionalDefault:autoauto, low, medium, or high; currently supported only by gpt-image-2. Do not send it for other image models.
response_formatOptionalDefault:b64_jsonurl or b64_json; defaults to b64_json.
output_formatOptionalDefault:Unset (upstream decides)png, jpeg, or webp.
output_compressionOptionalDefault:Unset (upstream decides)Controls the output image compression level from 0 to 100. Higher values apply stronger compression, typically producing smaller files with more quality loss; 0 means no compression and 100 means maximum compression. It only applies when output_format is jpeg or webp, and exact results may vary by upstream provider.
backgroundOptionalDefault:Unset (upstream decides)transparent, opaque, or auto; support depends on the model.
streamOptionalDefault:falseReturn an event stream when true or when Accept is text/event-stream.

Response fields

Field
Description
createdUnix timestamp in seconds.
data[].b64_json / data[].urlBase64 image or image URL selected by response_format.
data[].revised_promptThe upstream revised prompt, when available.
SSE image_edit.partial_imagePartial image event in streaming mode.
SSE image_edit.completedSignals that one image edit has completed in streaming mode.

Usage notes

  • Use multipart/form-data for direct file uploads; JSON requests pass image references through images.
  • The mask dimensions should match the input image.
07GET/v1/images/{task_id}image_generation

Get image task

Get image generation status and results by task ID.

No request body

Request example

BASH
curl https://media.flux-code.cc/v1/images/task_... \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY"

Response example

JSON
{  "id": "task_...",  "object": "image",  "status": "completed",  "created": 1713833628,  "created_at": "2026-05-28T00:00:00.000Z",  "completed": 1713833700,  "completed_at": "2026-05-28T00:01:12.000Z",  "data": [    {      "url": "https://media.flux-code.cc/api/storage/generations/..."    }  ]}

Request parameters

Parameter
Requirement
Default
Description
AuthorizationRequired headerDefault:—Bearer <API_KEY>.
task_idRequired path parameterDefault:—Image task ID corresponding to {task_id} in the request path.

Response fields

Field
Description
idImage task ID.
objectTask object type.
statusprocessing, needs_attention, completed, or failed.
data[].b64_json / data[].urlImage results returned after completion.
created / created_at / completed / completed_atCreation and completion times; completion fields are absent while running.

Usage notes

  • Only tasks created by the user who owns the current API key can be queried.
  • A running task has status processing. A failed task includes the reason in error.message.
03

Generate videos

Discover model capabilities, create videos, and query persistent tasks.

05POST/v1/videos/generationsvideo

Create video

Create a persistent video task from a text prompt or reference images using the OpenAI-style route.

POST /v1/videos is no longer a video creation endpoint. Use POST /v1/videos/generations or /api/v1/videos/generations.

application/json

Request example

BASH
curl https://media.flux-code.cc/v1/videos/generations \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "client_request_id": "video-request-001",    "model": "seedance2",    "seconds": 8,    "aspect_ratio": "16:9",    "resolution": "1080p",    "prompt": "A hero walking through a neon city",    "negative_prompt": "low resolution, blur, watermark",    "quote_token": "opaque-current-quote-token",    "generate_audio": true,    "reference_images": ["data:image/png;base64,..."],    "reference_videos": ["https://media.example/reference.mp4"],    "reference_audios": ["https://media.example/reference.mp3"]  }'

Response example

JSON
{  "object": "video.task",  "id": "video_0123456789abcdef0123456789abcdef01234567",  "task_id": "video_0123456789abcdef0123456789abcdef01234567",  "generation_id": "video_0123456789abcdef0123456789abcdef01234567",  "status": "queued",  "model": "seedance2",  "duration": 8,  "duration_seconds": 8,  "aspectRatio": "16:9",  "aspect_ratio": "16:9",  "resolution": "1080p",  "billing": {    "kind": "snapshot",    "mode": "per_second",    "unit": "second",    "unitPrice": 3,    "creditsPerSecond": 3,    "durationSeconds": 8,    "quotedCredits": 24,    "actualCredits": 0  },  "generateAudio": true,  "generate_audio": true}

Request parameters

Parameter
Requirement
Default
Description
client_request_id / clientRequestIdRequiredDefault:—A caller-generated idempotency key of up to 128 characters.
promptRequiredDefault:—Video prompt, up to 32,000 characters.
modelRequiredDefault:—Real video model ID such as seedance2, seedance2-fast, or veo31. Duration, ratio, and resolution must not be encoded in the ID; composite IDs are rejected.
seconds / duration / duration_secondsRequiredDefault:—Separate video duration in seconds. seconds accepts a positive integer or decimal integer string; supplied aliases must agree and the normalized value must be supported by the selected model.
aspectRatio / aspect_ratioRequiredDefault:—Separate video aspect ratio supported by the selected model.
resolutionRequiredDefault:—Separate lowercase output resolution supported by the selected model.
quote_token / quoteTokenOptionalDefault:Omit to create with the current server quoteShort-lived opaque quote token from the matching model and resolution billing row of GET /v1/videos/capabilities. A changed quote returns 409 with the latest currentQuote; confirm it and retry with the new token.
negative_prompt / negativePromptOptionalDefault:NoneNegative prompt, up to 8,000 characters.
generate_audio / generateAudioOptionalDefault:Model defaultWhether to generate audio. Seedance 2.0, including Fast, and Kling 3.0 Omni default to false, while Kling 3.0 defaults to true. Runway Gen-4.5 and Ray 3.14, including HDR, do not support audio, and models without audio support cannot accept true.
firstFrame / first_frame, lastFrame / last_frameOptionalDefault:NoneFirst frame and optional last frame as base64 image data URLs. lastFrame requires firstFrame; last-frame support is model-specific.
referenceImages / reference_imagesOptionalDefault:Empty arrayOrdered base64 image data URL array. The limit is model-specific; Seedance defaults to 10 and admins may configure it. Reference images and frame inputs are mutually exclusive for every model.
callback_url / callbackUrlOptionalDefault:NonePublic https webhook that receives the task object when the task completes or fails.

Response fields

Field
Description
task_id / id / generation_idThe same persistent video task ID.
objectAlways video.task.
statusInitial task status, usually queued.
modelReal video model ID used for this request.
duration / duration_seconds, aspectRatio / aspect_ratio, resolutionSeparate video parameters used by this task.
billingSnapshot locked at creation. mode=per_second multiplies the unit price by duration; mode=per_item charges unitPrice once and has no creditsPerSecond.

Usage notes

  • The endpoint always returns a persistent task with HTTP 202 and never waits synchronously for the video; poll GET /v1/videos/{id}.
  • Model, duration, ratio, and resolution are validated independently and are never parsed from the model ID.
  • billing is an immutable creation quote. An idempotent retry with an existing client_request_id always returns the original task billing instead of repricing from current configuration.
06GET/v1/videos/capabilitiesvideo

List video model capabilities

List real video models visible to the current API key, their independent generation parameters, image input and audio capabilities, and whether the account pool is configured to reach them.

No request body

Request example

BASH
curl https://media.flux-code.cc/v1/videos/capabilities \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY"

Response example

JSON
{  "items": [    {      "model": "seedance2",      "displayName": "Seedance 2.0",      "durations": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],      "aspectRatios": ["1:1", "4:3", "3:4", "16:9", "9:16", "21:9"],      "resolutions": ["1080p", "720p", "480p"],      "input": {        "frames": "first-and-optional-last",        "referenceImages": {          "maxCount": 10,          "configurable": true        },        "framesAndReferencesMutuallyExclusive": true      },      "audio": {        "supported": true,        "defaultEnabled": false      },      "billing": [        {          "kind": "current_quote",          "resolution": "1080p",          "mode": "per_second",          "unit": "second",          "unitPrice": 3,          "creditsPerSecond": 3,          "quoteToken": "opaque-current-quote-token"        }      ],      "configuredReachable": true    }  ],  "limits": {    "maxMediaInputCount": 256,    "maxMediaInputBytes": 536870912  }}

Request parameters

Parameter
Requirement
Default
Description
AuthorizationRequired headerDefault:—Bearer <API_KEY>.

Response fields

Field
Description
items[].model / displayNameReal video model ID and display name.
items[].durations / aspectRatios / resolutionsAllowed independent duration, aspect ratio, and resolution values for the model.
items[].input.framesnone, first-only, or first-and-optional-last, describing frame input support.
items[].input.referenceImagesReference-image limit and whether admins can configure that limit; use the current response value.
items[].input.framesAndReferencesMutuallyExclusiveIndicates that frame inputs and reference images cannot be sent together.
items[].audioAudio generation support and the default used when generate_audio is omitted.
items[].billing[]Current effective quote and quoteToken for each output resolution. per_second includes creditsPerSecond; per_item is charged only by unitPrice per item.
items[].configuredReachableWhether the trusted account-pool group is configured with an account capable of running this model; this is not real-time capacity.
limitsInfrastructure-wide input count and byte limits; per-model limits still come from items[].input.

Usage notes

  • Before creating a video, select model, duration, aspect_ratio, and resolution from this endpoint. Do not construct composite model IDs.
  • A quote token is bound to the current API key, model, and resolution and may be omitted for compatibility. When a supplied token is stale, creation returns 409 conflict with the latest currentQuote.
  • configuredReachable reports configuration reachability only. It exposes no accounts, credentials, health, concurrency, or live remaining capacity.
  • Responses use Cache-Control: no-store. Query again after an admin changes a Seedance reference-image limit.
08GET/v1/videos/{id}video

Get video task

Get video generation status and results by task ID.

No request body

Request example

BASH
curl https://media.flux-code.cc/v1/videos/video_0123456789abcdef0123456789abcdef01234567 \  -H "Authorization: Bearer $FLUXMEDIA_API_KEY"

Response example

JSON
{  "object": "video.task",  "id": "video_0123456789abcdef0123456789abcdef01234567",  "task_id": "video_0123456789abcdef0123456789abcdef01234567",  "generation_id": "video_0123456789abcdef0123456789abcdef01234567",  "status": "completed",  "model": "seedance2",  "duration": 8,  "duration_seconds": 8,  "aspectRatio": "16:9",  "aspect_ratio": "16:9",  "resolution": "1080p",  "generateAudio": true,  "generate_audio": true,  "input": { "mode": "references", "count": 1 },  "billing": {    "kind": "snapshot",    "mode": "per_item",    "unit": "item",    "unitPrice": 3,    "durationSeconds": 8,    "quotedCredits": 3,    "actualCredits": 3  },  "created_at": "2026-05-28T00:00:00.000Z",  "completed_at": "2026-05-28T00:01:40.000Z",  "video_url": "https://media.flux-code.cc/api/storage/generations/...",  "data": [{"url": "https://media.flux-code.cc/api/storage/generations/..."}]}

Request parameters

Parameter
Requirement
Default
Description
AuthorizationRequired headerDefault:—Bearer <API_KEY>.
idRequired path parameterDefault:—Persistent video task ID returned by the create endpoint, corresponding to {id} in the request path. Maximum 128 characters; only tasks owned by the current API key user are queryable.

Response fields

Field
Description
id / task_id / generation_idThe same persistent video task ID.
objectAlways video.task.
statusqueued, in_progress, completed, or failed.
model, duration / duration_seconds, aspectRatio / aspect_ratio, resolutionThe task's real model ID and separate video parameters.
inputInput mode and count without the user-supplied image contents.
billingImmutable quote and actual consumption. Legacy tasks are marked legacy with unknown unit price and quote; no current price is fabricated.
data[].url / video_urlThe same video URL returned after completion.
created_at / completed_atISO creation and completion times; completed_at is absent while running.

Usage notes

  • Only tasks created by the user who owns the current API key can be queried.
  • Tasks are persisted and remain queryable across process restarts or multiple instances; responses use Cache-Control: no-store.
  • snapshot actualCredits follows consumption or refund results; a refund preserves quotedCredits and sets actualCredits to 0.
  • A failed task includes the reason in error.message.
Image Size Table

The table maps the site image-size selector's resolution bases and aspect ratios to the standard size enum values.

Resolution1:13:22:316:99:164:33:421:9
1K1248x12481248x832832x12481248x704704x12481248x944944x12481248x528
2K2048x20482048x13601360x20482048x11521152x20482048x15361536x20482048x880
4K2880x28803520x23522352x35203840x21602160x38403312x24962496x33123840x1648

auto lets the backend decide. Standard ratio sizes are rounded to multiples of 16; each edge must be 256–3840px, total pixels 655,360–8,294,400, and the aspect ratio must not exceed 3:1. The 4K square and some 4K ratios are reduced by the total-pixel cap; the table shows the resulting dimensions. Custom WIDTHxHEIGHT values that satisfy these constraints are also accepted.