Providers
Google Gemini
Configure the Gemini provider for Google's AI models.
Setup
import { GeminiProvider } from "noumen";
const provider = new GeminiProvider({
apiKey: "...", // Google AI Studio API key
model: "gemini-2.5-flash", // default
});Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Google AI Studio API key |
model | string | "gemini-2.5-flash" | Default model |
Streaming
The Gemini provider uses generateContentStream from the @google/genai SDK. It maps Gemini's response format to noumen's OpenAI-compatible chunks:
- Text parts become
contentdeltas functionCallparts becometool_callsdeltasusageMetadataon chunks is captured for token usage
Message conversion
Gemini has a unique message format. The provider handles the mapping:
- System messages become the
systemInstructionconfig parameter - OpenAI-style
toolmessages are converted tofunctionResponseparts - Tool call ID to function name resolution is handled automatically
- Multiple tool results are batched into a single
userturn
Models
gemini-2.5-flash-- fast, good default for coding tasksgemini-2.5-pro-- higher capability for complex tasksgemini-2.0-flash-- previous generation, still capable