Set up Vercel AI Gateway

Last validated:

Configure a Vercel AI Gateway provider in Aperture so your team can access models from multiple LLM providers through a single gateway endpoint. The Aperture preset enables OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages. Select a model and client back end that support the API you intend to use.

Your client and selected provider must support the same API format. Refer to Supported providers and clients for available setup options and requirements.

Prerequisites

Before you begin, you need:

Configure the provider

Add Vercel AI Gateway as a provider in your Aperture configuration:

{
  "providers": {
    "vercel": {
      "baseurl": "https://ai-gateway.vercel.sh",
      "apikey": "<your-vercel-token>",
      "models": [
        "anthropic/claude-sonnet-4.6",
        "openai/gpt-5.4-nano"
      ],
      "cost_basis": "vercel",
      "compatibility": {
        "openai_chat": true,
        "openai_responses": true,
        "anthropic_messages": true
      }
    }
  }
}

Set baseurl to https://ai-gateway.vercel.sh, without /v1. Adding /v1 produces the incorrect URL https://ai-gateway.vercel.sh/v1/v1/chat/completions. Refer to how Aperture builds upstream URLs for details.

Model names use a provider/model prefix format.

The configuration fields work as follows:

  • cost_basis: Selects the pricing source for token-cost estimates. With auto_cost_basis enabled, Aperture uses vercel for the official https://ai-gateway.vercel.sh host. The example sets it explicitly for the same result. Set it explicitly for a custom gateway host. Costs reported directly by the gateway do not require this field.
  • openai_chat: Enables the chat completions API used by most OpenAI-compatible tools.
  • openai_responses: Enables the Responses API used by tools such as OpenAI Codex.
  • anthropic_messages: Enables the Anthropic Messages API. The selected model must support this API.

Refer to the compatibility flags reference for the full list of flags.

Verify the provider

Administrators can test a connection to a specific model from the Models page of the Aperture admin dashboard.

  1. Open the Aperture admin dashboard at /admin/ and select Administration > Models.
  2. Find the model you want to test in the list of configured models. If the model is not listed, check your provider configuration and ensure the model name is correct.
  3. Select the Play icon to the left of the model name to send a test request. If the request succeeds, the icon changes to a green check mark. If it fails, the icon changes to a red "X".

Aperture sends a test request through the configured provider. This tests the gateway's provider configuration, not a separate client's credentials or another user's grants.

Next steps