mcpField
F
fal-platform

fal-platform

github.com/fal-ai-community云与 DevOps257221 次安装24 周前更新
代码仓库

关于 fal-platform

fal-platform 是一组用于 fal.ai 平台管理的脚本,面向需要查看模型价格、用量和请求记录的用户。它还支持估算操作成本及管理请求负载。

主要功能

  1. 01查询模型价格
  2. 02跟踪用量与支出
  3. 03估算调用成本
  4. 04列出并管理请求
  5. 05配置 FAL_KEY

适用场景

  1. 01运行模型前估算费用
  2. 02按模型或日期检查用量
  3. 03清理请求负载

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/fal-ai-community/skills --skill fal-platform

安装后在 Claude Code 中输入/fal-platform确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

scripts/
estimate-cost.sh
pricing.sh
requests.sh
setup.sh
usage.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 /modelsGET
定价GET /models/pricingGET
使用情况GET /models/usageGET
列出请求GET /models/requests/by-endpointGET
删除载荷DELETE /models/requests/{id}/payloadsDELETE

基础 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