Compatible Gateways
Vercel AI Gateway
Use Vercel AI Gateway's OpenAI-compatible API with Anvia.
Vercel AI Gateway exposes an OpenAI-compatible API at https://ai-gateway.vercel.sh/v1.
Create the Client
import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";
const client = new OpenAIClient({
baseUrl: "https://ai-gateway.vercel.sh/v1",
apiKey: process.env.AI_GATEWAY_API_KEY,
});
const model = client.completionModel("anthropic/claude-sonnet-4.6");
const agent = new AgentBuilder("support", model)
.instructions("Answer support questions clearly.")
.build();
const response = await agent.prompt("Hello!").send();
console.log(response.output);Use Vercel AI Gateway model ids directly, usually in provider/model form.
Get the Model List
Vercel AI Gateway supports GET /models on its OpenAI-compatible API.
const models = await client.listModels();
console.table(models.data.map((model) => ({ id: model.id, owner: model.ownedBy })));Notes
- Vercel AI Gateway can route across providers and models behind one API key.
- Provider options, fallbacks, attachments, and model-specific behavior still depend on the selected gateway model.
- If you use Vercel OIDC instead of an API key, pass the token through your application configuration as
apiKey.
For current Vercel AI Gateway details, see the OpenAI-compatible API documentation.
