Back to migration guides
    From Vercel AI Gateway

    Migrate from Vercel AI Gateway

    A gateway shouldn't tie you to a host. Mesh API gives you the same model routing and observability, with zero platform fee, multi-currency billing, and a stack that doesn't end at the Vercel project boundary.

    Published May 20267 min read

    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:

    diff
    - 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

    CapabilityVercel AI GatewayMesh API
    OpenAI-compatible endpointIndirect (through AI SDK)Direct, works with any OpenAI SDK
    Works outside Vercel hostingBundled with VercelYes, any framework, any cloud
    BillingThrough Vercel invoiceStandalone, pay-as-you-go, multi-currency
    Platform feeYesZero
    Smart routing across cost / latency / capabilityProvider routing onlyLive scoring on every dimension
    Negotiated provider ratesLimitedAcross every major provider
    Team management outside Vercel teamsTied to Vercel teamsNative RBAC, SSO, per-team budgets
    Per-key spend limitsLimitedBuilt in
    Audit logLimitedFull audit log
    Pre-built RAG and prompt workflowsManualReady-made
    Multi-cloud / on-prem clientsAwkwardFirst-class

    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:

    typescript
    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:

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

    Asia's largestsovereign AI gateway.

    1,000+ AI models. One endpoint. Your data stays inside your border.

    Get an API key