Flux Pro API Pricing and Code Examples: A Complete Developer Guide
Andrew Adams

If you build products that need AI-generated images, the Flux Pro API from Black Forest Labs is one of the most capable options available in 2026. Wireflow provides direct access to Flux 2 Pro through its visual workflow builder and REST API, letting you integrate high-fidelity image generation into production applications without managing infrastructure. This guide covers the full pricing breakdown across tiers, working code examples in multiple languages, and practical tips for keeping costs predictable at scale.
What Is the Flux Pro API?
Flux is a family of text-to-image models built by Black Forest Labs. The lineup includes three tiers, each targeting different use cases. Flux Schnell is the fastest and cheapest option, optimized for drafts and previews. Flux Dev sits in the middle, offering better quality at moderate cost. Flux 2 Pro is the flagship, producing photorealistic images at resolutions up to 4 megapixels with strong prompt adherence and fine detail rendering. For a hands-on look at this in action, check out the Flux Pro API feature page.
You can access Flux Pro directly from Black Forest Labs or through third-party providers like DeepInfra, Replicate, and Wireflow. Each provider has its own pricing model, rate limits, and API surface. The model itself remains the same, but the integration experience varies significantly depending on how you plan to use the generated images in your application.
Flux Pro API Pricing Breakdown
Pricing for Flux Pro depends on which provider you use and how you measure usage. Black Forest Labs charges per megapixel, while third-party platforms often charge a flat per-image rate or bundle usage into subscription tiers.
Black Forest Labs (Direct)
| Operation | Price |
|---|---|
| Text-to-Image | $0.030 per megapixel |
| Image Editing | $0.045 per megapixel |
| Ultra (high-res) | $0.060 per megapixel |
A standard 1024x1024 image (roughly 1 megapixel) costs about $0.03 to generate. A 4-megapixel image at maximum resolution costs approximately $0.12. These rates apply to the raw API; there are no monthly minimums or commitment requirements.
Third-Party Providers
| Provider | Flux 2 Pro Price | Notes |
|---|---|---|
| DeepInfra | $0.07/image | OpenAI-compatible API |
| Replicate | ~$0.05-0.08/image | Pay per prediction |
| Wireflow | Included in plan credits | Visual builder + API access |
Third-party pricing is typically higher per image than going direct, but providers add value through managed infrastructure, retry logic, and simplified authentication. Wireflow bundles Flux 2 Pro into its credit system alongside 150+ other AI models, which makes sense if you need pipeline automation across multiple model types.

Cost Estimation
For a batch of 1,000 standard-resolution images per month via Black Forest Labs direct, expect roughly $30. The same batch through DeepInfra runs about $70. Through Wireflow's Pro plan, it falls within the included monthly credits alongside access to additional models for tasks like batch image generation and image editing.
Getting Started: Authentication and Setup
Every Flux Pro API provider requires an API key. Here is the general pattern across providers.
For Black Forest Labs direct access, sign up at bfl.ai, generate an API key from the dashboard, and include it as a Bearer token in the Authorization header. For Wireflow, navigate to Settings, then API Keys in the dashboard to create a key that starts with sk-. Keys are shown only once at creation, so store them securely. Wireflow keys support granular scopes including workflows:execute, workflows:read, and executions:read, letting you limit access for different environments. Read the full authentication documentation for details on scopes and key rotation.

Code Examples
cURL
The simplest way to test the API. This example uses Wireflow's endpoint to execute a workflow containing a Flux 2 Pro node (generate:flux_2_pro). The POST to /workflows/{id}/execute returns a 201 with an executionId you then poll for results:
curl -X POST https://www.wireflow.ai/api/v1/workflows/YOUR_WORKFLOW_ID/execute \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"nodes": [
{
"id": "text-input-1",
"data": {
"params": {
"prompt": "A minimalist product photo of white headphones on a marble surface, soft natural lighting"
}
}
}
],
"edges": []
}'
Then poll the execution status until it reaches COMPLETED or FAILED:
curl https://www.wireflow.ai/api/v1/workflows/executions/EXECUTION_ID/poll \
-H "Authorization: Bearer sk-your-api-key"
The async pattern keeps your request from timing out on longer generations. Every response includes an X-Request-Id header you can reference when contacting support.
JavaScript (fetch)
const API_KEY = "sk-your-api-key";
const WORKFLOW_ID = "your-workflow-id";
// Step 1: Start execution
const execResponse = await fetch(
`https://www.wireflow.ai/api/v1/workflows/${WORKFLOW_ID}/execute`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
nodes: [{
id: "text-input-1",
data: {
params: {
prompt: "Aerial view of a coastal town at golden hour, photorealistic"
}
}
}],
edges: []
}),
}
);
const { executionId } = await execResponse.json();
// Step 2: Poll for results (exponential backoff)
let result;
let delay = 1000;
while (true) {
const poll = await fetch(
`https://www.wireflow.ai/api/v1/workflows/executions/${executionId}/poll`,
{ headers: { "Authorization": `Bearer ${API_KEY}` } }
);
result = await poll.json();
if (result.status === "COMPLETED" || result.status === "FAILED") break;
await new Promise((r) => setTimeout(r, delay));
delay = Math.min(delay * 1.5, 10000);
}
console.log(result); // Contains node outputs with image URLs
This pattern works for any workflow containing Flux 2 Pro or other chained models. The polling uses exponential backoff starting at 1 second, multiplying by 1.5 per attempt, and capping at 10 seconds between polls as recommended by the API documentation.
Python (requests)
import requests
import time
API_KEY = "sk-your-api-key"
WORKFLOW_ID = "your-workflow-id"
BASE_URL = "https://www.wireflow.ai/api/v1"
# Start execution
response = requests.post(
f"{BASE_URL}/workflows/{WORKFLOW_ID}/execute",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"nodes": [{
"id": "text-input-1",
"data": {
"params": {
"prompt": "Professional headshot of a person in a modern office, natural lighting"
}
}
}],
"edges": [],
},
)
execution_id = response.json()["executionId"]
# Poll with exponential backoff
delay = 1
while True:
poll = requests.get(
f"{BASE_URL}/workflows/executions/{execution_id}/poll",
headers={"Authorization": f"Bearer {API_KEY}"},
)
data = poll.json()
if data["status"] in ("COMPLETED", "FAILED"):
break
time.sleep(delay)
delay = min(delay * 1.5, 10)
print(data) # Image URLs in node outputs
For generating AI headshots and similar portrait content, Flux 2 Pro produces results that closely match studio photography when given detailed prompts about lighting and composition.
Rate Limits and Error Handling
Wireflow enforces per-plan rate limits to keep the API responsive for all users. The execution-per-minute cap stays at 10 across every tier to prevent automation overload. Here is the full breakdown by plan:
| Plan | Requests/min | Executions/min | Daily Executions |
|---|---|---|---|
| Free | 10 | 10 | 50 |
| Starter | 20 | 10 | 200 |
| Pro | 60 | 10 | 1,000 |
| Enterprise | 200 | 10 | Unlimited |
Every API response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. When you hit a 429, the Retry-After header tells you exactly how long to wait. A 402 response means insufficient credits and includes a detailed breakdown with requiredCredits, availableCredits, and a per-node breakdown array showing which nodes in your workflow need how many credits, so you can identify which orchestration steps consume the most.
For idempotency, include an Idempotency-Key header on execute requests. Identical keys within 24 hours replay the original response without triggering a duplicate run, which is essential for retry logic in production batch processing systems.

