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

# Image Generation

> Generate images with DALL-E 3, Midjourney, Flux, Stable Diffusion, and more

## Request

<ParamField header="Authorization" type="string" required>
  `Authorization: Bearer nb_YOUR_API_KEY`
</ParamField>

<ParamField body="model" type="string" required>
  Image model slug. See [Image Models](/en/concepts/models#image-models).

  Popular options: `dall-e-3`, `flux-1.1-pro`, `midjourney-v6`, `midjourney-turbo`, `sd-3.5-large`
</ParamField>

<ParamField body="prompt" type="string" required>
  Text description of the image to generate.
</ParamField>

<ParamField body="negative_prompt" type="string">
  What to exclude from the image. Supported by Flux, SD, Midjourney models.
</ParamField>

<ParamField body="size" type="string" default="1024x1024">
  Image dimensions. Available options depend on the model:

  | Model                 | Available sizes                                               |
  | --------------------- | ------------------------------------------------------------- |
  | DALL-E 3              | `1024x1024`, `1024x1792`, `1792x1024`                         |
  | Flux 1.1 Pro          | `1024x1024`, `768x1344`, `1344x768`, `1024x1536`, `1536x1024` |
  | Midjourney V6 / Turbo | `1:1`, `2:3`, `3:2`, `9:16`, `16:9` (aspect ratios)           |
  | SD 3.5 Large          | `1024x1024`, `768x1344`, `1344x768`                           |
</ParamField>

<ParamField body="format" type="string" default="webp">
  Output format: `webp`, `png`, `jpeg`
</ParamField>

<ParamField body="quality" type="string" default="standard">
  Quality preset: `standard` or `hd`. Affects cost on DALL-E 3 and GPT Image.
</ParamField>

<ParamField body="style" type="string">
  Style hint for compatible models (`vivid` or `natural` for DALL-E 3).
</ParamField>

<ParamField body="seed" type="integer">
  Random seed for reproducible results. Pass the same seed with the same prompt to get similar outputs.
</ParamField>

<ParamField body="image_url" type="string">
  Input image URL for image-to-image generation (supported by Flux Kontext, SD Inpaint).
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL — DALL-E 3 theme={null}
  curl -X POST https://elumenta.ru/api/v2/generate \
    -H "Authorization: Bearer nb_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "dall-e-3",
      "prompt": "A cozy coffee shop on a rainy evening, warm lighting, impressionist style",
      "size": "1024x1024",
      "format": "webp"
    }'
  ```

  ```bash cURL — Flux 1.1 Pro theme={null}
  curl -X POST https://elumenta.ru/api/v2/generate \
    -H "Authorization: Bearer nb_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "flux-1.1-pro",
      "prompt": "Portrait of a CEO in a modern office, professional photography, Canon 5D",
      "negative_prompt": "blurry, low quality, distorted",
      "size": "768x1344",
      "format": "webp",
      "seed": 42
    }'
  ```

  ```bash cURL — MidJourney theme={null}
  curl -X POST https://elumenta.ru/api/v2/generate \
    -H "Authorization: Bearer nb_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "midjourney-v6",
      "prompt": "Ethereal forest at dawn, soft bokeh, film photography --ar 2:3 --stylize 100",
      "size": "2:3"
    }'
  ```

  ```python Python theme={null}
  import requests

  res = requests.post(
      "https://elumenta.ru/api/v2/generate",
      headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
      json={
          "model": "flux-1.1-pro",
          "prompt": "Minimalist product photo of a black sneaker on white background",
          "negative_prompt": "shadow, text, watermark",
          "size": "1024x1024",
          "format": "webp"
      }
  )

  data = res.json()
  print(f"Image URL: {data['result_url']}")
  print(f"Tokens used: {data['tokens_spent']}")
  ```
</CodeGroup>

## Response

<ResponseField name="id" type="integer">
  Unique generation ID.
</ResponseField>

<ResponseField name="status" type="string">
  `completed` | `pending` | `failed`
</ResponseField>

<ResponseField name="result_url" type="string">
  Direct URL to the generated image. Files are stored for the duration matching your plan (Free: 7 days, Basic: 30 days, Pro/VIP: 90 days, Elite: unlimited).
</ResponseField>

<ResponseField name="tokens_spent" type="integer">
  Elumenta tokens consumed.
</ResponseField>

<ResponseField name="seed" type="integer">
  The seed used (useful if you didn't specify one and want to reproduce the result).
</ResponseField>

## Response Example

```json theme={null}
{
  "id": 18491,
  "status": "completed",
  "model_slug": "flux-1.1-pro",
  "result_url": "https://storage.elumenta.ru/generations/18491.webp",
  "tokens_spent": 4,
  "result_metadata": { "width": 768, "height": 1344 },
  "created_at": "2026-03-08T12:02:30Z"
}
```

## Async Generation (MidJourney)

MidJourney returns `status: "pending"` initially. Poll until complete:

```json theme={null}
{
  "id": 18495,
  "status": "pending",
  "model_slug": "midjourney",
  "eta_seconds": 45
}
```

Then poll: `GET /api/v2/generate/{id}`

See [Generation Status](/en/api-reference/generations/status) for details.

## Non-square Pricing Note

<Warning>
  DALL-E 3 and GPT Image 1.5 charge more for non-square aspect ratios (e.g. 1024×1792 costs up to 2× more). Use the [Calculate Price](/en/api-reference/models/calculate-price) endpoint to check exact token cost before generating.
</Warning>
