Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Tools · Function

createVertex

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.

How it works

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.

Syntax

createVertex(options)

Parameters

NameTypeDescription
optionsobjectOptional provider settings, including project and location.

Returns

A configured Google Vertex provider instance that can be called with a model identifier.

Key points

  • Import createVertex from the @ai-sdk/google-vertex package.
  • The function creates a customized provider instance rather than directly generating text.
  • Assign the factory result to a provider variable, commonly named vertex.
  • The project setting is optional and identifies the Google Cloud project used by the provider.
  • The location setting is optional and selects the Vertex regional location.

Common mistakes

  • Use createVertex when you need provider configuration; the default provider instance is sufficient when customization is unnecessary.

Example: Create a configured Vertex provider

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.

When to use it

Configure project and location

A service must target a specific Google Cloud project and Vertex region.

Create a Vertex model instance

An application needs to select a Vertex model through the AI SDK provider interface.

Centralize provider setup

A codebase wants provider configuration separated from individual generation calls.

Interview questions

QWhat does createVertex do?

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'.

QHow do you configure and use createVertex?

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.

QWhich package exposes createVertex and what does it support?

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-vertex
  • Google Vertex provider
  • generateText

Source: Google Vertex Provider - AI SDK. Checked 2026-10-15.