Skip to content

v0 app with OpenRouter: AI launch checklist

v0 apps call OpenRouter with your own API key, from server code, so OpenRouter's own limits are your safety net. Of the 20 checks before you charge users, v0 handles 2, partly handles 4, and leaves 14 to you.

Checked 12 Nov 2026 against each platform's docs; every fact links to its source.

How AI calls work in v0

Built-in AI
Yes: 'By default, v0 uses the Vercel AI Gateway'; v0 'is pre-configured to connect to the gateway'. Vercel's blog says provider tokens are used server-side only with short-lived OIDC tokens scoped per project.
Other options
Marketplace AI providers (fal, Deep Infra) and Grok by xAI via Project menu ... → Settings → Integrations; or direct provider keys as environment variables (docs example: OPEN_AI_API_KEY).
Who pays
Your Vercel team's AI Gateway Credits: provider list price, no markup or platform fee on tokens. Free tier covers a subset of models with lower per-model rate limits; buying credits moves you to the paid tier. BYOK needs purchased credits and a positive credit balance; failed BYOK requests are retried with Vercel's own provider keys and charged to your credits. Optional add-ons (custom reporting, team-wide ZDR, regional hosting at 5%) are surcharges.
Models and providers
OpenAI, Anthropic, Google and OpenRouter-style multi-provider access all go through AI Gateway's catalog; fal is a separate Marketplace integration.

Keys and secrets

Where secrets live
Project menu ... → Settings → Environment Variables, scoped to Production, Preview and/or Development; the v0 preview only sees Development variables. Keys are 'stored securely on Vercel'.
Server-side by default?
Yes for AI Gateway (OIDC, server-side). For your own env vars, Next.js keeps non-NEXT_PUBLIC_ variables server-only and inlines NEXT_PUBLIC_ ones into the browser bundle at build time.
How keys end up in the browser
A NEXT_PUBLIC_ prefix on an AI key. v0 checks for 'Misuse of NEXT_PUBLIC_ variables' and flagged insecure deployments need review before deploy.

The 20 checks, in v0

What v0 does for you, and what to ask it (or your coding agent) to add. Tick them off in the interactive checklist.

Cost and abuse

  • v0 partly handles it

    A spending cap per user

    Set a daily project budget on the AI Gateway Budgets page (it stops the whole app, not one user), then ask v0: 'Before each streamText call, sum this user's cost today from ai_costs and return a limit message when it's over $2.'

    vercel.com ↗

  • v0 partly handles it

    Rate limits on every AI endpoint

    Add Firewall → Configure → New Rule → Rate Limit on your AI route (Hobby gets one rule, keyed by IP or JA4), and ask v0 to add a per-user limit in the route handler keyed by the signed-in user id.

    vercel.com ↗

  • v0 handles it

    AI keys only on the server

    AI Gateway calls run server-side with per-project OIDC tokens and v0 flags NEXT_PUBLIC_ misuse before deploy; if you add your own provider key under Settings → Environment Variables, never give it a NEXT_PUBLIC_ prefix.

    vercel.com ↗

  • You add it

    Retries capped, with a timeout

    Ask v0: 'Set maxRetries: 2 and an abort-signal timeout on every generateText and streamText call, and don't retry from the client.' AI Gateway also retries failed BYOK requests with Vercel's own provider keys and charges your credits.

    vercel.com ↗

  • v0 handles it

    A budget alert at each AI provider

    Set team and project budgets with 50/75/100% email alerts on the AI Gateway Budgets page; budgets are off by default, BYOK spend isn't counted, and Spend Management's pause doesn't stop AI Gateway usage, so also set provider-side limits for BYOK keys.

    vercel.com ↗

Charging for AI use

  • You add it

    Every AI call charged or deliberately free

    Ask v0 to tag each gateway call with a step name and list which ones are charged to users; Custom Reporting can then group spend by tag to find untagged or free calls.

    vercel.com ↗

  • You add it

    Credits deducted on the server, after success

    Connect Supabase or Neon from v0's Databases and ask v0 to deduct credits in a server action after the result is saved, in one transaction, with database permissions that block client writes to the balance.

    v0.app ↗

  • You add it

    Failed AI calls refunded

    Ask v0 to catch gateway errors, including a 402 quota_for_entity_exceeded when a budget is hit, and refund reserved credits with the reason.

    vercel.com ↗

  • You add it

    One charge per request, even on a double click

    Ask v0 to send a request id from the client, store it with a unique constraint, return the saved result on repeats, and disable the submit button while pending.

    v0.app ↗

A record of every AI result

  • v0 partly handles it

    Each AI result stored with its feature, model, prompt version and settings

    AI Gateway logs each request's model, tokens and spend, but not your user or prompt version, so ask v0 to save the gateway generation id with feature, model, prompt_version, params, input and user_id on an ai_results row.

    vercel.com ↗

  • You add it

    Retries and corrections saved next to the original, never over it

    Ask v0 to save regenerations and edits as new ai_results rows with parent_id and version instead of overwriting.

    v0.app ↗

  • You add it

    What users do next with each AI result, recorded on the server

    Ask v0 to add an ai_events table and a server action recordAiEvent called from the Retry, Edit, Copy and Export buttons.

    v0.app ↗

