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

# Image generation server tool

> Let a model generate an image during a response with a configured image model.

The `orq:image_generation` tool lets a text model create an image during a response. The tool entry selects the image model and rendering options. The calling model supplies only the image prompt.

## Quick start

The examples use the client configuration from the [Server tools overview](/docs/ai-gateway/features/server-tools).

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/chat/completions \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "openai/gpt-5.4-mini",
      "messages": [
        { "role": "user", "content": "Create a square product illustration of a green desk lamp." }
      ],
      "tools": [
        {
          "type": "orq:image_generation",
          "model": "openai/gpt-image-1",
          "size": "1024x1024",
          "quality": "high"
        }
      ]
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await client.chat.completions.create({
    model: 'openai/gpt-5.4-mini',
    messages: [
      {
        role: 'user',
        content: 'Create a square product illustration of a green desk lamp.',
      },
    ],
    tools: [
      {
        type: 'orq:image_generation',
        model: 'openai/gpt-image-1',
        size: '1024x1024',
        quality: 'high',
      },
    ] as any,
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  response = client.chat.completions.create(
      model="openai/gpt-5.4-mini",
      messages=[
          {
              "role": "user",
              "content": "Create a square product illustration of a green desk lamp.",
          }
      ],
      tools=[
          {
              "type": "orq:image_generation",
              "model": "openai/gpt-image-1",
              "size": "1024x1024",
              "quality": "high",
          }
      ],
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

The tool returns an image URL to the calling model. **Orq.ai** stores the generated image in workspace storage when uploads are available, otherwise it uses a provider-hosted URL.

## Configuration

| Parameter            | Type    | Required | Description                                         |
| -------------------- | ------- | -------- | --------------------------------------------------- |
| `type`               | string  | Yes      | Must be `orq:image_generation`.                     |
| `model`              | string  | Yes      | Image model in `provider/model` format.             |
| `size`               | string  | No       | Image dimensions supported by the selected model.   |
| `quality`            | string  | No       | Image quality supported by the selected model.      |
| `background`         | string  | No       | Background option supported by the selected model.  |
| `output_format`      | string  | No       | Output format supported by the selected model.      |
| `output_compression` | integer | No       | Compression level from 0 to 100, when supported.    |
| `moderation`         | string  | No       | Moderation setting supported by the selected model. |
| `style`              | string  | No       | Image style supported by the selected model.        |

Rendering options are model-dependent. Unsupported values return an error from the selected image provider.

## Cost and usage

The image model call is billed at the selected model's standard rate. Each tool call appears at `usage.server_tool_use.image_generation_calls`.
