Repository navigation
Conversation
moe-berri
marked this pull request as draft
October 26, 2026 19:02
Contributor
Merging this PR will not alter performance1 warning
Comparing Footnotes |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by #41522. The native Codex implementation is included in that PR at
2123d9ddc6083f41f6458ab827a49c494522843f, alongside standard LiteLLM model forwarding. This PR is closed and should not be merged separatelyCodex and Pi users can keep their ChatGPT login in their client and send subscription requests through LiteLLM. The gateway uses a separate virtual key for access and usage attribution, reusing the existing passthrough transport and logging
Details
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a signed-in Codex user cannot send subscription requests through the gateway
http://localhost:4000/backend-api/codexand supply a LiteLLM key throughx-litellm-api-key404 Not Foundfor/backend-api/codex/responsesAfter: the same user receives a response using their own subscription
http://localhost:4000/backend-api/codexand supply a LiteLLM key throughx-litellm-api-keyRelevant issues
Fixes #46062
This independently implements the native route scope requested in #46062. #41522 instead adds caller credential forwarding through routed model APIs and includes multiaccount provider changes. #46684 is an alternative native-route implementation, not a dependency of this PR
Documentation is coordinated with the setup guide and the subscription overview. Merge this implementation first, then the guide, then the overview
Pre-Submission checklist
make checkpasses on the committed head. The new route tests and existing OpenAI passthrough logging tests pass, 82 tests. The earlier broader mapped run passed 1,312 tests and exposed one Azure logging regression that was corrected and retested in the final 82-test runScreenshots / Proof of Fix
The comparison uses Codex 0.160.0, the same existing ChatGPT login, GPT-6 Luna with high reasoning, and the prompt
Reply with exactly Hello. Do not use tools.Each proxy runs from its stated commit. The base listens on port 14124 and the candidate on port 14123, with a disposable Postgres database for candidate usage attributionProvider setup, with the URL changed only to select the proxy under test:
Before (4c674e8)
Interactive Codex
LITELLM_API_KEY, runcodex --no-alt-screen, and enter the prompt aboveunexpected status 404 Not Found: {"detail":"Not Found"}Native catalog
curl -i http://localhost:14124/backend-api/codex/models404and{"detail":"Not Found"}After (1ceca04)
Interactive Codex
LITELLM_API_KEY, runcodex --no-alt-screen, and enter the prompt aboveHello.and the gateway records the completed inference underdemo-developer, with 11,845 input and 6 output tokensWatch the recorded setup and request flow. It reuses an existing login and omits browser sign-in. Terminal output is recorded, with idle time shortened
Native catalog
GET /backend-api/codex/modelswith a ChatGPT bearer and separatex-litellm-api-keyAdditional live checks on this head used two distinct saved logins and generated gateway keys for separate test users. Both inference calls completed with 16 input and 5 output tokens, and both rejected a disallowed model with 403. The saved rows contained neither subscription token. An HTTP client observer confirmed each outgoing request carried its respective account token, with the gateway key and cookies absent
Pi 0.73.1's actual agent SDK also completed an SSE request at high reasoning. Its model metadata was extended locally to select GPT-6 Luna because that Pi release's bundled catalog predates the model. This is SDK evidence, not a claim that the interactive Pi CLI was recorded
Controlled regression tests cover missing and invalid gateway credentials, missing subscription credentials, header injection, request/body preservation, streaming usage, and upstream 401/403/429 without account fallback
Type
New Feature
Caveats
Medium
Low
Final Attestation
The tested behaviors and limits are stated above; no universal regression guarantee is claimed