Models

Choose and configure completion and embedding models for Anvia agents.

Anvia treats models as capabilities. A completion model can answer prompts and call tools. An embedding model can turn text into vectors for retrieval.

Provider clients create those capabilities, then agents, extractors, pipelines, and retrieval code consume them through provider-neutral interfaces.

import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const openai = new OpenAIClient({ apiKey });
const model = openai.completionModel("gpt-5.5");

const agent = new AgentBuilder("support", model)
  .instructions("Answer clearly and ask for missing details.")
  .build();

Model Categories

CategoryUse it for
CompletionAgents, extractors, prompt steps, streaming, and tool calls
EmbeddingsRetrieval, document search, semantic routing, and vector stores
Model listingDiscovering provider-returned model ids and metadata
Compatible gatewaysOpenAI-compatible gateways, hosted model APIs, and local model backends
Compatible providersOpenAI-compatible APIs through OpenAIClient({ baseUrl, apiKey })
Vertex AIGemini through GeminiClient({ vertexai: true, project, location })

Completion Capabilities

Completion models expose provider, defaultModel, and capabilities. Anvia uses those capabilities to reject unsupported requests before making provider calls.

Core capability checks cover the normalized Anvia surface: streaming, tools, tool choice, image input, document file input, output schemas, and reasoning events. They do not guarantee that every upstream model name supports every feature, and they do not validate provider-specific additionalParams.

Configuration Boundary

Provider clients only use explicit constructor values. They do not read environment variables directly.

Load credentials through your application configuration layer, then pass them into the client once:

const client = new OpenAIClient({
  apiKey: config.openai.apiKey,
  baseUrl: config.openai.baseUrl,
});

Create clients and models once per application runtime when practical. Agents, extractors, pipelines, and retrieval code can reuse the model instances.

Model Listing

Use listModels() when you need provider-returned model ids or metadata for configuration screens, diagnostics, or model selection.

const models = await client.listModels();

Model listing fetches live provider data. Anvia does not cache results or add hidden metadata. Beta or private model ids can still be passed directly to completionModel(...), but they only appear in listModels() when the provider returns them.

See Model Listing for the normalized response shape and compatible-gateway behavior.

Compatible Gateways

GatewayPage
OpenRouterOpenRouter
LiteLLMLiteLLM
Vercel AI GatewayVercel AI Gateway
Cloudflare AI GatewayCloudflare AI Gateway
PortkeyPortkey
Helicone AI GatewayHelicone AI Gateway
LangDB AI GatewayLangDB AI Gateway
MiniMaxMiniMax
Moonshot AIMoonshot AI
Novita AINovita AI
NVIDIA NIMNVIDIA NIM
OllamaOllama
Ollama CloudOllama Cloud
OpenCodeOpenCode

Use compatible gateways when a service exposes an OpenAI-compatible API shape. In Anvia, these endpoints use OpenAIClient({ baseUrl, apiKey }).

Providers

ProviderPage
OpenAIOpenAI Models
AnthropicAnthropic Models
Google GeminiGoogle Gemini Models
MistralMistral Models
Compatible providersCompatible Provider Models

Provider support varies for attachments, tool behavior, streaming metadata, structured output, and provider-specific parameters. Anvia normalizes the SDK surface and validates known adapter capabilities, but it does not make every provider model identical.