focalapi-cli 0.2.0 → 0.2.2
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.
- package/CHANGELOG.md +24 -10
- package/LICENSE +202 -202
- package/README.md +141 -155
- package/dist/cli.js +234 -50
- package/package.json +57 -53
- package/scripts/postinstall.cjs +41 -41
- package/skills/focalapi/SKILL.md +47 -54
- package/skills/focalapi-auth/SKILL.md +28 -30
- package/skills/focalapi-chat/SKILL.md +29 -32
- package/skills/focalapi-gen/SKILL.md +50 -53
- package/skills/focalapi-models/SKILL.md +55 -49
- package/skills/focalapi-task/SKILL.md +25 -25
- package/skills/focalapi-usage/SKILL.md +26 -27
package/skills/focalapi/SKILL.md
CHANGED
|
@@ -1,54 +1,47 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi
|
|
3
|
-
version: 2.0.0
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
focalapi
|
|
30
|
-
focalapi
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
当前已闭环验证的自动生成入口是图片与视频。未来出现音频、3D 或其他模态时,
|
|
50
|
-
只有在 CLI 帮助和 `models get` 同时给出可执行契约后才能调用;不要仅凭模型列表或
|
|
51
|
-
名称推断能力。
|
|
52
|
-
|
|
53
|
-
若业务命令返回 `missing_api_key`,转 focalapi-auth 完成登录后立即回到原任务;
|
|
54
|
-
其他错误只按 `{error.code, error.hint}` 修复一次,不要盲目轮换模型。
|
|
1
|
+
---
|
|
2
|
+
name: focalapi
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Primary router for FocalAPI creative models. Use when the user wants to generate, edit, or process creative media, choose a creative model, or inspect a generation task, even when the user does not mention FocalAPI. Covers automatic image and video model selection, generation, asynchronous continuation, and error routing."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# FocalAPI creative-model routing
|
|
12
|
+
|
|
13
|
+
FocalAPI is a creative-model gateway for the current Agent to call. It is not the Agent's own model or provider. Do not change the Agent's primary model configuration or require the user to say “use FocalAPI” first.
|
|
14
|
+
|
|
15
|
+
## Zero-guesswork execution contract
|
|
16
|
+
|
|
17
|
+
1. If the user does not specify a model, omit `--model`. The CLI selects a FocalAPI default from the live model pool and detailed contracts available to the current key. Do not generate a test sample first.
|
|
18
|
+
2. If the user specifies a model or provider, run `focalapi models get <model-id> --json` first. If the model ID is incomplete, run `models search` once to find the exact ID, then read its details.
|
|
19
|
+
3. Use only parameters and values listed in the detailed `supported_params`. Never infer support from a similar model.
|
|
20
|
+
4. Add `--json` for Agent and script calls. stdout is the only machine-readable result; diagnostics go to stderr.
|
|
21
|
+
5. After successful generation, return local absolute file paths to the user. If a video response contains `task_id`, follow `next_command`; never submit the same task again.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# No model specified: run once without probing models first.
|
|
25
|
+
focalapi gen image "<user prompt>" -o ./focalapi-out --json
|
|
26
|
+
focalapi gen video "<user prompt>" --no-wait -o ./focalapi-out --json
|
|
27
|
+
|
|
28
|
+
# Continue an asynchronous video task.
|
|
29
|
+
focalapi task status <task-id> --json
|
|
30
|
+
focalapi task download <task-id> -o ./focalapi-out --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Routing table
|
|
34
|
+
|
|
35
|
+
| User goal | Entry point | Skill |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Generate or edit images; create from reference images | `focalapi gen image` | focalapi-gen |
|
|
38
|
+
| Generate video; animate images or reference media | `focalapi gen video` | focalapi-gen |
|
|
39
|
+
| Select, compare, or inspect model parameters | `focalapi models resolve/get/search` | focalapi-models |
|
|
40
|
+
| Inspect progress or failures; download results | `focalapi task status/download` | focalapi-task |
|
|
41
|
+
| Resolve key, sign-in, or 401 issues | `focalapi auth status/login` | focalapi-auth |
|
|
42
|
+
| Inspect quota, usage, or service failures | `focalapi usage/doctor` | focalapi-usage |
|
|
43
|
+
| Provide text assistance explicitly requested by the user | `focalapi chat` | focalapi-chat |
|
|
44
|
+
|
|
45
|
+
The fully validated automatic generation paths currently cover images and video. Audio, 3D, or another modality may be used only after both CLI help and `models get` expose an executable contract. Never infer a capability from a model list or name alone.
|
|
46
|
+
|
|
47
|
+
If a business command returns `missing_api_key`, route to focalapi-auth and return to the original task immediately after sign-in. For other errors, follow `{error.code, error.hint}` once; do not rotate models blindly.
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-auth
|
|
3
|
-
version: 2.0.0
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi auth --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm i -g focalapi-cli
|
|
15
|
-
focalapi auth login --key <sk-key>
|
|
16
|
-
focalapi auth status --json
|
|
17
|
-
focalapi connect
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
认证成功后立即重试原业务命令,不要把登录本身当作任务终点。
|
|
1
|
+
---
|
|
2
|
+
name: focalapi-auth
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Handle focalapi-cli installation, first sign-in, key status, and 401/authentication errors. Trigger only during initial setup or when a business command explicitly returns missing_api_key or invalid_api_key. Return to the original creative task after authentication succeeds."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi auth --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# FocalAPI authentication
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i -g focalapi-cli
|
|
15
|
+
focalapi auth login --key <sk-key>
|
|
16
|
+
focalapi auth status --json
|
|
17
|
+
focalapi connect
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Create a key at `https://focalapi.com/console/token`. Never reveal the complete key in a response, log, or echoed command. Prefer `FOCALAPI_API_KEY` in CI and sandbox environments.
|
|
21
|
+
|
|
22
|
+
Do not run `auth status` before every business command. After an authentication error, follow this fixed path:
|
|
23
|
+
|
|
24
|
+
- `missing_api_key`: sign in or set `FOCALAPI_API_KEY`.
|
|
25
|
+
- `invalid_api_key`: ask the user to verify or create a key in the console, then sign in again.
|
|
26
|
+
- `upstream_auth_failed`: the FocalAPI key may be valid. Preserve the request ID and escalate to the service operator; do not repeatedly replace the user's key.
|
|
27
|
+
|
|
28
|
+
Retry the original business command immediately after authentication succeeds. Signing in is not the end of the task.
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-chat
|
|
3
|
-
version: 2.0.0
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi chat --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
focalapi
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
模型列表里出现名称不等于 CLI 已支持调用。当前 Key 没有音频模型契约时应明确说明
|
|
32
|
-
暂不可用,不要尝试相似模型或外部接口。
|
|
1
|
+
---
|
|
2
|
+
name: focalapi-chat
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Supplementary FocalAPI text and audio commands. Use only when the user explicitly requests text assistance through FocalAPI or when the live model contract confirms an available audio model. Route image and video creation to focalapi-gen."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi chat --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Supplementary FocalAPI capabilities
|
|
12
|
+
|
|
13
|
+
This Skill is not the default route for creative requests. Route images, video, image editing, and image-to-video work to `focalapi-gen`.
|
|
14
|
+
|
|
15
|
+
When the user explicitly requests text assistance, get an available text model from the live list before calling it:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
focalapi models list --json
|
|
19
|
+
focalapi chat "<user text task>" -m <text-model-from-list> --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use audio commands only when both `focalapi models get <model-id> --json` and `focalapi audio --help` confirm an executable contract:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
focalapi audio transcribe <file> -m <model-id> --json
|
|
26
|
+
focalapi audio speech "<text>" -m <model-id> -o <file> --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A name appearing in the model list does not prove that the CLI supports calling it. If the current key has no audio model contract, state that audio is unavailable; do not try a similar model or an external API.
|
|
@@ -1,53 +1,50 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-gen
|
|
3
|
-
version: 2.
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi gen --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
focalapi gen image "
|
|
19
|
-
focalapi gen video "
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
CLI
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
focalapi
|
|
31
|
-
focalapi gen
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`pending` / `running` 不是失败;继续查询同一个 `task_id`,不得重新提交生成。
|
|
53
|
-
失败时读取结构化 `error.code` 和 `hint`,只修复明确问题,不盲目换模型。
|
|
1
|
+
---
|
|
2
|
+
name: focalapi-gen
|
|
3
|
+
version: 2.1.0
|
|
4
|
+
description: "Use FocalAPI for image and video generation, image editing, image-to-video, and reference-media creation. Trigger directly when the user asks to draw, generate or edit an image, create video, or animate media, even without naming FocalAPI. Select a model automatically by default and do not probe models first."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi gen --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# FocalAPI image and video generation
|
|
12
|
+
|
|
13
|
+
## Default: select automatically and run once
|
|
14
|
+
|
|
15
|
+
When the user does not specify a model, run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
focalapi gen image "<complete prompt>" -o ./focalapi-out --json
|
|
19
|
+
focalapi gen video "<complete prompt>" --no-wait -o ./focalapi-out --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The CLI selects a default from the live model pool and detailed contracts available to the current key. Do not generate separate samples with a low-cost model, test prompt, or multiple models. Doing so creates unnecessary cost and ambiguity.
|
|
23
|
+
|
|
24
|
+
## Explicit models and advanced parameters
|
|
25
|
+
|
|
26
|
+
When the user names a model, read its live contract once:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
focalapi models get <model-id> --json
|
|
30
|
+
focalapi gen image "<prompt>" -m <model-id> [contract-supported options] -o ./focalapi-out --json
|
|
31
|
+
focalapi gen video "<prompt>" -m <model-id> [contract-supported options] --no-wait -o ./focalapi-out --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Use `--image <url...>` for image editing and reference images. Pass `--mask` only when the contract lists it.
|
|
35
|
+
- Use `--negative-prompt`, `--creativity`, `--prompt-extend`, `--style-references`, and `--moodboards` only when the image contract lists the corresponding field.
|
|
36
|
+
- Use `--image <url...>` for video reference images. Pass duration, resolution, aspect ratio, and audio options only as allowed by `supported_params`.
|
|
37
|
+
- Use `--content '<json-array>'` for models such as MiniMax H3, LTX 2.5, and FLUX 3 when the contract requires role-aware media content. LTX also exposes `--fps`; FLUX 3 exposes `--safety-tolerance`.
|
|
38
|
+
- Never copy one model's `ratio`, `aspect_ratio`, `size`, or `resolution` to another model.
|
|
39
|
+
- Use `gen gemini-image` only when the user explicitly selects a native Gemini image model. Continue to use the automatic `gen image` entry point for ordinary requests.
|
|
40
|
+
|
|
41
|
+
## Complete the result workflow
|
|
42
|
+
|
|
43
|
+
Synchronous image results contain local absolute paths in `files`; return them directly to the user. For asynchronous results, run the returned `next_command`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
focalapi task status <task-id> --json
|
|
47
|
+
focalapi task download <task-id> -o ./focalapi-out --json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`pending` and `running` are not failures. Keep checking the same `task_id` and never resubmit generation. On failure, read the structured `error.code` and `hint`, and fix only the explicit problem instead of rotating models blindly.
|
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-models
|
|
3
|
-
version: 2.
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi models --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
focalapi models resolve image --json
|
|
19
|
-
focalapi models resolve video --json
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
`resolve`
|
|
23
|
-
|
|
24
|
-
- `model.id
|
|
25
|
-
- `endpoint_type
|
|
26
|
-
- `model.supported_params
|
|
27
|
-
- `next_command
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
focalapi models get
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
focalapi models search <keyword> --json
|
|
41
|
-
focalapi models get
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
1. `models get`
|
|
47
|
-
2.
|
|
48
|
-
3.
|
|
49
|
-
4.
|
|
1
|
+
---
|
|
2
|
+
name: focalapi-models
|
|
3
|
+
version: 2.1.0
|
|
4
|
+
description: "Select FocalAPI creative models and inspect live parameter contracts. Use when the user does not specify a model, names a model or provider, compares models, or encounters a generation-parameter error. Use resolve to obtain a callable default and never infer capabilities from names or probe models one by one."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi models --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# FocalAPI model selection
|
|
12
|
+
|
|
13
|
+
## Shortest path
|
|
14
|
+
|
|
15
|
+
When the user does not specify a model, do not list every model or rank them yourself:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
focalapi models resolve image --json
|
|
19
|
+
focalapi models resolve video --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`resolve` reads the live list available to the current key, then reads detailed contracts for candidate models and returns:
|
|
23
|
+
|
|
24
|
+
- `model.id`: the exact ID accepted by generation commands;
|
|
25
|
+
- `endpoint_type`: the generation endpoint verified by model details;
|
|
26
|
+
- `model.supported_params`: available parameters, defaults, enumerations, and ranges;
|
|
27
|
+
- `next_command`: the next command with no guessing required.
|
|
28
|
+
|
|
29
|
+
Omitting `--model` from `focalapi gen image/video` uses the same selection logic internally.
|
|
30
|
+
|
|
31
|
+
## User-selected models
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
focalapi models get <complete-model-id> --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Search once only when the user provides an incomplete provider or family name:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
focalapi models search <keyword> --json
|
|
41
|
+
focalapi models get <selected-complete-id> --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Rules:
|
|
45
|
+
|
|
46
|
+
1. `models get` is authoritative for endpoints and parameters. A list summary may show only a protocol family and cannot be used to infer modality.
|
|
47
|
+
2. Do not send generation requests to models one by one as an availability test. Discovery and detail queries are read-only preflight checks.
|
|
48
|
+
3. If an explicitly selected model is unavailable, present available candidates or return to `models resolve`; never replace it silently.
|
|
49
|
+
4. Return to the user's original generation task after the query instead of stopping at the model list.
|
|
50
|
+
|
|
51
|
+
## Current verified creative families
|
|
52
|
+
|
|
53
|
+
The maintained defaults currently prefer Seedream 5.0, GPT Image 2, Gemini 3.1 Image, Grok Imagine Image 2.0, Kling Image 3.0, Qwen Image 3.0, and Krea 2 for images. Video selection currently covers Seedance 2.5, Kling 3.0, Vidu Q3, Gemini Omni Flash, Grok Imagine Video 1.5, LTX 2.5, FLUX 3, and MiniMax H3.
|
|
54
|
+
|
|
55
|
+
These names are routing context, not permission to guess a model ID. Use the exact canonical ID returned by `models resolve` or `models get`. Removed IDs, including the former Veo 3.1 preview models, must not be retried.
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-task
|
|
3
|
-
version: 2.0.0
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi task --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
focalapi task status <task-id> --json
|
|
17
|
-
focalapi task download <task-id> -o ./focalapi-out --json
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
- `pending`
|
|
21
|
-
- `success
|
|
22
|
-
- `failed
|
|
23
|
-
- `unknown
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
---
|
|
2
|
+
name: focalapi-task
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Continue asynchronous FocalAPI image or video tasks and download their outputs. Use when a generation response contains task_id or next_command, or when the user asks about progress, failure reasons, or result files. Reuse the original task_id and never generate again."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["focalapi"]
|
|
8
|
+
cliHelp: "focalapi task --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Complete asynchronous FocalAPI tasks
|
|
12
|
+
|
|
13
|
+
After a generation command returns `task_id`, prefer the response's `next_command`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
focalapi task status <task-id> --json
|
|
17
|
+
focalapi task download <task-id> -o ./focalapi-out --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- `pending` or `running`: this is still the same valid task. Check it later and do not resubmit generation.
|
|
21
|
+
- `success`: run download, verify that the file exists, and return its absolute path to the user.
|
|
22
|
+
- `failed`: show the upstream error summary and hint. Generate again only when an explicit parameter or content issue requires it.
|
|
23
|
+
- `unknown`: preserve the raw response and run `focalapi doctor --json`; never fabricate a success state.
|
|
24
|
+
|
|
25
|
+
Polling must be bounded. When the user does not ask for blocking wait behavior, report the current status and `task_id`.
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: focalapi-usage
|
|
3
|
-
version: 2.0.0
|
|
4
|
-
description: "
|
|
5
|
-
metadata:
|
|
6
|
-
requires:
|
|
7
|
-
bins: ["focalapi"]
|
|
8
|
-
cliHelp: "focalapi usage --help"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
focalapi usage --json
|
|
15
|
-
focalapi auth status --json
|
|
16
|
-
focalapi doctor --json
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
- `missing_api_key`
|
|
21
|
-
- `insufficient_quota
|
|
22
|
-
- `network_error
|
|
23
|
-
- `invalid_request
|
|
24
|
-
- `upstream_auth_failed
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
目标,减少无关调用。
|
|
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.
|