UNPKG

@ai-sdk/google-vertex

Version:

The **[Google Vertex provider](https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Google Vertex AI](https://cloud.google.com/vertex-ai) APIs.

77 lines (71 loc) 3.44 kB
import { OpenAICompatibleProvider } from '@ai-sdk/openai-compatible'; import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils'; interface GoogleCredentials { /** * The client email for the Google Cloud service account. Defaults to the * value of the `GOOGLE_CLIENT_EMAIL` environment variable. */ clientEmail: string; /** * The private key for the Google Cloud service account. Defaults to the * value of the `GOOGLE_PRIVATE_KEY` environment variable. */ privateKey: string; /** * Optional. The private key ID for the Google Cloud service account. Defaults * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable. */ privateKeyId?: string; } type GoogleVertexMaasModelId = 'deepseek-ai/deepseek-r1-0528-maas' | 'deepseek-ai/deepseek-v3.1-maas' | 'deepseek-ai/deepseek-v3.2-maas' | 'openai/gpt-oss-120b-maas' | 'openai/gpt-oss-20b-maas' | 'meta/llama-4-maverick-17b-128e-instruct-maas' | 'meta/llama-4-scout-17b-16e-instruct-maas' | 'minimax/minimax-m2-maas' | 'qwen/qwen3-coder-480b-a35b-instruct-maas' | 'qwen/qwen3-next-80b-a3b-instruct-maas' | 'qwen/qwen3-next-80b-a3b-thinking-maas' | 'moonshotai/kimi-k2-thinking-maas' | (string & {}); interface GoogleVertexMaasProvider extends OpenAICompatibleProvider<GoogleVertexMaasModelId, string, string, string> { } interface GoogleVertexMaasProviderSettings$1 { /** * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable. */ project?: string; /** * Google Cloud location/region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable. * Use 'global' for the global endpoint. */ location?: string; /** * Base URL for the API calls. If not provided, will be constructed from project and location. */ baseURL?: string; /** * Headers to use for requests. Can be: * - A headers object * - A Promise that resolves to a headers object * - A function that returns a headers object * - A function that returns a Promise of a headers object */ headers?: Resolvable<Record<string, string | undefined>>; /** * Custom fetch implementation. You can use it as a middleware to intercept requests, * or to provide a custom fetch implementation for e.g. testing. */ fetch?: FetchFunction; } interface GoogleVertexMaasProviderSettings extends GoogleVertexMaasProviderSettings$1 { /** * Optional. The Google credentials for the Google Cloud service account. If * not provided, the Google Vertex provider will use environment variables to * load the credentials. */ googleCredentials?: GoogleCredentials; } /** * Create a Google Vertex AI MaaS (Model as a Service) provider instance for Edge runtimes. * Uses the OpenAI-compatible Chat Completions API for partner and open models. * Automatically handles Google Cloud authentication. * * @see https://cloud.google.com/vertex-ai/generative-ai/docs/maas/use-open-models */ declare function createVertexMaas(options?: GoogleVertexMaasProviderSettings): GoogleVertexMaasProvider; /** * Default Google Vertex AI MaaS provider instance for Edge runtimes. */ declare const vertexMaas: GoogleVertexMaasProvider; export { type GoogleVertexMaasModelId, type GoogleVertexMaasProvider, type GoogleVertexMaasProviderSettings, createVertexMaas, vertexMaas };