focalapi-cli 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,27 @@
1
- ---
2
- name: focalapi-usage
3
- description: 查询 focalapi 额度/用量/账单,以及用 doctor 做链路诊断。Use when 用户问余额、用量、花了多少、Key 什么时候过期,或任何 focalapi 调用失败需要排障。
4
- ---
5
-
6
- # focalapi 用量与诊断
7
-
8
- ## 额度与用量
9
-
10
- ```bash
11
- focalapi auth status # Key 有效性 + 剩余额度 + 过期时间
12
- focalapi usage # 令牌额度 + 本周期账单用量
13
- focalapi usage --start 2026-08-01 --end 2026-08-05 --json
14
- ```
15
-
16
- 额度字段说明:`total_granted` 总额度、`total_used` 已用、`total_available` 剩余、`unlimited_quota` 为 true 表示不限额。
17
-
18
- ## 诊断(doctor)
19
-
20
- 任何 focalapi 调用失败,第一步永远是:
21
-
22
- ```bash
23
- focalapi doctor # 人读报告
24
- focalapi doctor --json # 机读报告(checks 数组,每项 ok/detail/hint)
25
- ```
26
-
27
- 检查链:Key 解析 → 网络与鉴权(GET /v1/models)→ 端到端推理(focal-rehearsal-chat 免费演练模型,不耗额度)→ 额度。
28
-
29
- - 全部 ✓:链路正常,问题在调用参数(对照命令 --help)。
30
- - 任一 ✗:按该项 hint 修复;退出码非零适合脚本判断。
31
-
32
- ## 成本控制建议
33
-
34
- - 演示/联调一律用 `focal-rehearsal-chat`(免费)。
35
- - 生成类操作前先 `focalapi usage` 确认额度充足。
36
- - 视频是任务制计费,优先用 `--seconds` 显式控制时长。
1
+ ---
2
+ name: focalapi-usage
3
+ version: 2.0.0
4
+ description: "查询 focalapi 额度、用量与账单,或诊断网络、鉴权和服务错误。当用户问消费/余额,或业务命令失败且需要按错误码闭环时使用;正常生成前不强制增加诊断步骤。"
5
+ metadata:
6
+ requires:
7
+ bins: ["focalapi"]
8
+ cliHelp: "focalapi usage --help"
9
+ ---
10
+
11
+ # focalapi 用量与诊断
12
+
13
+ ```bash
14
+ focalapi usage --json
15
+ focalapi auth status --json
16
+ focalapi doctor --json
17
+ ```
18
+
19
+ - 用户问额度、余额、用量或账单:运行 `usage`。
20
+ - `missing_api_key` / `invalid_api_key`:转 focalapi-auth。
21
+ - `insufficient_quota`:运行 `usage`,说明缺口,不自动充值。
22
+ - `network_error` / `timeout` / 5xx:运行一次 `doctor`,按 checks[].hint 处理。
23
+ - `invalid_request`:回到 `models get` 的实时参数契约;不要重复发送同一请求。
24
+ - `upstream_auth_failed`:保留 request ID 并反馈服务方,不要让用户更换本站 Key。
25
+
26
+ 正常业务命令没有报错时不要先跑 doctor 或免费演练;Agent 应直接完成用户的创作
27
+ 目标,减少无关调用。