# flux-2-pro

**方法**: `POST`
**路径**: `/bfl/v1/flux-2-pro`

此模型按量付费，不同分辨率不同价格
官方文档：
<https://docs.bfl.ai/api-reference/tasks/generate-or-edit-an-image-with-flux2-[pro>]

价格计算器：
<https://bfl.ai/pricing>

## 请求参数

### Header 参数

```text
Content-Type
string
必需
示例:
application/json
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
prompt_upsampling
boolean
可选
prompt
string
必需
seed
integer
可选
width
integer
可选
height
integer
可选
safety_tolerance
integer
可选
output_format
string
可选
示例
{
"prompt_upsampling"
:
true
,
"prompt"
:
"画只猫"
,
"seed"
:
42
,
"width"
:
65
,
"height"
:
65
,
"safety_tolerance"
:
2
,
"output_format"
:
"jpeg"
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/bfl/v1/flux-2-pro' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "prompt_upsampling": true,
  "prompt": "画只猫",
  "seed": 42,
  "width": 65,
  "height": 65,
  "safety_tolerance": 2,
  "output_format": "jpeg"
}'
```

## 返回响应

### 🟢 200 成功

**内容类型**: `application/json`

#### 响应结构

```text
id
string
必需
polling_url
string
必需
cost
integer
必需
input_mp
integer
必需
output_mp
integer
必需
```

#### 示例

```json
{"id":"d5ba37dc-ba09-4658-852e-deea7e176439","polling_url":"https://api.eu2.bfl.ai/v1/get_result?id=d5ba37dc-ba09-4658-852e-deea7e176439","cost":3.0,"input_mp":0.0,"output_mp":0.0}
```
