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

# Images

> Generate images with OpenAI image models

```
POST /openapi/memorylake/router/openai/v1/images/generations
```

OpenAI Images. Generates images from a text prompt with an image model such as `gpt-image-1`. Parameters not listed below are passed to the model unchanged.

### Headers

**x-memorylake-api-key** `string`

Your MemoryLake API key, when you call the model with your own provider key. The provider key then goes in the provider's usual key header. Your provider key is forwarded to the provider and never stored.

**traceparent** `string`

W3C trace context. When present, the request joins your trace and the same trace id comes back in `X-Trace-ID`.

### Request Body

**model** `string` *required*

Image model name

**prompt** `string` *required*

Text description of the image

**background** `string`

Background of the image. One of: `transparent`, `opaque`, `auto`.

**n** `integer`

Number of images to generate

**output\_format** `string`

Image file format. One of: `png`, `jpeg`, `webp`.

**quality** `string`

Rendering quality. One of: `low`, `medium`, `high`, `auto`.

**size** `string`

Image size, such as `1024x1024`

```bash cURL theme={null}
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/router/openai/v1/images/generations' \
  -H 'Authorization: Bearer sk_xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gpt-image-1-mini",
    "prompt": "A small red circle on a white background",
    "quality": "low",
    "size": "1024x1024"
  }'
```

### Response

**created** `integer`

Creation time, Unix seconds

**data** `array`

One entry per image

**Data object**

**b64\_json** `string`

The image, base64-encoded

**revised\_prompt** `string`

Prompt the model actually used, when it rewrote yours

**usage** `object`

Tokens used

**Usage object**

**input\_tokens** `integer`

Tokens in the prompt

**output\_tokens** `integer`

Image tokens generated

**total\_tokens** `integer`

Sum of input and output tokens

```json Success (200) theme={null}
{
  "created": 1792747467,
  "data": [
    {
      "b64_json": "iVBORw0KGgo…"
    }
  ],
  "usage": {
    "input_tokens": 9,
    "output_tokens": 272,
    "total_tokens": 281
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.