text-to-image

Create image from text - Nano Banana 2.1

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.

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

Request body

promptstring 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_urlstring 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.

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_toolboolean

Ground the generation on Google Search results, useful for prompts about current events, real places or recent products. It does not affect the price.

Example request

{
  "prompt": "Place the product from Image 1 on a marble kitchen counter, soft morning light",
  "webhook_url": "https://www.example.com/webhook",
  "reference_images": [
    {
      "image": "https://example.com/product.png"
    }
  ],
  "aspect_ratio": "1:1",
  "resolution": "1K",
  "thinking_level": "medium"
}

Response

OK - The request has succeeded and the Nano Banana 2.1 process has started.

Example response

{
  "data": {
    "generated": [
      "https://openapi-generator.tech",
      "https://openapi-generator.tech"
    ],
    "task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
    "status": "CREATED"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.