OpenRouterBuilder class

OpenRouter-specific LLM builder with provider-specific configuration methods

This builder provides a layered configuration approach where OpenRouter-specific parameters are handled separately from the generic LLMBuilder, keeping the main builder clean and focused.

OpenRouter is an OpenAI-compatible provider that offers access to multiple AI models through a unified API, with additional features like web search capabilities.

Constructors

OpenRouterBuilder.new(LLMBuilder _baseBuilder)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() Future<ChatCapability>
Builds and returns a configured LLM provider instance
buildModelListing() Future<ModelListingCapability>
Builds a provider with ModelListingCapability
forAcademicResearch() OpenRouterBuilder
Configure for academic research with focused search
forGeneralSearch() OpenRouterBuilder
Configure for general web search
forNewsAndEvents() OpenRouterBuilder
Configure for news and current events
forQuickSearch() OpenRouterBuilder
Configure for quick searches with online shortcut
forTechnicalQueries() OpenRouterBuilder
Configure for technical documentation and coding
maxSearchResults(int maxResults) OpenRouterBuilder
Sets the maximum number of search results to include
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
searchPrompt(String prompt) OpenRouterBuilder
Sets a custom search prompt for web search
toString() String
A string representation of this object.
inherited
useOnlineShortcut(bool enabled) OpenRouterBuilder
Enables or disables the online shortcut feature
webSearch({int maxResults = 5, String? searchPrompt, bool useOnlineShortcut = true}) OpenRouterBuilder
Configures web search for OpenRouter models

Operators

operator ==(Object other) bool
The equality operator.
inherited