Repository navigation
feat(pi): route OpenAI GPT-6 models via Pi's configuration_update - #79
Conversation
…pdate Pi main (pi#10930, merged as 60ac3bc) pins reasoning.effort and sends the thinking level as configuration_update items for GPT-6 on the openai provider, as it already does for Anthropic. The extension now registers a virtual model per OpenAI model in the core registry and returns the effort as thinkingLevel, with no before_provider_request rewrite. Decisions (reversible): - Gate on api openai-responses plus compat.supportsMidConvoEffort, not the Pi version; Pi 1.0.4 rejects these models with unsupported_model. - Detect Sign in with ChatGPT with ctx.modelRegistry.isUsingOAuth() on the openai provider and reject it with unsupported_model. The extension does not read the API key, so a non-sk- key (which Pi also treats as ChatGPT) is not detected. - A none decision on gpt-6-luna/gpt-6-sol is left as is and documented: Pi sends request-level effort for thinking off, missing the cache. - openai-codex stays out of scope. Closes #78
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Closes #78
What changed
packages/pi/src/router.ts: registersreasoning-router/<id>for the OpenAI models in the core registry (gpt-6-astra,gpt-6-sol,gpt-6-luna,gpt-6.1-sol) as well as the Anthropic ones. Each routes toopenai/<id>and returns the effort asthinkingLevel, with nobefore_provider_requestrewrite.api === "openai-responses"andcompat.supportsMidConvoEffort === true), not on the Pi version.PHYSICAL_PROVIDERbecame a provider-to-API map.message_endnow matches the pending decision's provider instead of the hard-codedanthropic.openaiis rejected withunsupported_model, before classifying.docs/harnesses/pi.md(status, summary, OpenAI cache section, step 4, lineage limitation, "Upstream first?"). The payload rewrite is now needed only foropenai-codex. Also the "OpenAI models are not routed yet" line inpackages/pi/README*.md(EN/CN/JA/KO).@reasoning-router/piminor.Verification
npm run check: typecheck and lint pass, 470 tests pass. The only Biome warning is an unused variable already inpackages/classifiers/test/jev.test.ts.npm run smoke:pi(Pi 1.0.4, Anthropic): PASS, unchanged.earendil-works/pimain atb45e0eb(includes60ac3bc), loadingpackages/pi/dist/extension.jswith-e. A fake Responses endpoint and a fakesglangSystem One classifier both ran on127.0.0.1. The key wassk-fake…and anHTTPS_PROXYpointed at a dead port, so nothing could leave the host. No real credentials, no paid calls.pi -pturns in one session, classifiedhigh,high,low:reasoning.effortstayed fixed, each request'sinputwas a prefix of the next, and the decision log recordedhigh,high,lowwith cached reads on turns 2 and 3.reasoning-router unsupported_model: openai/gpt-6-sol is not an OpenAI Responses model with mid-conversation effort in this Pi, with no request sent.Assumptions and limitations
route()can see the credential type throughctx.modelRegistry.isUsingOAuth(model), which exists in 1.0.4 and main. On theopenaiprovider the only OAuth login is Sign in with ChatGPT, so an OAuth login there is rejected. Pi's own check is stricter: any non-sk-key sent toapi.openai.com. The extension doesn't read the key itself, so a non-sk-API key wouldn't be caught. It also rejects OAuth even with a custombaseUrl, where Pi would still sendconfiguration_update; that's the conservative choice. The ChatGPT path is covered by unit tests only, because a live test would need a real OAuth login.off: with thinking off, Pi sendsreasoning.effort: "none"(and noinclude) instead of aconfiguration_update. Anonedecision ongpt-6-lunaorgpt-6-soltherefore misses the cache on that request and the next. I documented this rather than stopping the classifier from choosingnoneon OpenAI; that could be a follow-up if it shows up in practice.openai-codexis out of scope; upstream won't enable it until Codex CLI turns onfeatures.reasoning_effort_override.smoke:pistays pinned to Pi 1.0.4 (Anthropic only). An OpenAI smoke can be added once a Pi release includes pi#10930.Summary by CodeRabbit
nonefor certain GPT-6 models may bypass prompt caching.