Pro Image To Image API Documentation¶
Generate content using the Flux 2 Pro Image To Image model Generate content using the Flux 2 Pro Text To Image model Generate content using the FLux 2 Flex Image To Image model Generate content using the FLux 2 Flex Text To Image model Pricing: Flux 2 Pro at 10 credits (~$0.025) for 1K or 15 credits (~$0.035) for 2K, Pricing: Flux 2 Flex at 25 credits (~$0.07) for 1K or 40 credits (~$0.12) for 2K
Overview¶
This document describes how to use the Pro Image To Image model for content generation. The process consists of two steps:
-
Create a generation task
-
Query task status and results
Authentication¶
All API requests require a Bearer Token in the request header:
x-api-key: YOUR_API_KEY
Get API Key:
-
Visit API Key to get your API Key
-
Add to request header:
x-api-key: YOUR_API_KEY
1. Create Generation Task¶
API Information¶
- URL:
POST https://api.revidapi.com/paid/flux-2/create - Header:
x-api-key: Your-API-Key
Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name, format: flux-2/pro-image-to-image |
| input | object | Yes | Input parameters object |
| callBackUrl | string | No | Callback URL for task completion notifications. If provided, the system will send POST requests to this URL when the task completes (success or fail). If not provided, no callback notifications will be sent. Example: "https://your-domain.com/api/callback" |
Model Parameter¶
The model parameter specifies which AI model to use for content generation.
| Model | Price | Description |
|---|---|---|
flux-2/pro-image-to-image |
•10 credit for 1K •15 creadit for 2K |
The exact model identifier for this API |
flux-2/pro-text-to-image |
•10 credit for 1K •15 creadit for 2K |
The exact model identifier for this API |
flux-2/flex-image-to-image |
•25 credit for 1K •40 creadit for 2K |
The exact model identifier for this API |
flux-2/flex-text-to-image |
•25 credit for 1K •40 creadit for 2K |
The exact model identifier for this API |
Example :
Model flux-2/pro-image-to-image The exact model identifier for this API
Type string Must be passed as a string value
Required yes This parameter is mandatory for all requests
Note: The model parameter must match exactly as shown above. Different models have different capabilities and parameter requirements.
Callback URL Parameter¶
The callBackUrl parameter allows you to receive automatic notifications when your task completes.
| Property | Value | Description |
|---|---|---|
| Purpose | Task completion notification | Receive real-time updates when your task finishes |
| Method | POST request | The system sends POST requests to your callback URL |
| Timing | When task completes | Notifications sent for both success and failure states |
| Content | Query Task API response | Callback content structure is identical to the Query Task API response |
| Parameters | Complete request data | The param field contains the complete Create Task request parameters, not just the input section |
| Optional | Yes | If not provided, no callback notifications will be sent |
Important Notes:
- The callback content structure is identical to the Query Task API response
- The param field contains the complete Create Task request parameters, not just the input section
- If callBackUrl is not provided, no callback notifications will be sent
input Object Parameters¶
input_urls¶
- Type:
array - Required: Yes
- Description: Input reference images (1-8 images).
- Max File Size: 10MB
- Accepted File Types: image/jpeg, image/png, image/webp
- Multiple Files: Yes
- Default Value:
["https://static.aiquickdraw.com/tools/example/1764235041265_kjJ2sTMR.png","https://static.aiquickdraw.com/tools/example/1764235045490_9SjAUr4Z.png"]
prompt¶
- Type:
string - Required: Yes
- Description: Must be between 3 and 5000 characters.
- Max Length: 5000 characters
- Default Value:
"The jar in image 1 is filled with capsules exactly same as image 2 with the exact logo"
aspect_ratio¶
- Type:
string - Required: Yes
- Description: Aspect ratio for the generated image. Select 'auto' to match the first input image ratio (requires input image).
- Options:
1:1: 1:1 (Square)4:3: 4:3 (Landscape)3:4: 3:4 (Portrait)16:9: 16:9 (Widescreen)9:16: 9:16 (Vertical)3:2: 3:2 (Classic)2:3: 2:3 (Classic Portrait)auto: Auto (Based on first input image) (Automatically select ratio based on the first input image. Requires at least one input image.)- Default Value:
"1:1"
resolution¶
- Type:
string - Required: Yes
- Description: Output image resolution.
- Options:
1K: 1K2K: 2K- Default Value:
"1K"
Request Example¶
{
"model": "flux-2/pro-image-to-image",
"input": {
"input_urls": ["https://static.aiquickdraw.com/tools/example/1764235041265_kjJ2sTMR.png","https://static.aiquickdraw.com/tools/example/1764235045490_9SjAUr4Z.png"],
"prompt": "The jar in image 1 is filled with capsules exactly same as image 2 with the exact logo",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}
Response Example¶
{
"code": 200,
"msg": "success",
"data": {
"taskId": "281e5b0*********************f39b9"
}
}
Response Parameters¶
| Parameter | Type | Description |
|---|---|---|
| code | integer | Response status code, 200 indicates success |
| msg | string | Response message |
| data.taskId | string | Task ID for querying task status |
2. Query Task Status¶
API Information¶
- URL:
POST https://api.revidapi.com/paid/get/taskid - Parameter:
taskId(passed via URL parameter)
Request Example¶
POST https://api.revidapi.com/paid/get/taskid?taskId=281e5b0*********************f39b9
Response Example¶
{
"code": 200,
"msg": "success",
"data": {
"taskId": "281e5b0*********************f39b9",
"model": "flux-2/pro-image-to-image",
"state": "waiting",
"param": "{\"model\":\"flux-2/pro-image-to-image\",\"input\":{\"input_urls\":[\"https://static.aiquickdraw.com/tools/example/1764235041265_kjJ2sTMR.png\",\"https://static.aiquickdraw.com/tools/example/1764235045490_9SjAUr4Z.png\"],\"prompt\":\"The jar in image 1 is filled with capsules exactly same as image 2 with the exact logo\",\"aspect_ratio\":\"1:1\",\"resolution\":\"1K\"}}",
"resultJson": "{\"resultUrls\":[\"https://static.aiquickdraw.com/tools/example/1764235088513_4zZQUda1.png\"]}",
"failCode": null,
"failMsg": null,
"costTime": null,
"completeTime": null,
"createTime": 1757584164490
}
}
Response Parameters¶
| Parameter | Type | Description |
|---|---|---|
| code | integer | Response status code, 200 indicates success |
| msg | string | Response message |
| data.taskId | string | Task ID |
| data.model | string | Model name used |
| data.state | string | Task status: waiting(waiting), success(success), fail(fail) |
| data.param | string | Task parameters (JSON string) |
| data.resultJson | string | Task result (JSON string, available when task is success). Structure depends on outputMediaType: {resultUrls: []} for image/media/video, {resultObject: {}} for text |
| data.failCode | string | Failure code (available when task fails) |
| data.failMsg | string | Failure message (available when task fails) |
| data.costTime | integer | Task duration in milliseconds (available when task is success) |
| data.completeTime | integer | Completion timestamp (available when task is success) |
| data.createTime | integer | Creation timestamp |
Usage Flow¶
- Create Task: Call
POST https://api.revidapi.com/paid/get/taskidvto create a generation task - Get Task ID: Extract
taskIdfrom the response - Wait for Results:
- If you provided a
callBackUrl, wait for the callback notification - If no
callBackUrl, poll status by callingPOST https://api.revidapi.com/paid/get/taskidv - Get Results: When
stateissuccess, extract generation results fromresultJson
Error Codes¶
| Status Code | Description |
|---|---|
| 200 | Request successful |
| 400 | Invalid request parameters |
| 401 | Authentication failed, please check API Key |
| 402 | Insufficient account balance |
| 404 | Resource not found |
| 422 | Parameter validation failed |
| 429 | Request rate limit exceeded |
| 500 | Internal server error |