Search

PythonReactSEOPDF
OpenClaw

fal-consumption-audit

审计 fal 账号消耗与用户扣费的一致性。查询 fal 官方账单,交叉比对 fal_tasks 中的用户消耗,汇总积分/现金明细,检测异常。当用户提到"消耗审计"、"账单核对"、"fal 对账"、"用量异常"时使用此 skill。

hexiaochun0 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install hexiaochun/fal-consumption-audit

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

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...

Source information

Source
github
Repository
openclaw/skills
Path
skills/hexiaochun/fal-consumption-audit
Version
—
Commit
8fc64cadf455f58795f0e4473101c28cf373b52f
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

Extracted content

SKILL.md
# 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...

Related skills

OpenClaw

x402hub

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,...

OpenClaw

claw

capevace

Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.

OpenClaw

captchas-openclaw

captchasco

OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.