Guide

How to use the FLUX API: FLUX.2 Pro in Python and curl, and the price per image

Prices checked Nov 26, 2026 · 3 min read

How to use the FLUX API: one request returning a detailed image

To use the FLUX API, send one POST /v1/tasks with model set to flux-2-pro and a prompt inside input. Then poll GET /v1/tasks/{id} or pass a callback_url, and read the image from output.urls. FLUX.2 Pro costs $0.025 per image at 1K and $0.035 at 2K on TapModels. Credits are held on submit and charged only if the task succeeds.

The request

Images are asynchronous tasks. The base URL is https://api.tapmodels.com/v1 and auth is Authorization: Bearer sk_live_....

{
  "model": "flux-2-pro",
  "input": {
    "prompt": "A hand-lettered bakery sign above a blue door, morning light, 35mm photo",
    "aspect_ratio": "3:4",
    "resolution": "2K",
    "output_format": "png"
  },
  "callback_url": "https://your.app/hooks/tapmodels"
}

The reply is 202 { "id": "task_...", "status": "queued", "estimated_credits": 3.5 }.

Parameters and valid values

FieldRequiredValid valuesDefault
promptyesText describing the imagenone
image_inputnoUp to 4 reference imagesnone
aspect_rationo1:1, 4:3, 3:4, 16:9, 9:16, 21:91:1
resolutionno1K, 2K1K
output_formatnojpg, pngjpg

FLUX.2 Pro is listed for text to image. The schema also carries an image_input field with up to 4 references, so check GET /v1/models/flux-2-pro for exactly what the live model accepts before you build on it. Upload any reference file with POST /v1/files (up to 30 MB) and pass the returned URL.

Image tasks use the same task endpoint as video, so there's no separate image client call to make. The OpenAI-compatible route is for chat models only.

Python example

import os, time, requests

BASE = "https://api.tapmodels.com/v1"
H = {"Authorization": f"Bearer {os.environ['TAPMODELS_API_KEY']}"}

r = requests.post(f"{BASE}/tasks", headers=H, json={
    "model": "flux-2-pro",
    "input": {"prompt": "A hand-lettered bakery sign above a blue door, morning light, 35mm photo",
              "aspect_ratio": "3:4", "resolution": "2K"},
})
r.raise_for_status()
task = r.json()

while task["status"] in ("queued", "running"):
    time.sleep(2)
    task = requests.get(f"{BASE}/tasks/{task['id']}", headers=H).json()

print(task["status"], task["output"], task["credits_charged"])

Curl example

curl https://api.tapmodels.com/v1/tasks \
  -H "Authorization: Bearer $TAPMODELS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-2-pro","input":{"prompt":"A hand-lettered bakery sign above a blue door, morning light","resolution":"2K","aspect_ratio":"3:4"}}'

curl https://api.tapmodels.com/v1/tasks/task_123 \
  -H "Authorization: Bearer $TAPMODELS_API_KEY"

Output files are kept for 14 days, so save the image to your own storage. If you would rather not poll, add callback_url. We then POST the task object to it with an X-Signature header (t=<unix>,v1=<hex hmac-sha256 of "t.body">), and retry any non-2xx reply for 24 hours.

FLUX API cost per image

List price is the provider's published rate as recorded in our catalog on 2026-11-26. Credits are 100 per dollar.

ResolutionTapModelsList priceLower by1,000 images
1K$0.025$0.03about 17%$25.00
2K$0.035$0.045about 22%$35.00

Worked example: a catalogue of 1,000 product backgrounds.

  • All at 2K: 1,000 x $0.035 = $35.00 (3,500 credits). At list price: 1,000 x $0.045 = $45.00.
  • Draft all at 1K, upscale only the 200 you keep at 2K: 1,000 x $0.025 + 200 x $0.035 = $25.00 + $7.00 = $32.00.

Going from 1K to 2K adds $0.01 per image, a 40% increase. Many uses are fine at 1K, so choose by where the image will be shown.

If you pick between image models by price, FLUX.2 Pro at 1K ($0.025) sits between Seedream 5.5 ($0.018) and GPT Image 2 ($0.03). We publish no quality ranking, so test your own prompts. See Nano Banana vs FLUX and GPT Image vs FLUX.

Common errors

HTTPCodeWhat to do
401unauthorizedCheck the key is present and not revoked
402insufficient_creditsBalance minus held credits is below the estimate
402key_limit_reachedThe key's spend limit would be exceeded
403model_not_allowedThe key's allowed_models excludes flux-2-pro
422invalid_inputA field is outside the valid values above, for example 4K
429rate_limitedWait for Retry-After, then retry
task failedupstream_errorResubmit: 0 credits were charged

The default limit is 20 new tasks per 10 seconds per account. A 1,000-image job needs at least 50 windows of 10 seconds to submit, about 8 minutes 20 seconds.

Next step: compare the cost of every image model on the FLUX pricing page or in cheapest image generation API.

Frequently asked questions

How do I use the FLUX API?

Send POST /v1/tasks with model flux-2-pro and an input object with a prompt, an aspect_ratio and a resolution of 1K or 2K. Poll GET /v1/tasks/{id} or pass a callback_url, then read the image URL from output.urls once the status is succeeded.

How much does the FLUX.2 Pro API cost?

On TapModels, FLUX.2 Pro costs $0.025 per image at 1K and $0.035 at 2K. List prices recorded in our catalog are $0.03 and $0.045. A thousand 1K images cost $25.00. Failed tasks are not charged.

Is FLUX.2 Pro the same as Flux Pro?

FLUX.2 Pro is the flagship text to image model of Black Forest Labs and the one we list under the id flux-2-pro. We do not list older FLUX versions, so for the Flux Pro API on TapModels, use flux-2-pro and check GET /v1/models for the live list.

What resolutions does the FLUX API support?

Through TapModels, FLUX.2 Pro accepts 1K and 2K. Aspect ratios are 1:1, 4:3, 3:4, 16:9, 9:16 and 21:9, and output formats are jpg and png. A value outside those lists returns 422 invalid_input and the message names the field.

Sources