Model Information
| Model ID | black-forest-labs/flux-3/text-to-image |
| Category | Image |
| Endpoint | /api/v1/images/generations |
| Input Modalities | text |
| Output Modalities | image |
Request
POST https://mogu.io/api/v1/images/generationsAuthentication: Authorization: Bearer <api-key>
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | ✓ | Model ID: black-forest-labs/flux-3/text-to-image | |
| prompt | string | ✓ | Describe the image or editing instructions | |
| timeout | number (30..1800) | 900 | Maximum wait time in seconds | |
| resolution | enum: 1k | 2k | 4k | "1k" | Output resolution | |
| aspect_ratio | enum: 21:9 | 2:1 | 16:9 | 3:2 | 7:5 | 4:3 | 5:4 | 1:1 | 4:5 | 3:4 | 5:7 | 2:3 | 9:16 | 1:2 | "1:1" | Output aspect ratio | |
| output_format | enum: jpeg | png | "jpeg" | Output image format |
Multimodal Output
This model can output image. Add modalities to your request:
{
"model": "black-forest-labs/flux-3/text-to-image",
"messages": [
{
"role": "user",
"content": "Draw a cat"
}
],
"modalities": [
"image"
]
}Image output does not support streaming. Set stream: false.
Code Examples
curl -X POST https://mogu.io/api/v1/images/generations \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "black-forest-labs/flux-3/text-to-image",
"prompt": "Your prompt here",
"timeout": 900,
"resolution": "1k",
"aspect_ratio": "1:1",
"output_format": "jpeg"
}'Response
Response (200 OK)
{
"created": 1700000000,
"data": [
{
"url": "https://cos.example.com/images/...signed..."
}
],
"usage": {
"input_tokens": 14,
"output_tokens": 1542,
"total_tokens": 1556
},
"credit": 90
}Error Codes
| HTTP | Type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid parameters |
| 400 | content_moderation | Content blocked by safety system |
| 400 | input_too_large | Input exceeds model limit |
| 401 | auth_error | Invalid API key |
| 402 | insufficient_credits | Not enough credits |
| 429 | rate_limit_error | Too many requests |
| 502 | provider_error | Upstream error, retry later |
| 504 | timeout_error | Request timed out |