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
| Category | Use it for |
|---|---|
| Completion | Agents, extractors, prompt steps, streaming, and tool calls |
| Embeddings | Retrieval, document search, semantic routing, and vector stores |
| Model listing | Discovering provider-returned model ids and metadata |
| Compatible gateways | OpenAI-compatible gateways, hosted model APIs, and local model backends |
| Compatible providers | OpenAI-compatible APIs through OpenAIClient({ baseUrl, apiKey }) |
| Vertex AI | Gemini 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
| Gateway | Page |
|---|---|
| OpenRouter | OpenRouter |
| LiteLLM | LiteLLM |
| Vercel AI Gateway | Vercel AI Gateway |
| Cloudflare AI Gateway | Cloudflare AI Gateway |
| Portkey | Portkey |
| Helicone AI Gateway | Helicone AI Gateway |
| LangDB AI Gateway | LangDB AI Gateway |
| MiniMax | MiniMax |
| Moonshot AI | Moonshot AI |
| Novita AI | Novita AI |
| NVIDIA NIM | NVIDIA NIM |
| Ollama | Ollama |
| Ollama Cloud | Ollama Cloud |
| OpenCode | OpenCode |
Use compatible gateways when a service exposes an OpenAI-compatible API shape. In Anvia, these endpoints use OpenAIClient({ baseUrl, apiKey }).
Providers
| Provider | Page |
|---|---|
| OpenAI | OpenAI Models |
| Anthropic | Anthropic Models |
| Google Gemini | Google Gemini Models |
| Mistral | Mistral Models |
| Compatible providers | Compatible 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.
