Flux Context
AgentOdkrywajBiblioteka

Generuj

Wszystkie narzędziaWszystkie modele

Przepływy pracy

Reklama AIOdtwórz viralNowe
APIUlepsz plan
AgentBiblioteka

Ładowanie...

Możesz poczekać lub odświeżyć tę stronę.

Odśwież stronęPrzejdź do strony głównejSkontaktuj się z pomocą

    API

    Manage your API access and requests.

    OverviewAPI KeyAPI LogsDocs

    Getting started

    QuickstartAuthenticationPoll & downloadErrors & limits

    Image models

    Seedream 5.5Seedream 5.0 ProSeedream 5.0 LiteNano Banana 2GPT Image 2Seedream 4.5

    Video models

    Seedance 2.0Seedance 2.0 MiniSeedance 2.0 FastSeedance 2.5Wan 3.0
    Quickstart · Documentation

    Getting started

    QuickstartAuthenticationPoll & downloadErrors & limits

    Image models

    Seedream 5.5Seedream 5.0 ProSeedream 5.0 LiteNano Banana 2GPT Image 2Seedream 4.5

    Video models

    Seedance 2.0Seedance 2.0 MiniSeedance 2.0 FastSeedance 2.5Wan 3.0
    Docs Getting started

    Quickstart

    Your first Flux API request, in a few simple steps.

    API access is available to all registered accounts. Generations use your existing subscription and purchased credits. Gift credits cannot be used; API results remain private.

    1. Create a key

    Create a key in API Key and save it as a server-side environment variable.

    Shell
    export FLUX_API_KEY="YOUR_FLUX_API_KEY"

    2. Check your connection

    This request reads your balance and does not spend credits.

    cURL
    curl https://api.flux-context.org/api/v1/balance \
      -H "Authorization: Bearer $FLUX_API_KEY"

    3. Create a generation

    Choose a model to see its parameters and a complete request example.

    Seedream 5.5

    Text-to-image and image-to-image

    Seedream 5.0 Pro

    Text-to-image and image-to-image

    Seedream 5.0 Lite

    Text-to-image and image-to-image

    Nano Banana 2

    Text-to-image and image-to-image

    Seedance 2.0

    Text and references to video

    Seedance 2.0 Mini

    Text and references to video

    Seedance 2.0 Fast

    Text and references to video

    Seedance 2.5

    Text and references to video

    Wan 3.0

    Text and references to video

    GPT Image 2

    Text-to-image and image-to-image

    Seedream 4.5

    Text-to-image and image-to-image

    4. Poll and download

    Save the returned request ID and query approximately every 10 seconds. Background work continues even when you stop polling.

    cURL
    curl https://api.flux-context.org/api/v1/generations/REQUEST_ID \
      -H "Authorization: Bearer $FLUX_API_KEY"

    When status is succeeded, download each URL in results. Response excerpt:

    JSON
    {
      "id": "REQUEST_ID",
      "status": "succeeded",
      "results": [
        {
          "url": "https://api.flux-context.org/api/v1/files/SIGNED_TOKEN",
          "url_expires_at": "2026-09-10T11:42:18Z",
          "expires_at": "2026-10-10T10:42:18Z",
          "expired": false,
          "media_type": "image",
          "content_type": "image/png",
          "size_bytes": 1234567,
          "width": 1024,
          "height": 1024
        }
      ]
    }

    Stop polling when the status is succeeded or failed. For failed tasks, read error and billing for the reason and final credit settlement.

    Download links last one hour. Query again for a fresh link. Files are retained for 30 days after transfer; file expiry does not change generation or billing records. Video results use media_type video and content_type video/mp4; save them with a .mp4 extension. Downloads support HEAD and single byte-range requests for playback and resuming.

    Shell
    curl --fail --location "$RESULT_URL" --output result.png

    Credits and settlement

    No subscription is required. API generations spend subscription credits first, then purchased credits. Gift credits cannot be used, including for additional video charges. GET /balance returns credits_available for these eligible pools only; breakdown.giftRemaining is informational and is not included. Refunds follow the original charge.

    Fixed requests are charged upfront. Seedance 2.5 editing reserves credits and settles automatically after generation. Billing includes credits_precharged, credits_additional, credits_refunded, credits_final and settlement_status. credits_charged remains the total debited before refunds. credits_final is null while pending. If settlement_mode is precharge_retained, the precharge remains debited and results are available while billing awaits review.

    Missing final billing data stays pending and is retried in the background. No manual log checks are required. Results are available after settlement. File expiry does not refund a successful generation.

    Reference media

    Supply public HTTPS URLs, without duration fields. Flux measures MP4/MOV video and MP3/WAV/M4A audio before charging. References must stay available until generation finishes. Requests use up to 3 concurrent probes, a 20-second deadline, an 8 MiB metadata budget per file and 32 MiB in total. Range support is recommended; small files also work without it.

    INVALID_REFERENCE_MEDIA (HTTP 400) means media could not be read reliably or exceeded a model constraint. No task was created or credits charged. Check the URL, file format and duration, then retry.

    Common request headers

    HeaderUsage
    Authorization
    Required
    Bearer YOUR_FLUX_API_KEY. Keep this key on your server. Access changes are synchronized automatically. Status reads may take up to five minutes to reflect a permission change. Existing download links keep their original expiry.
    Content-Type
    Required for POST
    application/json
    Idempotency-Key
    Optional · POST
    For automatic retries, reuse the same value and body for one business request. The original task is returned without another charge. If omitted, every POST creates an independent task. Use 1–128 letters, digits, dots, colons, underscores, or hyphens.

    A network timeout does not prove creation failed. Use the optional retry header when automatically retrying POST requests. The Python example handles it for you.

    Errors & limits

    Każda próba żądania HTTP posiada identyfikator request_id i nagłówek X-Request-Id. ID generacji pozostaje stałe przy ponownych próbach z użyciem tego samego klucza Idempotency-Key i niezmienionej treści żądania. Do sprawdzania statusu używaj ID generacji FLUX; provider_task_id jest opcjonalnym odniesieniem dla wsparcia technicznego, a nie kluczem wyszukiwania w systemie FLUX.

    Błędy zachowują kod error.code systemu FLUX i, gdy to możliwe, dodają szczegóły dotyczące źródła i dostawcy. Kody biznesowe, kody błędów i status HTTP dostawcy różnią się od statusu HTTP systemu FLUX. Pomyślne sprawdzenie statusu nie oznacza, że generowanie zakończyło się powodzeniem.

    Przed ponowieniem próby przeczytaj wyjaśnienie błędu i sprawdź stan rozliczeń. Popraw nieprawidłowe dane wejściowe, odczekaj w przypadku limitów zapytań (rate limits) i sprawdź status pierwotnego zadania, jeśli jego wynik jest nieznany. Błędy konta lub konfiguracji po stronie dostawcy (upstream) wymagają kontaktu ze wsparciem FLUX, a nie nowego klucza API FLUX czy dodatkowych kredytów FLUX.

    Aby uzyskać wsparcie, skopiuj informacje diagnostyczne z logów API. Jeśli są dostępne, podaj ID żądania HTTP, ID generacji FLUX i ID zadania dostawcy. Nigdy nie udostępniaj kluczy API, nagłówków autoryzacyjnych ani prywatnych danych wejściowych.

    OperationLimit
    Create requests60 / minute / account
    Read requests300 / minute / account
    Generation concurrency (queued and processing)20 / account

    These are default limits. Your effective limits appear in Overview and GET /balance. All keys share the account limit. HTTP 429 includes Retry-After: 60 and a limit object with scope and value. For TOO_MANY_TASKS, wait for existing generations to finish; 60 seconds does not guarantee a slot.

    HTTPWhat to check
    400Request parameters or an invalid optional header.
    401A missing, invalid, or revoked API key.
    402Available credits.
    403Account access is restricted or disabled.
    404The request ID and its owning account.
    409A retry identifier was reused with different parameters.
    410The result is no longer retained.
    503Temporary unavailability or an unconfirmed submission.

    SUBMISSION_NOT_CONFIRMED is not a confirmed failure. Keep the original request ID and query its status. Temporary query errors do not trigger refunds.

    Prefer Python?Download Python example