Gateway: Vercel AI SDK
PlatformcreateOpenAI must use openai.chat(). Anthropic baseURL must include /v1. Default openai() hits the Responses API.
Vercel AI SDK provider factories take baseURL and headers. The OpenAI factory default is not Chat Completions. The Anthropic factory default includes /v1, which is the opposite of the official Anthropic SDK.
What this Gateway accepts
POST /openai/v1/chat/completions and GET /openai/v1/models. Anthropic: POST /anthropic/v1/messages. Gemini Developer API: POST /google/{v1beta|v1}/models/{model}:generateContent and :streamGenerateContent. Embeddings, the OpenAI Responses API, Assistants, Azure OpenAI paths, Vertex AI paths, and Anthropic Batches are not this Gateway. Those requests 404.Headers
| Header | Value |
|---|---|
| X-Traccia-Api-Key | Workspace key from Settings → API Keys |
| X-Traccia-Agent-Id | Same Agent ID you would pass to init |
Keep the provider API key on the client. The Gateway forwards it and does not store it. Missing Traccia key returns 401. Missing agent ID returns 400.
OpenAI
Official default prefix is https://api.openai.com/v1. Set baseURL to https://gateway.traccia.ai/openai/v1. Since AI SDK 5,openai('model-id') uses the Responses API. This Gateway only implements Chat Completions. Use openai.chat('model-id').
import { createOpenAI } from "@ai-sdk/openai";import { generateText } from "ai";
const openai = createOpenAI({ apiKey: process.env.OPENAI_API_KEY, baseURL: "https://gateway.traccia.ai/openai/v1", headers: { "X-Traccia-Api-Key": process.env.TRACCIA_API_KEY!, "X-Traccia-Agent-Id": "billing-bot", },});
const result = await generateText({ model: openai.chat("gpt-4o-mini"), prompt: "hello",});Do Not Call openai(model)
openai("gpt-4o-mini") posts to /v1/responses and 404s. openai.chat("gpt-4o-mini") posts to /v1/chat/completions.Anthropic
Official default prefix is https://api.anthropic.com/v1. The provider appends /messages. Current @ai-sdk/anthropic only rewrites the official Anthropic host. A custom URL is used as given. Set baseURL to https://gateway.traccia.ai/anthropic/v1 so the request is POST .../anthropic/v1/messages.
import { createAnthropic } from "@ai-sdk/anthropic";import { generateText } from "ai";
const anthropic = createAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY, baseURL: "https://gateway.traccia.ai/anthropic/v1", headers: { "X-Traccia-Api-Key": process.env.TRACCIA_API_KEY!, "X-Traccia-Agent-Id": "billing-bot", },});
const result = await generateText({ model: anthropic("claude-sonnet-4-5"), prompt: "hello",});Do Not Copy The Anthropic SDK Base
https://gateway.traccia.ai/anthropic (no /v1) is correct for @anthropic-ai/sdk. On Vercel AI SDK it becomes /anthropic/messages and 404s.Next Steps
© 2026 Traccia.