Repository navigation
feat(vercel): add opt-in personal AI Gateway budgets - #4623
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GYiF6FrNLHsyqZXK1MeD8t
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
Keep the AI Gateway key and Vercel access token in separate plugin manifests. Match paginated budgets to the authenticated user and use documented UTC resets. Reject malformed own-budget rows instead of reporting them as unconfigured, localize the missing-budget state, and retain contributor history. Refs steipete#4621, steipete#4623 Co-authored-by: sf-jin-ku <jin.ku@sendbird.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fee78a1fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| static let teamKey = "VERCEL_TEAM_ID" | ||
|
|
||
| /// The plugin host binds one auth secret per manifest, so the personal budget is a second bundled script. | ||
| public static let descriptor = Self.spec.makeDescriptor(fetchPlan: ProviderFetchPlan( |
There was a problem hiding this comment.
Teach credential metadata about the Vercel access token
For a personal-budget setup with a Team ID and only pluginSecrets["VERCEL_ACCESS_TOKEN"] (and, for config validation, source: api), omitting a custom credential adapter leaves PluginProviderSpec.makeCredentials() checking only AI_GATEWAY_API_KEY: CodexBarConfigValidator therefore emits api_key_missing for a valid token-based config, and a failed codexbar diagnose vercel reports auth as unconfigured because the generated authDetector also ignores the access token. Supply Vercel credential metadata that recognizes either credential while retaining the separate secret projections.
Useful? React with 👍 / 👎.
| { | ||
| title: "Personal budget", | ||
| rows: [ | ||
| { label: "spent", value: spentText }, |
There was a problem hiding this comment.
Give the spend row a budget-specific localization key
When the app language is non-English, localizedProviderDetails localizes every row label via L, and the existing catalog entry for lowercase "spent" means the exhausted-quota state (for example, French renders it as “quota épuisé”). Reusing that key here labels a normal dollar-spend amount as an exhausted quota, so this row needs a dedicated Spent key/translations or an existing spend-amount label.
Useful? React with 👍 / 👎.
|
Merged in f0019e7, thanks @sf-jin-ku! Personal Vercel AI Gateway budgets are now available through the access-token route we discussed in #4611. We kept your plugin, made matching budget rows validate their state flags (a row missing |
Adds optional personal AI Gateway budgets to the existing Vercel provider. A Vercel access token and Team ID select the personal-budget view; without that token, the AI Gateway key continues to show team credits. Each credential is bound to its own plugin manifest and origin.
The budget plugin reads the authenticated user, follows bounded pagination for that team's user budgets, prefers a custom budget over an inherited default, and calculates the documented UTC resets. Missing budgets are explicitly unconfigured; malformed matching rows fail closed. Plan history and burn-down are disabled to avoid mixing team and personal scopes. Settings and the unconfigured-state label are translated in all 22 non-English catalogs. No new provider ID, host capability, CLI credential discovery, or Keychain read is added.
Implementation by @sf-jin-ku, with maintainer validation and parser/localization cleanup on this branch.
Validation
zsh /Users/steipete/Projects/CodexBar-triage-evidence/20260921/serial.sh bash -c 'source Scripts/test_environment.sh; swift test --build-system native --jobs 2 -Xswiftc -gnone --filter "VercelBudgetPluginTests|VercelProviderSettingsTests|ProviderSettingsDescriptorTests|ProviderArchitectureGatekeeperTests|APIBalancePluginTests|PluginProviderSpecTests|BurnDownCapabilityTests|ConfigValidationTests|ProviderPluginDetailsParityTests|UserFacingLocalizationCoverageTests|LocalizationLanguageCatalogTests"': 268 tests in 11 suites passed, including one temporary offscreen-capture test removed before commit. Both JavaScript engines exercised the missing-active-field regression.make checkthrough the same shared build-slot wrapper: passed, including SwiftFormat and SwiftLint (0 violations in 3061 files).node Scripts/check-app-locales.mjs: 22 catalogs / 2579 English keys passed. The Italian catalog precheck produced no output.Synthetic settings renders
These use the real shared field renderer with empty, isolated settings; no running-app capture or real account data.
Before:

After:

Fixes #4621.