Overview
- Skill Key
- hexiaochun/fal-consumption-audit
- Author
- hexiaochun
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/hexiaochun/fal-consumption-audit
- Latest Commit SHA
- 8fc64cadf455f58795f0e4473101c28cf373b52f
审计 fal 账号消耗与用户扣费的一致性。查询 fal 官方账单,交叉比对 fal_tasks 中的用户消耗,汇总积分/现金明细,检测异常。当用户提到"消耗审计"、"账单核对"、"fal 对账"、"用量异常"时使用此 skill。
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 fal-consumption-audit 技能。 若已安装,则直接安装 fal-consumption-audit 技能。
# Fal 消耗审计
## 审计目标
核对三层数据的一致性,发现差异和异常:
```
fal 官方账单(实际成本)
↕ 比对
fal_tasks 任务表(系统记录)
↕ 比对
用户积分/现金明细(用户扣费)
```
## 审计流程
复制此清单跟踪进度:
```
Task Progress:
- [ ] Step 1: 查询 fal 官方账单
- [ ] Step 2: 查询 fal_tasks 任务明细
- [ ] Step 3: 按用户聚合消耗
- [ ] Step 4: 比对用户积分/现金明细
- [ ] Step 5: 异常检测 & 输出报告
```
---
## Step 1: 查询 fal 官方账单
调用 fal Platform API 获取每个 fal 账号的实际消耗。
**API**: `GET https://api.fal.ai/v1/models/usage`
**认证**: `Authorization: Key {fal_api_key}`
**关键参数**:
| 参数 | 值 | 说明 |
|------|-----|------|
| `expand` | `["time_series", "auth_method", "summary"]` | 包含按时间和汇总数据 |
| `timeframe` | `day` | 按天聚合 |
| `start` | 审计开始日期 | ISO8601 格式 |
| `end` | 审计结束日期 | ISO8601 格式 |
**数据来源**: `FalAccount` 表(`ts_fal_account`),取最新插入的 20 个账号(按 id 倒序,不过滤 status)
```
FalAccount 关键字段:
id - 账号ID
api_key - fal API 密钥(用于调用 Usage API + 关联 FalTasks)
balance - 当前余额
status - 1=正常 0=禁用
查询: FalAccount.select().order_by(FalAccount.id.desc()).limit(20)
```
**输出**: 每个 fal 账号 → 各模型的 cost(USD) 和 quantity
---
## Step 2: 查询 fal_tasks 任务明细
从 `FalTasks` 表查询同一时间段内,每个 fal key 被哪些用户使用。
**数据来源**: `FalTasks` 表(`ts_fal_tasks`)
```
FalTasks 关键字段:
user_id - 发起任务的用户ID(核心关联字段)
api_key - 使用的 fal API 密钥(与 FalAccount.api_key 关联)
app_name - fal 模型名称(如 fal-ai/flux/schnell)
money - 向用户收取的金额(系统内积分,单位:分)
cost_money - fal 实际成本
status - 任务状态
is_refund - 是否退款(0=否 1=是)
created_at - 创建时间
```
**查询逻辑**:
```
SELECT
api_key,
user_id,
app_name,
COUNT(*) as task_count,
SUM(money) as total_charged, -- 向用户收的
SUM(cost_money) as total_cost, -- fal 实际成本
SUM(CASE WHEN i...
capt-marbles
Task Router
capncoconut
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay, check marketplace stats, or manage agent credentials. Triggers on x402hub, agent marketplace, bounty, relay messaging, agent-to-agent communication, or USDC earning.
capevace
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
captchasco
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.
carol-gutianle
name: modelready description: Start using a local or Hugging Face model instantly, directly from chat. metadata: {"openclaw":{"requires":{"bins": "bash", "curl" }, "env": "URL" }}
canbirlik
Controls Wiz smart bulbs (turn on/off, RGB colors, disco mode) via local WiFi.