> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdn-fly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FLUX.2 [pro]

> 通过 Starrise AI API 调用 Black Forest Labs FLUX.2 [pro] 文生图模型。

FLUX.2 \[pro] 是 Black Forest Labs 推出的高级文生图模型，通过 Starrise AI 提供。支持最高 4MP 分辨率和多参考图一致性。API 为**同步调用** — 直接返回 Base64 编码的图片数据。

## 核心能力

* **文生图** — 根据文字描述生成图片
* **高分辨率** — 支持最高 4MP 输出分辨率
* **可复现** — 使用 `seed` 实现确定性生成
* **格式可选** — 支持 `jpeg` 或 `png` 输出

## 快速示例

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-2-pro",
    "prompt": "一只可爱的北极熊宝宝",
    "size": "1024x1024"
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://dayu.cdn-fly.com/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "flux-2-pro",
        "prompt": "一只可爱的北极熊宝宝",
        "size": "1024x1024"
    }
)

result = response.json()
# result["data"][0]["b64_json"] 包含 Base64 编码的图片
```

## 参数说明

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | 固定为 `flux-2-pro` |
| `prompt` | string | 是 | 图片描述文字 |
| `n` | integer | 否 | 生成张数（1–4），默认 `1` |
| `size` | string | 否 | 输出尺寸，如 `1024x1024`，支持最高 4MP |
| `output_format` | string | 否 | `jpeg` 或 `png` |
| `seed` | integer | 否 | 随机种子，用于复现 |

## 响应字段

| 字段 | 说明 |
| - | - |
| `data[].b64_json` | Base64 编码的图片数据 |
| `created` | 创建时间戳 |

> **[API 参考](/zh/api-reference/model-api/blackforestlabs/flux-2-pro)**
>
> 查看 FLUX.2 \[pro] 的交互式 API Playground。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.