@ai-sdk/google-vertex 5.0.140 → 5.0.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -1
  3. package/dist/anthropic/edge/index.d.ts +155 -1
  4. package/dist/anthropic/edge/index.d.ts.map +1 -1
  5. package/dist/anthropic/edge/index.js +1 -1
  6. package/dist/anthropic/edge/index.js.map +1 -1
  7. package/dist/anthropic/index.d.ts +155 -1
  8. package/dist/anthropic/index.d.ts.map +1 -1
  9. package/dist/anthropic/index.js.map +1 -1
  10. package/dist/edge/index.d.ts +160 -6
  11. package/dist/edge/index.d.ts.map +1 -1
  12. package/dist/edge/index.js +111 -93
  13. package/dist/edge/index.js.map +1 -1
  14. package/dist/index.d.ts +161 -7
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +111 -93
  17. package/dist/index.js.map +1 -1
  18. package/dist/maas/edge/index.d.ts +156 -1
  19. package/dist/maas/edge/index.d.ts.map +1 -1
  20. package/dist/maas/edge/index.js +1 -1
  21. package/dist/maas/index.d.ts +156 -1
  22. package/dist/maas/index.d.ts.map +1 -1
  23. package/dist/xai/edge/index.d.ts +155 -1
  24. package/dist/xai/edge/index.d.ts.map +1 -1
  25. package/dist/xai/edge/index.js +1 -1
  26. package/dist/xai/index.d.ts +155 -1
  27. package/dist/xai/index.d.ts.map +1 -1
  28. package/docs/16-google-vertex.mdx +7 -6
  29. package/package.json +3 -3
  30. package/src/anthropic/google-vertex-anthropic-options.ts +2 -24
  31. package/src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts +2 -2
  32. package/src/google-vertex-embedding-model-options.ts +2 -11
  33. package/src/google-vertex-image-settings.ts +3 -4
  34. package/src/google-vertex-model-catalog.ts +138 -89
  35. package/src/google-vertex-options.ts +3 -37
  36. package/src/google-vertex-speech-model-options.ts +2 -5
  37. package/src/google-vertex-transcription-model-options.ts +2 -3
  38. package/src/google-vertex-video-settings.ts +3 -11
  39. package/src/maas/google-vertex-maas-options.ts +3 -12
  40. package/src/xai/google-vertex-xai-options.ts +3 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @ai-sdk/google-vertex
2
2
 
3
+ ## 5.0.141
4
+
5
+ ### Patch Changes
6
+
7
+ - f5fc6ba: Derive known model ID suggestions from each provider's model catalog declarations so catalog updates automatically update autocomplete, while preserving existing suggestions, endpoint-specific model lists, and support for custom model IDs.
8
+ - c8fb453: Add the missing `gemini-4-hydrogen` model ID to the Vertex catalog so model suggestions and generated capability documentation include it.
9
+ - Updated dependencies [f5fc6ba]
10
+ - Updated dependencies [8e60cb4]
11
+ - @ai-sdk/anthropic@4.0.105
12
+ - @ai-sdk/google@4.0.121
13
+
3
14
  ## 5.0.140
4
15
 
5
16
  ### Patch Changes
package/README.md CHANGED
@@ -25,7 +25,7 @@ import { vertex } from '@ai-sdk/google-vertex';
25
25
  import { generateText } from 'ai';
26
26
 
27
27
  const { text } = await generateText({
28
- model: vertex('gemini-3.8-flash'),
28
+ model: vertex('gemini-4-hydrogen'),
29
29
  prompt: 'Write a vegetarian lasagna recipe.',
30
30
  });
