Vercel AI Gateway is a clean way to ship AI inside a Vercel project. The trade-off is that everything gets pulled into Vercel's billing and Vercel's ecosystem, including your AI spend. Mesh API does the same provider routing, retries, and observability work, and runs anywhere your code does, with negotiated rates and a bill that doesn't surprise you.
Quick Migration
If you're using the Vercel AI SDK with the AI Gateway provider:
- import { gateway } from "@ai-sdk/gateway";+ import { createOpenAI } from "@ai-sdk/openai";++ const mesh = createOpenAI({+ baseURL: "https://api.meshapi.ai/v1",+ apiKey: process.env.MESH_API_KEY,+ });Then your generateText, streamText, and tool calls keep working, just point them at mesh("auto") or mesh("anthropic/claude-opus-4-7") instead of the gateway model.
Why teams switch from Vercel AI Gateway
Migration steps
1. Sign up for Mesh
Get a key from the dashboard.
2. Keep the Vercel AI SDK, switch the provider
The Vercel AI SDK is great. You don't have to leave it. Just point its OpenAI provider at Mesh:
import { createOpenAI } from "@ai-sdk/openai";import { generateText } from "ai"; const mesh = createOpenAI({ baseURL: "https://api.meshapi.ai/v1", apiKey: process.env.MESH_API_KEY,}); const { text } = await generateText({ model: mesh("auto"), // or "anthropic/claude-opus-4-7", "openai/gpt-4.1", etc. prompt: "Explain Mesh API in one sentence.",});Streaming:
import { streamText } from "ai"; const result = await streamText({ model: mesh("auto"), prompt: "Write a haiku about gateways.",}); for await (const delta of result.textStream) { process.stdout.write(delta);}Tool calling, structured output, and multimodal inputs all work the same way as with the Vercel AI Gateway provider, you're just on a different base URL.
3. Move billing out of Vercel
Set up Mesh billing once, recharge in your currency, and you've decoupled AI spend from your hosting invoice. Most finance teams ask for this within a quarter anyway.
4. Extend to non-Vercel workloads
Cron jobs, background workers, mobile backends, internal tools that don't sit on Vercel, they all hit api.meshapi.ai/v1 with the same key. One bill, one dashboard, one audit log across your whole stack.
What you gain on Mesh
- Portability. Your gateway lives at a URL, not inside a hosting platform.
- Zero platform fee. What the model costs is what you pay.
- Smart routing. Every request scored on cost, latency, capability, and context window. "auto" is auditable, not a black box.
- Team controls. Per-key spend limits, RBAC, SSO, audit log, ZDR, outside any single hosting provider's account model.
- Negotiated rates and multi-currency. Built for teams who care what the AI bill looks like in their actual currency.