x402-ai-starter is a growing TypeScript project in the AI payments / x402 ecosystem. It currently has 73 GitHub stars and 27 forks.

x402 is a new protocol built on top of HTTP for doing fully accountless payments easily, quickly, cheaply and securely.
This template built with Next.js, AI SDK, AI Elements, and AI Gateway and the Coinbase CDP shows off using x402 with a modern AI stack.
Demo: https://x402-ai-starter.vercel.app/
git clone https://github.com/vercel-labs/x402-ai-starter
cd x402-ai-starter
pnpm install
Sign into the Coinbase CDP portal
Following .env.example, set the following environment variables in .env.local:
CDP_API_KEY_IDCDP_API_KEY_SECRETCDP_WALLET_SECRETUsing AI Gateway requires either a Vercel OIDC token, or an API Key.
To get an OIDC token, simply run vc link then vc env pull. An API can be obtained from the AI Gateway dashboard.
Using AI Gateway isn't required, you can use any AI SDK model provider and its associated credentials.
Run pnpm dev
Open http://localhost:3000 in your browser to see the app in action.
By default, the app uses the base-sepolia network, or "testnet". This is a testing network with fake money. The app is configured to automically request more funds from a faucet (source of testnet money) when your account is running low. You can also do this yourself in the Coinbase CDP dashboard.
When you're ready to deploy your SaaS application to production, follow these steps:
In your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment, including:
CDP_API_KEY_IDCDP_API_KEY_SECRETCDP_WALLET_SECRETTo move to mainnet, set the NETWORK environment variable to base.
Make sure that the Purchaser account has enough funds to pay for the tools you're using. To fund the account, you can send USDC to the account's address in the Coinbase CDP dashboard.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.