---
title: "Create image from text - GPT Image 2"
method: POST
path: "/v1/ai/text-to-image/gpt-image-2"
tags: ["text-to-image"]
---

# Create image from text - GPT Image 2

`POST /v1/ai/text-to-image/gpt-image-2`

## Request

- Base URL: `https://api.magnific.com`
- URL: `https://api.magnific.com/v1/ai/text-to-image/gpt-image-2`
- Auth: API key in header `x-magnific-api-key`

Generate images from a text prompt using OpenAI's GPT Image 2 model.

**Key Features:**
- Strong instruction following on long, detailed prompts
- Reliable text rendering inside the image
- Explicit resolution tier, aspect ratio, format and compression control
- Selectable quality tier (`low` / `medium` / `high`)

**Best for:**
- Marketing and editorial images that must contain legible text
- Prompts with many precise constraints
- Cases where transparency or an exact output format is required

**Output:** one image per `num_images` (up to 10), at the size selected
by `resolution` + `aspect_ratio`, delivered as CDN URLs in the task's
`generated` array.

**Credits:** the `quality` tier sets the price per image and
`resolution` multiplies it (`1k` x1, `2k` x2, `4k` x3). Every image in
`num_images` is billed.

The request is processed asynchronously: the endpoint returns a task id
immediately. Retrieve the result by polling the task endpoint or by
providing an optional `webhook_url`.

## Request body

- Ttigi2RequestContent
  - `prompt` string, required: Text description of the image you want to generate. **Tips:** - GPT Image 2 follows long, detailed instructions well - Text to render inside the image can be given verbatim, in quotes - Precise constraints (colours, layout, camera) are respected closely **Examples:** - Simple: "A vintage travel poster for Mars" - Detailed: "A vintage travel poster for Mars, bold sans-serif title reading VISIT MARS, muted orange palette, grain"
  - `webhook_url` string, uri: Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.
  - `num_images` integer: How many images to generate for this prompt. **Each image is billed separately.**
  - `resolution` '1k' | '2k' | '4k': Resolution tier of the generated image. Combined with `aspect_ratio` it selects the exact pixel size. **Credits:** the tier multiplies the price set by `quality` — `1k` x1, `2k` x2, `4k` x3. On the edit endpoint it does not affect the price.
  - `aspect_ratio` 'square_1_1' | 'classic_4_3' | 'traditional_3_4' | 'widescreen_16_9' | 'social_story_9_16' | 'film_horizontal_21_9' | 'standard_3_2' | 'portrait_2_3' | 'horizontal_2_1' | 'banner_3_1': Image size with the aspect ratio. The aspect ratio is the proportional relationship between an image's width and height, expressed as *_width_height (e.g., square_1_1, widescreen_16_9). It is calculated by dividing the width by the height. If not present, the default is `square_1_1`.
  - `quality` 'low' | 'medium' | 'high': Render quality tier. Higher tiers spend more provider compute and cost more credits; lower tiers are faster and cheaper. - `low`: fastest and cheapest, for drafts and iteration - `medium`: balanced - `high`: maximum detail and prompt adherence (default)
  - `output_format` 'png' | 'jpeg' | 'webp': The file format of the generated image. - `png`: lossless, supports transparency. Best for logos, text and sharp edges - `jpeg`: compressed, no transparency. Smallest files for photographic content - `webp`: compressed, supports transparency `output_compression` only applies to `jpeg` and `webp`.
  - `background` 'opaque' | 'auto': How the image background is produced. - `opaque`: always render a filled background - `auto`: let the model decide, which may return a transparent background Transparency is only preserved by formats that support an alpha channel (`png`, `webp`). When omitted, the provider default applies.
  - `output_compression` integer: Compression level for the generated image, where 100 is the least compressed. Only applies when `output_format` is `jpeg` or `webp`; ignored for `png`.
  - `moderation` 'auto' | 'low': Strictness of the model provider's own content filter. - `auto`: the provider's standard filtering (default) - `low`: less restrictive filtering This is the model provider's filter and is applied in addition to Freepik's platform moderation, which cannot be disabled.

## Response `200`

OK - The request has succeeded and the GPT Image 2 process has started.

- GetStyleTransferTaskStatus200Response
  - `data` TaskDetail, required
    - `task_id` string, uuid, required: Task identifier
    - `status` 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED', required: Task status
    - `generated` string[], required

## Other responses

- `400`: Bad Request - The server could not understand the request due to invalid syntax.
- `401`: Unauthorized - The client must authenticate itself to get the requested response.
- `500`: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
- `503`: Service Unavailable

---

[API](https://skmtc.dev/magnific/apis/magnific-api.md) · [All operations](https://skmtc.dev/magnific/apis/magnific-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magnific/apis/magnific-api/revisions/60711fb082c7?raw)
