OpenRouterProvider constructor
OpenRouterProvider({})
Creates an OpenRouter provider.
Pass httpClient to reuse an existing client (its lifecycle is then the
caller's responsibility); otherwise one is created and closed by
dispose. endpoint overrides the default completions URL, useful for
a proxy in front of OpenRouter.
Implementation
OpenRouterProvider({
required this.apiKey,
required this.model,
http.Client? httpClient,
Uri? endpoint,
this.tools,
this.extraParams,
}) : _httpClient = httpClient ?? http.Client(),
_ownsClient = httpClient == null,
_endpoint =
endpoint ?? Uri.parse('https://openrouter.ai/api/v1/chat/completions');