OpenRouterProvider class
Streams chat completions from OpenRouter, whose
API mirrors OpenAI's /chat/completions schema and proxies models from
Anthropic, OpenAI, Google, Meta and others behind one key.
- Inheritance
-
- Object
- AgentProvider
- OpenRouterProvider
Constructors
Properties
- apiKey → String
-
Your OpenRouter API key.
final
-
extraParams
→ Map<
String, Object?> ? -
Extra body fields merged in, e.g.
{'temperature': 0.7}.final - hashCode → int
-
The hash code for this object.
no setterinherited
- model → String
-
Model id, e.g.
anthropic/claude-sonnet-4.5oropenai/gpt-4o.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tools
→ List<
Map< ?String, Object?> > -
Raw OpenAI-shaped function/tool schemas, passed through as
toolsin the request body.nullomits the field.final
Methods
-
asResponder(
{List< ChatMessage> history()?}) → AgentResponder -
Adapts this provider to AgentResponder, for ChatController's managed
send().inherited -
dispose(
) → void -
Releases resources held by this provider.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendMessage(
ChatController controller, String text, {List< Attachment> ? attachments}) → Future<void> -
Drives
controller's manual streaming API directly, so tool calls surface asToolCalls instead of being dropped.inherited -
streamEvents(
List< ChatMessage> conversation) → Stream<ProviderEvent> -
Streams structured events for
conversation's next assistant turn.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited