Skip to content

Migrate expense AI to Vercel Gateway#35

Draft
alexradulescu wants to merge 2 commits into
mainfrom
codex/ai-gateway-qwen-preview
Draft

Migrate expense AI to Vercel Gateway#35
alexradulescu wants to merge 2 commits into
mainfrom
codex/ai-gateway-qwen-preview

Conversation

@alexradulescu

Copy link
Copy Markdown
Owner

BLUF

  • Replaces direct Gemini/OpenAI integrations with Vercel AI Gateway.
  • Uses Qwen 3.5 Flash as primary and GPT-OSS-20B as automatic fallback.
  • Keeps the existing structured-output streaming contract and 300-second Vercel function duration.
  • Removes provider-specific SDKs and documents the Gateway environment variable.
  • Includes a separate Mantine compatibility fix so TypeScript remains green.

What changed

  • Updated both expense categorization API functions to use gateway('alibaba/qwen3.5-flash').
  • Configured openai/gpt-oss-20b through providerOptions.gateway.models.
  • Removed @ai-sdk/google, @ai-sdk/openai, and the standalone openai package.
  • Updated TanStack Router/plugin and Zod versions required for the current build.
  • Replaced unsupported responsive props on Mantine Menu with responsive Box wrappers.
  • Updated .env.example for VITE_INSTANTDB_APP_ID and AI_GATEWAY_API_KEY.

Validation

  • bunx tsc --noEmit — passed.
  • bun run lint — passed with 3 existing no-shadow warnings and no errors.
  • Targeted formatting check — passed.
  • bun run build — passed.
  • Browser route sweep across 9 routes — all expected pages rendered with zero console errors.
  • API handler validation paths return expected 400/405 responses.

Deployment notes

  • AI_GATEWAY_API_KEY must be available in the intended Vercel Preview/Production environment.
  • Environment changes require a new deployment.
  • Local Vite preview validates the SPA only; Vercel Functions require vercel dev or a deployed preview.

Follow-ups identified during review

These are pre-existing upload-path concerns and are intentionally not expanded into this focused provider migration:

  • Return extracted statement text in the body rather than X-Extracted-Text.
  • Construct uploaded Blobs from the exact Buffer slice rather than its pooled backing ArrayBuffer.
  • Reduce the displayed upload maximum below Vercel's 4.5 MB request limit.
  • Add protection/rate limiting for publicly callable AI endpoints.
  • Migrate deprecated streamObject to streamText + Output.array before adopting AI SDK 7.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
buddy-budget Ready Ready Preview, Comment Jul 11, 2026 6:55am

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.

1 participant