Model Configuration

Copy page

Configure AI models for your Agents and Sub Agents

Configure models at Project (required), Agent, or Sub Agent levels. Settings inherit down the hierarchy.

Configuration Hierarchy

You must configure at least the base model at the project level:

// inkeep.config.ts
export default defineConfig({
  models: {
    base: {
      model: "anthropic/claude-sonnet-4-6",
      providerOptions: { temperature: 0.7, maxOutputTokens: 2048 }
    }
  }
});

Override at agent or sub agent level:

const myAgent = agent({
  models: {
    base: { model: "openai/gpt-5.2" }  // Override project default
  }
});

const mySubAgent = subAgent({
  models: {
    structuredOutput: { model: "openai/gpt-4.1-mini" }  // Override for JSON output
  }
});

Model Types

TypePurposeFallback
baseText generation and reasoningRequired at project level
structuredOutputJSON/structured output onlyFalls back to base
summarizerSummaries and status updatesFalls back to base

Each model type inherits independently through the project → agent → sub agent hierarchy. structuredOutput and summarizer resolve to the most specific level that sets them, regardless of where base is configured — overriding only base at the agent or sub agent level does not change which structuredOutput or summarizer is used. They fall back to the resolved base only when no level sets them.

Supported Models

ProviderExample ModelsAPI Key
Anthropicanthropic/claude-opus-5-5
anthropic/claude-sonnet-5-5
anthropic/claude-haiku-5-5
anthropic/claude-sonnet-4-6
anthropic/claude-opus-4-8
anthropic/claude-opus-4-7
anthropic/claude-opus-4-6
anthropic/claude-haiku-4-5
ANTHROPIC_API_KEY
OpenAIopenai/gpt-6.2-sol
openai/gpt-6.1-terra
openai/gpt-6-luna
openai/gpt-5.5-pro
openai/gpt-5.5
openai/gpt-5.4-pro
openai/gpt-5.4
openai/gpt-5.4-mini
openai/gpt-5.4-nano
openai/gpt-5.2
openai/gpt-5.1
openai/gpt-4.1
openai/gpt-4.1-mini
openai/gpt-5*
OPENAI_API_KEY
Azure OpenAIazure/my-gpt4-deployment
azure/my-gpt35-deployment
AZURE_API_KEY
Googlegoogle/gemini-4-hydrogen
google/gemini-4-neon
google/gemini-3.5-flash-lite
google/gemini-3.1-pro-preview
google/gemini-3.5-flash
google/gemini-3.1-flash-lite
google/gemini-2.5-pro
google/gemini-2.5-flash
google/gemini-2.5-flash-lite
GOOGLE_GENERATIVE_AI_API_KEY
OpenRouteropenrouter/anthropic/claude-sonnet-4-0
openrouter/meta-llama/llama-3.1-405b
OPENROUTER_API_KEY
Gatewaygateway/openai/gpt-4.1-miniAI_GATEWAY_API_KEY
NVIDIA NIMnim/nvidia/llama-3.3-nemotron-super-49b-v1.5
nim/nvidia/nemotron-4-340b-instruct
NIM_API_KEY
Custom OpenAI-compatiblecustom/my-custom-model
custom/llama-3-custom
CUSTOM_LLM_API_KEY
Mockmock/defaultNone required
Note
Note
*openai/gpt-5, openai/gpt-5-mini, and openai/gpt-5-nano require a verified OpenAI organization. If your organization is not yet verified, these models will not be available.

Pinned vs Unpinned Models

A dated model ID such as openai/gpt-5.5-2026-04-23 pins an exact version. A provider alias such as openai/gpt-5.5 can point to a different version over time. Providers publish the available aliases and versions.

The TypeScript SDK also provides constants for common models:

import { OPENAI_MODELS } from "@inkeep/agents-sdk";

models: {
  base: {
    model: OPENAI_MODELS.GPT_6_2_SOL,
  }
}
Note
Note

Anthropic scheduled the Claude Sonnet 4.5 retirement on its API for November 30, 2026. If your project uses anthropic/claude-sonnet-4-5 or its dated ID, choose a supported model such as anthropic/claude-sonnet-4-6. See Anthropic's model deprecations.

Provider Options

Inkeep Agents supports all Vercel AI SDK provider options.

How providerOptions works

providerOptions accepts two types of values:

  • Scalars (temperature, topP, maxOutputTokens, seed, maxDuration) — standard generation parameters applied to every call
  • Objects (anthropic: {}, openai: {}, gateway: {}, etc.) — provider-specific options for that provider

This means you can mix them freely:

providerOptions: {
  temperature: 0.7,            // generation param
  anthropic: {                 // Anthropic-specific options
    thinking: { type: 'enabled', budgetTokens: 8000 }
  }
}
Note
Note

Constructor-level config (baseURL, headers, resourceName, apiVersion) is always specified at the top level of providerOptions, not nested under a provider key.

Complete Examples

Basic configuration:

OpenAI with reasoning:

Anthropic with thinking:

Google with thinking:

Controlling reasoning:

Each provider exposes reasoning through providerOptions (see the examples above):

  • Anthropic — anthropic.thinking
  • OpenAI — openai.reasoningEffort
  • Google — google.thinkingConfig.thinkingBudget

