Providers ​
Provider packages adapt vendor SDKs to Anvia's runtime contracts. The application creates a provider client, asks it for a capability-specific model, and injects that model into Core.
Provider client Capability model Anvia runtime
credentials completionModel() Agent
endpoint -> embeddingModel() -> generateCompletion
SDK options transcriptionModel() Pipeline stagesThis boundary keeps credentials and vendor configuration out of prompts, tools, and product logic.
1. Install only what the application uses ​
pnpm add @anvia/core @anvia/openaiAvailable provider guides cover:
- OpenAI through
@anvia/openai - Anthropic through
@anvia/anthropic - Gemini through
@anvia/gemini - Mistral through
@anvia/mistral - Grok through
@anvia/grok - Compatible APIs through an OpenAI- or Anthropic-shaped adapter
2. Create models at a server boundary ​
import { OpenAIClient } from '@anvia/openai'
const openai = new OpenAIClient({
apiKey: process.env.OPENAI_API_KEY!,
})
export const supportModel =
openai.completionModel({
modelId: 'gpt-5.6-sol',
api: "responses"
})The returned object satisfies Anvia's CompletionModel. Inject it into the runtime:
import { Agent } from '@anvia/core'
import { supportModel } from './models'
export const supportAgent = new Agent({
id: 'support',
model: supportModel,
instructions:
'Answer support questions clearly and concisely.',
maxTurns: 4,
})Keep provider clients, API keys, endpoints, and custom headers in server or worker code. Browsers should call application-owned routes.
3. Choose a capability before a brand ​
A provider client may expose several independent contracts:
const chat = openai.completionModel({
modelId: 'gpt-5.6-sol',
api: 'responses',
})
const embeddings = openai.embeddingModel({
modelId: 'text-embedding-3-small'
})A completion model cannot be used for embeddings merely because both come from one provider. It is normal to use different providers for conversation, retrieval, OCR, transcription, and evaluation.
4. Verify the actual configuration ​
Adapter capabilities describe what Anvia can map. They do not prove that every model ID, account, region, or compatible endpoint enables the same feature.
Before shipping, exercise the exact production path for streaming, tool choice, structured output, media, and provider parameters. Model listing proves inventory, not behavior.
Continue with the model boundary, provider selection, and capability declarations.