Function: google()
google(
modelId,config?):ModelConfig
Defined in: packages/core/src/providers/factories.ts:517
Configure Google (Gemini) provider explicitly.
Google's Gemini family is served through the Generative Language API at
https://generativelanguage.googleapis.com/v1beta and routed via
@ai-sdk/google. Model IDs follow the gemini-* prefix
(gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash,
gemini-1.5-pro, gemini-1.5-flash, …). Auto-detection routes any
gemini-* model here; the factory is for explicit config (custom
apiKey, baseUrl, reasoning, headers, fetch).
Multimedia: Gemini 1.5+/2.x is multimodal-first — images, video frames, audio, and PDF/file inputs are accepted natively through the AI SDK content-part path.
Reasoning ("thinking"): Gemini 2.5 models expose thinking budgets via
thinkingConfig. reasoning.effort maps to thinkingBudget (low=2048,
medium=8192, high=24576), or pass reasoning.budgetTokens directly for
fine-grained control.
API key env vars (checked in order): GEMINI_API_KEY,
GOOGLE_GEMINI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY.
Parameters
modelId
string
Gemini model ID, e.g. 'gemini-2.5-flash'
config?
ProviderConfig & object
Optional configuration (provider settings + reasoning).
Returns
Examples
const bot = new Baleybot({ model: google('gemini-2.5-flash') });
const bot = new Baleybot({
model: google('gemini-2.5-pro', { reasoning: { effort: 'high' } })
});
const bot = new Baleybot({
model: google('gemini-2.5-pro', { reasoning: { budgetTokens: 16384 } })
});
const bot = new Baleybot({
model: google('gemini-2.5-flash', { apiKey: 'AI...' })
});