@diegopetrucci/pi-fast 0.1.9 → 0.1.10
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 +16 -9
- package/index.ts +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A pi extension that provides `/fast` and `/ultrafast` toggles for supported direct OpenAI API, OpenAI Codex, and Anthropic Claude models. It selects the provider-specific Fast-mode request shape from the currently selected model.
|
|
4
4
|
|
|
5
|
-
For eligible direct OpenAI API models it injects:
|
|
5
|
+
For eligible direct OpenAI API-key models it injects:
|
|
6
6
|
|
|
7
7
|
```json
|
|
8
8
|
{
|
|
@@ -10,6 +10,14 @@ For eligible direct OpenAI API models it injects:
|
|
|
10
10
|
}
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
For eligible direct OpenAI ChatGPT OAuth models it injects:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"service_tier": "priority"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
13
21
|
For eligible OpenAI Codex OAuth models it injects:
|
|
14
22
|
|
|
15
23
|
```json
|
|
@@ -39,16 +47,15 @@ Direct OpenAI API Fast mode requires all of the following:
|
|
|
39
47
|
- Provider `openai`.
|
|
40
48
|
- API `openai-responses` or `openai-completions`.
|
|
41
49
|
- Model `gpt-6.1-sol`, `gpt-6-astra`, `gpt-6-sol`, or `gpt-6-luna`.
|
|
42
|
-
- API-key auth
|
|
50
|
+
- API-key auth sets `service_tier: "fast"`; Pi's `openai` ChatGPT OAuth sets `priority`.
|
|
43
51
|
- No existing `service_tier` field in the request payload.
|
|
44
52
|
|
|
45
|
-
The direct OpenAI route stays on OpenAI's direct API contract
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
and request payloads, not live or paid provider calls.
|
|
53
|
+
The direct OpenAI route stays on OpenAI's direct API contract but selects the tier by auth
|
|
54
|
+
type. OAuth uses `priority` because its endpoint rejected `fast`; acceptance or application
|
|
55
|
+
of `priority` on Pi's OAuth endpoint has not been live-verified. This direct route is never
|
|
56
|
+
forwarded to legacy `openai-codex` or its subscription-usage endpoint. The request shape is
|
|
57
|
+
support evidence, not certification; tests use mocked eligibility and payloads only, with
|
|
58
|
+
no live or paid provider calls.
|
|
52
59
|
|
|
53
60
|
### Ultrafast support (initial, fail-closed)
|
|
54
61
|
|
package/index.ts
CHANGED
|
@@ -155,7 +155,7 @@ function describeMode(state: SessionState): string {
|
|
|
155
155
|
return state.config.enabled ? "on (config default)" : "off (config default)";
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
function getEligibility(ctx: ExtensionContext): Eligibility {
|
|
158
|
+
function getEligibility(ctx: ExtensionContext, includeServiceTier = true): Eligibility {
|
|
159
159
|
const model = ctx.model;
|
|
160
160
|
if (!model) {
|
|
161
161
|
return { eligible: false, modelKey: "no-model", reason: "no model is selected" };
|
|
@@ -237,7 +237,11 @@ function getEligibility(ctx: ExtensionContext): Eligibility {
|
|
|
237
237
|
eligible: true,
|
|
238
238
|
modelKey: key,
|
|
239
239
|
provider: "openai",
|
|
240
|
-
serviceTier:
|
|
240
|
+
serviceTier: includeServiceTier
|
|
241
|
+
? ctx.modelRegistry.isUsingOAuth(model)
|
|
242
|
+
? OPENAI_FAST_SERVICE_TIER
|
|
243
|
+
: OPENAI_API_FAST_SERVICE_TIER
|
|
244
|
+
: undefined,
|
|
241
245
|
};
|
|
242
246
|
}
|
|
243
247
|
|
|
@@ -328,7 +332,7 @@ function updateStatus(ctx: ExtensionContext, state: SessionState): void {
|
|
|
328
332
|
return;
|
|
329
333
|
}
|
|
330
334
|
|
|
331
|
-
const eligibility = getEligibility(ctx);
|
|
335
|
+
const eligibility = getEligibility(ctx, false);
|
|
332
336
|
ctx.ui.setStatus(EXTENSION_ID, isFastEnabled(state) && eligibility.eligible ? "fast" : undefined);
|
|
333
337
|
}
|
|
334
338
|
|
|
@@ -346,7 +350,7 @@ function getStatusMessage(ctx: ExtensionContext, state: SessionState): string {
|
|
|
346
350
|
}
|
|
347
351
|
|
|
348
352
|
const enabled = isFastEnabled(state);
|
|
349
|
-
const eligibility = getEligibility(ctx);
|
|
353
|
+
const eligibility = getEligibility(ctx, enabled);
|
|
350
354
|
const active = enabled && eligibility.eligible;
|
|
351
355
|
|
|
352
356
|
if (active) {
|
|
@@ -405,7 +409,7 @@ async function injectAnthropicFastHeader(
|
|
|
405
409
|
hasActiveTools: boolean,
|
|
406
410
|
): Promise<void> {
|
|
407
411
|
if (state.ultrafast || !isFastEnabled(state)) return;
|
|
408
|
-
const eligibility = getEligibility(ctx);
|
|
412
|
+
const eligibility = getEligibility(ctx, false);
|
|
409
413
|
if (!eligibility.eligible || eligibility.provider !== "anthropic") return;
|
|
410
414
|
|
|
411
415
|
const matchingKeys = Object.keys(headers).filter(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopetrucci/pi-fast",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "A pi extension that enables Fast mode for supported direct OpenAI API, OpenAI Codex, and Anthropic Claude models based on the currently selected model.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|