What worked, for whom, at what cost

  • You add it

    Worked first time, per feature, model and prompt version

    Ask v0 for an admin page showing worked-first-time by feature, model and prompt version for 7 and 30 days.

    v0.app ↗

  • v0 partly handles it

    A cost record for every AI step

    Pass the user id and a step tag on each gateway request (Custom Reporting) or read cost per generation from Generation Lookup, and store it in an ai_costs row per call, retries included.

    vercel.com ↗

  • You add it

    Wasted AI spend and real cost per result, per feature

    Ask v0 for an admin query joining ai_costs and ai_events: total spend, spend on results that didn't work, cost per result that worked, per feature and model.

    vercel.com ↗

  • You add it

    Who the AI fails for

    Ask v0 to save language, length band, input kind, plan and new-user flag with each result and show worked-first-time per trait.

    v0.app ↗

Switching safely

  • You add it

    Prompts in version control, with version labels

    Ask v0 to move inline prompts into lib/prompts/ files with exported version labels saved on each result.

    v0.app ↗

  • You add it

    Model and prompt switchable by a flag

    Ask v0 to read the gateway model string and prompt version per feature from an environment variable (Settings → Environment Variables) or a database setting, with a user-id-hashed split.

    v0.app ↗

  • You add it

    Real past requests to replay before a change

    Ask v0 for a script that replays 50 anonymised past requests through any gateway model and prompt version and saves outputs and cost next to the originals.

    vercel.com ↗

  • You add it

    A plan for model shutdowns

    Keep every gateway model string in one config file and check it against the AI Gateway model list before switching.

    vercel.com ↗

OpenRouter limits to set before launch

Per-key limit
Key dialog → 'Key limit' → 'Credit limit', reset interval and 'Include BYOK usage in limit' (toggle appears only with BYOK keys configured). API: PATCH https://openrouter.ai/api/v1/keys/{key_hash} with limit (USD), limit_reset (daily, weekly, monthly; unset = lifetime; resets at midnight UTC) and include_byok_in_limit (default false).
When a key hits its limit
Conflicting docs: the capping guide says requests fail with 403 'Key limit exceeded'; the limits reference says over-limit requests return 402 with limit_source openrouter_key_limit (or openrouter_guardrail_budget / openrouter_workspace_budget). Test before relying on either.
Workspace and guardrails
Workspace budget: one pooled cap for all members and keys. Guardrail budgets: per member or per key, daily/weekly/monthly; 'the first limit reached blocks the request'; the lower of key limit and member guardrail wins.
Account balance
Prepaid credits; an 'in-flight spending budget' (a fraction of balance) can fail paid requests with 402 even when balance is positive; a negative balance can error even free models.
Alerts and top-up
Low-balance alerts and auto top-up: not found in the pages read.
Key scoping
Per-key credit limits and per-key guardrails (model, provider, ZDR and data-region policy). Keys are owned by a member or a workspace; spend is attributed to the key's creator, so per-person enforcement needs one key per person. Management API key can create keys (POST /api/v1/keys).
Rate limits
Free model variants (':free'): 20 RPM; 50 requests/day if under 10 credits ever purchased, 1,000/day at 10+. Paid models: 'no platform-level request cap' (upstream provider limits still apply). Key-management endpoints 10,000 requests/day. Cloudflare DDoS protection blocks dramatic excess.
Where usage shows
Activity page filters by API key, model, provider and user; export CSV or PDF grouped by Model, API Key or Creator. GET /api/v1/activity (management key, last 30 days) filters by api_key_hash. GET https://openrouter.ai/api/v1/key returns usage, usage_daily, usage_weekly, usage_monthly, limit_remaining and applicable budgets for the calling key.

openrouter.ai ↗openrouter.ai ↗openrouter.ai ↗openrouter.ai ↗

Mistakes v0 apps make at launch

  1. AI keys exposed with a NEXT_PUBLIC_ prefix.

    Vercel (Aug 4, 2025): v0 blocked over 17k insecure deployments in July 2025 alone, with exposed API keys and NEXT_PUBLIC_ misuse among the most common issues; about a thousand people were about to share OpenAI, Gemini, Claude and xAI keys.

    vercel.com ↗

  2. An unauthenticated AI route left over from development.

    Vercel Community thread (June–July 2026): a Hobby user saw Anthropic calls to models their app never used; the likely cause was 'an exposed route in my code that should have been removed when moving from dev to prod'. Advice: treat keys as compromised, rotate, authenticate or remove the route.

    community.vercel.com ↗

  3. Assuming Vercel caps AI spend.

    AI Gateway budgets are optional and unlimited by default; BYOK spend isn't counted; Spend Management's pause does not stop AI Gateway API key usage or v0 usage.

    vercel.com ↗vercel.com ↗

Questions

How do AI calls work in a v0 app with OpenRouter?

v0 apps call OpenRouter with your own API key, from server code, so OpenRouter's own limits are your safety net.

Can v0 cap AI spending per user?

Partly. Set a daily project budget on the AI Gateway Budgets page (it stops the whole app, not one user), then ask v0: 'Before each streamText call, sum this user's cost today from ai_costs and return a limit message when it's over $2.'

Where should the OpenRouter key live in v0?

Handled. AI Gateway calls run server-side with per-project OIDC tokens and v0 flags NEXT_PUBLIC_ misuse before deploy; if you add your own provider key under Settings → Environment Variables, never give it a NEXT_PUBLIC_ prefix.

How do I stop one user running up my OpenRouter bill?

Add a per-user daily cap in your own code, checked before every AI call. Then set a limit at OpenRouter as a backstop: Key dialog → 'Key limit' → 'Credit limit', reset interval and 'Include BYOK usage in limit' (toggle appears only with BYOK keys configured). API: PATCH https://openrouter.ai/api/v1/keys/{key_hash} with limit (USD), limit_reset (daily, weekly, monthly; unset = lifetime; resets at midnight UTC) and include_byok_in_limit (default false).

More checklists