OpenRouter Smart Chat Model
AI-generatedSummary
Selects and initializes an OpenRouter AI chat model using intelligent automatic model selection based on the specified task category and budget, or a manual model override. Configures model generation options such as temperature and token limits, and returns a Langchain-compatible chat model instance for use in workflows.
Inputs
- task (required) — Specifies the task category for which the smart model selection should be performed. Options include chat, analysis, coding, creative writing, data extraction, summarization, and translation.
- budget (required) — Defines the budget preference impacting model selection and cost/performance balance. Options are cheap (lowest cost), balanced (good price-performance), and premium (best quality).
- modelOverride — Optionally overrides automatic model selection with a specific model ID. The default 'auto' uses the database routing policy to select a suitable model.
- options.temperature — Controls randomness in model generation. Lower values produce more focused outputs; higher values more creative. Default is 0.7.
- options.maxTokens — Maximum number of tokens for the generated completion. Default is 4096.
- options.topP — Nucleus sampling parameter controlling diversity via cumulative probability cutoff. Default is 1.
- options.frequencyPenalty — Penalty applied to token frequency to reduce repetition. Range from -2 to 2, default 0.
- options.presencePenalty — Penalty to encourage new topics by increasing likelihood of new tokens. Range from -2 to 2, default 0.
Output shape
a single AI language model instance conforming to Langchain's BaseChatModel interface, available on the 'Model' output connection. The instance is configured and ready for generating chat completions.
The model instance returned is lazy-initialized and internally selects the best available model based on the chosen task and budget, or uses the manual override. The instance supports additional model generation options and tool binding. On execution, it communicates with the OpenRouter API to generate chat completions with telemetry logging. Supports automatic QoS-based provider ignoring and routing policy with guardrails. Errors during model selection or initialization are surfaced as node execution errors.