Skip to main content
⚠️ Model Deprecation Notice
gemini-2.5-flash-image-preview preview version will be deprecated soon.Recommended Migration to Official Release:
  • ✅ New Version: Gemini 2.5 Flash Image (official, more stable)
  • 🎁 New Features: Supports custom aspect ratios (16:9, 9:16, and 10 other ratios)
  • 💰 Same Price: Still $0.025/image
  • 🔄 Easy Migration: Just update the model name
View New Documentation →

Prerequisites

1 Get API Key Log in to YeLIn AI console to obtain your API key 2 Configure Billing Mode Edit token settings and choose one of the following billing modes (same price for both):
  • Volume Priority (Recommended): Uses balance billing first, automatically switches when balance is insufficient. Suitable for most users
  • Pay-per-call: Direct deduction for each call. Suitable for strict budget control scenarios
Both modes have exactly the same price at $0.025/image, only the billing method differs.
请在 Console 查看对应界面截图。
If billing mode is not configured, API calls will fail. You must complete this configuration first!

Model Overview

Nano Banana is the colloquial name for Google’s latest and most powerful image generation model gemini-2.5-flash-image-preview. It implements text-to-image functionality through the chat completions interface, fully compatible with gpt-4o-image and sora_image calling methods - just replace the model name for seamless switching. 🚀 Lightning-Fast Generation Generates high-quality images in just 10 seconds on average, faster than OpenAI series! Returns base64 format data for direct use.

Free Trial

Register and get $0.5 credit for multiple test requests

Live Demo

AI Images - Try instantly, no code required

🌟 Core Features

  • ⚡ Ultra-Fast Response: Generates in ~10 seconds on average, significantly faster than OpenAI series
  • 💰 Great Value: 0.025/image,37.50.025/image, 37.5% cheaper than official price (0.025/image,37.50.04/image)
  • 🔄 Perfect Compatibility: Completely consistent with gpt-4o-image and sora_image calling methods
  • 📦 Base64 Output: Returns base64 encoded image data directly, no secondary download needed
  • 🎨 Google Technology: Based on Google’s latest image generation technology, outstanding quality

📋 Model Comparison

💡 Pricing Advantage
  • 37.5% cheaper than official price
  • Top up $100, get +10% bonus, combined with exchange rate advantage, total ~7.3 fold off official price
  • Transparent and predictable pricing, no need to worry about token consumption

⚠️ Important Notes

API Endpoint Notice
  • ✅ Correct: /v1/chat/completions (chat completions endpoint)
  • ❌ Wrong: /v1/images/generations (traditional image generation endpoint)
This model uses the chat completions interface, consistent with gpt-4o-image and sora_image calling methods! Return Format Differences
  • gemini-2.5-flash-image-preview: Returns base64 encoding
  • sora_image: Returns image URL
  • Calling method is exactly the same, only return format differs

🚀 Quick Start

Prerequisites

  1. Create Token: Login to LaoZhang API and create a pay-per-use type token
请在 Console 查看对应界面截图。
1 Login Console Visit https://api.yelinai.com/token and login to your account 2 Create New Token Click “Create New Token” button, make sure to select “Pay-per-use” type 3 Save Token Copy and securely save the generated token, format is sk-xxxxxx 💰 Pricing Advantage Explained
  • LaoZhang AI Price: $0.025/image (37.5% cheaper than official)
  • Official Price: $0.04/image
  • Recharge Bonus: Top up $100, get +10% bonus
  • Exchange Rate Advantage: Combined advantage, total ~7.3 fold off official price
  1. Select Domain: Recommended to use https://api.yelinai.com (globally accelerated). Overseas servers can directly connect to https://api-vip.YeLIn AI, but switch back to the primary domain if unstable

Basic Example - Curl

Complete Example - Python

Bash Script - Auto Save

🎯 Use Cases

1. Rapid Prototyping

2. Content Creation

💡 Best Practices

1. Prompt Optimization

2. Base64 Processing

📊 Performance Comparison

⚠️ Important Notes

  1. Token Type: Must use pay-per-use type token
  2. API Endpoint: Use /v1/chat/completions, not /v1/images/generations
  3. Return Format: Returns base64 encoding, requires manual decoding and saving
  4. Model Name: gemini-2.5-flash-image-preview (case-sensitive)
  5. Request Format: Use chat format, put prompt in user message content

🔍 FAQ

What are the advantages of base64 format compared to URL? Base64 returns image data directly, no secondary download needed, avoids URL expiration issues. Especially suitable for scenarios requiring immediate image processing. How to switch from sora_image to Nano Banana? Simply change the model name from sora_image to gemini-2.5-flash-image-preview, and modify result processing logic (from URL to base64). Are there limits for batch generation? No concurrency limits, but it’s recommended to control concurrency for optimal performance.

Image Editing API

Edit existing images, multi-image composition

Nano Banana Pro

4K HD, complex instruction understanding

API Key Management

Create and manage tokens

Pricing

View detailed pricing 🎨 Pro Tip: Nano Banana model is particularly good at understanding complex scene descriptions and artistic styles. Utilizing detailed prompts can yield better results!