翻篇收录说明
翻篇网页快照

Coding Agents and Chat Platforms with AI Gateway

https://vercel.com/docs/ai-gateway/coding-agents

最近抓取:2026-12-04 03:03:17(北京时间)

最近内容变化:2026-12-04 03:03:17(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Connect coding agents and chat platforms to AI Gateway. Configure Claude Code, Claude Desktop, Codex, Chatbox, Open WebUI, and more.

正文摘录

Copy pageCopy pageCoding Agents and Chat Platforms with AI GatewayCopy pageCopy pageRoute coding agents and chat platforms through AI Gateway to share model access, track spend, and configure provider fallbacks in one place. Set up with the Vercel CLI The Vercel CLI is the recommended way to connect a coding agent. One command provisions or reuses an API key, writes each agent's configuration, and points every agent at the right gateway endpoint: terminalnpx vercel@latest ai-gateway setup The command detects the agents installed on your machine, shows you a diff of every planned change before it writes anything, and stores your key in the macOS Keychain instead of in plaintext config. It reuses an existing key when your configs already point at the gateway, and accepts a pasted key so you don't have to mint a new one. Model lists written into agent configs come from the AI Gateway leaderboards, so the defaults track what's actually being used. The desktop apps differ. Codex Desktop reads the same config file as the Codex CLI, so it switches to AI Gateway along with it. The command doesn't configure the Claude Desktop app, so you switch it manually in Claude Desktop. For both, the command copies your existing desktop sessions so your history survives the provider switch. Read the full documentation for the command. Agent--agent valueAideraiderClaude Codeclaude-codeClineclineCodexcodexContinue CLIcontinueGitHub Copilot CLIcopilotCrushcrushCursorcursorDeep Agents CLIdeepagentsDeepSeek HarnessdeepseekFactory DroiddroidForgeCodeforgefxfxGoosegoosegptmegptmeGrok BuildgrokHermeshermesJunie CLIjunieKilo CodekiloKimi CLIkimiompompOpenClawopenclawOpenCodeopencodeOpenHandsopenhandsPipiQwen CodeqwenMistral VibevibeZCodezcodeZedzed Detection pre-selects the agents already installed on your machine, and --all covers every agent in the table. To connect a subset, name each one with --agent <value>. Every agent above also works when you configure it by hand, and the agents the CLI doesn't cover can only be set up that way. For the full command reference, including flags, key storage, session migration, and non-interactive output, see vercel ai-gateway. Which base URL to use Configuring an agent by hand means telling it where the gateway is. Unless the agent has an endpoint of its own, point it at the coding agent surface: https://ai-gateway.vercel.sh/coding-agent/v1 That URL passes straight through to the standard /v1 handlers, so auth, routing, billing, and errors are identical to the gateway's bare /v1 surface. The exception is the model list: /coding-agent/v1/models leaves out models that can't produce the text responses a coding agent needs, such as embedding, image, and video models, so they don't appear in your agent's model picker. Prefer the coding agent surface over bare /v1 for that list. Behavior shared across harnesses can also land there without requiring another config edit. For a client that speaks the Anthropic protocol and appends /v1/messages itself, drop the /v1 and use https://ai-gateway.vercel.sh/coding-agent. Three agents have a dedicated endpoint, because each needs something the generic surface doesn't do: AgentEndpointClaude Code and Claude Desktophttps://ai-gateway.vercel.sh/claude-codeOpenAI Codexhttps://ai-gateway.vercel.sh/codex/v1Cursorhttps://ai-gateway.vercel.sh/cursor/v1 See each agent's page for what its endpoint adds. Agents with a first-party AI Gateway provider, such as Cline, OpenCode, Pi, and omp, already know the URL and only need your API key. Why route coding agents here? BenefitWithoutWithSpend trackingSeparate dashboards per providerSingle unified viewModel accessLimited to agent's default models400+ models from 70+ providersBillingMultiple invoices, multiple accountsOne Vercel invoiceReliabilitySingle point of failureAutomatic provider fallbacksObservabilityLimited or no visibilityFull request traces and metrics Configure an agent's model with a virtual modelCoding agents send AI Gateway a model ID with each request, but they usually can't attach AI Gateway options such as provider order, model fallbacks, regional inference, or zero data retention. To apply those settings to an agent, create a virtual model and select vmc/<slug> as the agent's model. AI Gateway lists your team's virtual models in the model catalogs agents load, so the slug appears in pickers such as /model in Claude Code and Codex. You can change the virtual model's settings later without editing each developer's config. Featured agents These featured integrations provide a starting point. The setup table above lists every agent supported by the Vercel CLI, and the sidebar lists all integration guides alphabetically. Claude Code Claude Code is Anthropic's agentic coding tool for the terminal. The CLI connects it for you with --agent claude-code. To configure it by hand, use environment variables: export ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh/claude-code" export ANTHROPIC_API_KEY="" export ANTHROPIC_AUTH_TOKEN="your-ai-gateway-api-key" export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 Once configured, Claude Code works exactly as before, but requests route through the gateway. /claude-code is Claude Code's own compatibility endpoint, and the discovery variable puts the gateway models that Claude Code can use in its /model picker. See the Claude Code documentation for the dedicated Claude Code compatibility endpoint, model discovery, and advanced configuration. Claude Desktop Claude Desktop connects to AI Gateway through its Third-Party Inference settings using the https://ai-gateway.vercel.sh/claude-code compatibility endpoint and your AI Gateway API key. The Vercel CLI setup command does not write Claude Desktop's provider settings, so you configure it in the app, then optionally run npx vercel@latest ai-gateway setup --agent claude-code to migrate existing desktop sessions. See Claude Desktop with AI Gateway for Developer Mode setup, Third-Party Inference configuration, and session migration. OpenAI Codex OpenAI Codex is OpenAI's terminal-based coding agent. The CLI connects it for you with --agent codex. To configure it by hand, add the following to its configuration file: ~/.codex/config.tomlmodel_provider = "vercel" [model_providers.vercel] name = "Vercel AI Gateway" base_url = "https://ai-gateway.vercel.sh/codex/v1" env_key = "AI_GATEWAY_API_KEY" wire_api = "responses" /codex/v1 is Codex's own compatibility endpoint, and wire_api = "responses" is required, since Codex no longer speaks Chat Completions. Then start Codex, optionally on a specific model: codex codex --model openai/gpt-5.5-pro Codex reads the gateway catalog from /codex/v1/models at startup, so /model inside a session lists the gateway models that Codex can use. For full configuration options, including the dedicated Codex compatibility endpoint and profiles, see Configure OpenAI Codex. Command Code Command Code supports manual setup with your own AI Gateway API key and a custom base URL. Add AI Gateway as a provider in ~/.commandcode/providers.json, using https://ai-gateway.vercel.sh/coding-agent/v1 as the baseURL. Run /model to select one of your configured models under Vercel AI Gateway. See the Command Code documentation for the provider configuration and API key setup. OpenCode OpenCode is an open-source, terminal-based AI coding agent with native support. The CLI connects it for you with --agent opencode. You can also connect directly from within the tool: opencode > /connect # Select "Vercel AI Gateway" and enter your API key OpenCode automatically discovers available models and lets you switch between them on the fly. See the OpenCode documentation for more features. Blackbox AI Blackbox AI is a terminal-based CLI for AI-powered code generation and debugging. Configure it with the interactive setup: blackbox configure # Select "Configure Providers", choose "Vercel AI Gateway", and enter your API key See the Blackbox AI documentation for installation and setup. Cline Cline is a VS Code extension and CLI that provides autonomous coding assistance. The CLI connects it for you with --agent cline. To configure the extension by hand: Open the Cline settings panel Select Vercel AI Gateway as your API Provider Paste your API key Choose a model from the auto-populated catalog Cline tracks detailed metrics including reasoning tokens, cache performance, and latency. See the Cline documentation for troubleshooting tips. Amp Amp connects to AI Gateway through Amp's Model Routing settings. The integration is currently early access for Amp Megawatt and Gigawatt members and requires manual configuration. See Configure Amp with AI Gateway for eligibility, setup, and model selection. Aider Aider is an open-source terminal pair-programming agent. The Vercel CLI configures its AI Gateway base URL, default model, model metadata, and API key environment variable. See Configure Aider with AI Gateway for manual setup, model metadata, and model selection. Cursor Cursor is an AI-first code editor. The Vercel CLI provisions an API key and prints the values you need to finish configuration in Cursor's account-synced settings. See Configure Cursor with AI Gateway for the full setup and Cursor's BYOK limitations. GitHub Copilot CLI GitHub Copilot CLI is GitHub's terminal coding agent. Its BYOK mode uses environment variables, so the Vercel CLI can connect it without a config file or GitHub sign-in. See Configure GitHub Copilot CLI with AI Gateway for automatic and manual setup. Linear Linear's cloud coding agent runs Claude Code or Codex in a cloud sandbox to turn issues into draft pull requests. A Linear workspace admin connects it with Linear's bring your own key (BYOK) setting, using a custom endpoint and an AI Gateway API key. The Vercel CLI doesn't configure it. See Configure Linear's cloud coding agent with AI Gateway for the endpoint for each agent, billing, and how to stop charges. Run coding agents durably To deploy a coding agent as a service tha