Provider SDKs deleted; all LLM traffic routes through Vercel AI Gateway
hosman20 swaps three provider SDKs for a single gateway client and removes the customer-facing API key UI entirely. The platform now pays for inference; customers don't see provider tokens.
Commit 07a46ce is a +708/-1353 change across 19 files. The deleted side includes backend/src/lib/llm/{claude,gemini,openai,tools}.ts, backend/src/lib/userApiKeys.ts, the GET/PUT /user/api-keys routes, and frontend/src/app/(pages)/account/models/page.tsx (341 lines). Four env vars go away: GEMINI_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, and USER_API_KEYS_ENCRYPTION_SECRET.
The replacement is backend/src/lib/llm/gateway.ts, 343 lines, using ai@^6.0.182 and @ai-sdk/gateway. The adapter accepts "provider/model" strings and auto-routes based on the prefix. On Vercel, VERCEL_OIDC_TOKEN is preferred over the static AI_GATEWAY_API_KEY. Per-request attribution moves from apiKeys params to a StreamChatAttribution shape forwarded as x-user-id and x-org-id headers, which the gateway uses to slice cost reporting.
runLLMStream gains totalTokens?: number on its return type, pulled from streamResult.usage?.totalTokens. That's what the billing middleware reads to increment tokens_used_this_period. The gateway test suite (gateway.test.ts, 266 lines) mocks the entire ai package so tests don't hit providers; it drives onChunk manually and inspects the headers and model slug passed to streamText.
Two leftovers: mikeApi.ts still exports stale getApiKeyStatus/saveApiKey functions pointing to 404 routes (cleaned in the Batch 7 follow-up), and public.user_api_keys in Postgres is left orphaned.
Spotted something wrong? Or know the PR text has fresher detail than the writeup above?