Providers
Compatible Providers
Connect OpenAI-compatible and Anthropic-compatible endpoints.
Use the top-level provider clients for compatible endpoints. Pass the endpoint URL and credentials explicitly; Anvia does not read provider configuration from environment variables.
OpenAI-Compatible
import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";
const client = new OpenAIClient({
baseUrl: "https://provider.example.com/v1",
apiKey,
});
const model = client.completionModel("provider-chat-model");
const agent = new AgentBuilder("support", model)
.instructions("Answer support questions clearly.")
.build();The compatible client can also create embedding models when the endpoint supports them.
const embeddings = client.embeddingModel("provider-embedding-model");Anthropic-Compatible
import { AgentBuilder } from "@anvia/core";
import { AnthropicClient } from "@anvia/anthropic";
const client = new AnthropicClient({
baseUrl: "https://provider.example.com",
apiKey,
});
const model = client.completionModel("provider-claude-compatible-model");
const agent = new AgentBuilder("support", model)
.instructions("Answer support questions clearly.")
.build();Portability Notes
Compatible APIs still differ in model names, attachments, streaming metadata, tool-call behavior, and provider-specific parameters. Treat compatible clients as a shared transport shape, not a guarantee that every model behaves the same.
