# flux-2-pro

This document describes the input and output parameters for calling the `flux-2-pro` model API, for your reference when using the interface.

---

Only a subset of fields is shown below. For full details, please refer to the official documentation: [flux-2-pro API Documentation](https://docs.bfl.ai/api-reference/models/generate-or-edit-an-image-with-flux2-[pro])

## Endpoint

`POST https://api-us-ca.umodelverse.ai/v1/flux-2-pro`

## Authentication

### API Key

Unlike the official API, we do not use `x-key`. Instead, we use `Authorization`.

## Request Parameters

### Request Body

| Field Name | Type | Required | Default | Description |
|------------|------|----------|---------|-------------|
| prompt | string | Yes | None | Prompt text |
| input_image | string | No | None | Image in base64 |
| input_image_2 | string | No | None | Image in base64 |
| input_image_3 | string | No | None | Image in base64 |
| input_image_4 | string | No | None | Image in base64 |
| input_image_5 | string | No | None | Image in base64 |
| input_image_6 | string | No | None | Image in base64 |
| input_image_7 | string | No | None | Image in base64 |
| input_image_8 | string | No | None | Image in base64 |
| seed | int | No | None | Seed value for reproducibility |
| width | int | No | None | Image width, x >= 64 and must be a multiple of 32 |
| height | int | No | None | Image height, x >= 64 and must be a multiple of 32 |
| safety_tolerance | string | No | None | Tolerance level for input/output moderation, values from 1–6. 0 is most strict, 6 is least strict |
| output_format | jpeg/png | No | png | Output format, options: png, jpg |
| webhook_url | string | No | None | Webhook URL to receive generation results |
| webhook_secret | string | No | None | Webhook Secret for request validation |

## Response Parameters

| Field Name | Type | Description |
|------------|------|-------------|
| createed | int | Creation timestamp |
| input_mp | int | Input image megapixels (rounded up) |
| output_mp | int | Output image megapixels (rounded up) |
| total_pixels | int | Total pixel count |
| data | [object] | Image data |
| data.[].b64_json | string | Base64-encoded image |

## Example

#### curl

```bash
curl -X POST "https://api-us-ca.umodelverse.ai/v1/flux-2-pro" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MODELVERSE_API_KEY" \
  -d '{
     "prompt" : "A photograph of a red fox in an autumn forest",
     "width": 1024,
     "height": 1024
    }' | jq -r '.data[0].b64_json' | base64 --decode > flux-2-pro.png
```

#### python

```python
import requests
import os

url = "https://api-us-ca.umodelverse.ai/v1/flux-2-pro"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {os.getenv('MODELVERSE_API_KEY')}"
}
payload = {
    "prompt": "A photograph of a red fox in an autumn forest",
    "width": 1024,
    "height": 1024
}

response = requests.post(url, headers=headers, json=payload)
result = response.json()
print(result)
```
