Documentation Index
Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Flux 2 is a Black Forest Labs image model for high-quality text-to-image generation and reference-guided image editing. Use this page when you are ready to call the API after trying Flux 2 in the APIXO playground.| Capability | Value |
|---|---|
| Model ID | flux-2 |
| Modes | pro-text-to-image, pro-image-to-image, flex-text-to-image, flex-image-to-image |
| Prompt length | 3-5000 characters |
| Reference images | 1-8 URLs for image-to-image modes |
| Aspect ratios | 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, auto |
| Resolution tiers | 1K, 2K |
Endpoint and authentication
Base URL:| Method | Endpoint | Purpose |
|---|---|---|
POST | /generateTask/flux-2 | Submit a generation task |
GET | /statusTask/flux-2?taskId={taskId} | Poll task status and retrieve results |
Copy-paste async quickstart
This minimal request submits a text-to-image task and returns ataskId.
taskId; you need it to poll for the final result.
Poll for result
resultJson after state becomes success:
Request body
Text-to-image
Image-to-image
Parameters
Result delivery mode. Use
async for polling with statusTask, or callback for webhook delivery.Required when
request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.Flux 2 input parameters.
Mode options
| Mode | Use case |
|---|---|
pro-text-to-image | Pro text-to-image generation |
pro-image-to-image | Pro image-to-image editing with reference images |
flex-text-to-image | Flex text-to-image generation |
flex-image-to-image | Flex image-to-image editing with reference images |
Response format
Submit task response
POST /generateTask/flux-2 returns a task ID when the task is accepted:
API status code.
200 means the task was accepted.Human-readable status message.
Unique task identifier used with the status endpoint.
Status response fields
Unique task identifier.
Current task state:
processing, success, or failed.JSON string containing the generated image URLs. Present when
state is success.Machine-readable failure code. Present when
state is failed.Human-readable failure message. Present when
state is failed.Task creation timestamp in Unix milliseconds.
Task completion timestamp in Unix milliseconds. Present after completion.
Processing duration in milliseconds. Present after successful completion.
Webhook callback mode
Use callback mode when your backend should receive the final result automatically instead of polling.Billing
Flux 2 is billed per generated image. The selected mode tier andresolution determine the unit price.
| Mode tier | Resolution | APIXO Value price | Official price | Market price |
|---|---|---|---|---|
pro-* | 1K | $0.035 / image | $0.045 / image | $0.045 / image |
pro-* | 2K | $0.05 / image | $0.07 / image | $0.07 / image |
flex-* | 1K | $0.10 / image | $0.12 / image | $0.12 / image |
flex-* | 2K | $0.16 / image | $0.22 / image | $0.22 / image |
Latency and polling
Actual latency may vary by prompt complexity, reference image count, provider route, and current queue load.| Typical generation time | Recommended first poll | Poll interval |
|---|---|---|
| About 30 seconds | 20 seconds after task creation | 3-10 seconds |
429, slow down requests and retry with backoff. For account-level details, see System APIs.
Errors and troubleshooting
HTTP errors
| Code | Meaning | What to do |
|---|---|---|
400 | Invalid request body, missing parameter, unsupported value, prompt length issue, or inaccessible image URL | Fix the request before retrying |
401 | Missing or invalid API key | Check the Authorization header |
402 | Insufficient balance or quota | Add balance or switch account/key |
403 | Key or route cannot access the model, or provider rejected the content | Check permissions and adjust the prompt or images |
429 | Rate limit or concurrency limit reached | Retry with exponential backoff |
500 | Server error or unknown upstream failure | Retry with backoff |
502 | Upstream provider error | Retry with backoff |
504 | Upstream timeout | Retry or use callback mode for long-running jobs |
Task failure codes
| Fail code | Meaning | What to do |
|---|---|---|
SensitiveContent | Prompt, input image, or output was flagged by provider safety checks | Change the prompt or reference image |
ProhibitedContentDetected | Provider rejected the task for prohibited content | Adjust the prompt or input image |
ImageNotAccess | A reference image URL could not be fetched | Use a public, direct image URL |
PromptInvalid | Prompt was invalid or rejected by the provider | Rewrite the prompt |
MissingParameter | One or more required parameters were missing | Check mode, prompt, aspect_ratio, resolution, and image_urls |
RateLimited | Provider or account rate limit was reached | Retry with backoff |
Timeout | Provider timed out | Retry, reduce input complexity, or use callback mode |
Unknown error | Upstream failure did not match a known error rule | Retry with backoff or contact support if it persists |