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

# Image Generation

> Gegentica AI gateway enables image generation features provided by various foundational model vendors.

A typical scenario is text-to-image generation, where a user provides a prompt that the image model interprets to produce an image.

<Note>
  You can find the vision models [guide here](vision).
</Note>

### Text-to-Image Generation

Gegentica allows you to make text-to-image requests using the OpenAI-compatible API signature.

<Tabs>
  <Tab title="Python SDK">
    ```python theme={null}
    from gegentic import Gegentic

    client = Gegentic(
      provider='openai',
      base_url='https://gateway.gegentic-ai.com/v1',
      gegentic_api_key='sk-obg***',  # Your Gegentic API key here
    )

    response = client.images.generate(
      prompt="A beautiful sunset over the mountains",
      n=1,
      size="1024x1024"
    )
    ```
  </Tab>

  <Tab title="OpenAI Python">
    ```python theme={null}
    from openai import OpenAI
    from gegentic import createHeaders

    client = OpenAI(
      base_url='https://gateway.gegentic-ai.com/v1',
      api_key='sk-***',  # Your OpenAI API key here
      default_headers=createHeaders(
        provider="openai",
        api_key="sk-obg***",  # Your Gegentic API key here
      )
    )

    response = client.images.generate(
      prompt="A beautiful sunset over the mountains",
      n=1,
      size="1024x1024"
    )
    ```
  </Tab>

  <Tab title="cURL">
    ```curl theme={null}
    curl "https://gateway.gegentic-ai.com/v1/images/generations" \
    -H "Content-Type: application/json" \
    -H "x-gegentic-api-key: $GEGENTIC_API_KEY" \
    -d '{
      "model": "dall-e-3",
      "prompt": "Lucy in the sky with diamonds"
    }'
    ```
  </Tab>
</Tabs>
