fal.ai
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefal.ai Image Generator
fal.ai 图像生成工具
Use the fal.ai API to generate images from text prompts.
Official docs:https://fal.ai/docs
使用fal.ai API根据文本提示词生成图像。
官方文档:https://fal.ai/docs
When to Use
适用场景
Use this skill when you need to:
- Generate images from text descriptions
- Create illustrations or visual content
- Generate blog headers, thumbnails, or social media images
当你需要以下操作时,可使用此技能:
- 根据文本描述生成图像
- 创建插画或视觉内容
- 生成博客标题图、缩略图或社交媒体图片
Prerequisites
前置条件
- Sign up at fal.ai
- Get your API key from the dashboard
bash
export FAL_KEY="your-api-key"Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
- 在fal.ai注册账号
- 从控制台获取你的API密钥
bash
export FAL_KEY="your-api-key"重要提示: 在包含的命令中如果需要通过管道符传递给其他命令,请将包含$VAR的命令用$VAR包裹。由于Claude Code的一个bug,当直接使用管道符时,环境变量会被自动清除。bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
How to Use
使用方法
1. Generate Image (nano-banana-pro - fast)
1. 生成图像(nano-banana-pro - 快速版)
Write to :
/tmp/fal_request.jsonjson
{
"prompt": "A futuristic city at sunset, cyberpunk style"
}Then run:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'编写内容到:
/tmp/fal_request.jsonjson
{
"prompt": "A futuristic city at sunset, cyberpunk style"
}然后运行:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'2. Generate Image (flux/schnell - fast)
2. 生成图像(flux/schnell - 快速版)
Write to :
/tmp/fal_request.jsonjson
{
"prompt": "A cute cat eating a cookie"
}Then run:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/flux/schnell" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'编写内容到:
/tmp/fal_request.jsonjson
{
"prompt": "A cute cat eating a cookie"
}然后运行:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/flux/schnell" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'3. Generate Image (recraft-v3 - high quality)
3. 生成图像(recraft-v3 - 高质量版)
Write to :
/tmp/fal_request.jsonjson
{
"prompt": "Abstract art, vibrant colors"
}Then run:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/recraft-v3" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'编写内容到:
/tmp/fal_request.jsonjson
{
"prompt": "Abstract art, vibrant colors"
}然后运行:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/recraft-v3" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'4. Generate with Custom Size
4. 自定义尺寸生成图像
Write to :
/tmp/fal_request.jsonjson
{
"prompt": "Mountain landscape",
"image_size": "landscape_16_9"
}Then run:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'编写内容到:
/tmp/fal_request.jsonjson
{
"prompt": "Mountain landscape",
"image_size": "landscape_16_9"
}然后运行:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'5. Download Generated Image
5. 下载生成的图像
Write to :
/tmp/fal_request.jsonjson
{
"prompt": "A minimalist workspace"
}Then run:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url' | xargs curl -sL -o /tmp/image.png编写内容到:
/tmp/fal_request.jsonjson
{
"prompt": "A minimalist workspace"
}然后运行:
bash
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url' | xargs curl -sL -o /tmp/image.png6. Pipe Prompt from Echo (JSON escaped)
6. 通过Echo传递提示词(JSON转义)
bash
echo "A dragon breathing fire, epic fantasy art" | jq -Rs '{prompt: .}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'bash
echo "A dragon breathing fire, epic fantasy art" | jq -Rs '{prompt: .}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'7. Pipe Prompt from File (JSON escaped)
7. 通过文件传递提示词(JSON转义)
bash
cat /tmp/prompt.txt | jq -Rs '{prompt: .}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'bash
cat /tmp/prompt.txt | jq -Rs '{prompt: .}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'8. Pipe with Additional Parameters
8. 传递提示词并附加参数
bash
echo "Neon city at night" | jq -Rs '{prompt: ., image_size: "landscape_16_9"}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'bash
echo "Neon city at night" | jq -Rs '{prompt: ., image_size: "landscape_16_9"}' > /tmp/fal_request.json
bash -c 'curl -s -X POST "https://fal.run/fal-ai/nano-banana-pro" --header "Authorization: Key ${FAL_KEY}" --header "Content-Type: application/json" -d @/tmp/fal_request.json' | jq -r '.images[0].url'Available Models
可用模型
| Model | Description |
|---|---|
| Fast, good quality (recommended) |
| Fast generation |
| High quality |
| High quality vector/illustration |
See more at: https://fal.ai/models
| 模型 | 描述 |
|---|---|
| 快速生成,画质优秀(推荐) |
| 快速生成 |
| 高质量 |
| 高质量矢量/插画 |
更多模型请查看:https://fal.ai/models
Image Sizes
图像尺寸
| Size | Aspect Ratio |
|---|---|
| 1:1 |
| 1:1 (high res) |
| 4:3 |
| 16:9 |
| 3:4 |
| 9:16 |
| 尺寸 | 宽高比 |
|---|---|
| 1:1 |
| 1:1(高分辨率) |
| 4:3 |
| 16:9 |
| 3:4 |
| 9:16 |
Prompt Guidelines
提示词撰写指南
For best results:
- Be specific - Describe the subject clearly
- Add style hints - "modern", "minimalist", "photorealistic", "digital art", "cinematic"
- Specify colors/mood - "blue and purple gradient", "warm tones", "dark and moody"
- Keep it concise - Clear and focused descriptions work better
为获得最佳效果:
- 描述具体 - 清晰描述主体
- 添加风格提示 - 例如“现代风”、“极简主义”、“照片写实”、“数字艺术”、“电影质感”
- 指定色彩/氛围 - 例如“蓝紫渐变”、“暖色调”、“暗黑氛围感”
- 简洁明了 - 清晰聚焦的描述效果更佳