Default reasoning behavior varies by model. Claude 5 models and GPT-6.2 Sol reason by default. To reduce reasoning on GPT-6.2 Sol, set providerOptions.openai.reasoningEffort to 'low'. Sol rejects 'none'. See Tuning Agents and the provider guides for Anthropic, OpenAI, and Google.

Vercel AI Gateway:

When AI_GATEWAY_API_KEY is set, Anthropic, OpenAI, and Google models are automatically routed through Vercel AI Gateway for per-request cost tracking. No configuration changes are needed — your existing model strings work as-is. See AI Gateway below for fallback models, allowed providers, and advanced gateway configuration.

Azure OpenAI:

Note
Note

Azure OpenAI requires either resourceName (for standard Azure OpenAI deployments) or baseURL (for custom endpoints) in providerOptions. The AZURE_API_KEY environment variable must be set for authentication. Note that only one Azure OpenAI resource can be used at a time since authentication is handled via a single environment variable.

Custom OpenAI-compatible provider:

Note
Note

Custom OpenAI-compatible providers require a base URL to be specified in providerOptions.baseURL or providerOptions.baseUrl. The CUSTOM_LLM_API_KEY environment variable will be automatically used for authentication if present.

Context Window Override

Inkeep uses a built-in input token limit for supported models. Set providerOptions.contextWindowSize to specify the input token limit for a custom model or override a built-in limit.

Note
Note

Automatic compression uses the smaller of the input token limit, including any override, and a fixed 300,000-token budget. An artifact is oversized when it exceeds 30% of the model's input token limit. See Conversation Memory for compression triggers and fallback settings.

Anthropic charges higher rates for Claude Haiku 5.5 prompts over 100,000 tokens. Set contextWindowSize to 100000 on that model to start compression sooner.

AI Gateway

Vercel AI Gateway provides intelligent model routing, automatic failover, and per-request cost tracking. All AI Gateway features require AI_GATEWAY_API_KEY to be set in your environment.

When the gateway is active, Anthropic, OpenAI, and Google models are automatically routed through it — no configuration changes needed. This enables fallback models and allowed providers for those providers. Per-request cost tracking is available for any model routed through the gateway.

For self-hosted deployments, you can bring your own API keys (BYOK) for any provider by configuring them in your Vercel AI Gateway team settings.

Use the same provider model IDs shown above when Inkeep routes requests through the gateway automatically. For an explicit gateway/ model ID, use the gateway's ID. For example, configure gateway/anthropic/claude-sonnet-5.5 for Claude Sonnet 5.5. See the Vercel AI Gateway model catalog.

Fallback Models

Configure an ordered list of backup models that the gateway tries if the primary model fails or is unavailable:

If the primary model (anthropic/claude-sonnet-5-5) fails, the gateway automatically tries openai/gpt-5.2, then google/gemini-2.5-flash. If all models fail, the request errors.

Fallback models can be configured on any model slot (base, structuredOutput, summarizer). They inherit through the project → agent → sub agent hierarchy — even when a sub agent overrides the model itself, it still inherits fallbackModels from its parent unless it explicitly sets its own. All entries must use the provider/model format (e.g., "openai/gpt-5.2").

If a structured-output request has a Gemini fallback and the schema allows extra object properties, Inkeep delivers answer text and components after validation. Claude and OpenAI still receive the schema through their provider adapters.

Allowed Providers

Restrict and prioritize which providers can serve requests. The order determines preference — the first provider in the list has the highest priority:

The gateway will try to serve the request via AWS Bedrock first. If Bedrock is unavailable, it falls back to Anthropic's direct API.

Available providers include: anthropic, openai, google, bedrock, azure, vertex.

Like fallbackModels, allowedProviders inherits through the project → agent → sub agent hierarchy even when the model is overridden at a lower level.

Combining Both

Both features can be used together. With this configuration, allowedProviders restricts and prioritizes which providers can serve the primary model, while fallbackModels defines alternative models to try if the primary model is unavailable:

models: {
  base: {
    model: "anthropic/claude-sonnet-5-5",
    allowedProviders: ["bedrock", "anthropic"],
    fallbackModels: ["openai/gpt-5.2", "google/gemini-2.5-flash"],
  }
}

Advanced: Manual Gateway Provider Options

You can also configure gateway routing directly via providerOptions for access to the full gateway provider options (order, only, models, byok, providerTimeouts, tags, zeroDataRetention).

Note
Note

providerOptions.gateway.caching and providerOptions.anthropic.cacheControl interact with Inkeep's default-on prompt caching. Inkeep applies its caching default only when you haven't set a value — if you set providerOptions.gateway.caching or providerOptions.anthropic.cacheControl explicitly, your value is preserved.

models: {
  base: {
    model: "gateway/openai/gpt-4.1",
    providerOptions: {
      gateway: {
        models: ["openai/gpt-4.1", "anthropic/claude-sonnet-5.5"],
      }
    }
  }
}
Note
Note

If you set both fallbackModels and providerOptions.gateway.models, fallbackModels takes precedence.

CLI Defaults

npx @inkeep/create-agents and inkeep add --project set model defaults based on your provider.

ProviderBaseStructured OutputSummarizer
Anthropicclaude-sonnet-4-6claude-sonnet-4-6claude-sonnet-4-6
OpenAIgpt-5.2gpt-4.1-minigpt-5.4-nano
Googlegemini-2.5-flashgemini-2.5-flash-litegemini-2.5-flash-lite