Webhook Triggers for No-Code Integration
If you want to trigger Flux Pro workflows from external tools like Zapier, Make, or CI pipelines, Wireflow supports webhook-based execution that requires no API key on the trigger call. The endpoint uses the singular /workflow/ path (not /workflows/), which is a common source of confusion. Send a POST to the webhook URL with your input data:
curl -X POST https://www.wireflow.ai/api/v1/workflow/YOUR_WEBHOOK_ID/trigger \
-H "Content-Type: application/json" \
-d '{"prompt": "Product mockup on a clean white background"}'
This returns a 202 with an executionId. The webhook endpoint has CORS enabled with Access-Control-Allow-Origin: *, so it works from browser-based forms, Zapier webhooks, GitHub Actions, and no-code canvas tools. Poll the execution result using your API key to retrieve the generated images once the workflow completes.
Tips for Optimizing Costs
Keeping Flux Pro API costs manageable comes down to three practices. First, use the right tier for the job. Schnell handles draft previews at a fraction of Pro's cost; reserve Pro for final outputs. Second, generate at the resolution you actually need. A 1-megapixel image costs one-quarter of a 4-megapixel one. Third, cache aggressively. If the same prompt runs twice, serve the cached result instead of paying for a duplicate generation. Wireflow's workflow templates include built-in caching nodes that handle this automatically.
Try it yourself: View the Wireflow API Docs for the full endpoint reference, authentication guide, and rate limit details to start building with Flux 2 Pro today.
Frequently Asked Questions
How much does the Flux Pro API cost per image?
Through Black Forest Labs directly, a standard 1-megapixel image costs approximately $0.03. Third-party providers like DeepInfra charge around $0.07 per image. Wireflow includes Flux 2 Pro access within its plan credits alongside other models.
Is there a free tier for the Flux Pro API?
Black Forest Labs offers limited free credits for new accounts. Wireflow's Free plan includes 50 daily executions, which lets you test Flux 2 Pro workflows before committing to a paid tier.
What is the difference between Flux Schnell, Dev, and Pro?
Schnell is optimized for speed and low cost, producing acceptable quality for drafts. Dev offers better detail at moderate cost. Pro delivers the highest fidelity with photorealistic output up to 4 megapixels and the strongest prompt adherence.
Can I use Flux Pro API without managing infrastructure?
Yes. Platforms like Wireflow, DeepInfra, and Replicate host the model for you. You send API requests and receive generated images without provisioning GPUs or managing model weights.
What image resolutions does Flux 2 Pro support?
Flux 2 Pro supports output up to 4 megapixels. Common sizes include 1024x1024 (1MP), 1920x1080 (2MP), and 2048x2048 (4MP). Larger resolutions cost proportionally more when priced per megapixel.
How do I handle rate limits in production?
Implement exponential backoff starting at 1 second and capping at 10 seconds between retries. Check the X-RateLimit-Remaining header proactively to throttle requests before hitting 429 errors. Use the Idempotency-Key header to safely retry failed requests without triggering duplicate executions.
Can I chain Flux Pro with other AI models in a single API call?
Yes. Wireflow's workflow system lets you connect Flux 2 Pro with image editing, upscaling, video generation, and other models in a single execution. The API runs the entire chain and returns all outputs when complete.
Is there an official SDK for the Flux Pro API?
Black Forest Labs provides Python examples in their documentation. Wireflow uses plain REST with JSON; no official SDK exists, so any HTTP client (curl, fetch, requests, axios) works. This keeps integration lightweight with no dependency overhead.


