import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; const baseUrl = ( process.env.PI_AUTH_SERVER_URL || "http://127.0.0.1:8787" ).replace(/\/$/, ""); // Used only inside Pi so the native Codex serializer can construct its normal // request. The server replaces both OAuth headers before they leave for Codex. const PROXY_JWT = "eyJhbGciOiJub25lIn0.eyJodHRwczovL2FwaS5vcGVuYWkuY29tL2F1dGgiOnsiY2hhdGdwdF9hY2NvdW50X2lkIjoicGktYXV0aC1zZXJ2ZXIifX0."; /** Override only transport/auth and preserve Pi's native Codex model catalog. */ export default function (pi: ExtensionAPI) { pi.registerProvider("openai-codex", { baseUrl, apiKey: PROXY_JWT, headers: { "x-pi-auth-server-token": "$PI_AUTH_SERVER_TOKEN" }, }); }