fal-generate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefal.ai Generate
fal.ai 内容生成
Generate images and videos using state-of-the-art AI models on fal.ai.
使用fal.ai上的先进AI模型生成图片和视频。
Scripts
脚本
| Script | Purpose |
|---|---|
| Generate images/videos (queue-based) |
| Upload local files to fal CDN |
| Search and discover models |
| Get OpenAPI schema for any model |
| 脚本 | 用途 |
|---|---|
| 基于队列生成图片/视频 |
| 将本地文件上传至fal CDN |
| 搜索和发现模型 |
| 获取任意模型的OpenAPI schema |
Queue System (Default)
队列系统(默认)
All requests use the queue system by default for reliability:
User Request → Queue Submit → Poll Status → Get Result
↓
request_idBenefits:
- Long-running tasks (video) won't timeout
- Can check status anytime
- Can cancel queued requests
- Results retrievable even if connection drops
所有请求默认使用队列系统以确保可靠性:
用户请求 → 提交至队列 → 轮询状态 → 获取结果
↓
request_id优势:
- 长时间运行的任务(如视频生成)不会超时
- 可随时查看状态
- 可取消队列中的请求
- 即使连接断开也能检索结果
Generate Content
生成内容
bash
bash /mnt/skills/user/fal-generate/scripts/generate.sh [options]bash
bash /mnt/skills/user/fal-generate/scripts/generate.sh [options]Basic Usage (Queue Mode)
基础用法(队列模式)
bash
undefinedbash
undefinedImage - submits to queue, waits for completion
图片 - 提交至队列,等待完成
bash generate.sh --prompt "A serene mountain landscape" --model "fal-ai/nano-banana-pro"
bash generate.sh --prompt "宁静的山地景观" --model "fal-ai/nano-banana-pro"
Video - same, but takes longer
视频 - 操作相同,但耗时更长
bash generate.sh --prompt "Ocean waves crashing" --model "fal-ai/veo3.1"
bash generate.sh --prompt "海浪拍打岸边" --model "fal-ai/veo3.1"
Image-to-Video
图片转视频
bash generate.sh
--prompt "Camera slowly zooms in"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--image-url "https://example.com/image.jpg"
--prompt "Camera slowly zooms in"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--image-url "https://example.com/image.jpg"
undefinedbash generate.sh
--prompt "镜头缓慢拉近"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--image-url "https://example.com/image.jpg"
--prompt "镜头缓慢拉近"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--image-url "https://example.com/image.jpg"
undefinedAsync Mode (Return Immediately)
异步模式(立即返回)
For long video jobs, use to get request_id immediately:
--asyncbash
undefined对于长时视频任务,使用参数可立即获取request_id:
--asyncbash
undefinedSubmit and return immediately
提交后立即返回
bash generate.sh --prompt "Epic battle scene" --model "fal-ai/veo3.1" --async
bash generate.sh --prompt "史诗级战斗场景" --model "fal-ai/veo3.1" --async
Output:
输出:
Request ID: abc123-def456
请求ID: abc123-def456
Request submitted. Use these commands to check:
请求已提交。使用以下命令检查状态:
Status: ./generate.sh --status "abc123-def456" --model "fal-ai/veo3.1"
状态查询: ./generate.sh --status "abc123-def456" --model "fal-ai/veo3.1"
Result: ./generate.sh --result "abc123-def456" --model "fal-ai/veo3.1"
获取结果: ./generate.sh --result "abc123-def456" --model "fal-ai/veo3.1"
undefinedundefinedQueue Operations
队列操作
bash
undefinedbash
undefinedCheck status
检查状态
bash generate.sh --status "request_id" --model "fal-ai/veo3.1"
bash generate.sh --status "request_id" --model "fal-ai/veo3.1"
→ IN_QUEUE (position: 3) | IN_PROGRESS | COMPLETED
→ 队列中(位置: 3) | 处理中 | 已完成
Get result (when COMPLETED)
获取结果(任务完成后)
bash generate.sh --result "request_id" --model "fal-ai/veo3.1"
bash generate.sh --result "request_id" --model "fal-ai/veo3.1"
Cancel (only if still queued)
取消请求(仅队列中任务可取消)
bash generate.sh --cancel "request_id" --model "fal-ai/veo3.1"
undefinedbash generate.sh --cancel "request_id" --model "fal-ai/veo3.1"
undefinedShow Logs During Generation
生成过程中显示日志
bash
bash generate.sh --prompt "A sunset" --model "fal-ai/flux/dev" --logsbash
bash generate.sh --prompt "日落景象" --model "fal-ai/flux/dev" --logsStatus: IN_QUEUE (position: 2)
状态: 队列中(位置: 2)
Status: IN_PROGRESS
状态: 处理中
> Loading model...
> 加载模型...
> Generating image...
> 生成图片...
Status: COMPLETED
状态: 已完成
undefinedundefinedFile Upload
文件上传
Option 1: Auto-upload with --file
选项1:使用--file自动上传
bash
undefinedbash
undefinedLocal file is automatically uploaded to fal CDN
本地文件将自动上传至fal CDN
bash generate.sh
--file "/path/to/photo.jpg"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--prompt "Camera zooms in slowly"
--file "/path/to/photo.jpg"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--prompt "Camera zooms in slowly"
undefinedbash generate.sh
--file "/path/to/photo.jpg"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--prompt "镜头缓慢拉近"
--file "/path/to/photo.jpg"
--model "fal-ai/kling-video/v2.6/pro/image-to-video"
--prompt "镜头缓慢拉近"
undefinedOption 2: Manual upload with upload.sh
选项2:使用upload.sh手动上传
bash
undefinedbash
undefinedUpload first
先上传文件
URL=$(bash upload.sh --file "/path/to/photo.jpg")
URL=$(bash upload.sh --file "/path/to/photo.jpg")
Then generate
然后生成内容
bash generate.sh --image-url "$URL" --model "..." --prompt "..."
undefinedbash generate.sh --image-url "$URL" --model "..." --prompt "..."
undefinedOption 3: Use existing URL
选项3:使用现有URL
bash
undefinedbash
undefinedAny public URL works
任意公开URL均可使用
bash generate.sh --image-url "https://example.com/image.jpg" ...
**Supported file types:**
- Images: jpg, jpeg, png, gif, webp
- Videos: mp4, mov, webm
- Audio: mp3, wav, flac
**Upload flow (two-step):**-
POST rest.alpha.fal.ai/storage/auth/token?storage_type=fal-cdn-v3 → {"token": "...", "base_url": "https://v3b.fal.media"}
-
POST {base_url}/files/upload Authorization: Bearer {token} → {"access_url": "https://v3b.fal.media/files/..."}
**Max file size:** 100MB (simple upload)bash generate.sh --image-url "https://example.com/image.jpg" ...
**支持的文件类型:**
- 图片: jpg, jpeg, png, gif, webp
- 视频: mp4, mov, webm
- 音频: mp3, wav, flac
**上传流程(两步):**-
POST rest.alpha.fal.ai/storage/auth/token?storage_type=fal-cdn-v3 → {"token": "...", "base_url": "https://v3b.fal.media"}
-
POST {base_url}/files/upload Authorization: Bearer {token} → {"access_url": "https://v3b.fal.media/files/..."}
**最大文件大小:** 100MB(简单上传)Arguments Reference
参数参考
| Argument | Description | Default |
|---|---|---|
| Text description | (required) |
| Model ID | |
| Input image URL for I2V | - |
| Local file (auto-uploads) | - |
| | |
| Number of images | 1 |
Mode Options:
| Argument | Description |
|---|---|
| (default) | Queue mode - submit and poll until complete |
| Submit to queue, return request_id immediately |
| Synchronous (not recommended for video) |
| Show generation logs while polling |
Queue Operations:
| Argument | Description |
|---|---|
| Check status of a queued request |
| Get result of a completed request |
| Cancel a queued request |
Advanced:
| Argument | Description | Default |
|---|---|---|
| Seconds between status checks | 2 |
| Max seconds to wait | 600 |
| Object expiration in seconds | - |
| Get OpenAPI schema | - |
| 参数 | 描述 | 默认值 |
|---|---|---|
| 文本描述 | 必填 |
| 模型ID | |
| 图片转视频任务的输入图片URL | - |
| 本地文件(自动上传) | - |
| 尺寸选项: | |
| 生成图片数量 | 1 |
模式选项:
| 参数 | 描述 |
|---|---|
| 默认 | 队列模式 - 提交任务并轮询直至完成 |
| 提交至队列,立即返回request_id |
| 同步模式(不推荐用于视频任务) |
| 轮询时显示生成日志 |
队列操作:
| 参数 | 描述 |
|---|---|
| 检查队列中请求的状态 |
| 获取已完成请求的结果 |
| 取消队列中的请求 |
高级参数:
| 参数 | 描述 | 默认值 |
|---|---|---|
| 状态检查的间隔秒数 | 2 |
| 最长等待秒数 | 600 |
| 生成文件的过期时间(秒) | - |
| 获取OpenAPI schema | - |
Recommended Models
推荐模型
Text-to-Image
文本转图片
| Model | Notes |
|---|---|
| Best overall - T2I and editing |
| Open source, high quality |
| Open source, fast |
| Good balance (default) |
| ~1 second |
| Best for text rendering |
| 模型 | 说明 |
|---|---|
| 综合最佳 - 支持文本转图片和编辑 |
| 开源,高质量 |
| 开源,速度快 |
| 平衡性能与质量(默认模型) |
| 约1秒生成 |
| 文本渲染效果最佳 |
Text-to-Video
文本转视频
| Model | Notes |
|---|---|
| High quality |
| Fast, good quality |
| OpenAI Sora |
| Fast, reliable |
| Good for characters |
| 模型 | 说明 |
|---|---|
| 高质量 |
| 速度快,质量优秀 |
| OpenAI Sora模型 |
| 速度快,可靠 |
| 人物生成效果佳 |
Image-to-Video
图片转视频
| Model | Notes |
|---|---|
| Best overall |
| Fast, high quality |
| Smooth motion |
| Good balance |
| 模型 | 说明 |
|---|---|
| 综合最佳 |
| 速度快,高质量 |
| 运动流畅 |
| 性能平衡 |
Search Models
搜索模型
bash
undefinedbash
undefinedSearch by keyword
按关键词搜索
bash search-models.sh --query "flux"
bash search-models.sh --query "flux"
Filter by category
按分类筛选
bash search-models.sh --category "text-to-video"
**Categories:** `text-to-image`, `image-to-image`, `text-to-video`, `image-to-video`, `text-to-speech`, `speech-to-text`bash search-models.sh --category "text-to-video"
**分类:** `text-to-image`, `image-to-image`, `text-to-video`, `image-to-video`, `text-to-speech`, `speech-to-text`Get Model Schema (OpenAPI)
获取模型Schema(OpenAPI)
IMPORTANT: Fetch schema to see exact parameters for any model.
bash
undefined重要提示: 获取Schema以查看任意模型的具体参数。
bash
undefinedGet schema
获取Schema
bash get-schema.sh --model "fal-ai/nano-banana-pro"
bash get-schema.sh --model "fal-ai/nano-banana-pro"
Show only input parameters
仅显示输入参数
bash get-schema.sh --model "fal-ai/kling-video/v2.6/pro/image-to-video" --input
bash get-schema.sh --model "fal-ai/kling-video/v2.6/pro/image-to-video" --input
Quick schema via generate.sh
通过generate.sh快速获取Schema
bash generate.sh --schema "fal-ai/veo3.1"
**API Endpoint:**undefinedbash generate.sh --schema "fal-ai/veo3.1"
**API端点:**undefinedOutput
输出示例
Queue Submit Response:
json
{
"request_id": "abc123-def456",
"status": "IN_QUEUE",
"response_url": "https://queue.fal.run/.../requests/abc123-def456",
"status_url": "https://queue.fal.run/.../requests/abc123-def456/status",
"cancel_url": "https://queue.fal.run/.../requests/abc123-def456/cancel"
}Final Result:
json
{
"images": [{ "url": "https://v3.fal.media/files/...", "width": 1024, "height": 768 }]
}队列提交响应:
json
{
"request_id": "abc123-def456",
"status": "IN_QUEUE",
"response_url": "https://queue.fal.run/.../requests/abc123-def456",
"status_url": "https://queue.fal.run/.../requests/abc123-def456/status",
"cancel_url": "https://queue.fal.run/.../requests/abc123-def456/cancel"
}最终结果:
json
{
"images": [{ "url": "https://v3.fal.media/files/...", "width": 1024, "height": 768 }]
}Present Results to User
向用户展示结果
Images:

