@tduyng/pi-commandcode 0.0.2 → 0.0.4

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.
Files changed (2) hide show
  1. package/README.md +45 -26
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,11 +1,25 @@
1
- # pi-commandcode
1
+ # @tduyng/pi-commandcode
2
2
 
3
- Command Code models in Pi through the documented Provider API. Unofficial: this extension is not made or endorsed by Command Code.
3
+ Command Code models as a pi provider, through the documented Provider API, with pi's own prompt, tools and approvals. Unofficial: not made or endorsed by Command Code.
4
4
 
5
- ## Requirements
5
+ No tools, no prompt block, no schema, and the adapters add no round trip of their own.
6
6
 
7
- - A Command Code API key from a plan with API access: GOAT, Pro, Max, Team or Provider. The Go and $1 plans have no API access.
8
- - Pi 1.4 or newer.
7
+ ## No transport of its own
8
+
9
+ Streaming, tool calls and message conversion are pi's built-in adapters. The extension supplies a provider id, a base URL, a key reference, a catalog and a per-model wire choice, so there is no request code to drift from pi's own.
10
+
11
+ The wire follows the model. Claude models use Anthropic Messages, which is what they speak, and everything else uses OpenAI Chat Completions. That choice is the difference between a working model and a 400.
12
+
13
+ | Model id | Wire | Base URL |
14
+ | --- | --- | --- |
15
+ | `claude-*` | Anthropic Messages, `/provider/v1/messages` | `https://api.commandcode.ai/provider` |
16
+ | everything else | OpenAI Chat Completions, `/provider/v1/chat/completions` | `https://api.commandcode.ai/provider/v1` |
17
+
18
+ The key goes as a Bearer token for Chat Completions and as `x-api-key` for Messages, as the Provider API documents. `typesafe/*` decision models are left out because they run on a separate endpoint and never stream.
19
+
20
+ ## The catalog is a cache
21
+
22
+ The extension reads the model list from `https://api.commandcode.ai/provider/v1/models` and writes it to `<agent-dir>/commandcode-models.json`. A session starts from that file and fetches only when it is missing or when `/model` refreshes, so a cold start does not wait on the network and an offline session still lists the models it had.
9
23
 
10
24
  ## Use
11
25
 
@@ -14,38 +28,43 @@ export COMMAND_CODE_API_KEY="user_..."
14
28
  pi --provider commandcode --model claude-opus-5
15
29
  ```
16
30
 
17
- Inside Pi, `/model` lists every `commandcode` model. The list is fetched from `https://api.commandcode.ai/provider/v1/models` at startup, and again each time the model selector opens.
31
+ Inside pi, `/model` lists every `commandcode` model. The list refreshes each time the selector opens, with the cache as the offline answer.
18
32
 
19
- ## How it works
33
+ ## Install
20
34
 
21
- | Model id | Wire | Base URL |
22
- | --- | --- | --- |
23
- | `claude-*` | Anthropic Messages, `/provider/v1/messages` | `https://api.commandcode.ai/provider` |
24
- | everything else | OpenAI Chat Completions, `/provider/v1/chat/completions` | `https://api.commandcode.ai/provider/v1` |
35
+ - An API key from a plan with API access: GOAT, Pro, Max, Team or Provider. The Go and $1 plans have no API access.
36
+ - Pi 1.4 or newer.
37
+ - Network access to `api.commandcode.ai` with a 10 second fetch timeout.
25
38
 
26
- Streaming, tool calls and message conversion are Pi's own adapters. The extension sends the key as a Bearer token for Chat Completions and as `x-api-key` for Messages, as the Provider API documents.
39
+ ```bash
40
+ pi install npm:@tduyng/pi-commandcode
41
+ ```
27
42
 
28
- `typesafe/*` decision models are left out because they run on a separate endpoint and never stream.
43
+ Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-commandcode`
29
44
 
30
- ## Configuration
45
+ ```sh
46
+ export COMMAND_CODE_API_KEY="user_..."
47
+ ```
31
48
 
32
49
  | Variable | Meaning |
33
50
  | --- | --- |
34
- | `COMMAND_CODE_API_KEY` | Provider API key. Required for requests. |
35
- | `CMD_ZDR=1` | Sends `x-cmd-zdr: 1`, so requests go only to zero-data-retention upstreams. A model without one fails with HTTP 422. |
51
+ | `COMMAND_CODE_API_KEY` | Provider API key, required for requests |
52
+ | `CMD_ZDR=1` | Sends `x-cmd-zdr: 1`, so requests go only to zero-data-retention upstreams. A model without one fails with HTTP 422 |
36
53
 
37
54
  ## Limits
38
55
 
39
- - The catalog has no image or price metadata, so every model is text-only and shows zero cost in Pi.
40
- - Thinking is on for every model. Pi levels map to the gateway's `reasoning_effort` values, `minimal` sends `low`. `off` is offered only for the DeepSeek ids that accept it, because a model that cannot stop thinking rejects `off` with HTTP 400 and leaves the level out everywhere else.
41
- - Claude 4.6 and newer use adaptive thinking, the 4.5 models take a thinking budget.
42
- - Every model gets a 32768 output limit, the smallest limit in the Command Code CLI catalog. Per-model limits are not in the Provider API.
56
+ - The catalog carries no image or price metadata, so every model is text-only and shows zero cost in pi.
57
+
58
+ - Thinking is on for every model, and pi levels map to `reasoning_effort` with `minimal` sending `low`.
59
+
60
+ - `off` is offered only for the DeepSeek ids that accept it, because a model that cannot stop thinking rejects `off` with HTTP 400.
61
+
62
+ - Claude 4.6 and newer use adaptive thinking, and the 4.5 models take a thinking budget.
63
+
64
+ - Every model gets a 32768 output limit, the smallest in the Command Code CLI catalog, because per-model limits are not in the Provider API.
65
+
43
66
  - Chat Completions is used for every non-Claude model, as the docs say. A model that rejects that wire returns its own error.
44
- - Messages requests carry Pi's `?beta=true` query string, added by the Anthropic SDK.
45
- - If no models appear, check the network and the key, then open `/model` again.
46
67
 
47
- ## Tests
68
+ - Messages requests carry pi's `?beta=true` query string, added by the Anthropic SDK.
48
69
 
49
- ```sh
50
- bun test extensions/pi-commandcode
51
- ```
70
+ - If no models appear, check the network and the key, then open `/model` again.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tduyng/pi-commandcode",
3
- "version": "0.0.2",
4
- "description": "Use Command Code models in Pi through the documented Provider API, with Pi's own prompt and tools.",
3
+ "version": "0.0.4",
4
+ "description": "Command Code models in Pi through the documented Provider API, with Pi's own prompt and tools.",
5
5
  "keywords": [
6
6
  "pi",
7
7
  "pi-package",