char-slop/ai-dots

ai dotfiles

git clone https://git.t4t.associates/char-slop/ai-dots

Charlotte Somoai fast2567562

main
918 B32 linesraw
1import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
3export default function (pi: ExtensionAPI) {
4  let enabled = false;
5
6  pi.registerCommand("oai-fast", {
7    description: "Toggle OpenAI Codex fast mode",
8    handler: async (_args, ctx) => {
9      enabled = !enabled;
10      ctx.ui.setStatus(
11        "oai-fast",
12        enabled ? ctx.ui.theme.fg("accent", "OAI fast") : undefined,
13      );
14      ctx.ui.notify(`OpenAI Codex fast mode ${enabled ? "enabled" : "disabled"}.`, "info");
15    },
16  });
17
18  pi.on("before_provider_request", (event, ctx) => {
19    if (
20      !enabled ||
21      ctx.model?.provider !== "openai-codex" ||
22      typeof event.payload !== "object" ||
23      event.payload === null ||
24      Array.isArray(event.payload)
25    ) {
26      return;
27    }
28
29    // The Codex backend maps the legacy priority tier to Fast mode.
30    return { ...event.payload, service_tier: "priority" };
31  });
32}