Text generation
Generate text with a Gemini language model.
AI Tools · Const
The Google provider lets AI SDK applications call Google Gemini models through @ai-sdk/google. Use google(modelId) to create a model for AI SDK generation functions, with authentication supplied by the documented environment variable.
The Google provider connects AI SDK model calls to Google’s APIs. Import the default provider, pass a Gemini model identifier to it, and use the resulting model with AI SDK functions such as generateText; configure authentication through the provider’s documented API-key environment variable.
google(modelId)| Name | Type | Description |
|---|---|---|
modelId | string | Google model identifier, such as a Gemini model name. |
A language model instance compatible with AI SDK Core generation functions.
google provider can create models directly from a model identifier.google(modelId) to obtain a model usable with AI SDK generation functions.ai package and the Google provider package.import { generateText } from 'ai';
import { google } from '@ai-sdk/google';
const { text } = await generateText({
model: google('gemini-2.5-flash'),
prompt: 'Explain dependency injection in one sentence.',
});
console.log(text);Generates text with a Google Gemini model through the official Google provider.
Generate text with a Gemini language model.
Connect directly to Google’s Generative AI APIs.
Use Google-specific provider capabilities such as the documented interactions API.
generateTextcreateGoogle@ai-sdk/googleGOOGLE_GENERATIVE_AI_API_KEYAI Gateway