Skip to main content

Hosts & Gateways

Vercel AI Gateway

Put Verdictan in front of Vercel AI Gateway. Your application calls Verdictan, which applies your policies, and then Vercel AI Gateway sends the request to the model provider it picks.

Use the full provider/model ID from Vercel, in the configuration and in each request. Verdictan does not add or resolve the provider segment.

Before you start​

  • A working gateway from the quickstart.
  • A Vercel AI Gateway API key, and one model ID in Vercel's provider/model form.
  • The gateway startup command, and a separate application token for test requests.

Configure the provider​

Set base_url to the Vercel AI Gateway origin, without /v1:

policy-config.yaml
pack:
  name: vercel-integration
  version: 1.0.0
  enabled: true
policies:
  chain:
    - prompt-injection
providers:
  targets:
    - id: vercel-primary
      provider: vercel
      model: "replace-with-provider/model"
      base_url: https://ai-gateway.vercel.sh
      secret_key_ref:
        env: VERDICTAN_VERCEL_API_KEY

The gateway appends the path for each request family, such as /v1/chat/completions, and sends the key from VERDICTAN_VERCEL_API_KEY as a Bearer token.

Start and verify​

The Vercel target can also use the CLI 0.1.14 deployment procedure. Check In sync, then send the request below to test the configured route through Vercel.

With the quickstart in Docker, follow the container steps instead of steps 1 to 3.

  1. In the gateway terminal, set the key and lint the file:

    export VERDICTAN_VERCEL_API_KEY="<provider-api-key>"
    verdictan policy lint --file policy-config.yaml
  2. Restart the test gateway with the key in its environment.

  3. Deploy the file to the test agent in Configurations. If that agent already runs pack.version 1.0.0, increase the version first. Then wait for the gateway log line connected read model refresh applied updated config with your version as config_version. Try the change on a test gateway has the steps.

  4. In a second terminal, send a request with the full model ID:

    export VERDICTAN_CLIENT_TOKEN="<application-token>"
    curl --fail-with-body http://127.0.0.1:41002/v1/chat/completions \
      -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"model":"replace-with-provider/model","messages":[{"role":"user","content":"Reply with Hello."}]}'

choices[0].message.content contains the reply, and the request appears in History when capture is on, or in the delivered events.

Supported requests​

RequestSupport
Chat CompletionsYes. Streaming and tools work if the model supports them.
MessagesTranslated to Chat Completions
EmbeddingsYes, with a second target for an embedding model
Responses, audio, image input, response_format, parallel tool callsNo, even where Vercel supports them directly
note

The gateway authenticates embeddings requests and applies provider access and budget rules, but your policy chain does not run on them. Only Chat Completions, Responses, and Messages go through the chain.

Failure behavior​

ProblemWhat to check
401 from the gatewayThe application token is active, and the key is set on the gateway host.
Provider authentication errorVERDICTAN_VERCEL_API_KEY is set in the gateway process. Restart the gateway.
404 from Vercelbase_url has no /v1.
Model not foundThe request uses the full provider/model ID, and it matches the target.
capability.unsupported_familyThe request uses a family from the table.
Provider 429 or another upstream errorThe response body and your Vercel limits. See Error Handling.

Limits​

  • Model names, prices, rate limits, and data terms are in the Vercel AI Gateway documentation.
  • Vercel picks the upstream provider and its data terms after Verdictan policies run.
  • Streaming and tools vary by model. Test each one with your model.
  • A listener on a non-loopback address needs TLS and network controls.

Next steps​