• 1024×768 | Generated in 2.2sVideos:
[Click to view video](https://v3.fal.media/files/.../video.mp4)
• Duration: 5s | Generated in 45sAsync Submission:
Request submitted to queue.
• Request ID: abc123-def456
• Model: fal-ai/veo3
• Check status: --status "abc123-def456"图片:

• 1024×768 | 生成耗时2.2秒视频:
[点击查看视频](https://v3.fal.media/files/.../video.mp4)
• 时长: 5秒 | 生成耗时45秒异步提交结果:
请求已提交至队列。
• 请求ID: abc123-def456
• 使用模型: fal-ai/veo3
• 检查状态: --status "abc123-def456"Object Lifecycle (Optional)
对象生命周期(可选)
Control how long generated files remain accessible:
bash
undefined控制生成文件的可访问时长:
bash
undefinedFiles expire after 1 hour (3600 seconds)
文件1小时后过期(3600秒)
bash generate.sh --prompt "..." --lifecycle 3600
bash generate.sh --prompt "..." --lifecycle 3600
Files expire after 24 hours
文件24小时后过期
bash generate.sh --prompt "..." --lifecycle 86400
undefinedbash generate.sh --prompt "..." --lifecycle 86400
undefinedTroubleshooting
故障排除
Timeout Error
超时错误
Error: Timeout after 600s
Request ID: abc123-def456Solution: Use and to check manually, or increase .
--status--result--timeoutError: Timeout after 600s
Request ID: abc123-def456解决方案: 使用和手动检查任务状态,或增加参数值。
--status--result--timeoutAPI Key Error
API密钥错误
Error: FAL_KEY not setSolution: Run or .
./generate.sh --add-fal-keyexport FAL_KEY=your_keyError: FAL_KEY not set解决方案: 运行或执行设置密钥。
./generate.sh --add-fal-keyexport FAL_KEY=your_keyNetwork Error (claude.ai)
网络错误(claude.ai)
Go to and add to allowed domains.
claude.ai/settings/capabilities*.fal.ai前往,将添加至允许的域名列表。
claude.ai/settings/capabilities*.fal.ai