nano-banana
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano Banana - Image Generation API
Nano Banana - 图像生成API
Generate images from text prompts using Google Nano Banana (Gemini's native image generation).
通过Google Nano Banana(Gemini原生图像生成工具)从文本提示生成图像。
Base URL
基础URL
https://api.eng0.ai/api/datahttps://api.eng0.ai/api/dataModels
模型
| Model | ID | Best For | Max Resolution |
|---|---|---|---|
| Flash | | Fast generation, high-volume tasks | 1024px |
| Pro | | Professional quality, complex prompts | 4K |
| 模型 | ID | 适用场景 | 最大分辨率 |
|---|---|---|---|
| Flash | | 快速生成、高批量任务 | 1024px |
| Pro | | 专业画质、复杂提示词 | 4K |
Generate Image
生成图像
Create an image from a text description.
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic cityscape at sunset with flying cars",
"model": "flash",
"aspectRatio": "16:9"
}'Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Text description of the image to generate |
| string | No | | |
| string | No | | Output aspect ratio |
| string | No | | |
Aspect Ratios:
| Ratio | Use Case |
|---|---|
| Square (social media, icons) |
| Landscape (presentations, banners) |
| Portrait (mobile, stories) |
| Standard landscape |
| Standard portrait |
| Ultra-wide (cinematic) |
| Various formats |
Response:
json
{
"image": {
"base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"mimeType": "image/png",
"dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
},
"description": "A vibrant futuristic cityscape..."
}Response Fields:
| Field | Description |
|---|---|
| Base64-encoded image data |
| Image MIME type (typically |
| Ready-to-use data URL for HTML/CSS |
| Model's description of the generated image |
根据文本描述创建图像。
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic cityscape at sunset with flying cars",
"model": "flash",
"aspectRatio": "16:9"
}'参数说明:
| 参数名 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | - | 要生成的图像的文本描述 |
| string | 否 | | |
| string | 否 | | 输出图像的宽高比 |
| string | 否 | | |
宽高比选项:
| 比例 | 使用场景 |
|---|---|
| 正方形(社交媒体、图标) |
| 横屏(演示文稿、横幅) |
| 竖屏(移动端、故事内容) |
| 标准横屏 |
| 标准竖屏 |
| 超宽屏(电影级) |
| 多种格式 |
响应示例:
json
{
"image": {
"base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"mimeType": "image/png",
"dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
},
"description": "A vibrant futuristic cityscape..."
}响应字段说明:
| 字段 | 说明 |
|---|---|
| Base64编码的图像数据 |
| 图像MIME类型(通常为 |
| 可直接用于HTML/CSS的Data URL |
| 模型对生成图像的描述 |
Common Workflows
常见工作流
Generate a Simple Image
生成简单图像
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cute robot holding a cup of coffee"
}'bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cute robot holding a cup of coffee"
}'Generate High-Quality 4K Image
生成高质量4K图像
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Professional product photo of a sleek smartphone on marble surface",
"model": "pro",
"imageSize": "4K",
"aspectRatio": "4:3"
}'bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Professional product photo of a sleek smartphone on marble surface",
"model": "pro",
"imageSize": "4K",
"aspectRatio": "4:3"
}'Generate Social Media Banner
生成社交媒体横幅
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Abstract gradient background with geometric shapes in blue and purple",
"aspectRatio": "16:9"
}'bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Abstract gradient background with geometric shapes in blue and purple",
"aspectRatio": "16:9"
}'Generate Mobile Story Image
生成移动端故事图像
bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Cozy coffee shop interior with warm lighting",
"aspectRatio": "9:16"
}'bash
curl -X POST https://api.eng0.ai/api/data/images/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Cozy coffee shop interior with warm lighting",
"aspectRatio": "9:16"
}'Using with Python
Python使用示例
python
import requests
import base64
from pathlib import Path
BASE_URL = "https://api.eng0.ai/api/data"
def generate_image(
prompt: str,
model: str = "flash",
aspect_ratio: str = "1:1",
image_size: str = "1K"
) -> dict:
"""Generate an image from a text prompt."""
response = requests.post(
f"{BASE_URL}/images/generate",
json={
"prompt": prompt,
"model": model,
"aspectRatio": aspect_ratio,
"imageSize": image_size
}
)
return response.json()
def save_image(result: dict, filepath: str) -> None:
"""Save generated image to a file."""
if "image" in result:
image_data = base64.b64decode(result["image"]["base64"])
Path(filepath).write_bytes(image_data)
print(f"Saved to {filepath}")
else:
print(f"Error: {result.get('error', 'Unknown error')}")python
import requests
import base64
from pathlib import Path
BASE_URL = "https://api.eng0.ai/api/data"
def generate_image(
prompt: str,
model: str = "flash",
aspect_ratio: str = "1:1",
image_size: str = "1K"
) -> dict:
"""Generate an image from a text prompt."""
response = requests.post(
f"{BASE_URL}/images/generate",
json={
"prompt": prompt,
"model": model,
"aspectRatio": aspect_ratio,
"imageSize": image_size
}
)
return response.json()
def save_image(result: dict, filepath: str) -> None:
"""Save generated image to a file."""
if "image" in result:
image_data = base64.b64decode(result["image"]["base64"])
Path(filepath).write_bytes(image_data)
print(f"Saved to {filepath}")
else:
print(f"Error: {result.get('error', 'Unknown error')}")Example: Generate and save an image
Example: Generate and save an image
result = generate_image(
prompt="A serene mountain landscape at dawn with mist in the valley",
aspect_ratio="16:9"
)
save_image(result, "landscape.png")
result = generate_image(
prompt="A serene mountain landscape at dawn with mist in the valley",
aspect_ratio="16:9"
)
save_image(result, "landscape.png")
Example: Generate high-quality product image
Example: Generate high-quality product image
result = generate_image(
prompt="Minimalist tech gadget on white background, studio lighting",
model="pro",
image_size="4K"
)
save_image(result, "product.png")
---result = generate_image(
prompt="Minimalist tech gadget on white background, studio lighting",
model="pro",
image_size="4K"
)
save_image(result, "product.png")
---Using with Node.js
Node.js使用示例
javascript
const fs = require('fs');
const BASE_URL = 'https://api.eng0.ai/api/data';
async function generateImage(prompt, options = {}) {
const response = await fetch(`${BASE_URL}/images/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt,
model: options.model || 'flash',
aspectRatio: options.aspectRatio || '1:1',
imageSize: options.imageSize || '1K'
})
});
return response.json();
}
function saveImage(result, filepath) {
if (result.image) {
const buffer = Buffer.from(result.image.base64, 'base64');
fs.writeFileSync(filepath, buffer);
console.log(`Saved to ${filepath}`);
} else {
console.error('Error:', result.error || 'Unknown error');
}
}
// Example usage
(async () => {
const result = await generateImage(
'A neon-lit cyberpunk street scene at night',
{ aspectRatio: '21:9' }
);
saveImage(result, 'cyberpunk.png');
})();javascript
const fs = require('fs');
const BASE_URL = 'https://api.eng0.ai/api/data';
async function generateImage(prompt, options = {}) {
const response = await fetch(`${BASE_URL}/images/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt,
model: options.model || 'flash',
aspectRatio: options.aspectRatio || '1:1',
imageSize: options.imageSize || '1K'
})
});
return response.json();
}
function saveImage(result, filepath) {
if (result.image) {
const buffer = Buffer.from(result.image.base64, 'base64');
fs.writeFileSync(filepath, buffer);
console.log(`Saved to ${filepath}`);
} else {
console.error('Error:', result.error || 'Unknown error');
}
}
// Example usage
(async () => {
const result = await generateImage(
'A neon-lit cyberpunk street scene at night',
{ aspectRatio: '21:9' }
);
saveImage(result, 'cyberpunk.png');
})();Prompt Tips
提示词技巧
Be Specific
描述要具体
Bad: "A dog"
Good: "A golden retriever puppy playing in autumn leaves, warm sunlight"不好: "A dog"
好: "A golden retriever puppy playing in autumn leaves, warm sunlight"Include Style
指定风格
"Oil painting style portrait of a woman in Renaissance clothing"
"Minimalist vector illustration of a mountain range"
"Photorealistic close-up of a dewdrop on a leaf""Oil painting style portrait of a woman in Renaissance clothing"
"Minimalist vector illustration of a mountain range"
"Photorealistic close-up of a dewdrop on a leaf"Specify Lighting
说明光线
"... with dramatic side lighting"
"... golden hour sunlight"
"... soft diffused studio lighting""... with dramatic side lighting"
"... golden hour sunlight"
"... soft diffused studio lighting"Add Context
添加背景信息
"... in the style of Studio Ghibli"
"... professional product photography"
"... vintage 1970s film aesthetic""... in the style of Studio Ghibli"
"... professional product photography"
"... vintage 1970s film aesthetic"Model Comparison
模型对比
| Feature | Flash | Pro |
|---|---|---|
| Speed | Fast | Slower |
| Max Resolution | 1024px | 4K |
| Complex Prompts | Good | Excellent |
| Text Rendering | Good | Sharp |
| Best For | Quick iterations, previews | Final assets, print |
When to use Flash:
- Rapid prototyping
- Social media content
- High-volume generation
- When speed matters
When to use Pro:
- Professional/commercial use
- Print materials
- Complex compositions
- When quality matters
| 特性 | Flash | Pro |
|---|---|---|
| 速度 | 快 | 较慢 |
| 最大分辨率 | 1024px | 4K |
| 复杂提示词处理 | 良好 | 优秀 |
| 文本渲染 | 良好 | 清晰 |
| 最佳适用场景 | 快速迭代、预览图 | 最终素材、印刷品 |
何时使用Flash:
- 快速原型制作
- 社交媒体内容
- 高批量生成
- 优先考虑速度时
何时使用Pro:
- 专业/商业用途
- 印刷物料
- 复杂构图
- 优先考虑画质时
Error Handling
错误处理
No Image Generated:
json
{
"error": "No image generated",
"message": "SAFETY"
}This occurs when the prompt triggers content safety filters.
Invalid Parameters:
json
{
"error": "Invalid parameters",
"message": "Missing required parameter: prompt"
}未生成图像:
json
{
"error": "No image generated",
"message": "SAFETY"
}当提示词触发内容安全过滤器时会出现此错误。
参数无效:
json
{
"error": "Invalid parameters",
"message": "Missing required parameter: prompt"
}Important Notes
重要说明
- All generated images include invisible SynthID watermarking
- Images are generated server-side; base64 responses can be large
- The model takes longer but produces higher quality
pro - 4K resolution is only available with the model
pro - Content safety filters may block certain prompts
- 所有生成的图像包含不可见的SynthID水印
- 图像在服务器端生成;Base64格式的响应可能较大
- 模型耗时更长但画质更高
pro - 仅模型支持4K分辨率
pro - 内容安全过滤器可能拦截部分提示词
Combining with Other Skills
与其他技能结合使用
This skill provides image generation. Combine with:
- deep-research - Generate illustrations for research reports
- market-data - Create visualizations of financial data
Example workflow:
- Research a topic (deep-research)
- Generate relevant illustrations (this skill)
- Compile into a report
本技能提供图像生成功能,可与以下技能结合:
- deep-research - 为研究报告生成插画
- market-data - 创建金融数据可视化图
示例工作流:
- 研究主题(deep-research)
- 生成相关插画(本技能)
- 整理成报告