pi-clawbay 0.0.17 → 0.0.19

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/README.md CHANGED
@@ -1,77 +1,107 @@
1
1
  # TheClawBay Provider for Pi Coding Agent
2
2
 
3
- `pi-clawbay` is a Pi Coding Agent provider extension for [TheClawBay](https://theclawbay.com). It exposes TheClawBay GPT/Codex models through Pi and includes image generation support through both Codex-style hosted tools and the direct Images API.
3
+ A provider extension for [Pi Coding Agent](https://github.com/earendil-works/pi) that enables access to GPT-5 and Codex models through [TheClawBay](https://theclawbay.com) API.
4
4
 
5
5
  ## Features
6
6
 
7
- - **Single Pi provider:** registers `theclawbay`.
8
- - **Codex Responses transport:** sends requests to TheClawBay's native Codex route over HTTP streaming.
9
- - **Dynamic model discovery:** loads model IDs from TheClawBay's `/v1/models` endpoint and caches successful discovery results.
10
- - **GPT-5.4 variants:** exposes `gpt-5.4` and `gpt-5.4[1m]` as separate Pi selections while remapping both to the upstream `gpt-5.4` model ID.
11
- - **Hosted image generation:** Codex-style `image_generation` hosted tool support exposed as a model tool; the model decides when to call it with `tool_choice: auto`.
12
- - **Direct Images API transport:** manual `gpt-image-2` and `gpt-image-1.5` selections call TheClawBay's documented `/v1/images/generations` endpoint and save returned PNGs locally.
13
- - **Quota command:** adds `/quota` for current TheClawBay usage information.
7
+ - **GPT-5 & Codex Models** - Access via Codex Responses API with session-based prompt cache
8
+ - **Single Provider** - Only `theclawbay` is registered
9
+ - **GPT-5.4 Split Options** - `gpt-5.4` and `gpt-5.4[1m]` for clearer cost/context choice
10
+ - **High Usage Headroom** - More capacity than standard subscriptions
11
+ - **Simple Setup** - Single API key
14
12
 
15
13
  ## Installation
16
14
 
17
- ### Recommended: npm
15
+ ### Recommended: Install from npm
18
16
 
19
17
  ```bash
20
18
  pi install npm:pi-clawbay@latest
21
19
  ```
22
20
 
23
- Use the npm package form above. Do not install `npm:chrislopez24/pi-clawbay`; npm treats that as a GitHub-style dependency and it can leave broken global symlinks.
21
+ This uses the published npm package and avoids npm's GitHub dependency path.
24
22
 
25
- ### Local development
23
+ Do not use:
24
+
25
+ ```bash
26
+ pi install npm:chrislopez24/pi-clawbay
27
+ ```
28
+
29
+ That form is treated as a GitHub install, not a registry package install, and it can leave broken global symlinks behind.
30
+
31
+ ### Local Development
26
32
 
27
33
  ```bash
28
34
  pi -e /path/to/pi-clawbay
29
35
  ```
30
36
 
31
- Use local loading only while developing or testing this extension.
37
+ Use this only while actively developing the extension locally.
32
38
 
33
39
  ## Configuration
34
40
 
41
+ ### Environment Variable
42
+
35
43
  Set your TheClawBay API key:
36
44
 
37
45
  ```bash
38
46
  export THECLAWBAY_API_KEY=your-api-key-here
39
47
  ```
40
48
 
41
- Get an API key from the [TheClawBay Dashboard](https://theclawbay.com).
49
+ Get your API key from [TheClawBay Dashboard](https://theclawbay.com).
42
50
 
43
- ## Provider transport
51
+ ### Available Models
44
52
 
45
- The provider sends `theclawbay/*` requests to TheClawBay's native Codex route:
53
+ Model IDs are discovered dynamically at extension load from:
46
54
 
47
- ```text
48
- https://api.theclawbay.com/backend-api/codex
49
- ```
55
+ - `GET https://api.theclawbay.com/v1/models`
56
+
57
+ If discovery fails or `THECLAWBAY_API_KEY` is not set yet, the extension falls back to the last successful discovery cache, even if it is stale, then to a bundled default list so `/model` still works on startup. Live discovery refreshes the cache in the background after the provider has been registered.
58
+
59
+ Requests for `theclawbay/*` models are sent through TheClawBay's native Codex route:
60
+
61
+ - `https://api.theclawbay.com/backend-api/codex`
50
62
 
51
- The extension uses a custom HTTP streaming Responses transport. It sends:
63
+ This extension uses a custom Responses transport for that route. It sends:
52
64
 
53
65
  - `Authorization: Bearer $THECLAWBAY_API_KEY`
54
66
  - `chatgpt-account-id: theclawbay`
55
- - `originator: pi`
56
- - `OpenAI-Beta: responses=experimental`
57
- - `session_id` when Pi provides a session ID
67
+ - `session_id` when Pi provides a session id
58
68
  - `prompt_cache_key` in the request body
59
69
 
60
- It intentionally does not use Pi's built-in Codex WebSocket transport. That path expects ChatGPT/Codex JWT-style credentials and can fail with normal TheClawBay API keys.
70
+ This avoids Pi's built-in `openai-codex-responses` JWT parsing path, which expects a ChatGPT/Codex-style token and can fail with `Failed to extract accountId from token` when given a normal TheClawBay API key.
61
71
 
62
- ## Model discovery and filtering
72
+ Based on the live docs at `https://theclawbay.com/docs`:
63
73
 
64
- At startup, the extension calls:
74
+ - OpenAI-compatible apps use `https://api.theclawbay.com/v1`
75
+ - Native Codex config uses `https://api.theclawbay.com/backend-api/codex`
76
+ - The docs recommend calling `/models` first and selecting an available model dynamically
65
77
 
66
- ```text
67
- GET https://api.theclawbay.com/v1/models
68
- ```
78
+ ### GPT-5.4 Variants In This Extension
79
+
80
+ The live TheClawBay docs expose `gpt-5.4` as the upstream model. This extension presents it in Pi as two selectable entries:
81
+
82
+ - `theclawbay/gpt-5.4` → standard variant, capped to `272k` context in Pi
83
+ - `theclawbay/gpt-5.4[1m]` → long-context variant, configured to `1,050,000`
84
+
85
+ Internally:
69
86
 
70
- If live discovery fails, it falls back to the last successful cache and then to the bundled default list.
87
+ - `gpt-5.4` stays as-is
88
+ - `gpt-5.4[1m]` is remapped to upstream `gpt-5.4` before the request is sent
71
89
 
72
- Selectable Pi models include GPT/Codex text models plus two explicit image-only entries, `gpt-image-2` and `gpt-image-1.5`. The image entries are selectable manually, but they do not use the chat/Codex transport; they route directly to TheClawBay's Images API.
90
+ Why split it?
73
91
 
74
- ### Default fallback models
92
+ - `gpt-5.4` is the cheaper/default option
93
+ - `gpt-5.4[1m]` gives explicit access to long context
94
+ - both end up using the same official upstream model id from TheClawBay
95
+
96
+ ### Model Limits
97
+
98
+ - `gpt-5.4` is configured with a `272,000` token context window.
99
+ - `gpt-5.4[1m]` is configured with a `1,050,000` token context window.
100
+ - Current non-5.4 GPT-5/Codex variants default to `272,000` context and `128,000` max output tokens.
101
+
102
+ ### Example Model List
103
+
104
+ Current fallback list in this package:
75
105
 
76
106
  - `gpt-5.5`
77
107
  - `gpt-5.4`
@@ -82,202 +112,135 @@ Selectable Pi models include GPT/Codex text models plus two explicit image-only
82
112
  - `gpt-5.2`
83
113
  - `gpt-5.1-codex-max`
84
114
  - `gpt-5.1-codex-mini`
85
- - `gpt-image-2`
86
- - `gpt-image-1.5`
87
-
88
- ### GPT-5.4 variants
89
115
 
90
- The upstream TheClawBay model ID is `gpt-5.4`. This extension exposes two Pi entries for clearer cost/context selection:
116
+ Image-generation models returned by discovery, such as `gpt-image-*`, are intentionally hidden from `/model` until this extension has a dedicated, tested image-generation flow.
91
117
 
92
- | Pi model | Upstream model | Context configured in Pi |
93
- |----------|----------------|--------------------------|
94
- | `theclawbay/gpt-5.4` | `gpt-5.4` | `272,000` tokens |
95
- | `theclawbay/gpt-5.4[1m]` | `gpt-5.4` | `1,050,000` tokens |
96
-
97
- Other GPT/Codex fallback models use a `272,000` token context window and `128,000` max output tokens.
98
-
99
- ## Image generation
100
-
101
- `pi-clawbay` supports two image-generation flows. Prefer the Codex-style hosted tool from a text/Codex model; select a `gpt-image-*` model only when you explicitly want the direct Images API transport documented at <https://theclawbay.com/docs#image-generation>.
118
+ ## Usage
102
119
 
103
- The provider follows Codex CLI's hosted-tool pattern: for image-capable TheClawBay models, it exposes the hosted `image_generation` tool in the Responses payload and lets the model decide when to call it with `tool_choice: auto`. Normal coding and text requests still return regular assistant text; they do not produce an `image_generation_call` unless the model intentionally uses the hosted tool.
120
+ ### Select a Model
104
121
 
105
- Select a text/Codex model, for example:
122
+ Use `/model` command in pi:
106
123
 
107
124
  ```text
108
125
  /model theclawbay/gpt-5.5
126
+ /model theclawbay/gpt-5.4
127
+ /model theclawbay/gpt-5.4[1m]
109
128
  ```
110
129
 
111
- Ask for an image naturally:
112
-
113
- ```text
114
- Generate a minimalist black sailboat icon on a white background. No text.
115
- ```
116
-
117
- The hosted Responses tool definition is:
118
-
119
- ```json
120
- { "type": "image_generation", "output_format": "png" }
121
- ```
130
+ ### Commands
122
131
 
123
- The stream parser handles `image_generation_call` items, decodes the returned base64 PNG, and saves it to:
132
+ This extension currently registers:
124
133
 
125
134
  ```text
126
- ~/.pi/agent/generated_images/<session_id>/<image_generation_call_id>.png
127
- ```
128
-
129
- The assistant response includes:
130
-
131
- - a `file://` URL
132
- - the filesystem path
133
- - the revised prompt, when returned by TheClawBay
134
-
135
- ### Environment controls
136
-
137
- To disable hosted image generation entirely, use:
138
-
139
- ```bash
140
- export PI_CLAWBAY_IMAGE_GENERATION=off
141
- ```
142
-
143
- Override the output root when needed:
144
-
145
- ```bash
146
- export PI_CLAWBAY_GENERATED_IMAGES_DIR=/absolute/output/dir
135
+ /quota
136
+ /clawbay-quota
137
+ /clawbay-refresh-models
147
138
  ```
148
139
 
149
- ### Manual Direct Images API flow
140
+ `/quota` and `/clawbay-quota` show current usage. `/clawbay-refresh-models` refreshes live model discovery, updates the local cache, and re-registers the provider without needing `/reload`.
150
141
 
151
- For explicit direct Images API usage, select one of the image models:
142
+ `/cachehit` was removed.
152
143
 
153
- ```text
154
- /model theclawbay/gpt-image-2
155
- /model theclawbay/gpt-image-1.5
156
- ```
144
+ ### Programmatic Usage
157
145
 
158
- These models are not sent through the Codex chat endpoint. `streamSimple` calls:
146
+ ```typescript
147
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
159
148
 
160
- ```text
161
- POST https://api.theclawbay.com/v1/images/generations
162
- ```
163
-
164
- with the documented payload shape:
165
-
166
- ```json
167
- {
168
- "model": "gpt-image-2",
169
- "prompt": "A minimalist black sailboat icon on a white background. No text.",
170
- "size": "1024x1024",
171
- "quality": "low",
172
- "output_format": "png"
149
+ export default function (pi: ExtensionAPI) {
150
+ // After loading this extension, models are available:
151
+ // - theclawbay/gpt-5.5
152
+ // - theclawbay/gpt-5.4
153
+ // - theclawbay/gpt-5.4[1m]
154
+ // - theclawbay/gpt-5.4-mini
155
+ // - theclawbay/gpt-5.3-codex
173
156
  }
174
157
  ```
175
158
 
176
- The provider decodes `data[0].b64_json`, saves a PNG under `~/.pi/agent/generated_images/<session_id>/`, and returns the `file://` URL, path, and `revised_prompt` when present.
177
-
178
- The valid TheClawBay image model IDs exposed here are `gpt-image-2` and `gpt-image-1.5`. `gpt-image-2.0` is not a valid model ID.
159
+ ## API Reference
179
160
 
180
- ### Skill guidance
161
+ ### Endpoints
181
162
 
182
- This package includes a Pi skill:
183
-
184
- ```text
185
- theclawbay-imagegen
186
- ```
163
+ | Provider | Base URL | API Type |
164
+ |----------|----------|----------|
165
+ | `theclawbay` | `https://api.theclawbay.com/backend-api/codex` | OpenAI Codex Responses |
187
166
 
188
- The skill documents the recommended image-generation workflow and fallback behavior. It is helpful guidance for the agent, but it is not a separate runtime requirement. The provider stream implements the actual hosted image generation support.
167
+ ### Authentication
189
168
 
190
- If needed, load it explicitly inside Pi:
169
+ All requests use Bearer token authentication:
191
170
 
192
171
  ```text
193
- /skill:theclawbay-imagegen
172
+ Authorization: Bearer THECLAWBAY_API_KEY
194
173
  ```
195
174
 
196
- ### Direct Images API outside Pi
197
-
198
- For programmatic image generation outside the Pi provider loop, call TheClawBay's OpenAI-compatible Images API directly:
175
+ ### Quota Checking
199
176
 
200
- ```http
201
- POST https://api.theclawbay.com/v1/images/generations
202
- Authorization: Bearer $THECLAWBAY_API_KEY
203
- Content-Type: application/json
204
- ```
205
-
206
- Example payload:
177
+ Check your current usage:
207
178
 
208
- ```json
209
- {
210
- "model": "gpt-image-2",
211
- "prompt": "A minimalist black sailboat icon on a white background. No text.",
212
- "size": "1024x1024",
213
- "quality": "low",
214
- "output_format": "png"
215
- }
179
+ ```bash
180
+ curl "https://theclawbay.com/api/codex-auth/v1/quota" \
181
+ -H "Authorization: Bearer $THECLAWBAY_API_KEY"
216
182
  ```
217
183
 
218
- Use the direct API outside Pi only when you need your own programmatic integration or when hosted generation is unavailable. Inside Pi, selecting `theclawbay/gpt-image-2` or `theclawbay/gpt-image-1.5` uses this same endpoint automatically.
184
+ ## Error Handling
219
185
 
220
- ## Usage
186
+ Common error codes:
221
187
 
222
- ### Select a model
188
+ | Code | Description |
189
+ |------|-------------|
190
+ | `weekly_cost_limit_reached` | Weekly spend cap hit |
191
+ | `5h_cost_limit_reached` | 5-hour spend cap hit |
192
+ | `invalid_api_key` | Key missing or malformed |
193
+ | `model_not_found` | Requested model unavailable |
223
194
 
224
- ```text
225
- /model theclawbay/gpt-5.5
226
- /model theclawbay/gpt-5.4
227
- /model theclawbay/gpt-5.4[1m]
228
- ```
195
+ ## Debugging and Verification
229
196
 
230
- ### Commands
197
+ Enable extension debug logs with:
231
198
 
232
- ```text
233
- /quota
199
+ ```bash
200
+ PI_CLAWBAY_DEBUG=1 pi --no-extensions -e /path/to/pi-clawbay --model theclawbay/gpt-5.4 --thinking low -p "Respond with OK only."
234
201
  ```
235
202
 
236
- `/quota` shows current TheClawBay usage windows and reset times.
203
+ Useful smoke checks:
237
204
 
238
- ## API reference
239
-
240
- | Provider | Base URL | API type |
241
- |----------|----------|----------|
242
- | `theclawbay` | `https://api.theclawbay.com/backend-api/codex` | Responses over HTTP streaming |
205
+ ```bash
206
+ # Model registration and hidden image models
207
+ PI_CLAWBAY_DEBUG=1 pi --no-extensions -e /path/to/pi-clawbay --list-models theclawbay
243
208
 
244
- All provider requests use Bearer token authentication:
209
+ # Basic reasoning/cache path
210
+ PI_CLAWBAY_DEBUG=1 pi --no-extensions -e /path/to/pi-clawbay --model theclawbay/gpt-5.4 --thinking low --no-session -p "Say OK and nothing else."
245
211
 
246
- ```text
247
- Authorization: Bearer $THECLAWBAY_API_KEY
212
+ # Tool-call path
213
+ PI_CLAWBAY_DEBUG=1 pi --no-extensions -e /path/to/pi-clawbay --model theclawbay/gpt-5.4 --thinking low --tools ls -p "Use the ls tool on the current directory, then summarize whether package.json exists."
248
214
  ```
249
215
 
250
- Quota endpoint:
216
+ ## Troubleshooting
251
217
 
252
- ```bash
253
- curl "https://theclawbay.com/api/codex-auth/v1/quota" \
254
- -H "Authorization: Bearer $THECLAWBAY_API_KEY"
255
- ```
218
+ - `THECLAWBAY_API_KEY is not set`: export a valid key before selecting `theclawbay/*` models.
219
+ - `401` or `invalid_api_key`: verify the key in the TheClawBay dashboard and in your shell environment.
220
+ - `429`, `weekly_cost_limit_reached`, or `5h_cost_limit_reached`: run `/quota` or `/clawbay-quota` and wait for the reset window.
221
+ - Model missing from `/model`: run `/clawbay-refresh-models`; if discovery still omits it, TheClawBay may not expose it for your account.
222
+ - `gpt-image-*` missing: image-generation models are intentionally hidden until this extension has a dedicated tested image flow.
256
223
 
257
- ## Build and test
224
+ ## Building
258
225
 
259
226
  ```bash
260
227
  npm install
261
- npm run check
262
- npm test
228
+ npm run build
263
229
  npm pack --dry-run
264
230
  ```
265
231
 
266
232
  ## Publishing
267
233
 
268
- Publishing is handled by the GitHub Actions workflow in `.github/workflows/publish.yml`.
269
-
270
- Manual local publishing is not recommended. Use the workflow so npm provenance is attached:
271
-
272
234
  ```bash
273
- gh workflow run publish.yml --ref main
235
+ npm version patch
236
+ npm publish
274
237
  ```
275
238
 
276
239
  ## Resources
277
240
 
278
241
  - [TheClawBay Docs](https://theclawbay.com/docs)
279
242
  - [TheClawBay Dashboard](https://theclawbay.com)
280
- - [Pi Custom Provider Docs](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/custom-provider.md)
243
+ - [Pi Custom Provider Docs](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/custom-provider.md)
281
244
 
282
245
  ## License
283
246
 
@@ -0,0 +1,33 @@
1
+ import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
2
+ export declare const THECLAWBAY_OPENAI_DISCOVERY_BASE_URL = "https://api.theclawbay.com/v1";
3
+ export declare const THECLAWBAY_CODEX_BASE_URL = "https://api.theclawbay.com/backend-api/codex";
4
+ export declare const THECLAWBAY_QUOTA_URL = "https://theclawbay.com/api/codex-auth/v1/quota";
5
+ export declare const THECLAWBAY_OPENAI_MODELS_URL = "https://api.theclawbay.com/v1/models";
6
+ export declare const THECLAWBAY_CODEX_API = "theclawbay-codex-responses";
7
+ export declare const THECLAWBAY_CHATGPT_ACCOUNT_ID = "theclawbay";
8
+ export declare const MODEL_CACHE_VERSION = 1;
9
+ export declare const MODEL_CACHE_TTL_MS: number;
10
+ export declare const MODEL_DISCOVERY_TIMEOUT_MS = 10000;
11
+ export declare const GPT_54_UPSTREAM_MODEL_ID = "gpt-5.4";
12
+ export declare const GPT_54_DEFAULT_MODEL_ID = "gpt-5.4";
13
+ export declare const GPT_54_1M_MODEL_ID = "gpt-5.4[1m]";
14
+ export declare const MODEL_INPUTS: readonly ["text", "image"];
15
+ export declare const OPENAI_CODEX_THINKING_LEVEL_MAP: {
16
+ readonly xhigh: "xhigh";
17
+ readonly minimal: "low";
18
+ };
19
+ export declare const ZERO_COST: {
20
+ readonly input: 0;
21
+ readonly output: 0;
22
+ readonly cacheRead: 0;
23
+ readonly cacheWrite: 0;
24
+ };
25
+ export declare const OPENAI_KNOWN_COSTS: Record<string, ProviderModelConfig["cost"]>;
26
+ export declare const OPENAI_CODEX_CONTEXT_WINDOW = 272000;
27
+ export declare const OPENAI_DEFAULT_CONTEXT_WINDOW = 272000;
28
+ export declare const OPENAI_FRONTIER_CONTEXT_WINDOW = 1050000;
29
+ export declare const OPENAI_DEFAULT_MAX_TOKENS = 128000;
30
+ export declare const HIDDEN_MODEL_ID_PREFIXES: readonly ["gpt-image-"];
31
+ export declare const PINNED_MODEL_IDS: string[];
32
+ export declare const FALLBACK_OPENAI_MODEL_IDS: string[];
33
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAO,MAAM,oCAAoC,kCAAkC,CAAC;AACpF,eAAO,MAAM,yBAAyB,iDAAiD,CAAC;AACxF,eAAO,MAAM,oBAAoB,mDAAmD,CAAC;AACrF,eAAO,MAAM,4BAA4B,yCAAmD,CAAC;AAC7F,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AACjE,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAE1D,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,kBAAkB,QAAqB,CAAC;AACrD,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD,eAAO,MAAM,YAAY,4BAA6B,CAAC;AACvD,eAAO,MAAM,+BAA+B;;;CAA8C,CAAC;AAC3F,eAAO,MAAM,SAAS;;;;;CAAgE,CAAC;AACvF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAU1E,CAAC;AACF,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,6BAA6B,SAA8B,CAAC;AACzE,eAAO,MAAM,8BAA8B,UAAU,CAAC;AACtD,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAEhD,eAAO,MAAM,wBAAwB,yBAA0B,CAAC;AAChE,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAAO,CAAC;AAC7C,eAAO,MAAM,yBAAyB,UAUrC,CAAC"}
@@ -0,0 +1,44 @@
1
+ export const THECLAWBAY_OPENAI_DISCOVERY_BASE_URL = "https://api.theclawbay.com/v1";
2
+ export const THECLAWBAY_CODEX_BASE_URL = "https://api.theclawbay.com/backend-api/codex";
3
+ export const THECLAWBAY_QUOTA_URL = "https://theclawbay.com/api/codex-auth/v1/quota";
4
+ export const THECLAWBAY_OPENAI_MODELS_URL = `${THECLAWBAY_OPENAI_DISCOVERY_BASE_URL}/models`;
5
+ export const THECLAWBAY_CODEX_API = "theclawbay-codex-responses";
6
+ export const THECLAWBAY_CHATGPT_ACCOUNT_ID = "theclawbay";
7
+ export const MODEL_CACHE_VERSION = 1;
8
+ export const MODEL_CACHE_TTL_MS = 6 * 60 * 60 * 1000;
9
+ export const MODEL_DISCOVERY_TIMEOUT_MS = 10_000;
10
+ export const GPT_54_UPSTREAM_MODEL_ID = "gpt-5.4";
11
+ export const GPT_54_DEFAULT_MODEL_ID = "gpt-5.4";
12
+ export const GPT_54_1M_MODEL_ID = "gpt-5.4[1m]";
13
+ export const MODEL_INPUTS = ["text", "image"];
14
+ export const OPENAI_CODEX_THINKING_LEVEL_MAP = { xhigh: "xhigh", minimal: "low" };
15
+ export const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
16
+ export const OPENAI_KNOWN_COSTS = {
17
+ "gpt-5.5": { input: 5.0, output: 30.0, cacheRead: 0.5, cacheWrite: 5.0 },
18
+ [GPT_54_DEFAULT_MODEL_ID]: { input: 2.5, output: 15.0, cacheRead: 0.25, cacheWrite: 2.5 },
19
+ [GPT_54_1M_MODEL_ID]: { input: 5.0, output: 22.5, cacheRead: 0.5, cacheWrite: 5.0 },
20
+ "gpt-5.4-mini": { input: 1.25, output: 10.0, cacheRead: 0.125, cacheWrite: 1.25 },
21
+ "gpt-5.3-codex": { input: 1.75, output: 14.0, cacheRead: 0.175, cacheWrite: 1.75 },
22
+ "gpt-5.2-codex": { input: 1.75, output: 14.0, cacheRead: 0.175, cacheWrite: 1.75 },
23
+ "gpt-5.2": { input: 1.75, output: 14.0, cacheRead: 0.175, cacheWrite: 1.75 },
24
+ "gpt-5.1-codex-max": { input: 1.25, output: 10.0, cacheRead: 0.125, cacheWrite: 1.25 },
25
+ "gpt-5.1-codex-mini": { input: 0.25, output: 2.0, cacheRead: 0.025, cacheWrite: 0.25 },
26
+ };
27
+ export const OPENAI_CODEX_CONTEXT_WINDOW = 272000;
28
+ export const OPENAI_DEFAULT_CONTEXT_WINDOW = OPENAI_CODEX_CONTEXT_WINDOW;
29
+ export const OPENAI_FRONTIER_CONTEXT_WINDOW = 1050000;
30
+ export const OPENAI_DEFAULT_MAX_TOKENS = 128000;
31
+ export const HIDDEN_MODEL_ID_PREFIXES = ["gpt-image-"];
32
+ export const PINNED_MODEL_IDS = [];
33
+ export const FALLBACK_OPENAI_MODEL_IDS = [
34
+ "gpt-5.5",
35
+ GPT_54_DEFAULT_MODEL_ID,
36
+ GPT_54_1M_MODEL_ID,
37
+ "gpt-5.4-mini",
38
+ "gpt-5.3-codex",
39
+ "gpt-5.2-codex",
40
+ "gpt-5.2",
41
+ "gpt-5.1-codex-max",
42
+ "gpt-5.1-codex-mini",
43
+ ];
44
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"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"}
package/dist/index.d.ts CHANGED
@@ -16,6 +16,6 @@
16
16
  *
17
17
  * Get your API key at: https://theclawbay.com
18
18
  */
19
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
19
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
20
20
  export default function (pi: ExtensionAPI): void;
21
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAqBH,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,+BAA+B,CAAC;AA8mCvF,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QAsCxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAoBpE,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,GAAG,IAAI,CAiB/C"}