Repository navigation
fix(cli): let Claude Code renew a --pkce login's key through lite's apiKeyHelper - #51319
Conversation
…sist its absolute path An explicit --api-key or LITELLM_PROXY_API_KEY is now exported to Claude Code even when lite's renewing helper is configured, since the helper prints the stored login's key instead. The helper command also uses the absolute path of the lite found on PATH, so a relative PATH entry cannot make Claude Code run another repository's bin/lite
[High impact] The changes appear safe to merge, with no new actionable issue found. SummaryPKCE logins let Claude Code renew keys through
Reviews (8) · Last reviewed commit: "fix(cli): delete the key files lite clau..." · Reviewed by Greptile |
… is set A --settings that blanks apiKeyHelper now keeps the exported key, and a key passed with --api-key turns lite's helper off for that launch, so Claude Code no longer warns about two credentials or sends the stored login's key beside it The helper names the lite installed beside the Python that ran the login before one found on PATH, so a pyenv shim no longer fails in projects pinned to another Python lite claude signs in again with --pkce when the stored login used it, and print-token's hints name the proxy and --pkce
|
bugbot run |
…se --pkce only for the same proxy The --pkce --config-claude login now writes an empty env.ANTHROPIC_AUTH_TOKEN beside the helper, since a token exported in the shell wins over apiKeyHelper lite claude sends any other key through a private settings file that blanks the helper and merges the user's own --settings A re-login keeps --pkce only when the stored login is for the same proxy, else the saved default decides
…the renewing login in print-token hints lite claude now treats a lite auth print-token helper for this proxy as renewing whichever lite path it names, since every lite reads the same token store Every print-token hint to sign in again, including an expired key and an unreadable keychain, names lite login --pkce with the proxy Shorter docstrings
The private settings file lite claude writes for a key that lite's helper would not renew now also sets ANTHROPIC_BASE_URL. Without it, lite --base-url B --api-key <B key> claude after a --pkce --config-claude login to A sent the B key to A, since the login's settings point Claude Code at A
|
Closed to free an open-PR slot. Branch kept, and it reopens for final CI and bot reviews once ready |
|
bugbot run |
* fix(proxy): keep x-litellm-spend-logs-metadata on auth-rejected failure spend logs Budget, invalid-key and other auth-stage rejections are raised before the request headers are merged into metadata, so the persisted failure row lost the caller's spend logs metadata header. The auth failure handler now parses it with the same pre-call helper and stamps it into the metadata bucket it already uses for the requester IP and user agent. * fix(proxy): type the spend logs metadata header parser honestly The parser takes the request headers as a str mapping and returns the parsed JSON as object, which is what successful requests already store. The auth failure path keeps only JSON objects. The precedence regression now also asserts the caller's request body is left untouched. * fix(proxy): stamp the auth failure spend logs metadata into the route's bucket A chat request whose body also carried litellm_metadata got the header in litellm_metadata, which the failure spend row never reads on chat routes. The header now goes into the bucket picked by metadata_variable_name_for_request for the route, and the failure row lifts spend_logs_metadata from that bucket the same way it already lifts the requester IP and user agent. The regression tests now assert on the built failure spend row. * fix(proxy): keep the auth failure spend logs metadata fix inside the auth handler Restores the failure spend row's lifted fields to main, so failures after auth on litellm_metadata routes keep their current logging. The auth handler now writes the parsed header into metadata, which the failure spend row reads on every route, and into the route's own bucket for callbacks on litellm_metadata routes. * fix(proxy): make the spend logs metadata header field read-only and test the real spend writer The header collector now sets spend_logs_metadata when it is built, so the field can be ReadOnly with the same stored value. The auth failure tests run the real DBSpendUpdateWriter and read the queued spend log row from a fake database client instead of an autospec writer. * test(proxy): read auth failure spend rows from a real unconnected PrismaClient Replaces the mocked database client and the class-level queue byte reset. The test now enqueues into a real PrismaClient's own queue and dequeues its row in cleanup, which keeps the shared byte counter balanced. --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com>
…erriAI#51699) * fix(logging): keep a content-block system prompt in logged messages A /v1/messages request whose top-level system prompt is a list of content blocks never reached the logged messages, because only a plain-text system prompt was prepended. Accept a non-empty list too, so every logger that reads messages sees it. Claude on Vertex also normalizes a plain-text system prompt into blocks, so it was dropped there as well. Fixes BerriAI#36402 * fix(logging): type the logged system message * fix(logging): type the system message without a mutable annotation, close the test client
…parameter (BerriAI#50483) * test(mcp): check the tool dict conversion without patching the MCP handler * refactor(mcp): let the semantic filter take its MCP tool loader as a parameter * refactor(mcp): type the semantic filter's default tool loader Annotate the chosen loader as _OpenAIToolLoader and narrow its return to FunctionToolParam, so a default that returns raw MCP tools fails the type check. Drop the unused patch import.
Merging this PR will not alter performance1 warning
Comparing Footnotes |
…ach key its own settings file A `lite login --pkce --config-claude` leaves an empty ANTHROPIC_AUTH_TOKEN in Claude Code's user settings. When a repo's project settings set their own apiKeyHelper, `lite claude` skipped its private settings file, so the empty token hid the exported key and Claude Code sent the project helper's key. `lite claude` now also writes that file whenever the settings files leave ANTHROPIC_AUTH_TOKEN empty Every key launch also wrote the one file `--subscription` uses, so two launches started together could read each other's key and proxy. A key launch's file is now named after a hash of its contents, and every overlay is written to a temp file and renamed so a starting Claude Code never reads half of one
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
bugbot run |
BerriAI#51143) * fix(proxy): keep carried end-user spend when a budget reset is retried End-user pages commit before the budget window advance. When the advance failed, the tier stayed due and the next tick replayed every page, so a rollover-capped row already cut to its carryover (15 -> 5) matched the under-cap zero and lost it, and spend accrued since the first pass was zeroed again. Each end-user reset now stamps the tier window it closes in a new spend_reset_window column and skips rows already stamped with it. Fixes BerriAI#50898 * fix(proxy): leave never-reset tiers unguarded and test each tier's own window A tier with no budget_reset_at falls back to the old unguarded reset instead of stamping created_at, which an admin clearing the reset time would reuse and silently skip end users. Tests now give tiers distinct windows and cover a second window closing. * test(proxy): give the end-user ledger its own fake prisma client * fix(proxy): pin a reset time on tiers without one before end-user pages commit * fix(proxy): read the reset-time pin from the writer and skip tiers another sweep advanced * fix(proxy): keep linked rows of a tier another sweep advanced out of the rollover reset * fix(proxy): order the end-user reset window migration after upstream's same-timestamp migration * fix(proxy): reset end users again when an admin moves a tier's reset time back to a closed window * fix(proxy): clear end-user reset stamps in the same transaction as the tier's reset time A failed /budget/update used to leave the new reset time written with the stamps still set, so repeating the request found the time unchanged and skipped the clear. The update and the clear now commit together, and a reset time in the future no longer scans the tier's end users * fix(proxy): name each end-user reset window by the tier's last write Stamp end-user resets with the tier's updated_at read on the writer instead of its reset time. A failed window advance leaves updated_at as it was, so the retry still skips the end users already reset, while the advance or any /budget/update moves it and opens a new window. That covers a forced reset on the default end-user tier and drops the stamp clear, so /budget/update is the one-row update it is on main. The writer read also leaves out a tier another sweep already advanced, which a lagging read replica still showed as due * fix(proxy): name end-user reset windows by the tier and its advance count Tiers advanced in one batch share updated_at, so a customer moved between them could skip the new tier's reset, and any unrelated tier edit during a failed advance reopened the window. A budget_reset_count that only the window advance bumps, prefixed with the tier id, names the window instead. * fix(proxy): keep carried spend for customer teams and members on a retried reset Customer team and member pages commit before the window advance like end-user pages, so they now stamp the window they close and a retry skips them too. A member runs on its unexpired override when that has its own duration, else on its template. The window name now joins the tier id, its creation time, its count of closed windows and its reset time, so a duration change or a tier recreated under the same id opens a new window even when the advance failed. * test(integration): list every budget column and relation in the budget update field check --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
…luded services matrix (BerriAI#51759) Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… its helper On Windows, shutil.which searches the current directory before the directories it is given, so a lite.exe planted in the repo where someone ran `lite login --pkce --config-claude` could become their user-level apiKeyHelper The login now checks each directory by full path, this Python's scripts directory first and then each PATH entry, skipping empty entries
|
bugbot run |
…ard reserved (BerriAI#50516) * fix(bedrock): answer 400 for service tiers Bedrock cannot serve, forward reserved Converse used to drop any service_tier outside default, flex, and priority with no error, rewrite auto to default, and drop reserved. Now reserved and standard_only map to Bedrock tiers, auto sends no tier, and any other value answers 400 unless drop_params is on. Nova batch rows honor the row's drop_params. * fix(bedrock): keep a Responses batch row's drop_params and keep it out of passthrough rows * test(bedrock): annotate service tier test locals as Final and drop the row helper's kwargs * fix(bedrock): refuse a service tier on Nova batch rows unless drop_params, and honor the deployment's drop_params * fix(bedrock): map standard and any-case service tiers, and drop tiers from Claude batch rows under the deployment's drop_params * fix(bedrock): forward the tiers OpenAI-format batch rows take, accept auto on Claude rows, and label tiers in lowercase * fix(bedrock): mark the service tier block field read-only * fix(bedrock): read drop_params given as a string on batch rows, and cover the Nova row mapper's drop_params * test(prometheus): sort the service tier label test imports * fix(bedrock): send the Invoke route's service tier as a header and name the accepted tiers in the 400 * fix(bedrock): report and bill the tier Bedrock served on Invoke calls and streams, and send the tier header only to Nova * fix(bedrock): return copies when stamping the served tier, read its header without re-encoding the others, and pin it per stream chunk The Nova Invoke mapper and the event-stream decoder now return model_copy results instead of writing service_tier in place. One shared reader finds the X-Amzn-Bedrock-Service-Tier response header case-insensitively, so a non-ASCII request id no longer breaks the stream decoder, and the passthrough uses the same reader. Tests now vary the served tier in both directions, check every chunk, and cover a stream with no tier header or an empty one * test(bedrock): check the served tier on a stream whose headers come as a plain dict with an upper-case name The non-ASCII request id stream test now also carries X-AMZN-BEDROCK-SERVICE-TIER in a plain dict and asserts every chunk reports that tier, so a case-sensitive header reader or a lookup by the canonical name fails it * refactor(bedrock): drop the passthrough's own service tier header reader that main re-added The passthrough already reads the served tier through the shared case-insensitive reader in common_utils, so the httpx.Headers copy main brought back with the embeddings change has no callers and references a constant this branch removed --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
|
|
…figure lite claude hands its process to Claude Code, so the --settings files holding its key stayed in the Claude config dir. lite logout and lite unconfigure claude now delete them, and Claude Code reads one only at startup, so open sessions keep working
|
bugbot run |
|
bugbot run |
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 6283ea3. Configure here.
Handwritten 1-3 sentence description
Developers who sign in with
lite login --pkce --config-claudehad to approve the SSO sign-in again every day, since the login copied its key into Claude Code's settings and Claude Code kept sending it after it expired. That login already stores a refresh token, so now it points Claude Code'sapiKeyHelperatlite auth print-token, which renews the key.lite claudethen leaves out its own key copy, so an open session renews tooDetails
TLDR
Problem this solves:
lite login --pkce --config-claudewrote a key that expires in 24h by defaultclaudeand openlite claudesessions then got401 Expired Keyuntil the next sign-inHow it solves it:
apiKeyHelperatlite auth print-token, which renews the key, and blanksANTHROPIC_AUTH_TOKENso a shell export cannot winlite claudedrops its key copy while that helper runs, and sends any other key and its proxy in a private settings file--pkcefor the same proxylitefound, writes the key as beforeUser Flow
Before: a developer who signs in through SSO with
litesigns in again every daylite login --pkce --config-claudeand approve the Okta sign-inclaude, and each POST https://litellm-domain/v1/messages answers 200API Error: 401 Authentication Error - Expired Key, and so does a restartedclaudeAfter: the same developer signs in once and Claude Code keeps working
lite auth print-token, which renews itclaudeas beforeclaudeliteDecisions and alternatives
--pkceloginslitestart that checks the keychainLITELLM_CLI_JWT_EXPIRATION_HOURSinsteadlite claudepass a settings overlay with the helper instead of changing the loginclaude, the customer's own launch, would still get the static keyliteinstalled beside the Python that ran the login, by absolute path, before one found onPATHsh, whosePATHmay lack a venv or pipx bin dirPATHexits 127 in a project pinned to a Python withoutlitePATHentry would run whateverbin/liteClaude Code's working directory holdslite.exelitebreaks the helper until the next--config-claudeloginliteis found or the store refused the loginliteto run or no stored refresh token to renew withenv.ANTHROPIC_AUTH_TOKENas an empty string next to the helperapiKeyHelper, and the static key in settings used to hide itANTHROPIC_API_KEYloses to the helper in QA, so the login leaves that one alonelite claudedrops its env key only when the helper Claude Code will run is lite's for this proxy and the key came from the stored login--settingsflag counted firstliteinstall's helper for this proxy counts, since everylitereads the same token store--settingsfile that blanks the helper and setsenv.ANTHROPIC_AUTH_TOKENandenv.ANTHROPIC_BASE_URL, when the settings files hold lite's helper or end on the login's emptyANTHROPIC_AUTH_TOKEN--api-key,LITELLM_PROXY_API_KEY, lite's helper for another proxy, a--settingsthat blanks the helper, and a repo whose project settings set their own helper--settings, so the file merges the user's own and their keys winlite logoutandlite unconfigure claudedelete the files, sincelitehands its process to Claude Code and cannot at exit. Claude Code reads one only at startup, so open sessions keep working--subscription's too, is written to a temp file and renamed into place, so a Claude Code starting at the same time never reads half of oneprint-tokenhint to sign in again nameslogin --pkceand the proxy--pkcelogin renewslite login --pkce--pkceon a re-login only when the stored login is for the same proxylite configPKCE default decides therelite --base-url <first proxy> login --pkceruns againlitecommand reads, out of scope herelite claude --subscriptionblanks anyapiKeyHelper, the user's own includedANTHROPIC_AUTH_TOKEN, and either one outranks the claude.ai loginlite upandlite configure claudekeep writing a static keyconfigure claudetakes a long-lived virtual key, which needs no renewallite upsigns in again when the stored key is old, for a sessionlite downundoes, and is unchanged herelitestart every 300msAffected release
Regression in v1.102.0, where #40330 replaced the helper v1.101.x wrote with the login's static key. A plain
lite login --config-claudenever renewedPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Every leg drives Claude Code v2.1.305 in tmux from a fresh
HOMEagainst one 2-worker merge-base proxy with real Anthropic, OIDC SSO, and 1h keys, behind aliteshim that exits 127 under a.python-versionProxy setup
LITELLM_CLI_JWT_EXPIRATION_HOURS=1, plusGENERIC_CLIENT_ID,GENERIC_CLIENT_SECRET,GENERIC_AUTHORIZATION_ENDPOINT,GENERIC_TOKEN_ENDPOINT,GENERIC_USERINFO_ENDPOINT,GENERIC_SCOPE, andPROXY_BASE_URLfor SSO, andANTHROPIC_API_KEY,LITELLM_MASTER_KEY,DATABASE_URLpython litellm/proxy/proxy_cli.py --config config.yaml --port 28492 --num_workers 2A plain
lite loginon 2 workers fails on base and head alike withCLI login session not found or expired ... configure a Redis cache, so the plain login and base re-login legs ran after a restart that addedcoordination_redispointing at a local Redis togeneral_settingsEvery login is
lite --base-url http://127.0.0.1:28492 login --pkce --config-claude, approved in the browser, and every prompt isReply with exactly the word <WORD> and nothing else.inclaude --model claude-haiku-5-5claudepast expiryclaudein a repo pinned to another Pythonlite claudepast expiryANTHROPIC_AUTH_TOKENin the shelllite --api-key <restricted> claudelite --base-url <B> --api-key <B key> claudeapiKeyHelperlite claudefrom anotherliteinstallapiKeyHelperlite claudeafter the refresh token is revoked--pkceloginlite auth print-tokenwith no loginRun 'lite login'--pkceand the proxylite login --config-claude--pkcehintliterun by path, not onPATHapiKeyHelperLaunch settings file legs ran at 33c2fa7, the rest at 7ec2160
c61a417 adds the proxy URL to the settings file
lite claudewrites for a key lite's helper would not renew. 33c2fa7 also writes that file under a project helper, names it after its contents, and renames it into place. No other leg writes it, and the--subscriptionfile keeps its name and contents, written the same rename way. d48e951 only changes how the login findslite, checking each directory by full path, so it keeps the proof on Linux, where a planted./litewith an emptyPATHentry now loses to the venv's. The 1291 CLI tests pass at d48e951 and at fcc6ed0, which only merges main. At 6283ea3 the reallitewith Claude Code 2.1.305 writes both launch settings files,lite logoutandlite unconfigure claudeeach delete them, and the 1294 CLI tests passBefore (7461a99)
ANTHROPIC_AUTH_TOKENinto Claude Code's settings,/statusshows it, andPINEAPPLEanswers inclaudeCHERRYin the same session gets401 Authentication Error - Expired Key/exit, thenclaudeagain inother-repo, andMELONgets the same 401 at 10:23After (7ec2160)
"apiKeyHelper": "<venv>/bin/lite --base-url http://127.0.0.1:28492 auth print-token"and an emptyANTHROPIC_AUTH_TOKEN,/statusshowsAuth token: apiKeyHelper, andPINEAPPLEanswersCHERRYin the same session answers● CHERRY/exit, thenclaudeagain inother-repo, andMELONanswers● MELON. Neither the shim norother-repo/bin/literanOther cases
Open
lite claudepast expirySame login per leg, then
lite --base-url http://127.0.0.1:28492 claude --model claude-haiku-5-5left open past expiry and sent theCHERRYprompt401 Authentication Error - Expired Keyat 10:21, past the key's 10:13 expiry● CHERRYat 10:19, past the key's 10:13 expiryLogin kept in the OS keyring
A gnome-keyring Secret Service on the leg's D-Bus, so
keyringpicksSecretServiceandtoken.jsonkeeps no key, JWT, or refresh token on either side/statusshowsAuth token: ANTHROPIC_AUTH_TOKEN,PINEAPPLEanswers at 08:51, and at 09:58, past the key's 09:51 expiry,CHERRYgets401 Authentication Error - Expired Keylite auth print-tokenruns take 2.93, 2.69, and 2.74 s,/statusshowsAuth token: apiKeyHelper,PINEAPPLEanswers at 08:51, andCHERRYanswers at 09:57, past the key's 09:51 expiry, with the renewed key in the keyring until 10:56OS keyring locked after the login
Each leg gets its own keyring, locked right after the login, then
lite auth print-tokenandclaudewith theLEMONpromptprint-tokenexits 1 withUnlock it, or run 'lite login' to start over., andclaudeanswers● LEMONon the static key from settingsprint-tokenexits 1 withUnlock it, or run 'lite --base-url http://127.0.0.1:28492 login --pkce' to start over.,claudeshowsYour apiKeyHelper script is failing, and/statusshows the same messageclaudewith a stale token exported in the shellAfter the login,
ANTHROPIC_AUTH_TOKEN=sk-stale...(a key the proxy does not know) in the environment, thenclaude --model claude-haiku-5-5and theKIWIprompt/statusshowsAuth token: ANTHROPIC_AUTH_TOKENfrom settings, and● KIWIANTHROPIC_AUTH_TOKENfrom the after login's settings, since that commit wrote the helper alone:/statusshowsAuth token: ANTHROPIC_AUTH_TOKEN, then● Please run /login · API Error: 401 Authentication Error, Invalid API key provided./statusshowsAuth token: apiKeyHelper, and● KIWI. A staleANTHROPIC_API_KEYin the shell answers● LIMEtoolite --api-key <restricted> claudeAfter the login, a new key limited to
claude-haiku-5-5from/key/generate, thenlite --base-url http://127.0.0.1:28492 --api-key <that key> claude --model claude-haiku-5-5, thePLUMprompt, andcurl "http://127.0.0.1:28492/key/info?key=<that key>"● PLUM, no warning, restricted keyspend 0.0,last_active None, so the stored login's key from settings was billed● PLUM, no warning,/statusshows this proxy's URL, restricted keyspend 0.00110953,last_active 2026-11-12T10:52:33lite claude --settings '{"apiKeyHelper":""}'● FIG● FIG, so a--settingsthat blanks lite's helper still gets the stored login's key through the merged settings filelite --base-url <proxy B> --api-key <B key> claudeafter a login to proxy AProxy B runs on port 28517 with its own master key, which proxy A answers with 401. After the login to A,
lite --base-url http://127.0.0.1:28517 --api-key <B key> claude --model claude-haiku-5-5, theBANANAprompt, and a count ofPOST /v1/messagesin each proxy's log/statusshows proxy A's URL, and● BANANAon A's static key, with 2 requests at A and none at B/statusshows proxy A's URL, and A answers the B key with 401, with 8 requests at A and none at B/statusshowsAnthropic base URL: http://127.0.0.1:28517, and● BANANA, with no request at A and 2 at Blite claudein a repo whose project settings setapiKeyHelperAfter the login to A, the repo's
.claude/settings.jsonsetsapiKeyHelperto a script that prints a key proxy A does not know, thenlite claude --model claude-haiku-5-5,/status, and theMANGOprompt/statusshowsAuth token: ANTHROPIC_AUTH_TOKEN, and● MANGOanswers on the login's static key/statusshowsAuth token: apiKeyHelper, the project helper ran 5 times, and proxy A answered401 Invalid API key8 times/statusshowsAuth token: ANTHROPIC_AUTH_TOKEN,● MANGOanswers, and the project helper never ranTwo
lite --api-keylaunches started togetherAfter the login to A, two terminals start
lite --base-url <proxy B> --api-key <B key> claudeandlite --base-url <proxy A> --api-key <A key> claudeat the same moment, then/statusin each,KIWIin the B session, andLEMONin the A session/statusshow A's URL andKIWIgoes to A, as in the proxy B caselitellm-subscription-overlay.json, both/statusshow proxy A's URL, and the B session'sKIWIgoes to A on A's key, with no request at Blitellm-launch-key-overlay-<hash>.jsonfiles, the B session's/statusshows B's URL,KIWIgoes to B, andLEMONgoes to Alite claudefrom anotherliteinstallAfter the head's login, a copy of the same
liteentry point at another path runs<leg>/other-install/bin/lite --base-url http://127.0.0.1:28492 claude --model claude-haiku-5-5/statusshowsAuth token: apiKeyHelperwithSetting sources: User settings, so no key copy went on the command line, and● GRAPElite claudeafter the refresh token is revokedAfter the login, the stored key is marked expired and its refresh token swapped for a revoked one, then
lite --base-url http://127.0.0.1:28492 claude --model claude-haiku-5-5Opening browser to: http://127.0.0.1:28492/sso/key/generate?..., a plain login that writes a static keyOpening browser to: http://127.0.0.1:28492/authorize?..., theKIWIprompt answers, and the new login renewslite auth print-tokenwith no loginAfter the re-login, a proxy it did not sign in to, then
lite --base-url http://127.0.0.1:28492 logoutand the same proxylite claude --subscriptionBase and head after their logins:
/statusshowsAuth token: none, and the prompt getsNot logged in · Please run /login, since the rig has no claude.ai loginPlain
lite login --config-claudeOn the Redis-backed proxy, both write
ANTHROPIC_AUTH_TOKEN,/statusshows it, andlite claudeanswers● MANGO. The head adds one lineliterun by path, not onPATHPATH=/usr/bin:/bin <venv>/bin/lite --base-url http://127.0.0.1:28492 login --pkce --config-claudeThis login's key is stored in the file, so run ... again after it expires."apiKeyHelper": "<venv>/bin/lite --base-url http://127.0.0.1:28492 auth print-token", since thatlitesits beside the Python that ran the loginRegression checkpoints
liteapiKeyHelperapiKeyHelperpip install 'litellm[cli]==1.101.6'and==1.102.0in fresh venvs, then the same login,claude, and prompts, run at 3a4e417 on 2026-10-30 on one worker"apiKeyHelper": "<venv>/bin/lite --base-url http://127.0.0.1:31138 auth print-token",/statusshowsapiKeyHelper, and it answers● CHERRYpast expiry and● MELONafter a restart/statusshowsANTHROPIC_AUTH_TOKEN, and it gets401 ... Expired Keypast expiry and after a restart/live-pr-risk at 33c2fa7
No dependent path breaks. Every case above ran on the merge base and the head with the same 2-worker proxy, client, and steps
Breaking
None observed
Backward incompatible
lite claude --subscriptionnow blanks a user's ownapiKeyHelper, recorded under Decisions--pkce --config-claudelogin, recorded under Caveatsmerge_claude_settingsandconfigure_claude_settingstake a wider credential type, and every caller still passes a static key--pkce --config-claudelogin now also writes an emptyenv.ANTHROPIC_AUTH_TOKEN, whichlite unconfigure clauderemoves with the helperlite --base-url <other proxy> claudegoes to that proxy, where the base sent it to the login's proxyRegression risk
cmdquoting andlite.exelookup are unit-tested only--subscriptionwas not driven, since the rig has none. Its/statusmatched on base and headDependency graph
lite claude(anthropic profile)lite claudefrom anotherliteinstallclaudewith a shell tokenlite claudere-login for another proxylite --api-key ... claudelite --base-url <other proxy> claudelite claudeunder a projectapiKeyHelperlite --api-key ... claudelauncheslite claude --settings ...lite claudere-loginlite upre-login,--pkcekept only for the same proxylite codex,lite opencode,lite pilite upsettings mergelite autoroutesettings mergelite configure claudelite unconfigure claudelite claude --subscriptionlite auth print-token, keyring unlocked and lockedNot verified
Merge base 7461a99, and the CLI tests pass, 1289 tests
Type
🐛 Bug Fix
Caveats (if any)
Medium
lite logout, the helper fails within 5 minutes, where the static key worked until it expired.lite --base-url <first proxy> login --pkcerestores itlite loginas another user moves open sessions' spend to that user--pkce --config-claudelogin, so the router savings bars are gonelitestart of 3 to 7 s, at startup and every 5 minutes--api-keyorLITELLM_PROXY_API_KEYkey stays in a 0600 file under~/.claudeuntillite logoutorlite unconfigure claudeLow
--api-keystill loses to a plain--config-claudelogin's static key, as on mainlite claudeignores a managed-settingsapiKeyHelperwhen it picks the key to sendFinal Attestation
Note
Medium Risk
Touches credential handling for Claude Code, spend-reset idempotency, and Bedrock request/response mapping; incorrect behavior could affect billing, logging, or provider routing.
Overview
lite login --pkce --config-claudenow wires Claude Code through anapiKeyHelperthat runslite auth print-token(with an emptyANTHROPIC_AUTH_TOKENso shell exports don’t override it), while plain logins still write a static token.lite claudeskips injectingANTHROPIC_AUTH_TOKENwhen the configured helper is LiteLLM’s for that proxy and the key came from the stored login; otherwise it may attach a content-addressed--settingsoverlay with the resolved key and base URL, andlite logout/ unconfigure remove those launch overlay files.Bedrock gains fuller
service_tierhandling: Converse/Invoke mapping (includingreservedand aliases), batch-record validation/drop behavior, Nova invoke headers, and propagating served tier fromX-Amzn-Bedrock-Service-Tieron responses and streams. Standard logging tweaks include case-insensitive requested tiers,reservedin known tiers, and prepending top-levelsystem(string or blocks) viaChatCompletionSystemMessage.The budget reset job is made idempotent across retries with
spend_reset_windowon end users/customer rows,budget_reset_counton budgets, and window-stamped spend resets keyed off tiers still due on the writer. Auth failures copyspend_logs_metadatafrom request headers into both metadata buckets for spend logs. MCP connect lets unscoped flows post selectedserverids at/authorize/complete, narrows grants, and the dashboard Finish control posts enabled server ids (disabled when none are on).Reviewed by Cursor Bugbot for commit 6283ea3. Bugbot is set up for automated code reviews on this repo. Configure here.