> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leapx-hub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Image - Batch Generation

## Introduction

Submit batch image generation task.

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer Token, e.g., `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...`
  How to get: Obtain via the POST interface in the Authentication module at the top left, `https://docs.leapx-hub.com/en/leapx-lab-v4/endpoint/get-token`
</ParamField>

## Request Parameters

<ParamField body="batchImageGenerationDTO.model" type="string" required>
  Model name
</ParamField>

<ParamField body="batchImageGenerationDTO.prompt" type="string" required>
  Image description prompt
</ParamField>

<ParamField body="batchImageGenerationDTO.n" type="integer" required>
  Number of images to generate
</ParamField>

<ParamField body="batchImageGenerationDTO.size" type="string" required>
  Image size
</ParamField>

<ParamField body="batchImageGenerationDTO.temperature" type="integer" required>
  Generation temperature
</ParamField>

<ParamField body="batchImageGenerationDTO.watermark" type="boolean" required>
  Whether to add watermark
</ParamField>

<ParamField body="batchImageGenerationDTO.image" type="string">
  Reference image URL
</ParamField>

<ParamField body="batchImageGenerationDTO.promptOptions" type="object">
  Prompt options
</ParamField>

<ParamField body="batchImageGenerationDTO.optimizePrompt" type="string">
  Optimize prompt
</ParamField>

<ParamField body="batchImageGenerationDTO.quality" type="string">
  Image quality
</ParamField>

<ParamField body="batchImageGenerationDTO.responseFormat" type="string">
  Response format
</ParamField>

<ParamField body="batchImageGenerationDTO.score" type="number">
  Score threshold
</ParamField>

<ParamField body="batchImageGenerationDTO.sequentialImageGeneration" type="string">
  Sequential image generation switch
</ParamField>

<ParamField body="batchImageGenerationDTO.sequentialImageGenerationOptions" type="object">
  Sequential image generation options
</ParamField>

### Example Code

<Tabs>
  <Tab title="cURL Example">
    ```bash theme={null}
    curl -X POST "https://leapx-hub.com/prod-api/nebula/v4/api/batchImageGenerationSubmit" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-xxxxxxxxxx" \
      -d '{
        "model": "flux-pro",
        "prompt": "A cat walking in space",
        "n": 1,
        "size": "1024x1024",
        "temperature": 1,
        "watermark": false
      }'
    ```
  </Tab>

  <Tab title="Python Example">
    ```python theme={null}
    import requests
    import json

    url = "https://leapx-hub.com/prod-api/nebula/v4/api/batchImageGenerationSubmit"
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer sk-xxxxxxxxxx"
    }
    data = {
        "model": "flux-pro",
        "prompt": "A cat walking in space",
        "n": 1,
        "size": "1024x1024",
        "temperature": 1,
        "watermark": False
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))
    print(response.json())
    ```
  </Tab>
</Tabs>

### Response Example

<ResponseExample>
  ```json theme={null}
  {
    "code": 200,
    "msg": "Operation successful",
    "data": {
      "images": [{
        "url": "https://example.com/image1.jpg"
      }, {
        "url": "https://example.com/image2.jpg"
      }]
    }
  }
  ```
</ResponseExample>
