AgentSea

Concept

Per-model type safety

Get compile-time TypeScript errors for model options that a model does not support. Inspired by TanStack AI.

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.

ModelToolsSystem promptVisionExtended thinking
Claude 3.5 SonnetYesYesYesYes
Claude 3 HaikuYesYesYesNo
GPT-4oYesYesYesNo
o1YesNoYesYes
o1-miniNoNoNoYes
Gemini 1.5 ProYesYesYesNo

02Quick start

TS
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?)

TS
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?)

TS
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?)

TS
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?)

TS
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

Ollama model IDs are not a fixed list, so type checks are looser here. Whether a model supports tools depends on the model you pull.

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.

TS
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.

TS
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

ModelToolsVisionThinkingContextMax output
claude-3-5-sonnet-*YesYesYes200K8,192
claude-3-5-haiku-*YesYesNo200K8,192
claude-3-opus-*YesYesNo200K4,096
claude-opus-4-5-*YesYesYes200K32,000

OpenAI

ModelToolsSystemVisionThinkingContextMax output
gpt-4o*YesYesYesNo128K16,384
gpt-4-turboYesYesYesNo128K4,096
gpt-3.5-turboYesYesNoNo16K4,096
o1YesNoYesYes200K100,000
o1-miniNoNoNoYes128K65,536
o3-miniYesNoNoYes200K100,000

Gemini

ModelToolsVisionThinkingContextMax output
gemini-2.0-flash-expYesYesNo1M8,192
gemini-2.0-flash-thinkingYesYesYes1M8,192
gemini-1.5-proYesYesNo2M8,192
gemini-1.5-flashYesYesNo1M8,192

06Runtime capability checks

Query the model registry at runtime:

TS
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'>
Resolves to true or false for a config type.
RequireCapability<T, 'tools'>
Constrains a parameter to configs that support the capability.
TS
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:

TS
// 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:

TS
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.

09Next steps