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

# POST /v1/images/generations

> Image generation with any model from the catalog

## Request body

<ParamField body="model" type="string" required>
  The namespaced model ID, e.g. `fal/flux-1.1-pro`.
</ParamField>

<ParamField body="prompt" type="string" required>
  Image description. Maximum 4000 characters.
</ParamField>

<ParamField body="n" type="integer" default="1">
  Number of images to generate (1–8). Each image bills independently.
</ParamField>

<ParamField body="size" type="string">
  Desired size. What's supported depends on the model:

  * OpenAI gpt-image-1: `1024x1024`, `1536x1024`, `1024x1536`
  * OpenAI dall-e-3: `1024x1024`, `1792x1024`, `1024x1792`
  * fal/Recraft/Ideogram: `1024x1024`, `1024x768`, `768x1024`, etc.
</ParamField>

<ParamField body="quality" type="string">
  `standard` | `hd` for OpenAI. Other models ignore it.
</ParamField>

## Response

```json theme={null}
{
  "id": "req_xxx",
  "object": "list",
  "created": 1782412958,
  "model": "fal/flux-1.1-pro",
  "data": [
    {
      "url": "https://supabase.geekhub.mx/storage/v1/object/public/generated-images/<org>/<req>/0.jpg"
    }
  ]
}
```

<Info>
  The URL is **ours** (Supabase Storage), not the provider's. It's persistent and doesn't expire. Same security model as fal.media, Cloudinary, or unsigned S3: the URL includes 2 UUIDs (`org_id` + `request_id`) making it unguessable.
</Info>

## Examples

<CodeGroup>
  ```python Flux 1.1 Pro theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.geekhub.mx/v1",
      api_key="ghub_sk_live_xxx",
  )

  response = client.images.generate(
      model="fal/flux-1.1-pro",
      prompt="An astronaut meditating on a cloud of tacos al pastor, cinematic style",
      n=1,
      size="1024x1024",
  )

  print(response.data[0].url)
  ```

  ```python GPT Image 1 theme={null}
  response = client.images.generate(
      model="openai/gpt-image-1",
      prompt="An astronaut meditating on a cloud of tacos al pastor",
      n=1,
      size="1024x1024",
      quality="hd",
  )
  ```

  ```python Imagen 4 theme={null}
  response = client.images.generate(
      model="google/imagen-4",
      prompt="An astronaut meditating on a cloud of tacos al pastor",
      n=1,
  )
  ```

  ```bash curl theme={null}
  curl -X POST https://api.geekhub.mx/v1/images/generations \
    -H "Authorization: Bearer ghub_sk_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "fal/flux-1.1-pro",
      "prompt": "An astronaut meditating on a cloud of tacos al pastor",
      "n": 1,
      "size": "1024x1024"
    }'
  ```
</CodeGroup>

## Expected latency

| Model              | P50 | P95 |
| ------------------ | --- | --- |
| DALL·E 3           | 8s  | 20s |
| GPT Image 1        | 15s | 45s |
| Imagen 4           | 6s  | 18s |
| Grok 2 Image       | 10s | 30s |
| Flux 1.1 Pro       | 7s  | 25s |
| Flux 1.1 Pro Ultra | 12s | 40s |
| Recraft V3         | 8s  | 28s |
| Ideogram V2        | 12s | 35s |
| SD 3.5 Large       | 10s | 30s |

If your request takes > 60s, assume it failed — send another.

## Costs

Each image is billed at the model price × 1.05 (markup) × FX MXN/USD. See [Image models](/en/models/images).

Example: 1 image with Flux 1.1 Pro at FX \$20 MXN/USD:

```
$0.040 × 1.05 × 20 = $0.84 MXN per image
```
