providers library
Optional model-provider integrations (OpenRouter, Gemini) built on
package:http.
Importing this library — unlike
package:agent_ui_kit_providers/agent_ui_kit_providers.dart — pulls the
http dependency into your build. See the README's "Providers" section
for usage.
Classes
- AgentProvider
- Base type for model-provider integrations.
- GeminiProvider
-
Streams
generateContentresponses from Google's Gemini API. - OpenRouterProvider
-
Streams chat completions from OpenRouter, whose
API mirrors OpenAI's
/chat/completionsschema and proxies models from Anthropic, OpenAI, Google, Meta and others behind one key. - ProviderEvent
- One unit of a provider's streamed response.
- TextDelta
- A chunk of assistant text.
- ToolCallEvent
- A tool call the model finished requesting, with fully-accumulated arguments.
Exceptions / Errors
- AgentProviderException
- Thrown when a provider's HTTP request fails.