@ai-sdk/gateway 2.0.0-beta.34 → 2.0.0
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.
- package/CHANGELOG.md +45 -185
- package/dist/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,267 +1,127 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
-
## 2.0.0
|
|
3
|
+
## 2.0.0
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 76678cd: fix(gateway): bump `@vercel/oidc` to latest
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 1.0.41
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- 11a8867: feat (provider/gateway): improve auth error messages
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## 1.0.40
|
|
16
16
|
|
|
17
17
|
### Patch Changes
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
- @ai-sdk/provider@3.0.0-beta.7
|
|
21
|
-
- @ai-sdk/provider-utils@4.0.0-beta.18
|
|
19
|
+
- f6a9bf3: feat (provider/gateway): add user and tags provider options
|
|
22
20
|
|
|
23
|
-
##
|
|
21
|
+
## 1.0.39
|
|
24
22
|
|
|
25
23
|
### Patch Changes
|
|
26
24
|
|
|
27
|
-
- Updated dependencies [
|
|
28
|
-
- @ai-sdk/provider-utils@
|
|
25
|
+
- Updated dependencies [17f9872]
|
|
26
|
+
- @ai-sdk/provider-utils@3.0.12
|
|
29
27
|
|
|
30
|
-
##
|
|
28
|
+
## 1.0.38
|
|
31
29
|
|
|
32
30
|
### Patch Changes
|
|
33
31
|
|
|
34
|
-
-
|
|
32
|
+
- 227ca94: fix: revert zod import change
|
|
35
33
|
|
|
36
|
-
##
|
|
34
|
+
## 1.0.37
|
|
37
35
|
|
|
38
36
|
### Patch Changes
|
|
39
37
|
|
|
40
|
-
-
|
|
41
|
-
- @ai-sdk/provider-utils@4.0.0-beta.16
|
|
38
|
+
- ec5a0a0: chore(provider/gateway): lazy schema loading
|
|
42
39
|
|
|
43
|
-
##
|
|
40
|
+
## 1.0.36
|
|
44
41
|
|
|
45
42
|
### Patch Changes
|
|
46
43
|
|
|
47
|
-
-
|
|
48
|
-
- Updated dependencies [f0b2157]
|
|
49
|
-
- @ai-sdk/provider-utils@4.0.0-beta.15
|
|
44
|
+
- 638a561: feat (provider/gateway): add 'only' to provider options
|
|
50
45
|
|
|
51
|
-
##
|
|
46
|
+
## 1.0.35
|
|
52
47
|
|
|
53
48
|
### Patch Changes
|
|
54
49
|
|
|
55
|
-
-
|
|
56
|
-
|
|
50
|
+
- 6f0644c: chore: use import \* from zod/v4
|
|
51
|
+
- Updated dependencies [6f0644c]
|
|
52
|
+
- Updated dependencies [6f0644c]
|
|
53
|
+
- @ai-sdk/provider-utils@3.0.11
|
|
57
54
|
|
|
58
|
-
##
|
|
55
|
+
## 1.0.34
|
|
59
56
|
|
|
60
57
|
### Patch Changes
|
|
61
58
|
|
|
62
|
-
-
|
|
63
|
-
- @ai-sdk/provider-utils@4.0.0-beta.13
|
|
64
|
-
|
|
65
|
-
## 2.0.0-beta.25
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- Updated dependencies [7e32fea]
|
|
70
|
-
- @ai-sdk/provider-utils@4.0.0-beta.12
|
|
71
|
-
|
|
72
|
-
## 2.0.0-beta.24
|
|
73
|
-
|
|
74
|
-
### Patch Changes
|
|
75
|
-
|
|
76
|
-
- 0e29b8b: chore(provider/gateway): lazy schema loading
|
|
77
|
-
|
|
78
|
-
## 2.0.0-beta.23
|
|
79
|
-
|
|
80
|
-
### Patch Changes
|
|
81
|
-
|
|
82
|
-
- acc14d8: feat (provider/gateway): add 'only' to provider options
|
|
83
|
-
|
|
84
|
-
## 2.0.0-beta.22
|
|
85
|
-
|
|
86
|
-
### Patch Changes
|
|
87
|
-
|
|
88
|
-
- 95f65c2: chore: use import \* from zod/v4
|
|
89
|
-
- Updated dependencies [95f65c2]
|
|
90
|
-
- Updated dependencies [95f65c2]
|
|
91
|
-
- @ai-sdk/provider-utils@4.0.0-beta.11
|
|
92
|
-
|
|
93
|
-
## 2.0.0-beta.21
|
|
94
|
-
|
|
95
|
-
### Patch Changes
|
|
96
|
-
|
|
97
|
-
- 7b1b1b1: fix(provider/gateway): add "react-native" as export condition for browser behavior
|
|
59
|
+
- 143f65b: fix(provider/gateway): add "react-native" as export condition for browser behavior
|
|
98
60
|
|
|
99
61
|
This avoids the use of native Node APIs in bundles created for React Native / Expo apps
|
|
100
62
|
|
|
101
|
-
##
|
|
102
|
-
|
|
103
|
-
### Major Changes
|
|
104
|
-
|
|
105
|
-
- dee8b05: ai SDK 6 beta
|
|
106
|
-
|
|
107
|
-
### Patch Changes
|
|
108
|
-
|
|
109
|
-
- Updated dependencies [dee8b05]
|
|
110
|
-
- @ai-sdk/provider@3.0.0-beta.6
|
|
111
|
-
- @ai-sdk/provider-utils@4.0.0-beta.10
|
|
112
|
-
|
|
113
|
-
## 1.1.0-beta.19
|
|
114
|
-
|
|
115
|
-
### Patch Changes
|
|
116
|
-
|
|
117
|
-
- Updated dependencies [521c537]
|
|
118
|
-
- @ai-sdk/provider-utils@3.1.0-beta.9
|
|
119
|
-
|
|
120
|
-
## 1.1.0-beta.18
|
|
121
|
-
|
|
122
|
-
### Patch Changes
|
|
123
|
-
|
|
124
|
-
- Updated dependencies [e06565c]
|
|
125
|
-
- @ai-sdk/provider-utils@3.1.0-beta.8
|
|
126
|
-
|
|
127
|
-
## 1.1.0-beta.17
|
|
63
|
+
## 1.0.33
|
|
128
64
|
|
|
129
65
|
### Patch Changes
|
|
130
66
|
|
|
131
|
-
-
|
|
67
|
+
- cffad55: feat(gateway): oidc refresh with `@vercel/oidc`
|
|
132
68
|
|
|
133
|
-
## 1.
|
|
69
|
+
## 1.0.32
|
|
134
70
|
|
|
135
71
|
### Patch Changes
|
|
136
72
|
|
|
137
|
-
-
|
|
138
|
-
- Updated dependencies [e8109d3]
|
|
139
|
-
- @ai-sdk/provider@2.1.0-beta.5
|
|
140
|
-
- @ai-sdk/provider-utils@3.1.0-beta.7
|
|
73
|
+
- bcdba23: feat(provider/gateway): Update DeepSeek model string autocomplete
|
|
141
74
|
|
|
142
|
-
## 1.
|
|
75
|
+
## 1.0.31
|
|
143
76
|
|
|
144
77
|
### Patch Changes
|
|
145
78
|
|
|
146
|
-
-
|
|
79
|
+
- 094685f: feat(provider/gateway): Add DeepSeek V3.2 Exp to Gateway language model settings
|
|
147
80
|
|
|
148
|
-
## 1.
|
|
81
|
+
## 1.0.30
|
|
149
82
|
|
|
150
83
|
### Patch Changes
|
|
151
84
|
|
|
152
|
-
-
|
|
85
|
+
- bc5ed71: chore: update zod peer depenedency version
|
|
86
|
+
- Updated dependencies [bc5ed71]
|
|
87
|
+
- @ai-sdk/provider-utils@3.0.10
|
|
153
88
|
|
|
154
|
-
## 1.
|
|
89
|
+
## 1.0.29
|
|
155
90
|
|
|
156
91
|
### Patch Changes
|
|
157
92
|
|
|
158
|
-
-
|
|
159
|
-
- Updated dependencies [0adc679]
|
|
160
|
-
- Updated dependencies [2b0caef]
|
|
161
|
-
- @ai-sdk/provider-utils@3.1.0-beta.6
|
|
162
|
-
- @ai-sdk/provider@2.1.0-beta.4
|
|
93
|
+
- 7ca78f1: feat(provider/gateway): Add new Qwen models to Gateway model string autocomplete
|
|
163
94
|
|
|
164
|
-
## 1.
|
|
95
|
+
## 1.0.28
|
|
165
96
|
|
|
166
97
|
### Patch Changes
|
|
167
98
|
|
|
168
|
-
-
|
|
99
|
+
- 322901b: feat: add provider version to user-agent header
|
|
169
100
|
|
|
170
|
-
## 1.
|
|
101
|
+
## 1.0.27
|
|
171
102
|
|
|
172
103
|
### Patch Changes
|
|
173
104
|
|
|
174
|
-
-
|
|
105
|
+
- c5f403a: feat(provider/gateway): Add gpt-5-codex to Gateway model string autocomplete
|
|
175
106
|
|
|
176
|
-
## 1.
|
|
107
|
+
## 1.0.26
|
|
177
108
|
|
|
178
109
|
### Patch Changes
|
|
179
110
|
|
|
180
|
-
-
|
|
111
|
+
- e304478: feat(provider/gateway): Add LongCat Thinking model to Gateway autocomplete
|
|
181
112
|
|
|
182
|
-
## 1.
|
|
113
|
+
## 1.0.25
|
|
183
114
|
|
|
184
115
|
### Patch Changes
|
|
185
116
|
|
|
186
|
-
-
|
|
187
|
-
- Updated dependencies [8dac895]
|
|
188
|
-
- @ai-sdk/provider-utils@3.1.0-beta.5
|
|
189
|
-
- @ai-sdk/provider@2.1.0-beta.3
|
|
190
|
-
|
|
191
|
-
## 1.1.0-beta.8
|
|
192
|
-
|
|
193
|
-
### Patch Changes
|
|
194
|
-
|
|
195
|
-
- c823faf: feat(provider/gateway): Add new Gemini preview models to Gateway model string autocomplete
|
|
196
|
-
|
|
197
|
-
## 1.1.0-beta.7
|
|
198
|
-
|
|
199
|
-
### Patch Changes
|
|
200
|
-
|
|
201
|
-
- 4616b86: chore: update zod peer depenedency version
|
|
202
|
-
- Updated dependencies [4616b86]
|
|
203
|
-
- @ai-sdk/provider-utils@3.1.0-beta.4
|
|
204
|
-
|
|
205
|
-
## 1.1.0-beta.6
|
|
206
|
-
|
|
207
|
-
### Patch Changes
|
|
208
|
-
|
|
209
|
-
- aaf5ebf: feat(provider/gateway): Add new Qwen models to Gateway model string autocomplete
|
|
210
|
-
- ed329cb: feat: `Provider-V3`
|
|
211
|
-
- Updated dependencies [ed329cb]
|
|
212
|
-
- Updated dependencies [522f6b8]
|
|
213
|
-
- @ai-sdk/provider@2.1.0-beta.2
|
|
214
|
-
- @ai-sdk/provider-utils@3.1.0-beta.3
|
|
215
|
-
|
|
216
|
-
## 1.1.0-beta.5
|
|
217
|
-
|
|
218
|
-
### Patch Changes
|
|
219
|
-
|
|
220
|
-
- 5d21222: feat(provider/gateway): Add gpt-5-codex to Gateway model string autocomplete
|
|
221
|
-
- 0c4822d: feat: `EmbeddingModelV3`
|
|
222
|
-
- 1cad0ab: feat: add provider version to user-agent header
|
|
223
|
-
- Updated dependencies [0c4822d]
|
|
224
|
-
- @ai-sdk/provider@2.1.0-beta.1
|
|
225
|
-
- @ai-sdk/provider-utils@3.1.0-beta.2
|
|
226
|
-
|
|
227
|
-
## 1.1.0-beta.4
|
|
228
|
-
|
|
229
|
-
### Patch Changes
|
|
230
|
-
|
|
231
|
-
- 7ccb36f: feat(provider/gateway): Add LongCat Thinking model to Gateway autocomplete
|
|
232
|
-
- 6c766ef: feat(provider/gateway): Add DeepSeek V3.1 Terminus to Gateway autocomplete
|
|
233
|
-
|
|
234
|
-
## 1.1.0-beta.3
|
|
235
|
-
|
|
236
|
-
### Patch Changes
|
|
237
|
-
|
|
238
|
-
- ea9ca31: feat(provider/gateway): Add new xAI models
|
|
239
|
-
|
|
240
|
-
## 1.1.0-beta.2
|
|
241
|
-
|
|
242
|
-
### Patch Changes
|
|
243
|
-
|
|
244
|
-
- 3e83633: add getCredits() gateway method
|
|
245
|
-
- f83903d: getCredits style improvements
|
|
246
|
-
|
|
247
|
-
## 1.1.0-beta.1
|
|
248
|
-
|
|
249
|
-
### Patch Changes
|
|
250
|
-
|
|
251
|
-
- Updated dependencies [cbb1d35]
|
|
252
|
-
- @ai-sdk/provider-utils@3.1.0-beta.1
|
|
253
|
-
|
|
254
|
-
## 1.1.0-beta.0
|
|
255
|
-
|
|
256
|
-
### Minor Changes
|
|
117
|
+
- 4d3ff64: feat(provider/gateway): Add new xAI models
|
|
257
118
|
|
|
258
|
-
|
|
119
|
+
## 1.0.24
|
|
259
120
|
|
|
260
121
|
### Patch Changes
|
|
261
122
|
|
|
262
|
-
-
|
|
263
|
-
|
|
264
|
-
- @ai-sdk/provider-utils@3.1.0-beta.0
|
|
123
|
+
- c86e0f7: add getCredits() gateway method
|
|
124
|
+
- 6bbae01: getCredits style improvements
|
|
265
125
|
|
|
266
126
|
## 1.0.23
|
|
267
127
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV2, ProviderV2, EmbeddingModelV2, TypeValidationError } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { FetchFunction,
|
|
3
|
+
import { FetchFunction, InferValidator } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-haiku-4.5' | 'cohere/command-a' | 'cohere/command-r' | 'cohere/command-r-plus' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-r1-distill-llama-70b' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-base' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-
|
|
5
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-haiku-4.5' | 'cohere/command-a' | 'cohere/command-r' | 'cohere/command-r-plus' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-r1-distill-llama-70b' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-base' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemma-2-9b' | 'inception/mercury-coder-small' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3-70b' | 'meta/llama-3-8b' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'mistral/codestral' | 'mistral/devstral-small' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large' | 'mistral/mistral-medium' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-turbo' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-mini' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'stealth/sonoma-dusk-alpha' | 'stealth/sonoma-sky-alpha' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-code-fast-1' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | (string & {});
|
|
6
6
|
|
|
7
7
|
interface GatewayLanguageModelEntry {
|
|
8
8
|
/**
|
|
@@ -50,7 +50,7 @@ interface GatewayLanguageModelEntry {
|
|
|
50
50
|
*/
|
|
51
51
|
modelType?: 'language' | 'embedding' | 'image' | null;
|
|
52
52
|
}
|
|
53
|
-
type GatewayLanguageModelSpecification = Pick<
|
|
53
|
+
type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
54
54
|
|
|
55
55
|
interface GatewayFetchMetadataResponse {
|
|
56
56
|
models: GatewayLanguageModelEntry[];
|
|
@@ -64,12 +64,12 @@ interface GatewayCreditsResponse {
|
|
|
64
64
|
|
|
65
65
|
type GatewayEmbeddingModelId = 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | 'voyage/voyage-code-2' | (string & {});
|
|
66
66
|
|
|
67
|
-
interface GatewayProvider extends
|
|
68
|
-
(modelId: GatewayModelId):
|
|
67
|
+
interface GatewayProvider extends ProviderV2 {
|
|
68
|
+
(modelId: GatewayModelId): LanguageModelV2;
|
|
69
69
|
/**
|
|
70
70
|
Creates a model for text generation.
|
|
71
71
|
*/
|
|
72
|
-
languageModel(modelId: GatewayModelId):
|
|
72
|
+
languageModel(modelId: GatewayModelId): LanguageModelV2;
|
|
73
73
|
/**
|
|
74
74
|
Returns available providers and models for use with the remote provider.
|
|
75
75
|
*/
|
|
@@ -81,7 +81,7 @@ interface GatewayProvider extends ProviderV3 {
|
|
|
81
81
|
/**
|
|
82
82
|
Creates a model for generating text embeddings.
|
|
83
83
|
*/
|
|
84
|
-
textEmbeddingModel(modelId: GatewayEmbeddingModelId):
|
|
84
|
+
textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV2<string>;
|
|
85
85
|
}
|
|
86
86
|
interface GatewayProviderSettings {
|
|
87
87
|
/**
|
|
@@ -112,13 +112,13 @@ Create a remote provider instance.
|
|
|
112
112
|
declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
|
|
113
113
|
declare const gateway: GatewayProvider;
|
|
114
114
|
|
|
115
|
-
declare const gatewayProviderOptions: _ai_sdk_provider_utils.
|
|
115
|
+
declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
116
116
|
only?: string[] | undefined;
|
|
117
117
|
order?: string[] | undefined;
|
|
118
118
|
user?: string | undefined;
|
|
119
119
|
tags?: string[] | undefined;
|
|
120
120
|
}>;
|
|
121
|
-
type GatewayProviderOptions =
|
|
121
|
+
type GatewayProviderOptions = InferValidator<typeof gatewayProviderOptions>;
|
|
122
122
|
|
|
123
123
|
declare const symbol$6: unique symbol;
|
|
124
124
|
declare abstract class GatewayError extends Error {
|
|
@@ -141,7 +141,7 @@ declare abstract class GatewayError extends Error {
|
|
|
141
141
|
static hasMarker(error: unknown): error is GatewayError;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.
|
|
144
|
+
declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazyValidator<{
|
|
145
145
|
error: {
|
|
146
146
|
message: string;
|
|
147
147
|
type?: string | null | undefined;
|
|
@@ -149,7 +149,7 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
149
149
|
code?: string | number | null | undefined;
|
|
150
150
|
};
|
|
151
151
|
}>;
|
|
152
|
-
type GatewayErrorResponse =
|
|
152
|
+
type GatewayErrorResponse = InferValidator<typeof gatewayErrorResponseSchema>;
|
|
153
153
|
|
|
154
154
|
declare const symbol$5: unique symbol;
|
|
155
155
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV2, ProviderV2, EmbeddingModelV2, TypeValidationError } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { FetchFunction,
|
|
3
|
+
import { FetchFunction, InferValidator } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-haiku-4.5' | 'cohere/command-a' | 'cohere/command-r' | 'cohere/command-r-plus' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-r1-distill-llama-70b' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-base' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-
|
|
5
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-haiku-4.5' | 'cohere/command-a' | 'cohere/command-r' | 'cohere/command-r-plus' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-r1-distill-llama-70b' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-base' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemma-2-9b' | 'inception/mercury-coder-small' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3-70b' | 'meta/llama-3-8b' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'mistral/codestral' | 'mistral/devstral-small' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large' | 'mistral/mistral-medium' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-turbo' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-mini' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'stealth/sonoma-dusk-alpha' | 'stealth/sonoma-sky-alpha' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-code-fast-1' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | (string & {});
|
|
6
6
|
|
|
7
7
|
interface GatewayLanguageModelEntry {
|
|
8
8
|
/**
|
|
@@ -50,7 +50,7 @@ interface GatewayLanguageModelEntry {
|
|
|
50
50
|
*/
|
|
51
51
|
modelType?: 'language' | 'embedding' | 'image' | null;
|
|
52
52
|
}
|
|
53
|
-
type GatewayLanguageModelSpecification = Pick<
|
|
53
|
+
type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
54
54
|
|
|
55
55
|
interface GatewayFetchMetadataResponse {
|
|
56
56
|
models: GatewayLanguageModelEntry[];
|
|
@@ -64,12 +64,12 @@ interface GatewayCreditsResponse {
|
|
|
64
64
|
|
|
65
65
|
type GatewayEmbeddingModelId = 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | 'voyage/voyage-code-2' | (string & {});
|
|
66
66
|
|
|
67
|
-
interface GatewayProvider extends
|
|
68
|
-
(modelId: GatewayModelId):
|
|
67
|
+
interface GatewayProvider extends ProviderV2 {
|
|
68
|
+
(modelId: GatewayModelId): LanguageModelV2;
|
|
69
69
|
/**
|
|
70
70
|
Creates a model for text generation.
|
|
71
71
|
*/
|
|
72
|
-
languageModel(modelId: GatewayModelId):
|
|
72
|
+
languageModel(modelId: GatewayModelId): LanguageModelV2;
|
|
73
73
|
/**
|
|
74
74
|
Returns available providers and models for use with the remote provider.
|
|
75
75
|
*/
|
|
@@ -81,7 +81,7 @@ interface GatewayProvider extends ProviderV3 {
|
|
|
81
81
|
/**
|
|
82
82
|
Creates a model for generating text embeddings.
|
|
83
83
|
*/
|
|
84
|
-
textEmbeddingModel(modelId: GatewayEmbeddingModelId):
|
|
84
|
+
textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV2<string>;
|
|
85
85
|
}
|
|
86
86
|
interface GatewayProviderSettings {
|
|
87
87
|
/**
|
|
@@ -112,13 +112,13 @@ Create a remote provider instance.
|
|
|
112
112
|
declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
|
|
113
113
|
declare const gateway: GatewayProvider;
|
|
114
114
|
|
|
115
|
-
declare const gatewayProviderOptions: _ai_sdk_provider_utils.
|
|
115
|
+
declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
116
116
|
only?: string[] | undefined;
|
|
117
117
|
order?: string[] | undefined;
|
|
118
118
|
user?: string | undefined;
|
|
119
119
|
tags?: string[] | undefined;
|
|
120
120
|
}>;
|
|
121
|
-
type GatewayProviderOptions =
|
|
121
|
+
type GatewayProviderOptions = InferValidator<typeof gatewayProviderOptions>;
|
|
122
122
|
|
|
123
123
|
declare const symbol$6: unique symbol;
|
|
124
124
|
declare abstract class GatewayError extends Error {
|
|
@@ -141,7 +141,7 @@ declare abstract class GatewayError extends Error {
|
|
|
141
141
|
static hasMarker(error: unknown): error is GatewayError;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.
|
|
144
|
+
declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazyValidator<{
|
|
145
145
|
error: {
|
|
146
146
|
message: string;
|
|
147
147
|
type?: string | null | undefined;
|
|
@@ -149,7 +149,7 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
149
149
|
code?: string | number | null | undefined;
|
|
150
150
|
};
|
|
151
151
|
}>;
|
|
152
|
-
type GatewayErrorResponse =
|
|
152
|
+
type GatewayErrorResponse = InferValidator<typeof gatewayErrorResponseSchema>;
|
|
153
153
|
|
|
154
154
|
declare const symbol$5: unique symbol;
|
|
155
155
|
/**
|
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
|
182
182
|
var name4 = "GatewayModelNotFoundError";
|
|
183
183
|
var marker5 = `vercel.ai.gateway.error.${name4}`;
|
|
184
184
|
var symbol5 = Symbol.for(marker5);
|
|
185
|
-
var modelNotFoundParamSchema = (0, import_provider_utils.
|
|
185
|
+
var modelNotFoundParamSchema = (0, import_provider_utils.lazyValidator)(
|
|
186
186
|
() => (0, import_provider_utils.zodSchema)(
|
|
187
187
|
import_v4.z.object({
|
|
188
188
|
modelId: import_v4.z.string()
|
|
@@ -312,7 +312,7 @@ async function createGatewayErrorFromResponse({
|
|
|
312
312
|
return new GatewayInternalServerError({ message, statusCode, cause });
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
var gatewayErrorResponseSchema = (0, import_provider_utils2.
|
|
315
|
+
var gatewayErrorResponseSchema = (0, import_provider_utils2.lazyValidator)(
|
|
316
316
|
() => (0, import_provider_utils2.zodSchema)(
|
|
317
317
|
import_v42.z.object({
|
|
318
318
|
error: import_v42.z.object({
|
|
@@ -375,7 +375,7 @@ async function parseAuthMethod(headers) {
|
|
|
375
375
|
});
|
|
376
376
|
return result.success ? result.value : void 0;
|
|
377
377
|
}
|
|
378
|
-
var gatewayAuthMethodSchema = (0, import_provider_utils3.
|
|
378
|
+
var gatewayAuthMethodSchema = (0, import_provider_utils3.lazyValidator)(
|
|
379
379
|
() => (0, import_provider_utils3.zodSchema)(import_v43.z.union([import_v43.z.literal("api-key"), import_v43.z.literal("oidc")]))
|
|
380
380
|
);
|
|
381
381
|
|
|
@@ -426,7 +426,7 @@ var GatewayFetchMetadata = class {
|
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
|
-
var gatewayAvailableModelsResponseSchema = (0, import_provider_utils4.
|
|
429
|
+
var gatewayAvailableModelsResponseSchema = (0, import_provider_utils4.lazyValidator)(
|
|
430
430
|
() => (0, import_provider_utils4.zodSchema)(
|
|
431
431
|
import_v44.z.object({
|
|
432
432
|
models: import_v44.z.array(
|
|
@@ -448,7 +448,7 @@ var gatewayAvailableModelsResponseSchema = (0, import_provider_utils4.lazySchema
|
|
|
448
448
|
})
|
|
449
449
|
).nullish(),
|
|
450
450
|
specification: import_v44.z.object({
|
|
451
|
-
specificationVersion: import_v44.z.literal("
|
|
451
|
+
specificationVersion: import_v44.z.literal("v2"),
|
|
452
452
|
provider: import_v44.z.string(),
|
|
453
453
|
modelId: import_v44.z.string()
|
|
454
454
|
}),
|
|
@@ -458,7 +458,7 @@ var gatewayAvailableModelsResponseSchema = (0, import_provider_utils4.lazySchema
|
|
|
458
458
|
})
|
|
459
459
|
)
|
|
460
460
|
);
|
|
461
|
-
var gatewayCreditsResponseSchema = (0, import_provider_utils4.
|
|
461
|
+
var gatewayCreditsResponseSchema = (0, import_provider_utils4.lazyValidator)(
|
|
462
462
|
() => (0, import_provider_utils4.zodSchema)(
|
|
463
463
|
import_v44.z.object({
|
|
464
464
|
balance: import_v44.z.string(),
|
|
@@ -477,7 +477,7 @@ var GatewayLanguageModel = class {
|
|
|
477
477
|
constructor(modelId, config) {
|
|
478
478
|
this.modelId = modelId;
|
|
479
479
|
this.config = config;
|
|
480
|
-
this.specificationVersion = "
|
|
480
|
+
this.specificationVersion = "v2";
|
|
481
481
|
this.supportedUrls = { "*/*": [/.*/] };
|
|
482
482
|
}
|
|
483
483
|
get provider() {
|
|
@@ -626,7 +626,7 @@ var GatewayEmbeddingModel = class {
|
|
|
626
626
|
constructor(modelId, config) {
|
|
627
627
|
this.modelId = modelId;
|
|
628
628
|
this.config = config;
|
|
629
|
-
this.specificationVersion = "
|
|
629
|
+
this.specificationVersion = "v2";
|
|
630
630
|
this.maxEmbeddingsPerCall = 2048;
|
|
631
631
|
this.supportsParallelCalls = true;
|
|
632
632
|
}
|
|
@@ -688,7 +688,7 @@ var GatewayEmbeddingModel = class {
|
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
|
-
var gatewayEmbeddingResponseSchema = (0, import_provider_utils6.
|
|
691
|
+
var gatewayEmbeddingResponseSchema = (0, import_provider_utils6.lazyValidator)(
|
|
692
692
|
() => (0, import_provider_utils6.zodSchema)(
|
|
693
693
|
import_v46.z.object({
|
|
694
694
|
embeddings: import_v46.z.array(import_v46.z.array(import_v46.z.number())),
|
|
@@ -710,7 +710,7 @@ async function getVercelRequestId() {
|
|
|
710
710
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
711
711
|
|
|
712
712
|
// src/version.ts
|
|
713
|
-
var VERSION = true ? "2.0.0
|
|
713
|
+
var VERSION = true ? "2.0.0" : "0.0.0-test";
|
|
714
714
|
|
|
715
715
|
// src/gateway-provider.ts
|
|
716
716
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|