01Overview
A provider is the object an agent calls to generate a response. You create it once and pass it to the Agent constructor. The agent's provider config field names the provider it uses.
- Cloud providers: hosted APIs with pay-per-token pricing. Anthropic, OpenAI, Google Gemini, Mistral, DeepSeek and xAI.
- Local providers: self-hosted model servers. Ollama, LM Studio, LocalAI, Text Generation WebUI, vLLM, or any OpenAI-compatible endpoint. Data stays on your infrastructure and there are no API costs.
- Voice providers: speech-to-text and text-to-speech for voice agents.
02Cloud providers
Anthropic (Claude)
import { Agent, AnthropicProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
const provider = new AnthropicProvider(process.env.ANTHROPIC_API_KEY);
const toolRegistry = new ToolRegistry();
const agent = new Agent(
{
name: 'claude-agent',
description: 'Claude-backed assistant',
model: 'claude-sonnet-4-6',
provider: 'anthropic',
temperature: 0.7,
maxTokens: 4096,
},
provider,
toolRegistry,
);Models include claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5 and claude-fable-5. Older generations remain supported. Environment variable: ANTHROPIC_API_KEY.
OpenAI (GPT)
import { Agent, OpenAIProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
const provider = new OpenAIProvider(process.env.OPENAI_API_KEY);
const toolRegistry = new ToolRegistry();
const agent = new Agent(
{
name: 'gpt-agent',
description: 'OpenAI-backed assistant',
model: 'gpt-4.1',
provider: 'openai',
temperature: 0.8,
maxTokens: 2048,
},
provider,
toolRegistry,
);Models include gpt-5, gpt-4.1, gpt-4o, gpt-4o-mini, o3 and o4-mini. Environment variable: OPENAI_API_KEY.
Note
o3 and o4-mini accept different options. Per-model type safety checks at compile time which options each model supports.Google (Gemini)
import { Agent, GeminiProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
const provider = new GeminiProvider(process.env.GEMINI_API_KEY);
const toolRegistry = new ToolRegistry();
const agent = new Agent(
{
name: 'gemini-agent',
description: 'Gemini-backed assistant',
model: 'gemini-2.5-flash',
provider: 'gemini',
temperature: 0.7,
},
provider,
toolRegistry,
);Models include gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash, gemini-3.5-flash and gemini-3.1-pro-preview. The provider reads GEMINI_API_KEY, or GOOGLE_API_KEY if that is unset, and throws if neither is set.
Mistral, DeepSeek and xAI
Mistral, DeepSeek and xAI (Grok) are part of the provider registry. Each one is created with a config builder and runs over the OpenAI-compatible transport, using its own API key variable.
import { createProvider, mistral, deepseek, xai } from '@lov3kaizen/agentsea-core';
// Mistral: reads MISTRAL_API_KEY
const mistralProvider = createProvider(
mistral('mistral-large-latest', { tools: [myTool] }),
);
// DeepSeek: reads DEEPSEEK_API_KEY
const deepseekProvider = createProvider(deepseek('deepseek-reasoner'));
// xAI (Grok): reads XAI_API_KEY
const grokProvider = createProvider(xai('grok-3'));mistral-*mistral-large-latest, mistral-small-latest, codestral-latestdeepseek-*deepseek-chat, deepseek-reasonergrok-*grok-3, grok-3-fast, grok-3-miniThe config builders are anthropic(), openai(), gemini(), mistral(), deepseek() and xai(). They share one shape, so options are checked against the model you pick. See per-model type safety.
03Local providers
Local providers run models on your own machine or server. They keep data private, have no per-token cost and work offline.
Ollama (recommended)
The simplest way to run models locally. Ollama exposes model listing and pulling through the provider.
import { Agent, OllamaProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
const provider = new OllamaProvider({
baseUrl: 'http://localhost:11434', // default
timeout: 60000, // default
});
// Pull a model, then list what is available
await provider.pullModel('llama3.2');
const models = await provider.listModels();
const toolRegistry = new ToolRegistry();
const agent = new Agent(
{
name: 'local-agent',
description: 'Runs on a local Ollama server',
model: 'llama3.2',
provider: 'ollama',
},
provider,
toolRegistry,
);The base URL can also come from OLLAMA_BASE_URL.
LM Studio
A desktop app with a model browser and a built-in OpenAI-compatible server.
import { Agent, LMStudioProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
const provider = new LMStudioProvider({
baseUrl: 'http://localhost:1234/v1', // default
});
const toolRegistry = new ToolRegistry();
const agent = new Agent(
{
name: 'lmstudio-agent',
description: 'Runs on LM Studio',
model: 'local-model', // the model you loaded in LM Studio
provider: 'openai-compatible',
},
provider,
toolRegistry,
);LocalAI
import { LocalAIProvider } from '@lov3kaizen/agentsea-core';
const provider = new LocalAIProvider({
baseUrl: 'http://localhost:8080/v1', // default
});Text Generation WebUI
import { TextGenerationWebUIProvider } from '@lov3kaizen/agentsea-core';
const provider = new TextGenerationWebUIProvider({
baseUrl: 'http://localhost:5000/v1', // default
});vLLM
import { VLLMProvider } from '@lov3kaizen/agentsea-core';
const provider = new VLLMProvider({
baseUrl: 'http://localhost:8000/v1', // default
});Jan and other OpenAI-compatible servers
Any server that speaks the OpenAI chat API can be used through OpenAICompatibleProvider. baseUrl is required.
import { OpenAICompatibleProvider } from '@lov3kaizen/agentsea-core';
// Jan serves an OpenAI-compatible API. Point baseUrl at your Jan server.
const provider = new OpenAICompatibleProvider({
baseUrl: 'http://localhost:1337/v1',
});Note
OpenAICompatibleProvider with the server's base URL.04Voice providers
Speech-to-text and text-to-speech providers for voice-enabled agents:
- Speech-to-text: OpenAI Whisper, LemonFox STT, Local Whisper
- Text-to-speech: OpenAI TTS, LemonFox TTS, ElevenLabs, Piper TTS
See the voice guide for setup.
05Provider reference
AnthropicProvider(apiKey?)ANTHROPIC_API_KEY when no key is passed.OpenAIProvider(apiKey?)OPENAI_API_KEY.GeminiProvider(apiKey?)GEMINI_API_KEY or GOOGLE_API_KEY.OllamaProvider({ baseUrl?, timeout? })http://localhost:11434. Also listModels() and pullModel(name).LMStudioProvider({ baseUrl? })http://localhost:1234/v1.LocalAIProvider({ baseUrl? })http://localhost:8080/v1.TextGenerationWebUIProvider({ baseUrl? })http://localhost:5000/v1.VLLMProvider({ baseUrl? })http://localhost:8000/v1.OpenAICompatibleProvider({ baseUrl, apiKey?, timeout? })baseUrl is required.createProvider(config)mistral() or xai().06Choosing a provider
- Getting started: start with a cloud provider such as Anthropic or OpenAI for quality and easy setup. Use Ollama with
llama3.2for the simplest local setup. - Privacy: keep data on your infrastructure with a local provider.
- Production scale: vLLM serves self-hosted models at high request volume.
Because every provider implements the same interface, you can start on a cloud provider and move to a local one later without changing agent code. Swap the provider instance and the model name.
07Multi-provider setup
Use different providers for different tasks:
import {
Agent,
AnthropicProvider,
OllamaProvider,
ToolRegistry,
} from '@lov3kaizen/agentsea-core';
const toolRegistry = new ToolRegistry();
const context = { conversationId: 'demo', sessionData: {}, history: [] };
// Cloud provider for complex tasks
const researchAgent = new Agent(
{
name: 'researcher',
description: 'Research assistant',
model: 'claude-sonnet-4-6',
provider: 'anthropic',
systemPrompt: 'You are a research assistant.',
},
new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
toolRegistry,
);
// Local provider for simple tasks
const helperAgent = new Agent(
{
name: 'helper',
description: 'Simple local helper',
model: 'llama3.2',
provider: 'ollama',
systemPrompt: 'You are a helpful assistant.',
},
new OllamaProvider(),
toolRegistry,
);
const complexResult = await researchAgent.execute('Analyze this...', context);
const simpleResult = await helperAgent.execute('What is 2+2?', context);