Configure project and location
A service must target a specific Google Cloud project and Vertex region.
AI Tools · Function
createVertex creates a customized Google Vertex provider from optional settings such as a Google Cloud project and location. Use the returned provider to select Vertex models for AI SDK operations.
createVertex constructs a Google Vertex provider instance from optional configuration such as the Google Cloud project and regional location. The resulting provider is callable with a model identifier and can supply that model to AI SDK operations such as generateText.
createVertex(options)| Name | Type | Description |
|---|---|---|
options | object | Optional provider settings, including project and location. |
A configured Google Vertex provider instance that can be called with a model identifier.
import { createVertex } from '@ai-sdk/google-vertex';
import { generateText } from 'ai';
const vertex = createVertex({
project: 'my-project',
location: 'us-central1',
});
const { text } = await generateText({
model: vertex('gemini-2.5-flash'),
prompt: 'Explain dependency injection in one sentence.',
});
console.log(text);Creates a configured Google Vertex provider, then uses it to select a Vertex model for text generation.
A service must target a specific Google Cloud project and Vertex region.
An application needs to select a Vertex model through the AI SDK provider interface.
A codebase wants provider configuration separated from individual generation calls.
createVertex is the factory for a customized Google Vertex provider from the @ai-sdk/google-vertex package. Its returned provider can be called with a model identifier, such as vertex('gemini-2.5-flash'), to create the model used by AI SDK operations.
Follow-up: How would you configure the provider for a particular Google Cloud deployment? Pass the project identifier and regional location in the factory options, for example project: 'my-project' and location: 'us-central1'.
Import createVertex from @ai-sdk/google-vertex and call it with an options object. The documented options example sets project and location, and the resulting provider is then used to select Vertex models.
Follow-up: What is the role of the returned provider? It acts as the configured Vertex provider and produces model instances when called with a model name.
The provider belongs to the Google Vertex provider package, which supplies language-model support for Google Vertex AI APIs. The page identifies the package as @ai-sdk/google-vertex and shows createVertex as the customization entry point.
Follow-up: How can the provider be integrated into generation? Pass a model returned by the provider to an AI SDK function such as generateText.
vertex@ai-sdk/google-vertexGoogle Vertex providergenerateText