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

# Text-to-Image

### Text-to-image generation

Describe the image you want in a text prompt. The model generates an image based on your description:

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-1",
    "prompt":"Draw a cute kitten playing in the grass"
}'
```

### Asynchronous image generation

Image generation is synchronous by default: the request waits until the image is ready.

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-2",
    "prompt":"Draw a cute kitten playing in the grass"
}'
```

For asynchronous processing, include the `async` parameter and set it to `true`:

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-2",
    "prompt":"Draw a cute kitten playing in the grass",
    "async": true
}'
```

Use the returned task ID to check the status of an asynchronous request and retrieve the result:

```bash theme={null}
curl --location --request GET 'https://geekai.co/api/v1/images/{task_id}' \
--header 'Authorization: Bearer $GEEKAI_API_KEY'
```

Once the task status is `succeed`, you can retrieve the generated image URL.

For parameter details, see the [Image API reference](https://docs.geekai.co/en/api/image/generations.md).


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