OpenRouterProvider class
OpenRouter provider.
OpenRouter exposes an OpenAI-compatible chat completions endpoint but
requires extra identification headers (HTTP-Referer and X-Title).
- Inheritance
-
- Object
- OpenAiProvider
- OpenRouterProvider
Constructors
- OpenRouterProvider({required String apiKey, String baseUrl = 'https://openrouter.ai/api/v1/chat/completions', required String defaultModel, int? maxTokens, double temperature = -1, String maxTokensParamName = 'max_completion_tokens', Client? client, String referer = 'https://github.com/IstiN/flutter_agent_memory', String appTitle = 'flutter_agent_memory'})
Properties
- apiKey → String
-
finalinherited
- baseUrl → String
-
finalinherited
-
customHeaders
→ Map<
String, String> -
finalinherited
- defaultModel → String
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxTokens → int?
-
finalinherited
- maxTokensParamName → String
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- temperature → double
-
finalinherited
Methods
-
cancel(
) → Future< void> -
Cancels an in-flight generation, if supported.
inherited
-
chat(
String prompt, {String? model, void onCancel()?}) → Future< String> -
Send a single user prompt and return the generated text.
inherited
-
chatMessages(
List< LlmMessage> messages, {String? model, void onCancel()?}) → Future<String> -
Send a conversation and return the generated text.
inherited
-
chatMessagesStream(
List< LlmMessage> messages, {String? model, void onCancel()?}) → Stream<String> -
Streams a conversation in real-time.
inherited
-
chatStream(
String prompt, {String? model, void onCancel()?}) → Stream< String> -
Streams generated tokens in real-time.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited