Skip to content

[AISAGE-707] feat(ai-gateway): replace Vercel routing percentages with a switch - #7945

Merged
chrarnoldus merged 1 commit into
mainfrom
kilo/winter-compass-79m
Oct 19, 2026
Merged

chrarnoldus merged 1 commit into
mainfrom
kilo/winter-compass-79m

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

Replaces the separate paid/free Vercel routing percentages with one switch. When it is on, all eligible traffic, free and paid, goes to the Vercel AI Gateway. When it is off, that traffic goes to OpenRouter. The switch is on by default.

  • ai_gateway_config.config now stores vercel_routing_enabled (boolean, default true) instead of vercel_routing_percentage / vercel_routing_percentage_free. The JSON column needs no migration. Zod drops the obsolete percentage keys, and a saved config without the new key parses as on.
  • The opt-out (exclusion) list is unchanged and still applies when the switch is on.
  • The other eligibility checks are unchanged: the model must be on Vercel, Kilo-exclusive models need the vercel-routing flag, and the provider only/ignore policy must be satisfiable on Vercel. Everything else still goes to OpenRouter.
  • Removes the per-user/task randomization (routing-percentage.ts, passesVercelRoutingPercentage). The randomSeed argument to shouldRouteToVercel and taskId on GetProviderInput are removed too, because they were only used for that randomization.
  • Admin Gateway → Routing page: the two percentage inputs and "Clear override" are replaced by a "Route eligible traffic to Vercel" switch. The opt-out list and note stay.

Verification

  • Not tested manually. The admin page was not opened in a browser because the sandbox could not run the full dev stack (sandbox setup failed while installing Chromium).
  • Automated: pnpm --filter @kilocode/web-shared typecheck and the apps/web tsgo typecheck passed. oxlint on the changed directories passed. Jest suites for gateway-config, the Vercel provider, get-provider (local-fake, custom-llm), llm-proxy, embeddings, model-api-kinds, and the auto-free / gateway-model-lists admin routers passed against a local Postgres 18 + pgvector.

Visual Changes

On the admin Gateway Routing card, the "Paid models" / "Free models" percentage inputs and "Clear override" button are replaced by one switch. No screenshots were taken (see Verification).

Reviewer Notes

  • Effect on deploy: the production row currently holds percentage values. After this ships, those keys are ignored and routing becomes 100% to Vercel for eligible traffic until an admin turns the switch off. That matches the requested default of "on", but deploying this ramps Vercel traffic straight to 100%.

@chrarnoldus chrarnoldus self-assigned this Oct 18, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the replacement of Vercel routing percentages with a single on/off switch across the shared gateway config schema, runtime routing cache, provider selection, admin tRPC mutation, and admin UI; no defects were found in the changed code.

Files Reviewed (14 files)
  • apps/web/src/app/admin/gateway/RoutingContent.tsx
  • apps/web/src/routers/admin/auto-free-config-router.test.ts
  • apps/web/src/routers/admin/gateway-config-router.ts
  • apps/web/src/routers/admin/gateway-model-lists-router.test.ts
  • packages/web-shared/src/lib/ai-gateway/gateway-config.test.ts
  • packages/web-shared/src/lib/ai-gateway/gateway-config.ts
  • packages/web-shared/src/lib/ai-gateway/handlers/llm-proxy.ts
  • packages/web-shared/src/lib/ai-gateway/providers/get-provider.custom-llm.test.ts
  • packages/web-shared/src/lib/ai-gateway/providers/get-provider.local-fake.test.ts
  • packages/web-shared/src/lib/ai-gateway/providers/get-provider.ts
  • packages/web-shared/src/lib/ai-gateway/providers/routing-config.ts
  • packages/web-shared/src/lib/ai-gateway/providers/routing-percentage.ts
  • packages/web-shared/src/lib/ai-gateway/providers/vercel/index.test.ts
  • packages/web-shared/src/lib/ai-gateway/providers/vercel/index.ts

Reviewed by deepseek-v4.1-flash · Input: 60K · Output: 11.9K · Cached: 738.3K

Review guidance: REVIEW.md from base branch main

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants