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

# gpt-image-2

> OpenAI's flagship image model. Text-to-image and image-to-image (mask-driven edits) on one endpoint, billed per image. The default choice when you want OpenAI fidelity on layout, typography, and product shots.

`gpt-image-2` is OpenAI's flagship image model. Text-to-image and image-to-image (mask-driven edits) live on a single endpoint, billed per image generated. Strong on layout fidelity, in-image typography, and product/scene composition — the place to reach for when "looks like a real OpenAI render" matters more than the lowest per-image cost.

**Pricing:** $0.08 / image — see the [rate card](/pricing). The gateway bills a flat $0.08 per generated image; failures don't bill.

## Protocols

| Protocol      | Path                                                  |
| ------------- | ----------------------------------------------------- |
| OpenAI Images | `POST https://llm.bytespike.ai/v1/images/generations` |

## Quickstart

<CodeGroup>
  ```bash cURL theme={null}
  curl https://llm.bytespike.ai/v1/images/generations \
    -H "Authorization: Bearer $BYTESPIKE_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "model": "gpt-image-2",
      "prompt": "A flat-style red apple on a soft beige background, marketing hero",
      "n": 1,
      "size": "1024x1024"
    }'
  ```

  ```python Python (openai SDK) theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://llm.bytespike.ai/v1",
      api_key=os.environ["BYTESPIKE_API_KEY"],
  )

  resp = client.images.generate(
      model="gpt-image-2",
      prompt="A flat-style red apple on a soft beige background, marketing hero",
      n=1,
      size="1024x1024",
  )

  print(resp.data[0].url)
  ```

  ```typescript TypeScript (openai SDK) theme={null}
  import OpenAI from "openai"

  const client = new OpenAI({
    baseURL: "https://llm.bytespike.ai/v1",
    apiKey: process.env.BYTESPIKE_API_KEY,
  })

  const resp = await client.images.generate({
    model: "gpt-image-2",
    prompt: "A flat-style red apple on a soft beige background, marketing hero",
    n: 1,
    size: "1024x1024",
  })

  console.log(resp.data[0].url)
  ```
</CodeGroup>

## Capabilities

| Capability                               | Supported        |
| ---------------------------------------- | ---------------- |
| Text-to-image                            | ✅                |
| Image-to-image (with `source_image`)     | ✅                |
| Mask-driven edits                        | ✅                |
| `n` ≥ 2 batch generation                 | ✅                |
| `size` 1024×1024 / 1024×1792 / 1792×1024 | ✅                |
| `quality` standard / hd                  | ✅                |
| `response_format` url / b64\_json        | ✅                |
| Modality                                 | image            |
| Capability bucket                        | `image_generate` |

## When to use

* **Marketing creative** — hero images, social cards, anywhere typography-in-image matters.
* **Product mockups** — fidelity on materials, lighting, and small print holds up better than most domestic alternatives.
* **DOSIA `generate_image` tool** — the main brain will resolve "draw me an X" to this model by default when permission is granted.

When **not** to use:

* High-volume or budget-sensitive work — [`nano-banana-v2`](/models/nano-banana-v2) is materially cheaper for the same shape.

## Next

* [`nano-banana-v2`](/models/nano-banana-v2) — cheaper Google image model with image-to-image
* [Multimodal endpoints](/concepts/multimodal) — overview of image / video / audio / embedding surfaces
