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
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
请在 Console 查看对应界面截图。
Model Overview
Nano Banana is the colloquial name for Google’s latest and most powerful image generation modelgemini-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 requestsLive 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-imageandsora_imagecalling 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
| Model | Model ID | Billing | LaoZhang AI Price | Official Price | Savings | Speed |
|---|---|---|---|---|---|---|
| Nano Banana | gemini-2.5-flash-image-preview | Pay-per-use | $0.025/image | $0.04/image | 37.5% | ~10s |
| Nano Banana2 | gemini-3.1-flash-image-preview | Pay-per-use | $0.055/image | - | - | ~10s |
| GPT-Image-1 | gpt-image-1 | Token-based | 10input/10 input/10input/40 output per M | - | - | Medium |
| Flux Kontext Pro | flux-kontext-pro | Pay-per-use | $0.035/image | $0.04/image | 12.5% | Fast |
| Sora Image | sora_image | Pay-per-use | $0.01/image | - | - | Slower |
- 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)
gpt-4o-image and sora_image calling methods!
Return Format Differences
gemini-2.5-flash-image-preview: Returns base64 encodingsora_image: Returns image URL- Calling method is exactly the same, only return format differs
🚀 Quick Start
Prerequisites
- Create Token: Login to LaoZhang API and create a pay-per-use type token
请在 Console 查看对应界面截图。
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
- Select Domain: Recommended to use
https://api.yelinai.com(globally accelerated). Overseas servers can directly connect tohttps://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
| Metric | Nano Banana | GPT-4o Image | Sora Image |
|---|---|---|---|
| Generation Speed | ~10s | ~20-30s | ~10-15s |
| Price | $0.025/image | Token-based | $0.01/image |
| Return Format | Base64 | Base64 | URL |
| Quality | High | High | Medium-High |
| Compatibility | Fully compatible | - | Fully compatible |
⚠️ Important Notes
- Token Type: Must use pay-per-use type token
- API Endpoint: Use
/v1/chat/completions, not/v1/images/generations - Return Format: Returns base64 encoding, requires manual decoding and saving
- Model Name:
gemini-2.5-flash-image-preview(case-sensitive) - 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 fromsora_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.