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");

The same client can list models when the endpoint exposes an OpenAI-compatible model-list endpoint.

const models = await client.listModels();

listModels() fetches from the configured endpoint, usually GET {baseUrl}/models, and returns provider-reported data only. Anvia does not add hidden model metadata or cache the result.

Anvia does not need a package for every OpenAI-compatible provider. If the provider exposes OpenAI-compatible completion or embedding endpoints, use @anvia/openai and pass the endpoint directly.

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

CapabilityExample
Completionclient.completionModel(modelName)
Embeddingsclient.embeddingModel(modelName)
Model listingclient.listModels()
Custom endpointnew OpenAIClient({ baseUrl, apiKey })

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.