31
31
  ```
@@ -20,8 +20,162 @@ interface GoogleCredentials {
20
20
  privateKeyId?: string;
21
21
  }
22
22
  //#endregion
23
+ //#region src/google-vertex-model-catalog.d.ts
24
+ declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.0-flash-lite", "gemini-2.0-flash", "gemini-2.0-flash-001", "gemini-1.5-flash", "gemini-1.5-flash-001", "gemini-1.5-flash-002", "gemini-1.5-pro", "gemini-1.5-pro-001", "gemini-1.5-pro-002", "gemini-1.0-pro-001", "gemini-1.0-pro-vision-001", "gemini-1.0-pro", "gemini-1.0-pro-002", "gemini-2.0-flash-lite-preview-02-05", "gemini-2.5-flash-preview-09-2025", "gemini-3-pro-preview", "gemini-3-pro-image-preview", "gemini-3-flash-preview", "gemini-3.1-pro-preview", "gemini-3.1-flash-image-preview", "gemini-3.1-flash-lite-preview", "gemini-2.0-pro-exp-02-05", "gemini-2.0-flash-exp"];
25
+ declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
26
+ declare const embeddingModelIds: readonly ["textembedding-gecko", "textembedding-gecko@001", "textembedding-gecko@003", "textembedding-gecko-multilingual", "textembedding-gecko-multilingual@001", "text-multilingual-embedding-002", "text-embedding-004", "text-embedding-005", "gemini-embedding-001", "gemini-embedding-2", "gemini-embedding-2-preview"];
27
+ declare const videoModelIds: readonly ["veo-2.0-generate-preview", "veo-2.0-generate-exp", "veo-2.0-generate-001", "veo-3.0-generate-001", "veo-3.0-fast-generate-001", "veo-3.0-generate-preview", "veo-3.0-fast-generate-preview", "veo-3.1-generate-001", "veo-3.1-fast-generate-001", "veo-3.1-generate-preview", "veo-3.1-fast-generate-preview"];
28
+ declare const speechModelIds: readonly ["gemini-2.5-flash-tts", "gemini-2.5-pro-tts", "gemini-2.5-flash-lite-preview-tts", "gemini-3.1-flash-tts-preview", "chirp-3-hd"];
29
+ declare const transcriptionModelIds: readonly ["chirp_2", "chirp_3", "telephony"];
30
+ declare const geminiTranscriptionModelIds: readonly ["gemini-3.5-transcribe", "gemini-3.5-transcribe-live"];
31
+ declare const vertexAnthropicModels: {
32
+ 'claude-fable-5-1': {
33
+ image: boolean;
34
+ objectGeneration: boolean;
35
+ tools: boolean;
36
+ streaming: boolean;
37
+ computerUse: boolean;
38
+ };
39
+ 'claude-fable-5-2': {
40
+ image: boolean;
41
+ objectGeneration: boolean;
42
+ tools: boolean;
43
+ streaming: boolean;
44
+ computerUse: boolean;
45
+ };
46
+ 'claude-3-7-sonnet@20250219': {
47
+ image: boolean;
48
+ objectGeneration: boolean;
49
+ tools: boolean;
50
+ streaming: boolean;
51
+ computerUse: boolean;
52
+ };
53
+ 'claude-3-5-sonnet-v2@20241022': {
54
+ image: boolean;
55
+ objectGeneration: boolean;
56
+ tools: boolean;
57
+ streaming: boolean;
58
+ computerUse: boolean;
59
+ };
60
+ 'claude-3-5-sonnet@20240620': {
61
+ image: boolean;
62
+ objectGeneration: boolean;
63
+ tools: boolean;
64
+ streaming: boolean;
65
+ computerUse: boolean;
66
+ };
67
+ 'claude-3-5-haiku@20241022': {
68
+ image: boolean;
69
+ objectGeneration: boolean;
70
+ tools: boolean;
71
+ streaming: boolean;
72
+ computerUse: boolean;
73
+ };
74
+ 'claude-3-sonnet@20240229': {
75
+ image: boolean;
76
+ objectGeneration: boolean;
77
+ tools: boolean;
78
+ streaming: boolean;
79
+ computerUse: boolean;
80
+ };
81
+ 'claude-3-haiku@20240307': {
82
+ image: boolean;
83
+ objectGeneration: boolean;
84
+ tools: boolean;
85
+ streaming: boolean;
86
+ computerUse: boolean;
87
+ };
88
+ 'claude-3-opus@20240229': {
89
+ image: boolean;
90
+ objectGeneration: boolean;
91
+ tools: boolean;
92
+ streaming: boolean;
93
+ computerUse: boolean;
94
+ };
95
+ 'claude-fable-5': undefined;
96
+ 'claude-haiku-5-5': undefined;
97
+ 'claude-opus-4-1@20250805': undefined;
98
+ 'claude-opus-4-5@20251101': undefined;
99
+ 'claude-opus-4-6': undefined;
100
+ 'claude-opus-4-7': undefined;
101
+ 'claude-opus-4-8': undefined;
102
+ 'claude-opus-4@20250514': undefined;
103
+ 'claude-opus-5': undefined;
104
+ 'claude-opus-5-5': undefined;
105
+ 'claude-sonnet-4-5@20250929': undefined;
106
+ 'claude-sonnet-4-6': undefined;
107
+ 'claude-sonnet-4@20250514': undefined;
108
+ 'claude-sonnet-5': undefined;
109
+ 'claude-sonnet-5-5': undefined;
110
+ };
111
+ declare const vertexXaiModels: {
112
+ 'xai/grok-4.20-reasoning': {
113
+ reasoning: boolean;
114
+ };
115
+ 'xai/grok-4.20-non-reasoning': {
116
+ reasoning: boolean;
117
+ };
118
+ 'xai/grok-4.1-fast-reasoning': {
119
+ reasoning: boolean;
120
+ };
121
+ 'xai/grok-4.1-fast-non-reasoning': {
122
+ reasoning: boolean;
123
+ };
124
+ };
125
+ declare const vertexMaasModels: {
126
+ 'deepseek-ai/deepseek-r1-0528-maas': {
127
+ publisher: string;
128
+ };
129
+ 'deepseek-ai/deepseek-v3.1-maas': {
130
+ publisher: string;
131
+ };
132
+ 'deepseek-ai/deepseek-v3.2-maas': {
133
+ publisher: string;
134
+ };
135
+ 'openai/gpt-oss-120b-maas': {
136
+ publisher: string;
137
+ };
138
+ 'openai/gpt-oss-20b-maas': {
139
+ publisher: string;
140
+ };
141
+ 'meta/llama-4-maverick-17b-128e-instruct-maas': {
142
+ publisher: string;
143
+ };
144
+ 'meta/llama-4-scout-17b-16e-instruct-maas': {
145
+ publisher: string;
146
+ };
147
+ 'minimax/minimax-m2-maas': {
148
+ publisher: string;
149
+ };
150
+ 'qwen/qwen3-coder-480b-a35b-instruct-maas': {
151
+ publisher: string;
152
+ };
153
+ 'qwen/qwen3-next-80b-a3b-instruct-maas': {
154
+ publisher: string;
155
+ };
156
+ 'qwen/qwen3-next-80b-a3b-thinking-maas': {
157
+ publisher: string;
158
+ };
159
+ 'moonshotai/kimi-k2-thinking-maas': {
160
+ publisher: string;
161
+ };
162
+ };
163
+ /** Known model IDs, derived from the declarations used to build the catalog. */
164
+ type GoogleVertexModelIds = {
165
+ language: (typeof languageModelIds)[number];
166
+ image: (typeof imageModelIds)[number];
167
+ embedding: (typeof embeddingModelIds)[number];
168
+ video: (typeof videoModelIds)[number];
169
+ speech: (typeof speechModelIds)[number];
170
+ transcription: (typeof transcriptionModelIds)[number];
171
+ geminiTranscription: (typeof geminiTranscriptionModelIds)[number];
172
+ anthropic: keyof typeof vertexAnthropicModels;
173
+ xai: keyof typeof vertexXaiModels;
174
+ maas: keyof typeof vertexMaasModels;
175
+ };
176
+ //#endregion
23
177
  //#region src/anthropic/google-vertex-anthropic-options.d.ts
24
- type GoogleVertexAnthropicModelId = 'claude-sonnet-5' | 'claude-sonnet-5-5' | 'claude-haiku-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-fable-5-2' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-opus-4-8' | 'claude-opus-4-7' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-opus-4-5@20251101' | 'claude-sonnet-4-5@20250929' | 'claude-opus-4-1@20250805' | 'claude-opus-4@20250514' | 'claude-sonnet-4@20250514' | 'claude-3-7-sonnet@20250219' | 'claude-3-5-sonnet-v2@20241022' | 'claude-3-5-haiku@20241022' | 'claude-3-5-sonnet@20240620' | 'claude-3-haiku@20240307' | 'claude-3-sonnet@20240229' | 'claude-3-opus@20240229' | (string & {});
178
+ type GoogleVertexAnthropicModelId = GoogleVertexModelIds['anthropic'] | (string & {});
25
179
  //#endregion
26
180
  //#region src/anthropic/google-vertex-anthropic-provider.d.ts
27
181
  type GoogleVertexAnthropicTools = Pick<typeof anthropicTools, 'bash_20241022' | 'bash_20250124' | 'textEditor_20241022' | 'textEditor_20250124' | 'textEditor_20250429' | 'textEditor_20250728' | 'computer_20241022' | 'webSearch_20250305' | 'toolSearchRegex_20251119' | 'toolSearchBm25_20251119'>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../../src/edge/google-vertex-auth-edge.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"mappings":";;;;UAQiB;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;KCbU;;;KCYP,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC7KO,8CAA8CC;;;;;;EAM7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAgBU,uBAAqB"}
1
+ {"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../../src/edge/google-vertex-auth-edge.ts","../../../src/google-vertex-model-catalog.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"mappings":";;;;UAQiB;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;cCoTI;cAsCA;cAOA;cAcA;cAcA;cAQA;cAEA;cA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GA;;;;;;;;;;;;;;cA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCM;EACV,kBAAkB;EAClB,eAAe;EACf,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,wBAAwB;EACxB,kBAAkB;EAClB,mBAAmB;;;;KCpnBT,+BACR;;;KCUC,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC7KO,8CAA8CC;;;;;;EAM7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAgBU,uBAAqB"}
@@ -3,7 +3,7 @@ import { InvalidArgumentError, NoSuchModelError } from "@ai-sdk/provider";
3
3
  import { AnthropicLanguageModel, anthropicTools } from "@ai-sdk/anthropic/internal";
4
4
  import { z } from "zod/v4";
5
5
  //#region src/version.ts
6
- const VERSION = "5.0.140";
6
+ const VERSION = "5.0.141";
7
7
  //#endregion
8
8
  //#region src/edge/google-vertex-auth-edge.ts
9
9
  const loadCredentials = async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createGoogleVertexAnthropic","generateAuthToken","defaultGenerateAuthToken","createVertexAnthropicOriginal"],"sources":["../../../src/version.ts","../../../src/edge/google-vertex-auth-edge.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"sourcesContent":["// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n loadOptionalSetting,\n loadSetting,\n withUserAgentSuffix,\n getRuntimeEnvironmentUserAgent,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from '../version';\n\nexport interface GoogleCredentials {\n /**\n * The client email for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_CLIENT_EMAIL` environment variable.\n */\n clientEmail: string;\n\n /**\n * The private key for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_PRIVATE_KEY` environment variable.\n */\n privateKey: string;\n\n /**\n * Optional. The private key ID for the Google Cloud service account. Defaults\n * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.\n */\n privateKeyId?: string;\n}\n\nconst loadCredentials = async (): Promise<GoogleCredentials> => {\n try {\n return {\n clientEmail: loadSetting({\n settingValue: undefined,\n settingName: 'clientEmail',\n environmentVariableName: 'GOOGLE_CLIENT_EMAIL',\n description: 'Google client email',\n }),\n privateKey: loadSetting({\n settingValue: undefined,\n settingName: 'privateKey',\n environmentVariableName: 'GOOGLE_PRIVATE_KEY',\n description: 'Google private key',\n }),\n privateKeyId: loadOptionalSetting({\n settingValue: undefined,\n environmentVariableName: 'GOOGLE_PRIVATE_KEY_ID',\n }),\n };\n } catch (error: any) {\n throw new Error(`Failed to load Google credentials: ${error.message}`);\n }\n};\n\n// Convert a string to base64url\nconst base64url = (str: string) => {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst importPrivateKey = async (pemKey: string) => {\n const pemHeader = '-----BEGIN PRIVATE KEY-----';\n const pemFooter = '-----END PRIVATE KEY-----';\n\n // Remove header, footer, and any whitespace/newlines\n const pemContents = pemKey\n .replace(pemHeader, '')\n .replace(pemFooter, '')\n .replace(/\\s/g, '');\n\n // Decode base64 to binary\n const binaryString = atob(pemContents);\n\n // Convert binary string to Uint8Array\n const binaryData = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n binaryData[i] = binaryString.charCodeAt(i);\n }\n\n return await crypto.subtle.importKey(\n 'pkcs8',\n binaryData,\n { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' },\n true,\n ['sign'],\n );\n};\n\nconst buildJwt = async (credentials: GoogleCredentials) => {\n const now = Math.floor(Date.now() / 1000);\n\n // Only include kid in header if privateKeyId is provided\n const header: { alg: string; typ: string; kid?: string } = {\n alg: 'RS256',\n typ: 'JWT',\n };\n\n if (credentials.privateKeyId) {\n header.kid = credentials.privateKeyId;\n }\n\n const payload = {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/cloud-platform',\n aud: 'https://oauth2.googleapis.com/token',\n exp: now + 3600,\n iat: now,\n };\n\n const privateKey = await importPrivateKey(credentials.privateKey);\n\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}`;\n const encoder = new TextEncoder();\n const data = encoder.encode(signingInput);\n\n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data,\n );\n\n const signatureBase64 = base64url(\n String.fromCharCode(...new Uint8Array(signature)),\n );\n\n return `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}.${signatureBase64}`;\n};\n\n/**\n * Generate an authentication token for Google Vertex AI in a manner compatible\n * with the Edge runtime.\n */\nexport async function generateAuthToken(credentials?: GoogleCredentials) {\n const creds = credentials || (await loadCredentials());\n const jwt = await buildJwt(creds);\n\n const response = await fetch('https://oauth2.googleapis.com/token', {\n method: 'POST',\n headers: withUserAgentSuffix(\n { 'Content-Type': 'application/x-www-form-urlencoded' },\n `ai-sdk-google-vertex/${VERSION}`,\n getRuntimeEnvironmentUserAgent(),\n ),\n body: new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n assertion: jwt,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`Token request failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n return data.access_token;\n}\n","import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const googleVertexAnthropicProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n labels: z.record(z.string(), z.string()).optional(),\n }),\n ),\n);\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude\nexport type GoogleVertexAnthropicModelId =\n | 'claude-sonnet-5'\n | 'claude-sonnet-5-5'\n | 'claude-haiku-5-5'\n | 'claude-fable-5'\n | 'claude-fable-5-1'\n | 'claude-fable-5-2'\n | 'claude-opus-5'\n | 'claude-opus-5-5'\n | 'claude-opus-4-8'\n | 'claude-opus-4-7'\n | 'claude-opus-4-6'\n | 'claude-sonnet-4-6'\n | 'claude-opus-4-5@20251101'\n | 'claude-sonnet-4-5@20250929'\n | 'claude-opus-4-1@20250805'\n | 'claude-opus-4@20250514'\n | 'claude-sonnet-4@20250514'\n | 'claude-3-7-sonnet@20250219'\n | 'claude-3-5-sonnet-v2@20241022'\n | 'claude-3-5-haiku@20241022'\n | 'claude-3-5-sonnet@20240620'\n | 'claude-3-haiku@20240307'\n | 'claude-3-sonnet@20240229'\n | 'claude-3-opus@20240229'\n | (string & {});\n","import {\n InvalidArgumentError,\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n convertUint8ArrayToBase64,\n isValidHostnamePart,\n loadOptionalSetting,\n parseProviderOptions,\n withoutTrailingSlash,\n type FetchFunction,\n type Resolvable,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport {\n googleVertexAnthropicProviderOptions,\n type GoogleVertexAnthropicModelId,\n} from './google-vertex-anthropic-options';\n\ntype GoogleVertexAnthropicTools = Pick<\n typeof anthropicTools,\n | 'bash_20241022'\n | 'bash_20250124'\n | 'textEditor_20241022'\n | 'textEditor_20250124'\n | 'textEditor_20250429'\n | 'textEditor_20250728'\n | 'computer_20241022'\n | 'webSearch_20250305'\n | 'toolSearchRegex_20251119'\n | 'toolSearchBm25_20251119'\n>;\n\n/**\n * Tools supported by Google Vertex Anthropic.\n * This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.\n */\nexport const googleVertexAnthropicTools: GoogleVertexAnthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022: anthropicTools.bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124: anthropicTools.bash_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022: anthropicTools.textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124: anthropicTools.textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command.\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429: anthropicTools.textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n */\n textEditor_20250728: anthropicTools.textEditor_20250728,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n */\n computer_20241022: anthropicTools.computer_20241022,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n */\n webSearch_20250305: anthropicTools.webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119,\n};\nexport interface GoogleVertexAnthropicProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Anthropic tools supported by Google Vertex.\n * Note: Only a subset of Anthropic tools are available on Vertex.\n * Supported tools: bash_20241022, bash_20250124, textEditor_20241022,\n * textEditor_20250124, textEditor_20250429, textEditor_20250728,\n * computer_20241022, webSearch_20250305, toolSearchRegex_20251119,\n * toolSearchBm25_20251119\n */\n tools: typeof googleVertexAnthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\n * Enable native structured output in `structuredOutputMode: 'auto'` for Claude\n * 4.5 and newer. Defaults to false. Requires the Google Cloud organization\n * policy to allow the `structured_outputs` feature for each model used.\n * This does not enable strict tool input schemas.\n */\n supportsNativeStructuredOutput?: boolean;\n\n /**\n * Use a different URL prefix for API calls, e.g. to use proxy servers.\n * The default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create a Google Vertex Anthropic provider instance.\n */\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const getBaseURL = () => {\n const baseURL = withoutTrailingSlash(options.baseURL);\n if (baseURL != null) {\n return baseURL;\n }\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n if (location != null && !isValidHostnamePart(location)) {\n throw new InvalidArgumentError({\n argument: 'location',\n message:\n 'Invalid Google Vertex location. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints.',\n });\n }\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const getHost = () => {\n if (location === 'global') {\n return 'aiplatform.googleapis.com';\n } else if (location === 'eu' || location === 'us') {\n return `aiplatform.${location}.rep.googleapis.com`;\n } else {\n return `${location}-aiplatform.googleapis.com`;\n }\n };\n\n return `https://${getHost()}/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n };\n\n const createChatModel = (modelId: GoogleVertexAnthropicModelId) =>\n new AnthropicLanguageModel(modelId, {\n provider: 'googleVertex.anthropic.messages',\n baseURL: getBaseURL(),\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model: _model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n transformRequestHeaders: async (headers, providerOptions) => {\n const vertexOptions = await parseProviderOptions({\n provider: 'vertex',\n providerOptions,\n schema: googleVertexAnthropicProviderOptions,\n });\n\n // Explicit headers take precedence, regardless of their casing.\n if (\n vertexOptions?.labels == null ||\n Object.keys(headers).some(\n name =>\n name.toLowerCase() === 'x-vertex-ai-labels' &&\n headers[name] != null,\n )\n ) {\n return headers;\n }\n\n return {\n ...headers,\n 'x-vertex-ai-labels': convertUint8ArrayToBase64(\n new TextEncoder().encode(JSON.stringify(vertexOptions.labels)),\n ),\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // Native output is default-denied by GCP policy and requires Claude 4.5+.\n supportsNativeStructuredOutput:\n options.supportsNativeStructuredOutput === true &&\n supportsNativeStructuredOutput(modelId),\n // Native final output does not opt in to strict tool input schemas.\n supportsStrictTools: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = googleVertexAnthropicTools;\n\n return provider;\n}\n\nfunction supportsNativeStructuredOutput(modelId: string): boolean {\n const version = /^claude-[a-z]+-(\\d+)(?:-(\\d+))?(?:@|$)/.exec(modelId);\n return (\n version != null &&\n (Number(version[1]) > 4 ||\n (Number(version[1]) === 4 && Number(version[2]) >= 5))\n );\n}\n","import { resolve } from '@ai-sdk/provider-utils';\nimport {\n generateAuthToken as defaultGenerateAuthToken,\n type GoogleCredentials,\n} from '../../edge/google-vertex-auth-edge';\nimport {\n createGoogleVertexAnthropic as createVertexAnthropicOriginal,\n type GoogleVertexAnthropicProvider,\n type GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from '../google-vertex-anthropic-provider';\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Google credentials for the Google Cloud service account. If\n * not provided, the Google Vertex provider will use environment variables to\n * load the credentials.\n */\n googleCredentials?: GoogleCredentials;\n /**\n * Optional. Override the Bearer token generator. Defaults to OAuth exchange\n * with `googleCredentials`.\n */\n generateAuthToken?: () => Promise<string>;\n}\n\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const generateAuthToken =\n options.generateAuthToken ??\n (() => defaultGenerateAuthToken(options.googleCredentials));\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken()}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex AI Anthropic provider instance.\n */\nexport const googleVertexAnthropic = createGoogleVertexAnthropic();\n"],"mappings":";;;;;AAEA,MAAa,UAAA;;;AC0Bb,MAAM,kBAAkB,YAAwC;CAC9D,IAAI;EACF,OAAO;GACL,aAAa,YAAY;IACvB,cAAc,KAAA;IACd,aAAa;IACb,yBAAyB;IACzB,aAAa;GACf,CAAC;GACD,YAAY,YAAY;IACtB,cAAc,KAAA;IACd,aAAa;IACb,yBAAyB;IACzB,aAAa;GACf,CAAC;GACD,cAAc,oBAAoB;IAChC,cAAc,KAAA;IACd,yBAAyB;GAC3B,CAAC;EACH;CACF,SAAS,OAAY;EACnB,MAAM,IAAI,MAAM,sCAAsC,MAAM,SAAS;CACvE;AACF;AAGA,MAAM,aAAa,QAAgB;CACjC,OAAO,KAAK,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,MAAM,EAAE;AAC3E;AACA,MAAM,mBAAmB,OAAO,WAAmB;CAKjD,MAAM,cAAc,OACjB,QAAQ,+BAAW,EAAE,CAAC,CACtB,QAAQ,6BAAW,EAAE,CAAC,CACtB,QAAQ,OAAO,EAAE;CAGpB,MAAM,eAAe,KAAK,WAAW;CAGrC,MAAM,aAAa,IAAI,WAAW,aAAa,MAAM;CACrD,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KACvC,WAAW,KAAK,aAAa,WAAW,CAAC;CAG3C,OAAO,MAAM,OAAO,OAAO,UACzB,SACA,YACA;EAAE,MAAM;EAAqB,MAAM;CAAU,GAC7C,MACA,CAAC,MAAM,CACT;AACF;AAEA,MAAM,WAAW,OAAO,gBAAmC;CACzD,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;CAGxC,MAAM,SAAqD;EACzD,KAAK;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AAKA,MAAa,wBAAwB,4BAA4B"}
