关于 fal-platform
fal-platform 是一组用于 fal.ai 平台管理的脚本,面向需要查看模型价格、用量和请求记录的用户。它还支持估算操作成本及管理请求负载。
主要功能
- 01查询模型价格
- 02跟踪用量与支出
- 03估算调用成本
- 04列出并管理请求
- 05配置 FAL_KEY
适用场景
- 01运行模型前估算费用
- 02按模型或日期检查用量
- 03清理请求负载
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ fal-ai-community/ skills --skill fal-platform安装后在 Claude Code 中输入/fal-platform确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
scripts/estimate-cost.shpricing.shrequests.shsetup.shusage.sh详细介绍
fal.ai Platform
用于模型管理、定价、使用情况跟踪和成本估算的平台 API。
脚本
| 脚本 | 用途 |
|---|---|
setup.sh | 设置 FAL_KEY 和配置 |
pricing.sh | 获取模型定价信息 |
usage.sh | 查看使用情况和账单 |
estimate-cost.sh | 估算操作成本 |
requests.sh | 列出并管理请求 |
设置与配置
添加 FAL_KEY
# Interactive setup
bash /mnt/skills/user/fal-platform/scripts/setup.sh --add-fal-key
# Set key directly
bash /mnt/skills/user/fal-platform/scripts/setup.sh --add-fal-key "your_key_here"
# Show current config
bash /mnt/skills/user/fal-platform/scripts/setup.sh --show-config
这会将 FAL_KEY 添加到 .env 文件中,以便持久使用。
模型定价
获取任意模型的定价:
# Single model pricing
bash /mnt/skills/user/fal-platform/scripts/pricing.sh --model "fal-ai/flux/dev"
# Multiple models
bash /mnt/skills/user/fal-platform/scripts/pricing.sh --model "fal-ai/flux/dev,fal-ai/kling-video/v2/master/text-to-video"
# All pricing for a category
bash /mnt/skills/user/fal-platform/scripts/pricing.sh --category "text-to-image"
输出:
fal-ai/flux/dev
Price: $0.025 per image
Unit: image
fal-ai/kling-video/v2/master/text-to-video
Price: $0.50 per second
Unit: video_second
使用情况跟踪
查看使用情况和支出:
# Current period usage
bash /mnt/skills/user/fal-platform/scripts/usage.sh
# Filter by model
bash /mnt/skills/user/fal-platform/scripts/usage.sh --model "fal-ai/flux/dev"
# Date range
bash /mnt/skills/user/fal-platform/scripts/usage.sh --start "2024-01-01" --end "2024-01-31"
# Specific timeframe
bash /mnt/skills/user/fal-platform/scripts/usage.sh --timeframe "day"
时间范围: minute、hour、day、week、month
成本估算
运行前估算成本:
# Estimate by API calls (historical pricing)
bash /mnt/skills/user/fal-platform/scripts/estimate-cost.sh \
--model "fal-ai/flux/dev" \
--calls 100
# Estimate by units
bash /mnt/skills/user/fal-platform/scripts/estimate-cost.sh \
--model "fal-ai/kling-video/v2/master/text-to-video" \
--units 60 \
--type "unit_price"
输出:
Cost Estimate for fal-ai/flux/dev
Quantity: 100 calls
Estimated Cost: $2.50
请求管理
列出并管理请求:
# List recent requests
bash /mnt/skills/user/fal-platform/scripts/requests.sh --model "fal-ai/flux/dev" --limit 10
# Delete request payloads (cleanup)
bash /mnt/skills/user/fal-platform/scripts/requests.sh --delete "request_id_here"
API 端点参考
| 操作 | 端点 | 方法 |
|---|---|---|
| 模型搜索 | GET /models | GET |
| 定价 | GET /models/pricing | GET |
| 使用情况 | GET /models/usage | GET |
| 列出请求 | GET /models/requests/by-endpoint | GET |
| 删除载荷 | DELETE /models/requests/{id}/payloads | DELETE |
基础 URL: https://api.fal.ai/v1
常用标志(所有脚本)
所有脚本均支持以下常用标志:
--add-fal-key [KEY] # Add/update FAL_KEY in .env
--help, -h # Show help
--json # Output raw JSON
--quiet, -q # Suppress status messages
故障排除
需要 API 密钥
Error: FAL_KEY required for this operation
Run: bash /mnt/skills/user/fal-platform/scripts/setup.sh --add-fal-key
权限被拒绝
Error: API key doesn't have permission for this operation
Some operations require admin API keys. Check your key permissions at:
https://fal.ai/dashboard/keys
评论
支持 Markdown