01Why per-model type safety
Different models have different capabilities. o1-mini does not support tools. o1 does not support system prompts. Claude Haiku 4.5 does not support extended thinking.
Without type safety, you find these mismatches at runtime. With per-model type safety, TypeScript reports them while you write the code.
| Model | Tools | System prompt | Vision | Extended thinking |
|---|---|---|---|---|
| Claude 3.5 Sonnet | Yes | Yes | Yes | Yes |
| Claude 3 Haiku | Yes | Yes | Yes | No |
| GPT-4o | Yes | Yes | Yes | No |
| o1 | Yes | No | Yes | Yes |
| o1-mini | No | No | No | Yes |
| Gemini 1.5 Pro | Yes | Yes | Yes | No |
02Quick start
import { anthropic, openai, createProvider } from '@lov3kaizen/agentsea-core';
// Valid: Claude Sonnet 4.5 supports tools and extended thinking
const claudeConfig = anthropic('claude-sonnet-4-5-20250929', {
tools: [myTool],
systemPrompt: 'You are helpful',
thinking: { type: 'enabled', budgetTokens: 10000 },
temperature: 0.7,
});
// Valid: o1 supports tools but NOT system prompts
const o1Config = openai('o1', {
tools: [myTool],
reasoningEffort: 'high',
// systemPrompt: '...' // Error: not allowed for o1
});
// Error: o1-mini does not support tools
const o1MiniConfig = openai('o1-mini', {
// tools: [myTool], // Error: 'tools' does not exist in type
reasoningEffort: 'medium',
});
const provider = createProvider(claudeConfig);
console.log(provider.supportsCapability('vision'));03Config builders
Each provider has a config builder. It takes a model ID and returns a config whose options match that model.
anthropic(model, config?)
import { anthropic } from '@lov3kaizen/agentsea-core';
// Claude Opus 4.8: tools and system prompts. Thinking is adaptive on 4.6+ models,
// so budgetTokens-style config is not part of the type for them.
const config = anthropic('claude-opus-4-8', {
tools: [myTool],
systemPrompt: 'You are a helpful assistant',
temperature: 0.7,
maxTokens: 4096,
providerOptions: {
metadata: { userId: 'user-123' },
},
});
// Claude Sonnet 4.5: explicit extended thinking
const thinkingConfig = anthropic('claude-sonnet-4-5-20250929', {
tools: [myTool],
thinking: { type: 'enabled', budgetTokens: 10000 },
});
// Claude Haiku 4.5: no extended thinking
const haikuConfig = anthropic('claude-haiku-4-5-20251001', {
tools: [myTool],
systemPrompt: 'You are fast',
// thinking: { ... } // Error: not allowed for Haiku 4.5
});Typed models include claude-opus-4-8 (the default), claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5, claude-fable-5, claude-sonnet-4-5-20250929, claude-opus-4-5-20251101 and the Claude 3.x family.
openai(model, config?)
import { openai } from '@lov3kaizen/agentsea-core';
// GPT-4o: tools and system prompts
const gpt4oConfig = openai('gpt-4o', {
tools: [myTool],
systemPrompt: 'You are helpful',
temperature: 0.8,
providerOptions: {
responseFormat: { type: 'json_object' },
seed: 42,
parallelToolCalls: true,
},
});
// o1: tools and reasoning, but no system prompt
const o1Config = openai('o1', {
tools: [myTool],
reasoningEffort: 'high',
});
// o1-mini: reasoning only
const o1MiniConfig = openai('o1-mini', {
reasoningEffort: 'medium',
});
// o3-mini: tools, but no system prompt
const o3MiniConfig = openai('o3-mini', {
tools: [myTool],
reasoningEffort: 'high',
});Typed models include gpt-5.5, gpt-5.4-mini, gpt-5, gpt-4.1, gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo and the reasoning models o3, o3-mini, o1 and o1-mini.
gemini(model, config?)
import { gemini } from '@lov3kaizen/agentsea-core';
const geminiConfig = gemini('gemini-2.5-pro', {
tools: [myTool],
systemPrompt: 'You are helpful',
topK: 40,
temperature: 0.9,
providerOptions: {
safetySettings: [
{ category: 'HARM_CATEGORY_HARASSMENT', threshold: 'BLOCK_MEDIUM_AND_ABOVE' },
],
},
});Typed models include gemini-3.5-flash, gemini-3.1-pro-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash and gemini-1.5-flash-8b.
ollama(model, config?)
import { ollama } from '@lov3kaizen/agentsea-core';
// Ollama models are user-defined, so the model ID is not checked strictly
const ollamaConfig = ollama('llama3.2', {
tools: [myTool],
systemPrompt: 'You are helpful',
temperature: 0.7,
providerOptions: {
numCtx: 4096,
numGpu: 1,
},
});Note
mistral(), deepseek(), xai()
Mistral, DeepSeek and xAI use the same builder shape. Each checks the model ID and the options that model supports. createProvider sets up the OpenAI-compatible transport and reads the matching key variable: MISTRAL_API_KEY, DEEPSEEK_API_KEY or XAI_API_KEY.
import { mistral, deepseek, xai, createProvider } from '@lov3kaizen/agentsea-core';
const mistralConfig = mistral('mistral-large-latest', {
tools: [myTool],
systemPrompt: 'You are helpful',
temperature: 0.7,
});
const deepseekConfig = deepseek('deepseek-reasoner', {
systemPrompt: 'Think step by step',
});
const grokConfig = xai('grok-3', { tools: [myTool] });
const provider = createProvider(mistralConfig);04Creating providers
createProvider() takes any config builder result and returns a provider wrapper. Provider-specific factories also accept an explicit API key.
import {
anthropic,
openai,
createProvider,
createAnthropicProvider,
} from '@lov3kaizen/agentsea-core';
// Generic factory
const claudeProvider = createProvider(anthropic('claude-opus-4-8', { tools: [myTool] }));
const gptProvider = createProvider(openai('gpt-4o', { tools: [myTool] }));
// Provider-specific factory, with an explicit key
const claude = createAnthropicProvider(
anthropic('claude-opus-4-8', { tools: [myTool] }),
{ apiKey: process.env.ANTHROPIC_API_KEY },
);
console.log(claude.config.model); // 'claude-opus-4-8'
console.log(claude.supportsCapability('vision'));
console.log(claude.getModelInfo()?.capabilities.contextWindow);05Capability reference
The tables below are illustrative. The typed registry includes the latest Claude, GPT-5, o3 and Gemini 3 and 2.5 models. For exact capabilities, context window and maximum output of a specific model, call getModelInfo(model).
Anthropic
| Model | Tools | Vision | Thinking | Context | Max output |
|---|---|---|---|---|---|
| claude-3-5-sonnet-* | Yes | Yes | Yes | 200K | 8,192 |
| claude-3-5-haiku-* | Yes | Yes | No | 200K | 8,192 |
| claude-3-opus-* | Yes | Yes | No | 200K | 4,096 |
| claude-opus-4-5-* | Yes | Yes | Yes | 200K | 32,000 |
OpenAI
| Model | Tools | System | Vision | Thinking | Context | Max output |
|---|---|---|---|---|---|---|
| gpt-4o* | Yes | Yes | Yes | No | 128K | 16,384 |
| gpt-4-turbo | Yes | Yes | Yes | No | 128K | 4,096 |
| gpt-3.5-turbo | Yes | Yes | No | No | 16K | 4,096 |
| o1 | Yes | No | Yes | Yes | 200K | 100,000 |
| o1-mini | No | No | No | Yes | 128K | 65,536 |
| o3-mini | Yes | No | No | Yes | 200K | 100,000 |
Gemini
| Model | Tools | Vision | Thinking | Context | Max output |
|---|---|---|---|---|---|
| gemini-2.0-flash-exp | Yes | Yes | No | 1M | 8,192 |
| gemini-2.0-flash-thinking | Yes | Yes | Yes | 1M | 8,192 |
| gemini-1.5-pro | Yes | Yes | No | 2M | 8,192 |
| gemini-1.5-flash | Yes | Yes | No | 1M | 8,192 |
06Runtime capability checks
Query the model registry at runtime:
import {
getModelInfo,
modelSupportsCapability,
getModelsForProvider,
getModelsWithCapability,
} from '@lov3kaizen/agentsea-core';
// Full model info, including capabilities
const info = getModelInfo('claude-3-5-sonnet-20241022');
console.log(info?.capabilities.contextWindow, info?.capabilities.maxOutputTokens);
// Check one capability
const supportsTools = modelSupportsCapability('o1-mini', 'tools'); // false
const supportsVision = modelSupportsCapability('gpt-4o', 'vision'); // true
// Find models by provider, or by capability
const anthropicModels = getModelsForProvider('anthropic');
const visionModels = getModelsWithCapability('vision', true);
const thinkingModels = getModelsWithCapability('extendedThinking', true);A provider wrapper exposes the same checks: provider.supportsCapability(name) and provider.getModelInfo().
07Type-level capability checks
For generic code, use the type utilities. They check a config at compile time without running it.
ConfigSupports<T, 'tools'>RequireCapability<T, 'tools'>import type { ConfigSupports, RequireCapability, ProviderModelConfig } from '@lov3kaizen/agentsea-core';
type SupportsTools = ConfigSupports<typeof myConfig, 'tools'>; // true | false
function withTools<T extends ProviderModelConfig>(config: RequireCapability<T, 'tools'>) {
// config is known to support tools
}08Migration guide
Before, the mismatch surfaces when the agent runs:
// Fails at runtime: o1-mini does not support tools or system prompts
const agent = new Agent(
{
name: 'assistant',
description: 'Reasoning assistant',
model: 'o1-mini',
provider: 'openai',
systemPrompt: 'Hello',
tools: [myTool],
},
new OpenAIProvider(),
toolRegistry,
);After, the same mismatch is a compile error:
import { openai, createProvider } from '@lov3kaizen/agentsea-core';
const config = openai('o1-mini', {
// systemPrompt: 'Hello', // Compile error
// tools: [myTool], // Compile error
reasoningEffort: 'high', // Valid
});
const provider = createProvider(config);The builders check the config. The Agent constructor takes a provider instance, not the wrapper. Pass provider.provider, the underlying provider that createProvider creates, along with the tool registry.