focalapi-cli 0.1.1 → 0.2.1

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,26 @@
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: "Inspect FocalAPI quota, usage, and billing, or diagnose network, authentication, and service errors. Use when the user asks about spend or balance, or when a failed business command needs an error-code-driven resolution. Do not add mandatory diagnostics before normal generation."
5
+ metadata:
6
+ requires:
7
+ bins: ["focalapi"]
8
+ cliHelp: "focalapi usage --help"
9
+ ---
10
+
11
+ # FocalAPI usage and diagnostics
12
+
13
+ ```bash
14
+ focalapi usage --json
15
+ focalapi auth status --json
16
+ focalapi doctor --json
17
+ ```
18
+
19
+ - For quota, balance, usage, or billing questions, run `usage`.
20
+ - For `missing_api_key` or `invalid_api_key`, route to focalapi-auth.
21
+ - For `insufficient_quota`, run `usage`, explain the shortfall, and do not add funds automatically.
22
+ - For `network_error`, `timeout`, or 5xx errors, run `doctor` once and follow `checks[].hint`.
23
+ - For `invalid_request`, return to the live `models get` parameter contract and do not resend the same request.
24
+ - For `upstream_auth_failed`, preserve the request ID and escalate to the service operator; do not ask the user to replace the FocalAPI key.
25
+
26
+ Do not run `doctor` or a free rehearsal before a normal business command that has not failed. The Agent should complete the user's creative goal directly and avoid unrelated calls.