Skip to content

Image Generation

1. Overview

Creates a text-to-image or image-to-image task. After receiving the task id, pass it to the Get Result endpoint.

Description:

  1. Models in this family are not optimized for Chinese prompts. Use English natural-language prompts when possible.

2. Request

  • Method:POST
  • Endpoint:

    https://gateway.serevixai.ai/flux/v1/$model
    

Description:

  1. $model is the model ID to use. See Model List for available versions, such as flux-pro-1.1.

3. Parameters

3.1 Header Parameters

Parameter Type Required Description Example
Content-Type string Yes Sets the request content type. It must be application/json application/json
Accept string No Sets the response content type. The recommended value is application/json application/json
Authorization string Yes API key required for authentication, in the format Bearer $YOUR_API_KEY. Bearer $YOUR_API_KEY

3.2 Body Parameters (application/json)

Parameter Type Required Description Example
prompt string Yes Text prompt for image generation. draw a rainbow
image_prompt string No Optional Base64-encoded image input for use with Flux Redux.
width number No Width of the generated image in pixels. Must be a multiple of 32. 1024
height number No Height of the generated image in pixels. Must be a multiple of 32. 768
prompt_upsampling boolean No Whether to upsample the prompt. If enabled, the prompt may be automatically enhanced for more creative generation. false
seed number No Optional seed value used to reproduce a random result. 42
output_format string No Output image format. Supported values are jpeg and png. jpeg

Description:

  1. For advanced model-specific parameters, refer to the official documentation.

4. Request Examples

POST /flux/v1/flux-pro-1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer $YOUR_API_KEY

{
    "prompt": "draw a rainbow",
    "width": 1024,
    "height": 768
}
curl https://gateway.serevixai.ai/flux/v1/flux-pro-1.1 \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $YOUR_API_KEY" \
    -d "{
    \"prompt\": \"draw a rainbow\",
    \"width\": 1024,
    \"height\": 768
}"

5. Response Example

{
    "id": "1981b99c-a825-4d19-adc6-7dda6118c4ea",
    "polling_url": "https://gateway.serevixai.ai/flux/v1/get_result?id=1981b99c-a825-4d19-adc6-7dda6118c4ea"
}