---
title: Build your startup's AI features on Vercel AI Gateway
description: Add customer-facing AI features with AI Gateway, including model fallbacks, cost attribution for each customer, and data controls.
url: "https://vercel.com/kb/prompts/build-startup-ai-features-on-ai-gateway"
last_updated: 2026-12-01
related_resources:
  "[Build your startup's AI features on Vercel AI Gateway](/kb/guide/startups-on-vercel-ai-gateway)": "Build customer-facing AI features with Vercel AI Gateway, including authentication, model fallbacks, usage attribution for each customer, data controls, and budgets."
---

# Build your startup's AI features on Vercel AI Gateway

Add customer-facing AI features with AI Gateway, including model fallbacks, cost attribution for each customer, and data controls.

Ship an AI feature your customers rely on, and know what each customer costs you. This prompt routes model calls through Vercel AI Gateway with fallbacks, tags each request with a customer ID, and applies the data policies the feature needs.

Open or import your application repository and say which feature you want, if you know. Your agent reads the matching KB guide with the Vercel CLI. The handoff includes prompt text only; Vercel project access and credentials must be configured separately.

Expect authenticated model calls, fallback handling, per-customer usage records, and tests for provider failures and HTTP 402 and 429 responses. Your agent explains plan requirements and usage costs before it sends live requests.

## Agent prompt

```text
Help me add an AI feature to this application with Vercel AI Gateway, using https://vercel.com/kb/guide/startups-on-vercel-ai-gateway and its linked documentation. Read and follow the guide using the Vercel CLI: `npx vercel@latest kb inspect startups-on-vercel-ai-gateway`.

Inspect the repository and its dependencies first. If the intended feature isn't clear, ask whether I want a customer-facing feature with model fallbacks, usage attribution for each customer, or lower-cost requests with prompt caching. Implement the selected pattern using the application's existing framework and conventions.

1. Configure server-side AI Gateway authentication for local development and deployment. Use Vercel OIDC when available, and explain any required environment variables without printing secrets.
2. Apply the application's authentication, rate limiting, and input validation before each model call. Take the customer ID from the authenticated session, never from the client. Identify missing application-specific integrations instead of inventing them.
3. Call models through AI Gateway with the AI SDK version the repository already uses, or AI SDK 7 if it has none. Check every model and provider slug against the AI Gateway model catalog before using it.
4. For customer-facing routes, set fallback models and a provider order, and return a safe stream error when every attempt fails. Distinguish retries before streaming from failures after output begins. Avoid the `only` filter unless I name a requirement for specific providers.
5. Attach an opaque customer ID and feature tags to each request. Keep prompt text, personal data, and credentials out of them. Record each request's reported cost with the customer ID in the application's own storage. Keep Gateway keys on the server, and restrict spend reports to trusted staff because they cover the team.
6. Ask which data policies the feature needs, then apply zero data retention and disallow prompt training on the requests that need them. Handle the case where no provider qualifies.
7. Type-check the implementation and test success, provider failure, HTTP 402, and HTTP 429 paths. Use local mocks where needed and distinguish those results from live AI Gateway requests.

Return the changed files, required configuration, checks performed, and remaining deployment steps. Explain the relevant plan requirements, add-on charges, and usage costs before running live requests.

To find other KB guides, such as ones on related topics or next steps, search the Vercel Knowledge Base with the Vercel CLI: `npx vercel@latest kb search "<topic>"`
```

## Related resources

- [Build your startup's AI features on Vercel AI Gateway](/kb/guide/startups-on-vercel-ai-gateway): Build customer-facing AI features with Vercel AI Gateway, including authentication, model fallbacks, usage attribution for each customer, data controls, and budgets.

## Try other prompts

- [Keep AI responses available with model fallbacks](/kb/prompts/add-ai-gateway-model-fallbacks): Configure AI Gateway fallbacks for an existing generation flow, checking model compatibility, error handling, and retry boundaries.

- [Build an AI chat app with streaming responses](/kb/prompts/build-ai-chat-app): Build a chat interface with the AI SDK and AI Gateway, including streamed responses, cancellation, and recoverable errors.

## Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

- [Agent stack](/kb/architecture/agents): Build and operate agents with models, tools, and durable workflows.
- [Web applications](/kb/architecture/web): Choose rendering, data, authentication, and caching approaches.
- [Backends](/kb/architecture/backends): Choose a runtime, connect services, and run background work.

[Browse all stacks](/kb/architecture)

## Build with prompts

Build an app, extend an agent, or improve your project with ready-to-use prompts for your coding agent.

[Browse the prompt library](/kb/prompts) · [Read the Markdown index](/kb/prompts.md)
