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

# GPT Image 2

> Generate one 1K image from $0.021 with quality and size controls.

`gpt-image-2` generates one 1K image per synchronous request. Price depends on `quality` and `size`; **100 FreeModel credits = \$1**.

| Quality  | 1024x1024              | 1536x1024 or 1024x1536 |
| -------- | ---------------------- | ---------------------- |
| `low`    | 2.1 credits (\$0.021)  | 2.6 credits (\$0.026)  |
| `medium` | 5.2 credits (\$0.052)  | 7.3 credits (\$0.073)  |
| `high`   | 17.7 credits (\$0.177) | 26 credits (\$0.26)    |

The FreeModel Playground fixes quality at `medium` for predictable billing. Direct API requests can select any supported quality.

<ParamField body="model" type="string" required>
  Set to `gpt-image-2`.
</ParamField>

<ParamField body="prompt" type="string" required>
  Describe the desired subject, composition, lighting, and style.
</ParamField>

<ParamField body="quality" default="medium" type="string">
  Use `low`, `medium`, or `high`. Higher quality costs more.
</ParamField>

<ParamField body="size" type="string">
  Use `1024x1024`, `1536x1024`, or `1024x1536`. Price depends on the selected size.
</ParamField>

<ParamField body="n" default="1" type="integer">
  Set to `1`; multiple-image requests are not supported.
</ParamField>

## Request

```bash theme={null}
curl https://api.freemodel.app/v1/images/generations \
  -H "Authorization: Bearer $FREEMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A translucent mechanical keyboard, precise editorial photography",
    "quality": "medium",
    "size": "1536x1024",
    "n": 1
  }' \
  | jq -r '.data[0].b64_json' \
  | base64 --decode > image.png
```

The request normally completes in 20 to 60 seconds. Set a timeout of at least 120 seconds and decode `data[0].b64_json` as image bytes.

<Card title="Open the model playground" icon="wand-magic-sparkles" href="https://freemodel.app/models/gpt-image-2">
  Run the same route from the FreeModel model page.
</Card>
