---
title: "Create image from text - Nano Banana 2.1"
method: POST
path: "/v1/ai/text-to-image/nano-banana-2-1"
tags: ["text-to-image"]
---

# Create image from text - Nano Banana 2.1

`POST /v1/ai/text-to-image/nano-banana-2-1`

## Request

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

Generate or edit images with Google's Nano Banana 2.1 model.

**Key Features:**
- Text-to-image and image editing in the same endpoint: send up to 14
  reference images to edit, combine, or keep characters and products
  consistent
- Wide aspect ratio range, from `8:1` banners to `1:8` vertical strips,
  plus `auto` to follow the reference images
- Optional `thinking_level` for complex prompts
- Optional Google Search grounding
- Resolutions up to 4K

**Best for:**
- Product and brand visuals built from reference images
- Character and product consistency across generations
- Complex prompts with many constraints

**Credits:** the price is set by `resolution` (`1K`, `2K` or `4K`).
`thinking_level` and `use_google_search_tool` do not affect it.

## Request body

- TtiNanoBanana21Request
  - `prompt` string, required: Text description of the image to generate, or of the edit to apply to the reference images. Refer to the references by their caption ("Image 1", "Image 2", ...).
  - `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.
  - `reference_images` TtiNanoBanana21RequestReferenceImagesInner[]: Optional reference images for editing, composition, style or character and product consistency. **Image requirements:** - Maximum 14 images - Supported formats: PNG, JPEG, WebP - Public HTTPS URL or base64-encoded string
    - `image` string, required: Reference image as a public HTTPS URL or a base64-encoded string
    - `text` string: Optional caption attached to this image. When omitted, the image is captioned `Image N` (its 1-based position in the list), so the prompt can refer to it as "Image 1", "Image 2", and so on.
    - `mime_type` 'image/png' | 'image/jpeg' | 'image/webp': MIME type of the image. Optional: when omitted it is derived from the image.
  - `aspect_ratio` 'auto' | '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9' | '1:4' | '4:1' | '1:8' | '8:1': Aspect ratio for the generated image. **Available ratios:** - `auto`: Let the model choose. With reference images it follows their ratio, including ratios outside this list; without them it picks the ratio that best fits the prompt. - `1:1`: Square (default) - `2:3`, `3:2`: Portrait/Landscape - `3:4`, `4:3`: Standard - `4:5`, `5:4`: Photo print - `9:16`, `16:9`: Social stories/Widescreen - `21:9`: Ultra-wide cinematic - `1:4`, `4:1`, `1:8`, `8:1`: Banners, strips and vertical panels. At `1K` they render 512x2064, 2064x512, 352x2928 and 2928x352 pixels.
  - `resolution` '1K' | '2K' | '4K': Output resolution. It sets the price of the generation. **Available resolutions:** - `1K`: About 1 megapixel, 1024x1024 at `1:1` (default) - `2K`: About 4 megapixels, 2048x2048 at `1:1` - `4K`: About 16 megapixels, 4096x4096 at `1:1`
  - `thinking_level` 'minimal' | 'medium' | 'high': How much the model reasons about the prompt before drawing. Higher levels help with complex compositions and many constraints, at the cost of a longer generation time. It does not affect the price. When omitted, the model uses `medium`.
  - `use_google_search_tool` boolean: Ground the generation on Google Search results, useful for prompts about current events, real places or recent products. It does not affect the price.

## Response `200`

OK - The request has succeeded and the Nano Banana 2.1 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)
