GoogleVertexXaiProvider
Namespace: Vercel.AI.Google
public sealed class GoogleVertexXaiProviderxAI Grok models hosted on Vertex.
Inheritance: object
Constructors
Section titled “Constructors”GoogleVertexXaiProvider(string, string?, string?, HttpMessageHandler?)
Section titled “GoogleVertexXaiProvider(string, string?, string?, HttpMessageHandler?)”public GoogleVertexXaiProvider(string project, string? location, string? baseUrl = null, HttpMessageHandler? handler = null)Creates a provider.
Parameters
| Name | Type | Description |
|---|---|---|
project |
string | |
location |
string | |
baseUrl |
string | |
handler |
HttpMessageHandler |
GoogleVertexXaiProvider(GoogleVertexPartnerOptions, HttpMessageHandler?)
Section titled “GoogleVertexXaiProvider(GoogleVertexPartnerOptions, HttpMessageHandler?)”public GoogleVertexXaiProvider(GoogleVertexPartnerOptions options, HttpMessageHandler? handler = null)Creates a provider. <code class=“paramref”>handler</code> sends the request after the auth headers are added.
Parameters
| Name | Type | Description |
|---|---|---|
options |
GoogleVertexPartnerOptions | |
handler |
HttpMessageHandler |
Properties
Section titled “Properties”BaseUrl
Section titled “BaseUrl”public string BaseUrl { get; }OpenAI-compatible base URL.
Value: string
ClientCreated
Section titled “ClientCreated”public bool ClientCreated { get; }True after the inner provider has been created.
Value: bool
Location
Section titled “Location”public string Location { get; }Location.
Value: string
Project
Section titled “Project”public string Project { get; }Project id.
Value: string
Methods
Section titled “Methods”ConvertUsage(int?, int?, int?, int?)
Section titled “ConvertUsage(int?, int?, int?, int?)”public static GoogleTokenUsage ConvertUsage(int? promptTokens, int? completionTokens, int? cachedTokens, int? reasoningTokens)Counts Grok reasoning tokens separately. Output total is completion tokens plus reasoning tokens.
Parameters
| Name | Type | Description |
|---|---|---|
promptTokens |
int? | |
completionTokens |
int? | |
cachedTokens |
int? | |
reasoningTokens |
int? |
Returns: GoogleTokenUsage
EmbeddingModel(string)
Section titled “EmbeddingModel(string)”public IEmbeddingModel EmbeddingModel(string modelId)Embedding and image models are not available.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IEmbeddingModel
LanguageModel(string)
Section titled “LanguageModel(string)”public ILanguageModel LanguageModel(string modelId)Returns a chat model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: ILanguageModel
TransformBody(JsonObject)
Section titled “TransformBody(JsonObject)”public static JsonObject TransformBody(JsonObject body)Removes reasoning_effort. Vertex Grok does not accept it.
Parameters
| Name | Type | Description |
|---|---|---|
body |
JsonObject |
Returns: JsonObject
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product