focalapi-cli 0.2.1 → 0.3.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.
- package/CHANGELOG.md +35 -17
- package/LICENSE +202 -202
- package/README.md +144 -139
- package/dist/cli.js +401 -72
- package/package.json +57 -57
- package/scripts/postinstall.cjs +41 -41
- package/skills/focalapi/SKILL.md +48 -47
- package/skills/focalapi-auth/SKILL.md +28 -28
- package/skills/focalapi-chat/SKILL.md +29 -29
- package/skills/focalapi-gen/SKILL.md +10 -2
- package/skills/focalapi-models/SKILL.md +7 -1
- package/skills/focalapi-task/SKILL.md +29 -25
- package/skills/focalapi-usage/SKILL.md +27 -26
package/README.md
CHANGED
|
@@ -1,139 +1,144 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# focalapi-cli
|
|
4
|
-
|
|
5
|
-
**Give any AI Agent direct access to FocalAPI creative models**
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/focalapi-cli)
|
|
8
|
-
[](./LICENSE)
|
|
9
|
-
[](https://nodejs.org)
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
npm i -g focalapi-cli
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
focalapi-cli turns FocalAPI's creative-model gateway into commands and Skills that an Agent can run directly. Users describe the outcome they want; the Agent does not need to probe models, guess parameters, handcraft requests, or switch platforms first.
|
|
18
|
-
|
|
19
|
-
It does not configure FocalAPI as the Agent's primary model or provider. Agents such as Codex, Claude Code, and Cursor keep their existing reasoning models and call FocalAPI only for creative tasks such as image and video generation.
|
|
20
|
-
|
|
21
|
-
## Connect in three steps
|
|
22
|
-
|
|
23
|
-
```shell
|
|
24
|
-
# 1. Install. Skills are synchronized automatically when lifecycle scripts are allowed.
|
|
25
|
-
npm i -g focalapi-cli
|
|
26
|
-
|
|
27
|
-
# 2. Configure a FocalAPI key.
|
|
28
|
-
focalapi auth login --key sk-xxxx
|
|
29
|
-
|
|
30
|
-
# 3. Connect every detected Agent, then verify the installation. The operation is idempotent.
|
|
31
|
-
focalapi connect
|
|
32
|
-
focalapi connect verify --json
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Create a key at <https://focalapi.com/console/token>. CI and sandbox environments can use `FOCALAPI_API_KEY`; self-hosted deployments can set `FOCALAPI_BASE_URL`.
|
|
36
|
-
|
|
37
|
-
If an npm security policy blocks lifecycle scripts, run `focalapi connect` explicitly. This is also the stable manual integration entry point. Set `FOCALAPI_SKIP_POSTINSTALL=1` to intentionally skip automatic post-install integration.
|
|
38
|
-
|
|
39
|
-
## Zero-guesswork Agent workflows
|
|
40
|
-
|
|
41
|
-
When no model is specified, the CLI reads the live model pool and detailed model contract available to the current key, selects the maintained FocalAPI default, and sends only one real generation request.
|
|
42
|
-
|
|
43
|
-
```shell
|
|
44
|
-
# Automatically select the current default image model.
|
|
45
|
-
focalapi gen image "Product hero image, soft studio lighting" -o ./out --json
|
|
46
|
-
|
|
47
|
-
# Automatically select the current default video model and return a task ID immediately.
|
|
48
|
-
focalapi gen video "Ocean waves hitting rocks, cinematic" --no-wait -o ./out --json
|
|
49
|
-
|
|
50
|
-
# Continue from next_command in the generation response without resubmitting the task.
|
|
51
|
-
focalapi task status <task-id> --json
|
|
52
|
-
focalapi task download <task-id> -o ./out --json
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
focalapi connect
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# focalapi-cli
|
|
4
|
+
|
|
5
|
+
**Give any AI Agent direct access to FocalAPI creative models**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/focalapi-cli)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm i -g focalapi-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
focalapi-cli turns FocalAPI's creative-model gateway into commands and Skills that an Agent can run directly. Users describe the outcome they want; the Agent does not need to probe models, guess parameters, handcraft requests, or switch platforms first.
|
|
18
|
+
|
|
19
|
+
It does not configure FocalAPI as the Agent's primary model or provider. Agents such as Codex, Claude Code, and Cursor keep their existing reasoning models and call FocalAPI only for creative tasks such as image and video generation.
|
|
20
|
+
|
|
21
|
+
## Connect in three steps
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
# 1. Install. Skills are synchronized automatically when lifecycle scripts are allowed.
|
|
25
|
+
npm i -g focalapi-cli
|
|
26
|
+
|
|
27
|
+
# 2. Configure a FocalAPI key.
|
|
28
|
+
focalapi auth login --key sk-xxxx
|
|
29
|
+
|
|
30
|
+
# 3. Connect every detected Agent, then verify the installation. The operation is idempotent.
|
|
31
|
+
focalapi connect
|
|
32
|
+
focalapi connect verify --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create a key at <https://focalapi.com/console/token>. CI and sandbox environments can use `FOCALAPI_API_KEY`; self-hosted deployments can set `FOCALAPI_BASE_URL`.
|
|
36
|
+
|
|
37
|
+
If an npm security policy blocks lifecycle scripts, run `focalapi connect` explicitly. This is also the stable manual integration entry point. Set `FOCALAPI_SKIP_POSTINSTALL=1` to intentionally skip automatic post-install integration.
|
|
38
|
+
|
|
39
|
+
## Zero-guesswork Agent workflows
|
|
40
|
+
|
|
41
|
+
When no model is specified, the CLI reads the live model pool and detailed model contract available to the current key, selects the maintained FocalAPI default, and sends only one real generation request.
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
# Automatically select the current default image model.
|
|
45
|
+
focalapi gen image "Product hero image, soft studio lighting" -o ./out --json
|
|
46
|
+
|
|
47
|
+
# Automatically select the current default video model and return a task ID immediately.
|
|
48
|
+
focalapi gen video "Ocean waves hitting rocks, cinematic" --no-wait -o ./out --json
|
|
49
|
+
|
|
50
|
+
# Continue from next_command in the generation response without resubmitting the task.
|
|
51
|
+
focalapi task status <task-id> --json
|
|
52
|
+
focalapi task download <task-id> -o ./out --json
|
|
53
|
+
|
|
54
|
+
# Stop a task that is still queued; cancelled tasks are refunded automatically.
|
|
55
|
+
focalapi task cancel <task-id> --json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
When the user specifies a model, read its authoritative contract first:
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
focalapi models get <model-id> --json
|
|
62
|
+
focalapi gen image "<prompt>" -m <model-id> [contract-supported options] -o ./out --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The CLI can also resolve a model without generating anything:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
focalapi models resolve image --json
|
|
69
|
+
focalapi models resolve video --json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`resolve` returns the exact `model.id`, verified `endpoint_type`, complete `supported_params`, candidate models, and a `next_command`. When a list summary and detailed contract disagree, the detailed contract is authoritative.
|
|
73
|
+
|
|
74
|
+
The maintained creative defaults are aligned with the current catalog: 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; Seedance 2.5 (480p/720p/1080p), Kling 3.0, Vidu Q3, Gemini Omni Flash, Grok Imagine Video 1.5, LTX 2.5, and FLUX 3 for video. Availability still depends on the current key, so runtime model details always take precedence over this overview.
|
|
75
|
+
|
|
76
|
+
## Agent integration
|
|
77
|
+
|
|
78
|
+
```shell
|
|
79
|
+
focalapi connect # Install or repair every detected Agent.
|
|
80
|
+
focalapi connect list # Inspect supported, detected, and installed targets.
|
|
81
|
+
focalapi connect install codex cursor # Install for selected Agents.
|
|
82
|
+
focalapi connect install --path <dir> # Install to an unlisted or project-level Skills directory.
|
|
83
|
+
focalapi connect verify --json # Verify Skill integrity and authentication readiness.
|
|
84
|
+
focalapi connect uninstall # Remove only managed Skills that the user has not modified.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The built-in catalog currently covers 44 Agent targets, including Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, OpenClaw, Cline, Windsurf, Warp, Trae, Qwen Code, Kimi CLI, and Hermes. Targets such as Codex, Cline, Pi, and Warp that share `~/.agents/skills` are deduplicated by path, so the Skills are installed only once.
|
|
88
|
+
|
|
89
|
+
Installation is transactional: the current `focalapi-*` catalog is written as one unit, and any failed step rolls back the operation. The manifest records a SHA-256 directory digest for each Skill. By default, uninstall removes only managed Skills whose digest has not changed and preserves user-modified content.
|
|
90
|
+
|
|
91
|
+
The Skill routing contract requires Agents to:
|
|
92
|
+
|
|
93
|
+
- trigger FocalAPI for creative tasks even when the user does not name it;
|
|
94
|
+
- omit `--model` when no model is specified, letting the CLI select one without generating test samples;
|
|
95
|
+
- use only the live parameter contract returned by `models get` for an explicitly selected model;
|
|
96
|
+
- reuse the original `task_id` for asynchronous work instead of charging for duplicate submissions while a task is `pending`;
|
|
97
|
+
- return to the original task after resolving an authentication error rather than stopping at diagnostics.
|
|
98
|
+
|
|
99
|
+
## Current capability boundary
|
|
100
|
+
|
|
101
|
+
The fully validated automatic generation paths currently cover images and video, including image editing, reference-image creation, text-to-video, and image-to-video. The CLI retains text and audio commands, but an Agent may use them only when both the live model details and CLI help expose an executable contract. It never infers future audio, 3D, or other modality support from model names alone.
|
|
102
|
+
|
|
103
|
+
## Stable output for Agents
|
|
104
|
+
|
|
105
|
+
- All automation commands support `--json`; stdout contains JSON only, while progress and diagnostics go to stderr.
|
|
106
|
+
- Errors use `{ error: { code, message, hint, request_id? } }`.
|
|
107
|
+
- API keys are always redacted.
|
|
108
|
+
- Image results return local `files`; asynchronous video results return `task_id` and `next_command`.
|
|
109
|
+
- Local validation rejects known invalid billing multipliers and model parameters before sending a request.
|
|
110
|
+
|
|
111
|
+
## Command map
|
|
112
|
+
|
|
113
|
+
| Task | Command |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| Generate images with automatic or explicit model selection | `focalapi gen image` |
|
|
116
|
+
| Generate video with automatic or explicit model selection | `focalapi gen video` |
|
|
117
|
+
| Resolve models and inspect live contracts | `focalapi models resolve/get/search/list` |
|
|
118
|
+
| Check, cancel (queued), and download asynchronous tasks | `focalapi task status/cancel/download` |
|
|
119
|
+
| Sign in and inspect key status | `focalapi auth login/status/logout` |
|
|
120
|
+
| Inspect quota, usage, and diagnostics | `focalapi usage`, `focalapi doctor` |
|
|
121
|
+
| Connect Agent Skills | `focalapi connect` |
|
|
122
|
+
| Make read-only raw API requests | `focalapi request get/head` |
|
|
123
|
+
|
|
124
|
+
Every command includes built-in help: `focalapi <command> --help`.
|
|
125
|
+
|
|
126
|
+
## Development validation
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
npm install
|
|
130
|
+
npx tsc --noEmit
|
|
131
|
+
npm run build
|
|
132
|
+
npm test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Links
|
|
136
|
+
|
|
137
|
+
- FocalAPI: <https://focalapi.com>
|
|
138
|
+
- GitHub: <https://github.com/focalapi/focalapi-cli>
|
|
139
|
+
- npm: <https://www.npmjs.com/package/focalapi-cli>
|
|
140
|
+
- Bundled Skills: [`./skills`](./skills)
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
[Apache-2.0](./LICENSE)
|