Prerequisites
Get API Key
Log in to laozhang.ai console to obtain your API key
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.

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.05 free credit for 2 test images
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.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 |
| GPT-Image-1 | gpt-image-1 | Token-based | 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 |
⚠️ Important Notes
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

Login Console
Visit https://api.laozhang.ai/token and login to your account
- Select Domain: Recommended to use
https://api.laozhang.ai(globally accelerated). Overseas servers can directly connect tohttps://api-vip.laozhang.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?
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?
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?
Are there limits for batch generation?
No concurrency limits, but it’s recommended to control concurrency for optimal performance.
🔗 Related Resources
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!