Skip to content

feat(vercel): add opt-in personal AI Gateway budgets - #4623

Merged
steipete merged 3 commits into
steipete:mainfrom
sf-jin-ku:feat/vercel-budget-plugin
Oct 19, 2026
Merged

steipete merged 3 commits into
steipete:mainfrom
sf-jin-ku:feat/vercel-budget-plugin

Conversation

@sf-jin-ku

@sf-jin-ku sf-jin-ku commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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.
  • A synthetic Node reproduction failed on the original prototype (malformed budget became “not configured”) and passed after the parser correction. No network was used.
  • make check through 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.
  • Isolated Codex review through P2: scoped-clean.
  • Vercel's public OpenAPI and budget documentation were checked. No live Vercel token was used.

Synthetic settings renders

These use the real shared field renderer with empty, isolated settings; no running-app capture or real account data.

Before:
Vercel settings before

After:
Vercel settings after

Fixes #4621.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYiF6FrNLHsyqZXK1MeD8t
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated 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.

View the workflow run.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 19, 2026
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>
@steipete steipete changed the title Prototype: opt-in Vercel personal budget plugin (#4621 option A) feat(vercel): add opt-in personal AI Gateway budgets Oct 19, 2026
@steipete
steipete marked this pull request as ready for review October 19, 2026 09:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:28:27.425073Z 1fee78a Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete
steipete merged commit f0019e7 into steipete:main Oct 19, 2026
9 checks passed
@steipete

Copy link
Copy Markdown
Owner

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 active was being reported as unconfigured), removed a few redundant Swift wrappers, and kept plan history off so team and personal scopes never mix. It will ship in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:feature Preliminary submission classification; full source review pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vercel: optional personal AI Gateway budgets via a Vercel access token (auth contract)

2 participants