GeminiClient class
Native Google Gemini API client with SSE streaming support.
Unlike OpenAI-compatible providers, the Gemini REST API uses a completely
different authentication scheme (query-parameter API key instead of Bearer
token), endpoint layout (/models/{model}:streamGenerateContent), and
message format (contents / parts instead of messages).
This client translates the app's internal Message model into Gemini's request format and converts Gemini's SSE responses back into the unified StreamEvent types used throughout the codebase.
- Inheritance
-
- Object
- ApiProvider
- GeminiClient
Constructors
- GeminiClient(ApiConfig config)
-
Creates a client with the given Gemini
config.
Properties
Methods
-
createMessage(
{required List< Message> messages, required String systemPrompt, List<ToolDefinition> tools = const [], int? maxTokens}) → Future<Message> -
Send a non-streaming completion via the Gemini
generateContentendpoint.override -
createMessageStream(
{required List< Message> messages, required String systemPrompt, List<ToolDefinition> tools = const [], int? maxTokens}) → Stream<StreamEvent> -
Stream a message completion via the Gemini
streamGenerateContentendpoint.override -
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