OpenRouter Chat Model (with Cache)
AI-generatedSummary
Configure and initialize an OpenRouter chat model for generating AI chat completions with advanced prompt caching support tailored for Anthropic and Gemini models, including automatic conversation caching and reasoning token configuration.
Inputs
- model (required) — Select the OpenRouter model to use for chat completion. Options are dynamically loaded from the OpenRouter API.
- cacheSettings — Set prompt caching options including enabling caching (for Anthropic/Gemini models), cache TTL for Anthropic, whether to cache system prompts, first user messages, and automatic caching of conversation history for Anthropic models.
- reasoningSettings — Configure reasoning options for reasoning-capable models (e.g., DeepSeek V4, o-series). Includes 'Effort' level, maximum reasoning tokens, and option to exclude reasoning from the response.
- options — Configure model behavior including sampling parameters (temperature, topP), penalties for token repetition or new topics, maximum tokens to generate, response format (text or JSON), request timeout, max retries on failure, verbosity for thoroughness (especially for Claude), additional request body fields, and other advanced settings.
Output shape
a single response object encapsulating the initialized chat model instance
The operation returns an initialized chat model instance (
ChatOpenRouterWithCache) that supports AI language model completions, with caching controlled by the input parameters. The chat model instance can be used later in the workflow to generate responses. This node does not directly generate a textual completion output itself; it prepares the model for invocation elsewhere.
Examples
Example 1: Use Anthropic Claude model with prompt caching enabled and 1-hour TTL
model=anthropic/claude; cacheSettings.enabled=true; cacheSettings.ttl=1h; cacheSettings.cacheSystemPrompt=true; cacheSettings.cacheFirstUserMessage=false; options.temperature=0.7; options.maxTokens=4096; responseFormat=text