@diegopetrucci/pi-extensions 0.1.70 → 0.1.71

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
@@ -13,7 +13,7 @@ A collection of [pi](https://pi.dev) agent extensions I made. (Btw, [I am also b
13
13
 
14
14
  ### Providers
15
15
 
16
- - [`fast`](./extensions/fast): Adds one `/fast` toggle that enables the provider-specific Fast mode for the currently selected supported OpenAI Codex or Anthropic Claude model.
16
+ - [`fast`](./extensions/fast): Adds one `/fast` toggle that enables the provider-specific Fast mode for the currently selected supported direct OpenAI API, OpenAI Codex, or Anthropic Claude model.
17
17
 
18
18
  ### UI
19
19
 
@@ -1,8 +1,16 @@
1
1
  # fast
2
2
 
3
- A pi extension that provides one `/fast` toggle for supported OpenAI Codex and Anthropic Claude models. It selects the provider-specific Fast-mode request shape from the currently selected model.
3
+ A pi extension that provides one `/fast` toggle 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 OpenAI Codex models it injects:
5
+ For eligible direct OpenAI API models it injects:
6
+
7
+ ```json
8
+ {
9
+ "service_tier": "fast"
10
+ }
11
+ ```
12
+
13
+ For eligible OpenAI Codex OAuth models it injects:
6
14
 
7
15
  ```json
8
16
  {
@@ -26,7 +34,14 @@ anthropic-beta: fast-mode-2026-02-01
26
34
 
27
35
  ## Eligibility
28
36
 
29
- OpenAI Fast mode requires all of the following:
37
+ Direct OpenAI API Fast mode requires all of the following:
38
+
39
+ - Provider `openai`.
40
+ - API `openai-responses` or `openai-completions`.
41
+ - Model `gpt-6-astra`, `gpt-6-sol`, or `gpt-6-luna`.
42
+ - No existing `service_tier` field in the request payload.
43
+
44
+ OpenAI Codex Fast mode requires all of the following:
30
45
 
31
46
  - Provider `openai-codex`.
32
47
  - API `openai-codex-responses`.
@@ -114,6 +129,7 @@ The collection package loads this unified extension instead of `openai-fast` and
114
129
  ## Notes
115
130
 
116
131
  - Anthropic Fast mode has separate rate limits, costs more than standard speed, and does not share prompt-cache prefixes with standard-speed requests.
117
- - OpenAI Fast mode intentionally does not affect API-key models.
132
+ - Direct OpenAI Fast mode is limited to the confirmed, officially priced GPT-6 API models above; Fast pricing, availability, and rate limits remain provider- and account-dependent.
133
+ - OpenAI Codex Fast mode intentionally does not affect API-key models.
118
134
  - Existing `speed` and `service_tier` fields are never overwritten.
119
- - Cost accounting still depends on the provider reporting the effective tier in its streamed response.
135
+ - Pi's model catalog may not include a Fast-mode premium. Cost accounting depends on the provider reporting the effective tier in its streamed response, and this extension does not patch usage totals.
@@ -26,6 +26,10 @@ const OPENAI_SUPPORTED_MODELS = new Set([
26
26
  "gpt-5.6-terra",
27
27
  "gpt-5.6-luna",
28
28
  ]);
29
+ const OPENAI_API_PROVIDER_ID = "openai";
30
+ const OPENAI_API_IDS = new Set(["openai-responses", "openai-completions"]);
31
+ const OPENAI_API_FAST_SERVICE_TIER = "fast";
32
+ const OPENAI_API_SUPPORTED_MODELS = new Set(["gpt-6-astra", "gpt-6-sol", "gpt-6-luna"]);
29
33
 
30
34
  const DEFAULT_CONFIG: FastConfig = {
31
35
  enabled: false,
@@ -69,6 +73,7 @@ type Eligibility = {
69
73
  eligible: boolean;
70
74
  modelKey: string;
71
75
  provider?: FastProvider;
76
+ serviceTier?: string;
72
77
  reason?: string;
73
78
  };
74
79
 
@@ -190,7 +195,37 @@ function getEligibility(ctx: ExtensionContext): Eligibility {
190
195
  };
191
196
  }
192
197
 
193
- return { eligible: true, modelKey: key, provider: "openai" };
198
+ return {
199
+ eligible: true,
200
+ modelKey: key,
201
+ provider: "openai",
202
+ serviceTier: OPENAI_FAST_SERVICE_TIER,
203
+ };
204
+ }
205
+
206
+ if (model.provider === OPENAI_API_PROVIDER_ID) {
207
+ if (!OPENAI_API_IDS.has(model.api)) {
208
+ return {
209
+ eligible: false,
210
+ modelKey: key,
211
+ reason: `current API is ${model.api}, not openai-responses or openai-completions`,
212
+ };
213
+ }
214
+
215
+ if (!OPENAI_API_SUPPORTED_MODELS.has(model.id)) {
216
+ return {
217
+ eligible: false,
218
+ modelKey: key,
219
+ reason: "Fast mode is only enabled for GPT-6 Astra, GPT-6 Sol, and GPT-6 Luna on direct OpenAI APIs",
220
+ };
221
+ }
222
+
223
+ return {
224
+ eligible: true,
225
+ modelKey: key,
226
+ provider: "openai",
227
+ serviceTier: OPENAI_API_FAST_SERVICE_TIER,
228
+ };
194
229
  }
195
230
 
196
231
  return {
@@ -226,7 +261,7 @@ function getStatusMessage(ctx: ExtensionContext, state: SessionState): string {
226
261
  const wireSetting =
227
262
  eligibility.provider === "anthropic"
228
263
  ? `speed=${ANTHROPIC_FAST_SPEED}`
229
- : `service_tier=${OPENAI_FAST_SERVICE_TIER}`;
264
+ : `service_tier=${eligibility.serviceTier}`;
230
265
  return `Fast mode is ${describeMode(state)} and active for ${eligibility.modelKey}; requests will use ${wireSetting}.${injected}`;
231
266
  }
232
267
 
@@ -317,9 +352,10 @@ function injectFastPayload(
317
352
  }
318
353
 
319
354
  if ("service_tier" in payload) return undefined;
355
+ if (!eligibility.serviceTier) return undefined;
320
356
  state.lastInjectedAt = Date.now();
321
357
  state.lastInjectedModel = eligibility.modelKey;
322
- return { ...payload, service_tier: OPENAI_FAST_SERVICE_TIER };
358
+ return { ...payload, service_tier: eligibility.serviceTier };
323
359
  }
324
360
 
325
361
  export default function fastExtension(pi: ExtensionAPI) {
@@ -363,7 +399,7 @@ export default function fastExtension(pi: ExtensionAPI) {
363
399
  });
364
400
 
365
401
  pi.registerCommand("fast", {
366
- description: "Toggle Fast mode for supported OpenAI Codex and Anthropic Claude models",
402
+ description: "Toggle Fast mode for supported direct OpenAI, OpenAI Codex, and Anthropic Claude models",
367
403
  getArgumentCompletions: () => null,
368
404
  handler: async (args, ctx) => {
369
405
  const state = getState(ctx);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-fast",
3
- "version": "0.1.2",
4
- "description": "A pi extension that enables Fast mode for supported OpenAI Codex and Anthropic Claude models based on the currently selected model.",
3
+ "version": "0.1.3",
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",
7
7
  "pi",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-extensions",
3
- "version": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "description": "A collection of pi extensions and skills for annotation UIs, context management, workflow audits, contrarian review, review-comment triage, notifications, brrr push alerts, safety guards, GitHub research, repo-local knowledge, todos, tool rendering, model/provider helpers, and Xiaohei-style article illustrations.",
5
5
  "keywords": [
6
6
  "pi-package",