1
+ {"version":3,"file":"index.js","names":["createGoogleVertexAnthropic","generateAuthToken","defaultGenerateAuthToken","createVertexAnthropicOriginal"],"sources":["../../../src/version.ts","../../../src/edge/google-vertex-auth-edge.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"sourcesContent":["// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n loadOptionalSetting,\n loadSetting,\n withUserAgentSuffix,\n getRuntimeEnvironmentUserAgent,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from '../version';\n\nexport interface GoogleCredentials {\n /**\n * The client email for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_CLIENT_EMAIL` environment variable.\n */\n clientEmail: string;\n\n /**\n * The private key for the Google Cloud service account. Defaults to the\n * value of the `GOOGLE_PRIVATE_KEY` environment variable.\n */\n privateKey: string;\n\n /**\n * Optional. The private key ID for the Google Cloud service account. Defaults\n * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.\n */\n privateKeyId?: string;\n}\n\nconst loadCredentials = async (): Promise<GoogleCredentials> => {\n try {\n return {\n clientEmail: loadSetting({\n settingValue: undefined,\n settingName: 'clientEmail',\n environmentVariableName: 'GOOGLE_CLIENT_EMAIL',\n description: 'Google client email',\n }),\n privateKey: loadSetting({\n settingValue: undefined,\n settingName: 'privateKey',\n environmentVariableName: 'GOOGLE_PRIVATE_KEY',\n description: 'Google private key',\n }),\n privateKeyId: loadOptionalSetting({\n settingValue: undefined,\n environmentVariableName: 'GOOGLE_PRIVATE_KEY_ID',\n }),\n };\n } catch (error: any) {\n throw new Error(`Failed to load Google credentials: ${error.message}`);\n }\n};\n\n// Convert a string to base64url\nconst base64url = (str: string) => {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst importPrivateKey = async (pemKey: string) => {\n const pemHeader = '-----BEGIN PRIVATE KEY-----';\n const pemFooter = '-----END PRIVATE KEY-----';\n\n // Remove header, footer, and any whitespace/newlines\n const pemContents = pemKey\n .replace(pemHeader, '')\n .replace(pemFooter, '')\n .replace(/\\s/g, '');\n\n // Decode base64 to binary\n const binaryString = atob(pemContents);\n\n // Convert binary string to Uint8Array\n const binaryData = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n binaryData[i] = binaryString.charCodeAt(i);\n }\n\n return await crypto.subtle.importKey(\n 'pkcs8',\n binaryData,\n { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' },\n true,\n ['sign'],\n );\n};\n\nconst buildJwt = async (credentials: GoogleCredentials) => {\n const now = Math.floor(Date.now() / 1000);\n\n // Only include kid in header if privateKeyId is provided\n const header: { alg: string; typ: string; kid?: string } = {\n alg: 'RS256',\n typ: 'JWT',\n };\n\n if (credentials.privateKeyId) {\n header.kid = credentials.privateKeyId;\n }\n\n const payload = {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/cloud-platform',\n aud: 'https://oauth2.googleapis.com/token',\n exp: now + 3600,\n iat: now,\n };\n\n const privateKey = await importPrivateKey(credentials.privateKey);\n\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}`;\n const encoder = new TextEncoder();\n const data = encoder.encode(signingInput);\n\n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data,\n );\n\n const signatureBase64 = base64url(\n String.fromCharCode(...new Uint8Array(signature)),\n );\n\n return `${base64url(JSON.stringify(header))}.${base64url(\n JSON.stringify(payload),\n )}.${signatureBase64}`;\n};\n\n/**\n * Generate an authentication token for Google Vertex AI in a manner compatible\n * with the Edge runtime.\n */\nexport async function generateAuthToken(credentials?: GoogleCredentials) {\n const creds = credentials || (await loadCredentials());\n const jwt = await buildJwt(creds);\n\n const response = await fetch('https://oauth2.googleapis.com/token', {\n method: 'POST',\n headers: withUserAgentSuffix(\n { 'Content-Type': 'application/x-www-form-urlencoded' },\n `ai-sdk-google-vertex/${VERSION}`,\n getRuntimeEnvironmentUserAgent(),\n ),\n body: new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n assertion: jwt,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`Token request failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n return data.access_token;\n}\n","import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport type { GoogleVertexModelIds } from '../google-vertex-model-catalog';\n\nexport const googleVertexAnthropicProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n labels: z.record(z.string(), z.string()).optional(),\n }),\n ),\n);\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude\nexport type GoogleVertexAnthropicModelId =\n | GoogleVertexModelIds['anthropic']\n | (string & {});\n","import {\n InvalidArgumentError,\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n convertUint8ArrayToBase64,\n isValidHostnamePart,\n loadOptionalSetting,\n parseProviderOptions,\n withoutTrailingSlash,\n type FetchFunction,\n type Resolvable,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport {\n googleVertexAnthropicProviderOptions,\n type GoogleVertexAnthropicModelId,\n} from './google-vertex-anthropic-options';\n\ntype GoogleVertexAnthropicTools = Pick<\n typeof anthropicTools,\n | 'bash_20241022'\n | 'bash_20250124'\n | 'textEditor_20241022'\n | 'textEditor_20250124'\n | 'textEditor_20250429'\n | 'textEditor_20250728'\n | 'computer_20241022'\n | 'webSearch_20250305'\n | 'toolSearchRegex_20251119'\n | 'toolSearchBm25_20251119'\n>;\n\n/**\n * Tools supported by Google Vertex Anthropic.\n * This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.\n */\nexport const googleVertexAnthropicTools: GoogleVertexAnthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022: anthropicTools.bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124: anthropicTools.bash_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022: anthropicTools.textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124: anthropicTools.textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command.\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429: anthropicTools.textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n */\n textEditor_20250728: anthropicTools.textEditor_20250728,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n */\n computer_20241022: anthropicTools.computer_20241022,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n */\n webSearch_20250305: anthropicTools.webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119,\n};\nexport interface GoogleVertexAnthropicProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Anthropic tools supported by Google Vertex.\n * Note: Only a subset of Anthropic tools are available on Vertex.\n * Supported tools: bash_20241022, bash_20250124, textEditor_20241022,\n * textEditor_20250124, textEditor_20250429, textEditor_20250728,\n * computer_20241022, webSearch_20250305, toolSearchRegex_20251119,\n * toolSearchBm25_20251119\n */\n tools: typeof googleVertexAnthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\n * Enable native structured output in `structuredOutputMode: 'auto'` for Claude\n * 4.5 and newer. Defaults to false. Requires the Google Cloud organization\n * policy to allow the `structured_outputs` feature for each model used.\n * This does not enable strict tool input schemas.\n */\n supportsNativeStructuredOutput?: boolean;\n\n /**\n * Use a different URL prefix for API calls, e.g. to use proxy servers.\n * The default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create a Google Vertex Anthropic provider instance.\n */\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const getBaseURL = () => {\n const baseURL = withoutTrailingSlash(options.baseURL);\n if (baseURL != null) {\n return baseURL;\n }\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n if (location != null && !isValidHostnamePart(location)) {\n throw new InvalidArgumentError({\n argument: 'location',\n message:\n 'Invalid Google Vertex location. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints.',\n });\n }\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const getHost = () => {\n if (location === 'global') {\n return 'aiplatform.googleapis.com';\n } else if (location === 'eu' || location === 'us') {\n return `aiplatform.${location}.rep.googleapis.com`;\n } else {\n return `${location}-aiplatform.googleapis.com`;\n }\n };\n\n return `https://${getHost()}/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n };\n\n const createChatModel = (modelId: GoogleVertexAnthropicModelId) =>\n new AnthropicLanguageModel(modelId, {\n provider: 'googleVertex.anthropic.messages',\n baseURL: getBaseURL(),\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model: _model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n transformRequestHeaders: async (headers, providerOptions) => {\n const vertexOptions = await parseProviderOptions({\n provider: 'vertex',\n providerOptions,\n schema: googleVertexAnthropicProviderOptions,\n });\n\n // Explicit headers take precedence, regardless of their casing.\n if (\n vertexOptions?.labels == null ||\n Object.keys(headers).some(\n name =>\n name.toLowerCase() === 'x-vertex-ai-labels' &&\n headers[name] != null,\n )\n ) {\n return headers;\n }\n\n return {\n ...headers,\n 'x-vertex-ai-labels': convertUint8ArrayToBase64(\n new TextEncoder().encode(JSON.stringify(vertexOptions.labels)),\n ),\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // Native output is default-denied by GCP policy and requires Claude 4.5+.\n supportsNativeStructuredOutput:\n options.supportsNativeStructuredOutput === true &&\n supportsNativeStructuredOutput(modelId),\n // Native final output does not opt in to strict tool input schemas.\n supportsStrictTools: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = googleVertexAnthropicTools;\n\n return provider;\n}\n\nfunction supportsNativeStructuredOutput(modelId: string): boolean {\n const version = /^claude-[a-z]+-(\\d+)(?:-(\\d+))?(?:@|$)/.exec(modelId);\n return (\n version != null &&\n (Number(version[1]) > 4 ||\n (Number(version[1]) === 4 && Number(version[2]) >= 5))\n );\n}\n","import { resolve } from '@ai-sdk/provider-utils';\nimport {\n generateAuthToken as defaultGenerateAuthToken,\n type GoogleCredentials,\n} from '../../edge/google-vertex-auth-edge';\nimport {\n createGoogleVertexAnthropic as createVertexAnthropicOriginal,\n type GoogleVertexAnthropicProvider,\n type GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from '../google-vertex-anthropic-provider';\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Google credentials for the Google Cloud service account. If\n * not provided, the Google Vertex provider will use environment variables to\n * load the credentials.\n */\n googleCredentials?: GoogleCredentials;\n /**\n * Optional. Override the Bearer token generator. Defaults to OAuth exchange\n * with `googleCredentials`.\n */\n generateAuthToken?: () => Promise<string>;\n}\n\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const generateAuthToken =\n options.generateAuthToken ??\n (() => defaultGenerateAuthToken(options.googleCredentials));\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken()}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex AI Anthropic provider instance.\n */\nexport const googleVertexAnthropic = createGoogleVertexAnthropic();\n"],"mappings":";;;;;AAEA,MAAa,UAAA;;;AC0Bb,MAAM,kBAAkB,YAAwC;CAC9D,IAAI;EACF,OAAO;GACL,aAAa,YAAY;IACvB,cAAc,KAAA;IACd,aAAa;IACb,yBAAyB;IACzB,aAAa;GACf,CAAC;GACD,YAAY,YAAY;IACtB,cAAc,KAAA;IACd,aAAa;IACb,yBAAyB;IACzB,aAAa;GACf,CAAC;GACD,cAAc,oBAAoB;IAChC,cAAc,KAAA;IACd,yBAAyB;GAC3B,CAAC;EACH;CACF,SAAS,OAAY;EACnB,MAAM,IAAI,MAAM,sCAAsC,MAAM,SAAS;CACvE;AACF;AAGA,MAAM,aAAa,QAAgB;CACjC,OAAO,KAAK,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,MAAM,EAAE;AAC3E;AACA,MAAM,mBAAmB,OAAO,WAAmB;CAKjD,MAAM,cAAc,OACjB,QAAQ,+BAAW,EAAE,CAAC,CACtB,QAAQ,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;AAEA,SAAS,+BAA+B,SAA0B;CAChE,MAAM,UAAU,yCAAyC,KAAK,OAAO;CACrE,OACE,WAAW,SACV,OAAO,QAAQ,EAAE,IAAI,KACnB,OAAO,QAAQ,EAAE,MAAM,KAAK,OAAO,QAAQ,EAAE,KAAK;AAEzD;;;ACpSA,SAAgB,4BACd,UAAiD,CAAC,GACnB;CAC/B,MAAMC,sBACJ,QAAQ,4BACDC,kBAAyB,QAAQ,iBAAiB;CAC3D,OAAOC,8BAA8B;EACnC,GAAG;EACH,SAAS,aAAa;GACpB,eAAe,UAAU,MAAMF,oBAAkB;GACjD,GAAI,MAAM,QAAQ,QAAQ,OAAO;EACnC;CACF,CAAC;AACH;;;;AAKA,MAAa,wBAAwB,4BAA4B"}
@@ -2,8 +2,162 @@ import { FetchFunction, Resolvable } from "@ai-sdk/provider-utils";
2
2
  import { GoogleAuthOptions } from "google-auth-library";
3
3
  import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
4
4
  import { anthropicTools } from "@ai-sdk/anthropic/internal";
5
+ //#region src/google-vertex-model-catalog.d.ts
6
+ declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.0-flash-lite", "gemini-2.0-flash", "gemini-2.0-flash-001", "gemini-1.5-flash", "gemini-1.5-flash-001", "gemini-1.5-flash-002", "gemini-1.5-pro", "gemini-1.5-pro-001", "gemini-1.5-pro-002", "gemini-1.0-pro-001", "gemini-1.0-pro-vision-001", "gemini-1.0-pro", "gemini-1.0-pro-002", "gemini-2.0-flash-lite-preview-02-05", "gemini-2.5-flash-preview-09-2025", "gemini-3-pro-preview", "gemini-3-pro-image-preview", "gemini-3-flash-preview", "gemini-3.1-pro-preview", "gemini-3.1-flash-image-preview", "gemini-3.1-flash-lite-preview", "gemini-2.0-pro-exp-02-05", "gemini-2.0-flash-exp"];
7
+ declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
8
+ declare const embeddingModelIds: readonly ["textembedding-gecko", "textembedding-gecko@001", "textembedding-gecko@003", "textembedding-gecko-multilingual", "textembedding-gecko-multilingual@001", "text-multilingual-embedding-002", "text-embedding-004", "text-embedding-005", "gemini-embedding-001", "gemini-embedding-2", "gemini-embedding-2-preview"];
9
+ declare const videoModelIds: readonly ["veo-2.0-generate-preview", "veo-2.0-generate-exp", "veo-2.0-generate-001", "veo-3.0-generate-001", "veo-3.0-fast-generate-001", "veo-3.0-generate-preview", "veo-3.0-fast-generate-preview", "veo-3.1-generate-001", "veo-3.1-fast-generate-001", "veo-3.1-generate-preview", "veo-3.1-fast-generate-preview"];
10
+ declare const speechModelIds: readonly ["gemini-2.5-flash-tts", "gemini-2.5-pro-tts", "gemini-2.5-flash-lite-preview-tts", "gemini-3.1-flash-tts-preview", "chirp-3-hd"];
11
+ declare const transcriptionModelIds: readonly ["chirp_2", "chirp_3", "telephony"];
12
+ declare const geminiTranscriptionModelIds: readonly ["gemini-3.5-transcribe", "gemini-3.5-transcribe-live"];
13
+ declare const vertexAnthropicModels: {
14
+ 'claude-fable-5-1': {
15
+ image: boolean;
16
+ objectGeneration: boolean;
17
+ tools: boolean;
18
+ streaming: boolean;
19
+ computerUse: boolean;
20
+ };
21
+ 'claude-fable-5-2': {
22
+ image: boolean;
23
+ objectGeneration: boolean;
24
+ tools: boolean;
25
+ streaming: boolean;
26
+ computerUse: boolean;
27
+ };
28
+ 'claude-3-7-sonnet@20250219': {
29
+ image: boolean;
30
+ objectGeneration: boolean;
31
+ tools: boolean;
32
+ streaming: boolean;
33
+ computerUse: boolean;
34
+ };
35
+ 'claude-3-5-sonnet-v2@20241022': {
36
+ image: boolean;
37
+ objectGeneration: boolean;
38
+ tools: boolean;
39
+ streaming: boolean;
40
+ computerUse: boolean;
41
+ };
42
+ 'claude-3-5-sonnet@20240620': {
43
+ image: boolean;
44
+ objectGeneration: boolean;
45
+ tools: boolean;
46
+ streaming: boolean;
47
+ computerUse: boolean;
48
+ };
49
+ 'claude-3-5-haiku@20241022': {
50
+ image: boolean;
51
+ objectGeneration: boolean;
52
+ tools: boolean;
53
+ streaming: boolean;
54
+ computerUse: boolean;
55
+ };
56
+ 'claude-3-sonnet@20240229': {
57
+ image: boolean;
58
+ objectGeneration: boolean;
59
+ tools: boolean;
60
+ streaming: boolean;
61
+ computerUse: boolean;
62
+ };
63
+ 'claude-3-haiku@20240307': {
64
+ image: boolean;
65
+ objectGeneration: boolean;
66
+ tools: boolean;
67
+ streaming: boolean;
68
+ computerUse: boolean;
69
+ };
70
+ 'claude-3-opus@20240229': {
71
+ image: boolean;
72
+ objectGeneration: boolean;
73
+ tools: boolean;
74
+ streaming: boolean;
75
+ computerUse: boolean;
76
+ };
77
+ 'claude-fable-5': undefined;
78
+ 'claude-haiku-5-5': undefined;
79
+ 'claude-opus-4-1@20250805': undefined;
80
+ 'claude-opus-4-5@20251101': undefined;
81
+ 'claude-opus-4-6': undefined;
82
+ 'claude-opus-4-7': undefined;
83
+ 'claude-opus-4-8': undefined;
84
+ 'claude-opus-4@20250514': undefined;
85
+ 'claude-opus-5': undefined;
86
+ 'claude-opus-5-5': undefined;
87
+ 'claude-sonnet-4-5@20250929': undefined;
88
+ 'claude-sonnet-4-6': undefined;
89
+ 'claude-sonnet-4@20250514': undefined;
90
+ 'claude-sonnet-5': undefined;
91
+ 'claude-sonnet-5-5': undefined;
92
+ };
93
+ declare const vertexXaiModels: {
94
+ 'xai/grok-4.20-reasoning': {
95
+ reasoning: boolean;
96
+ };
97
+ 'xai/grok-4.20-non-reasoning': {
98
+ reasoning: boolean;
99
+ };
100
+ 'xai/grok-4.1-fast-reasoning': {
101
+ reasoning: boolean;
102
+ };
103
+ 'xai/grok-4.1-fast-non-reasoning': {
104
+ reasoning: boolean;
105
+ };
106
+ };
107
+ declare const vertexMaasModels: {
108
+ 'deepseek-ai/deepseek-r1-0528-maas': {
109
+ publisher: string;
110
+ };
111
+ 'deepseek-ai/deepseek-v3.1-maas': {
112
+ publisher: string;
113
+ };
114
+ 'deepseek-ai/deepseek-v3.2-maas': {
115
+ publisher: string;
116
+ };
117
+ 'openai/gpt-oss-120b-maas': {
118
+ publisher: string;
119
+ };
120
+ 'openai/gpt-oss-20b-maas': {
121
+ publisher: string;
122
+ };
123
+ 'meta/llama-4-maverick-17b-128e-instruct-maas': {
124
+ publisher: string;
125
+ };
126
+ 'meta/llama-4-scout-17b-16e-instruct-maas': {
127
+ publisher: string;
128
+ };
129
+ 'minimax/minimax-m2-maas': {
130
+ publisher: string;
131
+ };
132
+ 'qwen/qwen3-coder-480b-a35b-instruct-maas': {
133
+ publisher: string;
134
+ };
135
+ 'qwen/qwen3-next-80b-a3b-instruct-maas': {
136
+ publisher: string;
137
+ };
138
+ 'qwen/qwen3-next-80b-a3b-thinking-maas': {
139
+ publisher: string;
140
+ };
141
+ 'moonshotai/kimi-k2-thinking-maas': {
142
+ publisher: string;
143
+ };
144
+ };
145
+ /** Known model IDs, derived from the declarations used to build the catalog. */
146
+ type GoogleVertexModelIds = {
147
+ language: (typeof languageModelIds)[number];
148
+ image: (typeof imageModelIds)[number];
149
+ embedding: (typeof embeddingModelIds)[number];
150
+ video: (typeof videoModelIds)[number];
151
+ speech: (typeof speechModelIds)[number];
152
+ transcription: (typeof transcriptionModelIds)[number];
153
+ geminiTranscription: (typeof geminiTranscriptionModelIds)[number];
154
+ anthropic: keyof typeof vertexAnthropicModels;
155
+ xai: keyof typeof vertexXaiModels;
156
+ maas: keyof typeof vertexMaasModels;
157
+ };
158
+ //#endregion
5
159
  //#region src/anthropic/google-vertex-anthropic-options.d.ts
6
- type GoogleVertexAnthropicModelId = 'claude-sonnet-5' | 'claude-sonnet-5-5' | 'claude-haiku-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-fable-5-2' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-opus-4-8' | 'claude-opus-4-7' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-opus-4-5@20251101' | 'claude-sonnet-4-5@20250929' | 'claude-opus-4-1@20250805' | 'claude-opus-4@20250514' | 'claude-sonnet-4@20250514' | 'claude-3-7-sonnet@20250219' | 'claude-3-5-sonnet-v2@20241022' | 'claude-3-5-haiku@20241022' | 'claude-3-5-sonnet@20240620' | 'claude-3-haiku@20240307' | 'claude-3-sonnet@20240229' | 'claude-3-opus@20240229' | (string & {});
160
+ type GoogleVertexAnthropicModelId = GoogleVertexModelIds['anthropic'] | (string & {});
7
161
  //#endregion
8
162
  //#region src/anthropic/google-vertex-anthropic-provider.d.ts
9
163
  type GoogleVertexAnthropicTools = Pick<typeof anthropicTools, 'bash_20241022' | 'bash_20250124' | 'textEditor_20241022' | 'textEditor_20250124' | 'textEditor_20250429' | 'textEditor_20250728' | 'computer_20241022' | 'webSearch_20250305' | 'toolSearchRegex_20251119' | 'toolSearchBm25_20251119'>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"mappings":";;;;;KAYY;;;KCYP,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC/KO,8CAA8CC;;;;;;;EAO7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAiBU,uBAAqB"}
1
+ {"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../src/google-vertex-model-catalog.ts","../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"mappings":";;;;;cA6UM;cAsCA;cAOA;cAcA;cAcA;cAQA;cAEA;cA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GA;;;;;;;;;;;;;;cA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCM;EACV,kBAAkB;EAClB,eAAe;EACf,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,wBAAwB;EACxB,kBAAkB;EAClB,mBAAmB;;;;KCpnBT,+BACR;;;KCUC,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC/KO,8CAA8CC;;;;;;;EAO7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAiBU,uBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createGoogleVertexAnthropic","createVertexAnthropicOriginal"],"sources":["../../src/google-vertex-auth-google-auth-library.ts","../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"sourcesContent":["import { GoogleAuth, type GoogleAuthOptions } from 'google-auth-library';\n\nexport function createAuthTokenGenerator(options?: GoogleAuthOptions) {\n const auth = new GoogleAuth({\n scopes: ['https://www.googleapis.com/auth/cloud-platform'],\n ...options,\n });\n\n return async function generateAuthToken() {\n const client = await auth.getClient();\n const token = await client.getAccessToken();\n return token?.token ?? null;\n };\n}\n","import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const googleVertexAnthropicProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n labels: z.record(z.string(), z.string()).optional(),\n }),\n ),\n);\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude\nexport type GoogleVertexAnthropicModelId =\n | 'claude-sonnet-5'\n | 'claude-sonnet-5-5'\n | 'claude-haiku-5-5'\n | 'claude-fable-5'\n | 'claude-fable-5-1'\n | 'claude-fable-5-2'\n | 'claude-opus-5'\n | 'claude-opus-5-5'\n | 'claude-opus-4-8'\n | 'claude-opus-4-7'\n | 'claude-opus-4-6'\n | 'claude-sonnet-4-6'\n | 'claude-opus-4-5@20251101'\n | 'claude-sonnet-4-5@20250929'\n | 'claude-opus-4-1@20250805'\n | 'claude-opus-4@20250514'\n | 'claude-sonnet-4@20250514'\n | 'claude-3-7-sonnet@20250219'\n | 'claude-3-5-sonnet-v2@20241022'\n | 'claude-3-5-haiku@20241022'\n | 'claude-3-5-sonnet@20240620'\n | 'claude-3-haiku@20240307'\n | 'claude-3-sonnet@20240229'\n | 'claude-3-opus@20240229'\n | (string & {});\n","import {\n InvalidArgumentError,\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n convertUint8ArrayToBase64,\n isValidHostnamePart,\n loadOptionalSetting,\n parseProviderOptions,\n withoutTrailingSlash,\n type FetchFunction,\n type Resolvable,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport {\n googleVertexAnthropicProviderOptions,\n type GoogleVertexAnthropicModelId,\n} from './google-vertex-anthropic-options';\n\ntype GoogleVertexAnthropicTools = Pick<\n typeof anthropicTools,\n | 'bash_20241022'\n | 'bash_20250124'\n | 'textEditor_20241022'\n | 'textEditor_20250124'\n | 'textEditor_20250429'\n | 'textEditor_20250728'\n | 'computer_20241022'\n | 'webSearch_20250305'\n | 'toolSearchRegex_20251119'\n | 'toolSearchBm25_20251119'\n>;\n\n/**\n * Tools supported by Google Vertex Anthropic.\n * This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.\n */\nexport const googleVertexAnthropicTools: GoogleVertexAnthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022: anthropicTools.bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124: anthropicTools.bash_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022: anthropicTools.textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124: anthropicTools.textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command.\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429: anthropicTools.textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n */\n textEditor_20250728: anthropicTools.textEditor_20250728,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n */\n computer_20241022: anthropicTools.computer_20241022,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n */\n webSearch_20250305: anthropicTools.webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119,\n};\nexport interface GoogleVertexAnthropicProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Anthropic tools supported by Google Vertex.\n * Note: Only a subset of Anthropic tools are available on Vertex.\n * Supported tools: bash_20241022, bash_20250124, textEditor_20241022,\n * textEditor_20250124, textEditor_20250429, textEditor_20250728,\n * computer_20241022, webSearch_20250305, toolSearchRegex_20251119,\n * toolSearchBm25_20251119\n */\n tools: typeof googleVertexAnthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\n * Enable native structured output in `structuredOutputMode: 'auto'` for Claude\n * 4.5 and newer. Defaults to false. Requires the Google Cloud organization\n * policy to allow the `structured_outputs` feature for each model used.\n * This does not enable strict tool input schemas.\n */\n supportsNativeStructuredOutput?: boolean;\n\n /**\n * Use a different URL prefix for API calls, e.g. to use proxy servers.\n * The default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create a Google Vertex Anthropic provider instance.\n */\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const getBaseURL = () => {\n const baseURL = withoutTrailingSlash(options.baseURL);\n if (baseURL != null) {\n return baseURL;\n }\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n if (location != null && !isValidHostnamePart(location)) {\n throw new InvalidArgumentError({\n argument: 'location',\n message:\n 'Invalid Google Vertex location. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints.',\n });\n }\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const getHost = () => {\n if (location === 'global') {\n return 'aiplatform.googleapis.com';\n } else if (location === 'eu' || location === 'us') {\n return `aiplatform.${location}.rep.googleapis.com`;\n } else {\n return `${location}-aiplatform.googleapis.com`;\n }\n };\n\n return `https://${getHost()}/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n };\n\n const createChatModel = (modelId: GoogleVertexAnthropicModelId) =>\n new AnthropicLanguageModel(modelId, {\n provider: 'googleVertex.anthropic.messages',\n baseURL: getBaseURL(),\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model: _model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n transformRequestHeaders: async (headers, providerOptions) => {\n const vertexOptions = await parseProviderOptions({\n provider: 'vertex',\n providerOptions,\n schema: googleVertexAnthropicProviderOptions,\n });\n\n // Explicit headers take precedence, regardless of their casing.\n if (\n vertexOptions?.labels == null ||\n Object.keys(headers).some(\n name =>\n name.toLowerCase() === 'x-vertex-ai-labels' &&\n headers[name] != null,\n )\n ) {\n return headers;\n }\n\n return {\n ...headers,\n 'x-vertex-ai-labels': convertUint8ArrayToBase64(\n new TextEncoder().encode(JSON.stringify(vertexOptions.labels)),\n ),\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // Native output is default-denied by GCP policy and requires Claude 4.5+.\n supportsNativeStructuredOutput:\n options.supportsNativeStructuredOutput === true &&\n supportsNativeStructuredOutput(modelId),\n // Native final output does not opt in to strict tool input schemas.\n supportsStrictTools: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = googleVertexAnthropicTools;\n\n return provider;\n}\n\nfunction supportsNativeStructuredOutput(modelId: string): boolean {\n const version = /^claude-[a-z]+-(\\d+)(?:-(\\d+))?(?:@|$)/.exec(modelId);\n return (\n version != null &&\n (Number(version[1]) > 4 ||\n (Number(version[1]) === 4 && Number(version[2]) >= 5))\n );\n}\n","import { resolve } from '@ai-sdk/provider-utils';\nimport type { GoogleAuthOptions } from 'google-auth-library';\nimport { createAuthTokenGenerator } from '../google-vertex-auth-google-auth-library';\nimport {\n createGoogleVertexAnthropic as createVertexAnthropicOriginal,\n type GoogleVertexAnthropicProvider,\n type GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from './google-vertex-anthropic-provider';\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Authentication options provided by google-auth-library.\n * Complete list of authentication options is documented in the\n * GoogleAuthOptions interface:\n * https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.\n */\n googleAuthOptions?: GoogleAuthOptions;\n /**\n * Optional. Override the Bearer token generator. Defaults to OAuth exchange\n * via `google-auth-library` with `googleAuthOptions`.\n */\n generateAuthToken?: () => Promise<string | null>;\n}\n\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const generateAuthToken =\n options.generateAuthToken ??\n createAuthTokenGenerator(options.googleAuthOptions);\n\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken()}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex Anthropic provider instance.\n */\nexport const googleVertexAnthropic = createGoogleVertexAnthropic();\n"],"mappings":";;;;;;AAEA,SAAgB,yBAAyB,SAA6B;CACpE,MAAM,OAAO,IAAI,WAAW;EAC1B,QAAQ,CAAC,gDAAgD;EACzD,GAAG;CACL,CAAC;CAED,OAAO,eAAe,oBAAoB;EAGxC,QAAO,OADa,MADC,KAAK,UAAU,EAAA,CACT,eAAe,EAAA,EAC5B,SAAS;CACzB;AACF;;;ACVA,MAAa,uCAAuC,iBAClD,UACE,EAAE,O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qBACR,yBAAyB,QAAQ,iBAAiB;CAEpD,OAAOC,8BAA8B;EACnC,GAAG;EACH,SAAS,aAAa;GACpB,eAAe,UAAU,MAAM,kBAAkB;GACjD,GAAI,MAAM,QAAQ,QAAQ,OAAO;EACnC;CACF,CAAC;AACH;;;;AAKA,MAAa,wBAAwB,4BAA4B"}
1
+ {"version":3,"file":"index.js","names":["createGoogleVertexAnthropic","createVertexAnthropicOriginal"],"sources":["../../src/google-vertex-auth-google-auth-library.ts","../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"sourcesContent":["import { GoogleAuth, type GoogleAuthOptions } from 'google-auth-library';\n\nexport function createAuthTokenGenerator(options?: GoogleAuthOptions) {\n const auth = new GoogleAuth({\n scopes: ['https://www.googleapis.com/auth/cloud-platform'],\n ...options,\n });\n\n return async function generateAuthToken() {\n const client = await auth.getClient();\n const token = await client.getAccessToken();\n return token?.token ?? null;\n };\n}\n","import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport type { GoogleVertexModelIds } from '../google-vertex-model-catalog';\n\nexport const googleVertexAnthropicProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n labels: z.record(z.string(), z.string()).optional(),\n }),\n ),\n);\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude\nexport type GoogleVertexAnthropicModelId =\n | GoogleVertexModelIds['anthropic']\n | (string & {});\n","import {\n InvalidArgumentError,\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n convertUint8ArrayToBase64,\n isValidHostnamePart,\n loadOptionalSetting,\n parseProviderOptions,\n withoutTrailingSlash,\n type FetchFunction,\n type Resolvable,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport {\n googleVertexAnthropicProviderOptions,\n type GoogleVertexAnthropicModelId,\n} from './google-vertex-anthropic-options';\n\ntype GoogleVertexAnthropicTools = Pick<\n typeof anthropicTools,\n | 'bash_20241022'\n | 'bash_20250124'\n | 'textEditor_20241022'\n | 'textEditor_20250124'\n | 'textEditor_20250429'\n | 'textEditor_20250728'\n | 'computer_20241022'\n | 'webSearch_20250305'\n | 'toolSearchRegex_20251119'\n | 'toolSearchBm25_20251119'\n>;\n\n/**\n * Tools supported by Google Vertex Anthropic.\n * This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.\n */\nexport const googleVertexAnthropicTools: GoogleVertexAnthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022: anthropicTools.bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124: anthropicTools.bash_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022: anthropicTools.textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124: anthropicTools.textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command.\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429: anthropicTools.textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n */\n textEditor_20250728: anthropicTools.textEditor_20250728,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n */\n computer_20241022: anthropicTools.computer_20241022,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n */\n webSearch_20250305: anthropicTools.webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119,\n};\nexport interface GoogleVertexAnthropicProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;\n\n /**\n * Anthropic tools supported by Google Vertex.\n * Note: Only a subset of Anthropic tools are available on Vertex.\n * Supported tools: bash_20241022, bash_20250124, textEditor_20241022,\n * textEditor_20250124, textEditor_20250429, textEditor_20250728,\n * computer_20241022, webSearch_20250305, toolSearchRegex_20251119,\n * toolSearchBm25_20251119\n */\n tools: typeof googleVertexAnthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\n * Enable native structured output in `structuredOutputMode: 'auto'` for Claude\n * 4.5 and newer. Defaults to false. Requires the Google Cloud organization\n * policy to allow the `structured_outputs` feature for each model used.\n * This does not enable strict tool input schemas.\n */\n supportsNativeStructuredOutput?: boolean;\n\n /**\n * Use a different URL prefix for API calls, e.g. to use proxy servers.\n * The default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create a Google Vertex Anthropic provider instance.\n */\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const getBaseURL = () => {\n const baseURL = withoutTrailingSlash(options.baseURL);\n if (baseURL != null) {\n return baseURL;\n }\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n if (location != null && !isValidHostnamePart(location)) {\n throw new InvalidArgumentError({\n argument: 'location',\n message:\n 'Invalid Google Vertex location. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints.',\n });\n }\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n const getHost = () => {\n if (location === 'global') {\n return 'aiplatform.googleapis.com';\n } else if (location === 'eu' || location === 'us') {\n return `aiplatform.${location}.rep.googleapis.com`;\n } else {\n return `${location}-aiplatform.googleapis.com`;\n }\n };\n\n return `https://${getHost()}/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;\n };\n\n const createChatModel = (modelId: GoogleVertexAnthropicModelId) =>\n new AnthropicLanguageModel(modelId, {\n provider: 'googleVertex.anthropic.messages',\n baseURL: getBaseURL(),\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model: _model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n transformRequestHeaders: async (headers, providerOptions) => {\n const vertexOptions = await parseProviderOptions({\n provider: 'vertex',\n providerOptions,\n schema: googleVertexAnthropicProviderOptions,\n });\n\n // Explicit headers take precedence, regardless of their casing.\n if (\n vertexOptions?.labels == null ||\n Object.keys(headers).some(\n name =>\n name.toLowerCase() === 'x-vertex-ai-labels' &&\n headers[name] != null,\n )\n ) {\n return headers;\n }\n\n return {\n ...headers,\n 'x-vertex-ai-labels': convertUint8ArrayToBase64(\n new TextEncoder().encode(JSON.stringify(vertexOptions.labels)),\n ),\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // Native output is default-denied by GCP policy and requires Claude 4.5+.\n supportsNativeStructuredOutput:\n options.supportsNativeStructuredOutput === true &&\n supportsNativeStructuredOutput(modelId),\n // Native final output does not opt in to strict tool input schemas.\n supportsStrictTools: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = googleVertexAnthropicTools;\n\n return provider;\n}\n\nfunction supportsNativeStructuredOutput(modelId: string): boolean {\n const version = /^claude-[a-z]+-(\\d+)(?:-(\\d+))?(?:@|$)/.exec(modelId);\n return (\n version != null &&\n (Number(version[1]) > 4 ||\n (Number(version[1]) === 4 && Number(version[2]) >= 5))\n );\n}\n","import { resolve } from '@ai-sdk/provider-utils';\nimport type { GoogleAuthOptions } from 'google-auth-library';\nimport { createAuthTokenGenerator } from '../google-vertex-auth-google-auth-library';\nimport {\n createGoogleVertexAnthropic as createVertexAnthropicOriginal,\n type GoogleVertexAnthropicProvider,\n type GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from './google-vertex-anthropic-provider';\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Authentication options provided by google-auth-library.\n * Complete list of authentication options is documented in the\n * GoogleAuthOptions interface:\n * https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.\n */\n googleAuthOptions?: GoogleAuthOptions;\n /**\n * Optional. Override the Bearer token generator. Defaults to OAuth exchange\n * via `google-auth-library` with `googleAuthOptions`.\n */\n generateAuthToken?: () => Promise<string | null>;\n}\n\nexport function createGoogleVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const generateAuthToken =\n options.generateAuthToken ??\n createAuthTokenGenerator(options.googleAuthOptions);\n\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken()}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex Anthropic provider instance.\n */\nexport const googleVertexAnthropic = createGoogleVertexAnthropic();\n"],"mappings":";;;;;;AAEA,SAAgB,yBAAyB,SAA6B;CACpE,MAAM,OAAO,IAAI,WAAW;EAC1B,QAAQ,CAAC,gDAAgD;EACzD,GAAG;CACL,CAAC;CAED,OAAO,eAAe,oBAAoB;EAGxC,QAAO,OADa,MADC,KAAK,UAAU,EAAA,CACT,eAAe,EAAA,EAC5B,SAAS;CACzB;AACF;;;ACTA,MAAa,uCAAuC,iBAClD,UACE,EAAE,OAAO,EACP,QAAQ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