FLUX.2 Pro API
Black Forest Labs flagship professional image generation model

- 1MP
- APIMart $0.024 / image
- Official
$0.0320% less
Compare prices
Compare public channel prices for the same output specification
Automatic routing and failover
Call FLUX.2 Pro with one model ID and Yir picks the channel for each job from Black Forest Labs, APIMart, and FAL: it goes to the eligible channel with the lowest estimated price and is billed at that channel's public price, with no markup. If an attempt is confirmed failed, Yir retries on another channel within your max_cost. No routing parameters needed in your request. Routing and fallback docs
Pricing notes
Billed by the channel that actually runs the job. Failover may switch channels, which can change cost and time.
Sample generations
Every image below was generated directly by FLUX.2 Pro, only resized and compressed; each comes with its original prompt, ready to try in the playground

Ridge hike Prompt
Documentary photo of a woman in her thirties with a dark braid and a rust-orange fleece hiking along a narrow mountain ridge in Norway at dawn, wearing a forest-green roll-top backpack, mist in the valleys below, first sun touching the peaks, shot from behind and slightly below, 35mm film look

Backpack packshot Prompt
Studio product photograph of a roll-top hiking backpack in deep forest green, matte waxed canvas, tan leather straps, a small embossed logo patch reading FJELL, standing on a pale stone plinth against a warm grey seamless backdrop, soft window light from the left, crisp stitching detail

Brand poster Prompt
Minimal outdoor brand poster: large bold condensed headline FJELL at the top in off-white, below it the line Built for the long way in a thin sans serif, a forest-green backpack resting on a granite boulder in the middle, misty fjord behind, generous negative space, muted Scandinavian colors

Gear flat lay Prompt
Overhead flat lay on weathered pine boards: a forest-green backpack opened with its contents neatly arranged around it, a steel thermos, folded paper trail map, wool beanie, compass, enamel mug, trail mix in a cloth bag, a pair of worn leather hiking boots, soft even daylight, catalog styling

Flat illustrated map Prompt
Flat vector illustration of a hiking trail map: a dotted red route winding over stylised green mountains and a deep blue fjord, small icons for a hut, a lake and a summit flag, title FJELL TRAIL at the top in a clean geometric typeface, limited palette, print-ready poster

Aurora camp Prompt
Night photo of a small orange dome tent glowing from inside on a rocky plateau, green aurora borealis rippling across a starry sky, a forest-green backpack leaning against a boulder in the foreground, long exposure, sharp stars, deep blue and green tones
Use the API
Hand the code to a coding agent, generate right in the chat with MCP or the Skill, or integrate yourself with the SDK or the OpenAI-compatible API.
Let a coding agent integrate it
Copy the integration prompt, or open it directly in Codex or Claude. The agent reads this page and the model contract, then writes submit, wait and result handling into your project.
Add the Yir MCP server
Connect it to ChatGPT, Claude or Cursor, then mention @Yir and ask for FLUX.2 Pro by name. It quotes first and only generates after you confirm.
https://gateway.yir.ai/mcpOne command for Claude Code
Create an API key in the console, set it as YIR_API_KEY, then run:
claude mcp add --transport http yir https://gateway.yir.ai/mcp --header "Authorization: Bearer $YIR_API_KEY"Install the Yir Skill
Set YIR_API_KEY where your agent runs, add the Skill to Claude Code, Codex or another coding agent, then say “use FLUX.2 Pro on Yir to make…”.
npx skills add yir-ai/skillsInstall the official SDK with your package manager, or copy the code snippet below to get started
| import { createNodeYirClient } from "@yir-ai/sdk/server"; |
| // Reads YIR_API_KEY from the environment by default: process.env.YIR_API_KEY |
| const client = createNodeYirClient(); |
| // 1. Submit an image generation job |
| const job = await client.submitImage({ |
| model: "bfl/flux-2-pro", |
| input: { |
| type: "text", |
| prompt: "Create a citrus sparkling water product poster: a clear glass bottle and fresh oranges, cream background, soft natural light, and a crisp product label", |
| }, |
| parameters: { |
| resolution: "1MP", |
| aspect_ratio: "1:1", |
| n: 1, |
| }, |
| }); |
| // 2. Wait for the job to finish and deliver its result |
| const result = await client.waitForJob(job.id); |
| console.log("Delivered files:", result.result); |
| if (result.result && "files" in result.result) { |
| for (const file of result.result.files) { |
| console.log("->", file.url); |
| } |
| } |
Projects already on the OpenAI protocol, or gateways such as new-api, only need a new Base URL and key. OpenAI compatibility guide
- OpenAI SDK base_url
https://gateway.yir.ai/openai/v1- new-api channel Base URL
https://gateway.yir.ai/openai- Key
- Yir API key
- Model ID
bfl/flux-2-pro
curl https://gateway.yir.ai/openai/v1/images/generations \
-H "Authorization: Bearer $YIR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bfl/flux-2-pro",
"prompt": "Create a citrus sparkling water product poster: a clear glass bottle and fresh oranges, cream background, soft natural light, and a crisp product label",
"resolution": "1MP",
"aspect_ratio": "1:1"
}'Parameter overview
Common parameters; limits depend on the current model and selected channel
- Resolution resolution
- 1MP
Output resolution tier. Higher resolutions offer sharper pixel fidelity and scale pricing accordingly
- Aspect ratio aspect_ratio
- 1:1
- 4:3
- 3:4
- 16:9
- 9:16
Geometric aspect ratio. Choose according to target medium (portrait, banner, or square)
- Input mode input_mode
- Text input
- Image input
Reference limits and formats depend on the model and selected channel
- References references
- reference_image ≤ 8
Reference limits across input modes depend on the selected channel. Counts in the price table are examples, not input limits or free allowances.





