{ "model_id": "google/nano-banana-2", "provider_id": "google", "name": "Nano Banana 2", "description": "Google's second-generation image generation model with improved quality and speed.", "task": "Text-to-Image", "tags": [ "Image Generation", "Fast", "High Quality" ], "context_length": null, "max_output_tokens": null, "schema_version": "1.0.0", "pricing": { "Input tokens (per 1M)": 0.5, "Output tokens (per 1M)": 60 }, "examples": [ { "name": "Futuristic City", "description": "Sci-fi cityscape with neon lights", "input": { "prompt": "A futuristic cyberpunk city at night with towering skyscrapers, neon signs in Japanese and English, flying cars, and rain-slicked streets reflecting colorful lights", "aspect_ratio": "16:9" }, "output": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/futuristic-city.png" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/futuristic-city.png" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/nano-banana-2',\n {\n prompt:\n 'A futuristic cyberpunk city at night with towering skyscrapers, neon signs in Japanese and English, flying cars, and rain-slicked streets reflecting colorful lights',\n aspect_ratio: '16:9',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/nano-banana-2\",\n \"input\": {\n \"prompt\": \"A futuristic cyberpunk city at night with towering skyscrapers, neon signs in Japanese and English, flying cars, and rain-slicked streets reflecting colorful lights\",\n \"aspect_ratio\": \"16:9\"\n }\n}'" } ] }, { "name": "Abstract Art", "description": "Modern abstract expressionist painting", "input": { "prompt": "An abstract expressionist painting with bold splashes of cobalt blue, crimson red, and gold leaf accents on a large canvas", "aspect_ratio": "1:1", "output_format": "jpg" }, "output": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/abstract-art.jpg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/abstract-art.jpg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/nano-banana-2',\n {\n prompt:\n 'An abstract expressionist painting with bold splashes of cobalt blue, crimson red, and gold leaf accents on a large canvas',\n aspect_ratio: '1:1',\n output_format: 'jpg',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/nano-banana-2\",\n \"input\": {\n \"prompt\": \"An abstract expressionist painting with bold splashes of cobalt blue, crimson red, and gold leaf accents on a large canvas\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"jpg\"\n }\n}'" } ] }, { "name": "With Google Search", "description": "Use web search grounding for current events", "input": { "prompt": "An illustration of the latest Mars rover exploring the Martian surface", "aspect_ratio": "16:9", "google_search": true }, "output": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/with-google-search.jpg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/with-google-search.jpg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/nano-banana-2',\n {\n prompt: 'An illustration of the latest Mars rover exploring the Martian surface',\n aspect_ratio: '16:9',\n google_search: true,\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/nano-banana-2\",\n \"input\": {\n \"prompt\": \"An illustration of the latest Mars rover exploring the Martian surface\",\n \"aspect_ratio\": \"16:9\",\n \"google_search\": true\n }\n}'" } ] }, { "name": "High Resolution Portrait", "description": "4K portrait with specific aspect ratio", "input": { "prompt": "A professional studio portrait of a woman with dramatic side lighting, wearing elegant jewelry", "aspect_ratio": "3:4", "output_format": "jpg", "resolution": "4K" }, "output": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/high-resolution-portrait.jpg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/google/nano-banana-2/high-resolution-portrait.jpg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'google/nano-banana-2',\n {\n prompt:\n 'A professional studio portrait of a woman with dramatic side lighting, wearing elegant jewelry',\n aspect_ratio: '3:4',\n output_format: 'jpg',\n resolution: '4K',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"google/nano-banana-2\",\n \"input\": {\n \"prompt\": \"A professional studio portrait of a woman with dramatic side lighting, wearing elegant jewelry\",\n \"aspect_ratio\": \"3:4\",\n \"output_format\": \"jpg\",\n \"resolution\": \"4K\"\n }\n}'" } ] } ], "default_example": null, "code_snippets": [], "supports_async": false, "zdr": true, "zdr_comment": null, "external_info": "https://deepmind.google/technologies/imagen/", "terms": "https://ai.google.dev/gemini-api/terms", "cover_image_url": "https://pub-26f1392c1b674324be6786695bd72257.r2.dev/google/nano-banana-2.png", "metadata": { "Output Format": "JPEG" }, "request_formats": null, "providers": null, "provider_details": [ { "id": "google-vertex-ai", "pricing": { "input_tokens": 0.5, "output_tokens": 60 } } ], "banner": null, "created_at": "2026-05-22 17:53:12", "schema": { "input": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string" }, "image_input": { "maxItems": 3, "type": "array", "items": { "type": "string" } }, "aspect_ratio": { "type": "string", "enum": [ "match_input_image", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9" ] }, "output_format": { "type": "string", "enum": [ "jpg", "png" ] }, "resolution": { "type": "string", "enum": [ "1K", "2K", "4K" ] }, "google_search": { "type": "boolean" }, "image_search": { "type": "boolean" } }, "required": [ "prompt" ], "additionalProperties": false }, "output": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "image": { "type": "string", "format": "uri" } }, "required": [ "image" ], "additionalProperties": false } } }