Repository navigation
Add opt-in Vercel personal AI Gateway budget - #961
Merged
Merged
Conversation
added 4 commits
October 21, 2026 12:17
With a Vercel access token configured, the Vercel provider reads the token user's AI Gateway budget from api.vercel.com instead of the team credits endpoint. Without a token the credits path is unchanged. - Identify the user with /v2/user, then page through /ai-gateway/budgets/list (scopeType=user, at most 20 pages). - Match the native user ID or its usr_ form; a custom budget wins over an inherited default; two applicable budgets fail the refresh. - Daily, weekly and monthly budgets reset at UTC boundaries; none is cumulative with no reset. - The access token is read from the provider's stored secret, else VERCEL_ACCESS_TOKEN, and is only sent to api.vercel.com. The Team ID comes from the provider's Team ID setting, else VERCEL_TEAM_ID.
- Store the optional Vercel personal-budget access token in the provider's management token slot, the same DPAPI-protected settings field OpenRouter uses. Add has, set and remove Tauri commands. The token is never returned to the UI. - Validate a Vercel Team ID when it is saved, using the same shape rule the budget request enforces, so an invalid ID is rejected up front.
Settings > Providers > Vercel gains an access-token field and a Team ID field. Both are optional: without a token the card keeps showing team credits. Strings are added to every locale, and new proof scenarios cover the budget card and the settings pane with synthetic data.
Describe the Vercel access token and Team ID setup, the budget requests and matching rules, UTC reset boundaries, and the host each secret is sent to. Update the README provider row.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 21, 2026
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.
Summary
Ports upstream CodexBar 0.79 opt-in Vercel personal AI Gateway budget (steipete#4623 / steipete#4650) into the Rust Vercel provider.
/v1/credits(team credit balance and lifetime spend) is fetched exactly as before.VERCEL_ACCESS_TOKEN) and a Team ID is set (Settings > Providers > Vercel, orVERCEL_TEAM_ID), the provider reads the personal AI Gateway budget and shows Spend / Limit / Remaining under a "Personal budget" section.ProviderError::Othermessage (notNotInstalled).validate_single_line_secret/MAX_API_KEY_LEN). It is never logged.api.vercel.com; the AI Gateway key is only sent toai-gateway.vercel.sh. A test asserts the gateway key never reaches api.vercel.com.docs/PROVIDERS.md> "Vercel AI Gateway".VercelAccessTokenCredssection (token set/remove, configured state) and a Team ID field inOpenAiExtras. Seven new i18n keys in all 10 locales (check-localepasses, 1837 keys).verceladded to the proof catalog with a fixture (Spend $42.00 / Limit $100.00 / Remaining $58.00, "Personal budget"). Two scenarios:flyout-vercel-budgetandsettings-vercel-budget.docs/PROVIDERS.mdsection, README Vercel row.Windows differences from the Mac port:
Commits on
feat/vercel-gateway-budget:36edf0151Add opt-in Vercel personal AI Gateway budget97fb8e865Add Vercel access token commands and Team ID validation98e56304bAdd Vercel personal budget settings fieldsa4a7970fbDocument the opt-in Vercel personal budgetNot changed:
CHANGELOG.md.Proof
Label: Chromium, mocked IPC (
pnpm proof:check, 33/33 scenarios). Settings and flyout screenshots were checked visually. Full CUA desktop proof was not run in this lane; the change is covered by the proof harness scenarios above. Reviewers should run the CUA retest loop if a real-desktop check is required.Commands run
cargo fmt --all -- --check(rust and tauri manifests): cleancargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: cleancargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings: cleancargo test --manifest-path rust/Cargo.toml: 5108 passed, 0 failed, 2 ignored (vercel: 37 tests; provider_workspace: 9 tests)cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 755 passedpnpm install --frozen-lockfile(apps/desktop-tauri): okpnpm exec tsc --noEmit: okpnpm test: 156 files, 1492 tests passedpnpm lint: 0 errors (16 pre-existing warnings, none in touched files)pnpm run check-locale: ok (1837 keys match)pnpm run check:anti-slop: okpnpm proof:check: 33/33 passedNo new dependencies. No deletions.