Appearance
FLUX.2
FLUX.2 is Black Forest Labs' resolution-controlled image family on Pixapi. Choose flux-2-pro, flux-2-max, or flux-2-flex, then pass resolution as 1MP, 2MP, 3MP, or 4MP.
API surface
| Operation | Endpoint | Mode |
|---|---|---|
| Image generation | POST /v1/images/generations | Sync |
| Image generation task | POST /v1/async/images/generations | Async |
| Image editing | POST /v1/images/edits | Sync |
| Image editing task | POST /v1/async/images/edits | Async |
Model ids
| Model id | Best for |
|---|---|
flux-2-pro | Balanced FLUX.2 quality and credit cost |
flux-2-max | Highest-quality FLUX.2 output |
flux-2-flex | Flexible FLUX.2 resolution tiers |
Pricing
| Model id | 1MP | 2MP | 3MP | 4MP |
|---|---|---|---|---|
flux-2-pro | 3 | 4 | 5 | 6 |
flux-2-max | 6 | 8 | 11 | 13 |
flux-2-flex | 4 | 8 | 12 | 16 |
If you omit resolution, Pixapi bills the 1MP tier.
Request fields
Send the common fields at the top level. Put the model-specific controls listed below inside providerOptions.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | flux-2-pro, flux-2-max, flux-2-flex. Case-sensitive model ID. |
prompt | string | Yes | Describe the subject, composition, style, and requested edits. Pixapi keeps the first 2,000 characters; provide a non-empty prompt for both generation and editing. |
n | integer | No | Default 1; only integer 1 is supported. |
size | string | No | Use pixel dimensions WIDTHxHEIGHT, for example 1024x1024. |
image | string / string[] | For edits | Public HTTP(S) image URL or URL array; required on /images/edits. Up to 8 references. Output plus all references must total ≤ 9 MP; output ≤ 4 MP. Pixapi currently accepts at most 4 reference images. |
resolution | string | No | 1MP (Pixapi default), 2MP, 3MP, 4MP; 1 MP = 1,048,576 pixels. Controls the billed tier. |
providerOptions | object | No | Model-specific options; see the table below. |
providerOptions
All fields in this table are nested inside providerOptions, not alongside model.
| Field | Type | Description |
|---|---|---|
nsfw_check | boolean | Optional prompt/image moderation; default false. |
output_format | string | Output image format: jpeg (default), png, or webp. |
seed | integer | Random generation seed; omit for a random result. |
prompt_upsampling | boolean | Improve and expand the prompt; default false. |
safety_tolerance | integer | 0–5, default 2; higher values allow more permissive filtering. |
steps | integer | Flex only: 1–50, default 50; more steps take longer. |
guidance | number | Flex only: 1.5–10, default 5; higher values follow the prompt more strongly. |
Input rules
Use size for pixels and resolution for the tier.
Example
bash
curl https://api.pixapi.ai/v1/images/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"flux-2-pro","prompt":"A clean editorial product photo on a warm gray background","n":1,"resolution":"2MP"}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "flux-2-pro",
"prompt": "A clean editorial product photo on a warm gray background",
"n": 1,
"resolution": "2MP"
},
)
response.raise_for_status()
print(response.json())js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "flux-2-pro",
"prompt": "A clean editorial product photo on a warm gray background",
"n": 1,
"resolution": "2MP"
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
console.log(await response.json());go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "flux-2-pro",
"prompt": "A clean editorial product photo on a warm gray background",
"n": 1,
"resolution": "2MP"
}`)
req, err := http.NewRequest(
"POST",
"https://api.pixapi.ai/v1/images/generations",
bytes.NewBuffer(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}Edit an image
json
{
"model": "flux-2-pro",
"prompt": "Replace the background with a minimalist studio set",
"image": "https://example.com/input.png",
"n": 1
}For async requests and task polling, see Async Media Tasks.
For the shared response shape, see the API Reference.
