Repository navigation
feat(chatgpt): support per-model chatgpt_auth_file for multiple ChatGPT accounts - #41928
devin-ai-integration[bot] wants to merge 11 commits into
Conversation
…PT accounts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
[Medium impact] The reviewed changes appear safe to merge; account-file probes remain administrator-only, and string input keeps its text. SummaryAdds per-deployment ChatGPT accounts across Chat Completions and Responses.
Reviews (9) · Last reviewed commit: "fix(chatgpt): normalize subscription hea..." · Reviewed by Greptile |
… test docstring Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…cator Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
|
@greptileai Please review the updated multi-account ChatGPT implementation, particularly credential isolation, proxy permissions, and compatibility with current routing paths |
|
bugbot run |
|
@greptileai please review 2bfb569. Saved-prompt routing, lazy auth-directory creation, parameter inventories, and administrator configuration are fixed and verified. |
|
bugbot run |
|
@greptileai please review 3fb2f3b. The remaining test mutation is removed; runtime code is unchanged and local checks pass |
|
bugbot run |
|
@greptileai Please review commit 5cdc4c5 for administrator probe permissions and string input normalization, including compatibility with the client forwarding PR. |
|
bugbot run Please review commit 5cdc4c5, especially account selection and administrator authorization when testing unsaved ChatGPT configurations. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5cdc4c5. Configure here.
|
Superseded by #41522, which merged on Oct 26 and includes this PR's per-model chatgpt_auth_file support and the admin-only gate |
Use several ChatGPT accounts in one LiteLLM proxy, with a separate saved login for each model deployment. This refresh preserves the original contributor's work, brings it onto current main, and restricts account selection to proxy administrators
Details
TLDR
Problem this solves:
How it solves it:
Intentional product change: compared with the earlier PR revision, delegated model managers cannot select or replace a server-owned ChatGPT auth file; proxy administrators own that operation, and request-level credential opt-in cannot override it
User Flow
Before: two configured accounts still send requests through the default login
After: each alias uses its configured account
Relevant issues
Fixes #23777; continues the original implementation from #33680 and preserves this PR's contributor history
Pre-Submission checklist
3fb2f3bf91creview was Greptile 5/5 and Bugbot cleanCurrent tip:
5cdc4c5a82f13c0420553b4eb147e2c4cca132e9.make checkpasses on this committed tip. Fresh automated reviews and current-tip CI are pendingCompatibility and Test Connection
#41522 includes this revision and adds client-owned ChatGPT login forwarding. Its combined live account-selection matrix covers stored accounts, caller overrides, client-only setup, streaming, and routing groups
Admins can test an unsaved
chatgpt_auth_fileusing/health/test_connection. Non-admin probes return 403 before provider dispatch. This was checked on a real PostgreSQL-backed proxy with client-side credentials both disabled and enabled; the outgoing bearer and account header matched account-b in every successful admin probeThe live probe also exposed an existing ChatGPT Responses limitation: string input was forwarded unchanged and OpenAI rejected it with
Input must be a list. The adapter now normalizes plain text to a user message while preserving list input. The regression test checks the outgoing shape and selected credential pair. This normalization overlaps #38086; its structured-output fix remains relevant, and this PR does not close #38085The current ChatGPT and health-endpoint run passes 384 tests. The earlier evidence below remains labeled with the revision on which it ran
Screenshots / Proof of Fix
Live proxy requests used two distinct saved ChatGPT logins and GPT-6 Luna, with identical configuration on both revisions. An observer around the real HTTP transport compared the outgoing token and account header with the selected local record, recording only account-a/account-b labels; it forwarded requests unchanged and used no mocked provider responses. The isolated loopback QA proxy disabled master-key enforcement; the example below uses normal gateway authentication
Shared configuration, with illustrative paths:
The default login points to account-a. Both payloads request “Reply with exactly the word Hello” with no output-token cap
Before (72f1ac4)
Chat Completions
Send the following request for account-a, then account-b
Both return HTTP 200 and Hello; outgoing credential pairs both match account-a
Responses
Send the following request for account-a, then account-b, then default-login
All return HTTP 200 and Hello; outgoing credential pairs all match account-a
Streaming model group
"stream":trueRequest-level credential selectors
chatgpt_auth_file, then with that selector inextra_body; repeat withallow_client_side_credentialsfalse and trueModel-management permissions
Saved prompts without a usable default directory
"prompt_id":"account-check"After (2bfb569)
Chat Completions
Responses
Streaming model group
"stream":trueRequest-level credential selectors
chatgpt_auth_file, before a provider requestModel-management permissions
chatgpt_auth_file, with client-side credentials disabled and enabledSaved prompts without a usable default directory
No outgoing provider body contained the auth-file selector. The streaming sample proves the model group works, not statistical balancing; the explicit aliases prove both accounts independently
The original four request-path regression cases fail on the base and pass on the tip. The expanded matrix covers saved prompts and an unusable default token directory too. They exercise concurrent SDK and Router calls through Chat Completions and Responses with no default login, mocking only the external HTTP response
The official Dockerfile builds successfully from
2bfb5692166. A container using writable mounted auth directories, a generated gateway key, and one worker returned HTTP 200 with Hello for both accounts through both APIs. This container check verifies responses; the transport-observed account pairing above comes from the local proxy runRemaining CI evidence
The compatibility and types-shard jobs passed on the prior commit,
3fb2f3bf91c. Current-tip CI is pendingThe tokenizer timing assertion failed again on
3fb2f3bf91c(0.115s during a 0.422s count). It also fails on the exact main base: 0.128s event-loop stall against its 0.100s threshold. Equivalent local runs reproduce it on base (0.120s) and tip (0.123s), using the same environment and identical Rust sources. This PR does not change that tokenizer or testThe dependency scanner flags filelock and the VS Code extension's development dependency on msal-node in unchanged lockfiles. These required checks remain unresolved; they are not counted as passing
Documentation
Separate draft documentation PRs are prepared for merging after this feature:
Type
New Feature
Caveats
Severe
Medium
The second account rejects GPT-6.1 Sol but accepts GPT-6 Luna. The final paired live run uses GPT-6 Luna for both accounts
Final Attestation
Note
Medium Risk
Changes OAuth credential selection and proxy auth rules for ChatGPT; misconfiguration could route requests under the wrong account, but request-level credential override is explicitly blocked.
Overview
Adds a
chatgpt_auth_filedeployment parameter so each ChatGPT model alias can use its own OAuthauth.json, with cached per-path authenticators driving bearer tokens and account headers for chat and Responses.Routing and SDK:
litellm_params(includingchatgpt_auth_file) is passed into ChatGPT provider resolution and Responses bridging/prompt paths so the correct subscription is chosen end-to-end.Proxy hardening:
chatgpt_auth_fileis treated as server-owned credentials—blocked on inference and nested request bodies, writable only by proxy admins on model config;/health/test_connectioncan probe an unsaved file for admins.Responses fix: Plain-string
inputis wrapped as a user message list before upstream calls (health probes and API compatibility).Reviewed by Cursor Bugbot for commit 5cdc4c5. Bugbot is set up for automated code reviews on this repo. Configure here.