@ai-sdk/gateway 4.0.0-beta.4 → 4.0.0-beta.40
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 +246 -4
- package/dist/index.d.mts +143 -21
- package/dist/index.d.ts +143 -21
- package/dist/index.js +454 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +518 -186
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +292 -44
- package/package.json +4 -6
- package/src/gateway-embedding-model-settings.ts +1 -0
- package/src/gateway-embedding-model.ts +8 -8
- package/src/gateway-fetch-metadata.ts +1 -1
- package/src/gateway-generation-info.ts +147 -0
- package/src/gateway-image-model-settings.ts +6 -0
- package/src/gateway-image-model.ts +10 -10
- package/src/gateway-language-model-settings.ts +21 -9
- package/src/gateway-language-model.ts +19 -19
- package/src/gateway-model-entry.ts +2 -2
- package/src/gateway-provider-options.ts +27 -8
- package/src/gateway-provider.ts +99 -17
- package/src/gateway-reranking-model-settings.ts +1 -0
- package/src/gateway-reranking-model.ts +114 -0
- package/src/gateway-spend-report.ts +191 -0
- package/src/gateway-video-model.ts +15 -15
- package/src/index.ts +13 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,247 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 939171f: feat (provider/gateway): add reranking model support with `rerankingModel()` and `reranking()` methods
|
|
8
|
+
|
|
9
|
+
## 4.0.0-beta.39
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0694029: chore(provider/gateway): update gateway model settings files
|
|
14
|
+
|
|
15
|
+
## 4.0.0-beta.38
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [34bd95d]
|
|
20
|
+
- Updated dependencies [008271d]
|
|
21
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
23
|
+
|
|
24
|
+
## 4.0.0-beta.37
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [b0c2869]
|
|
29
|
+
- Updated dependencies [7e26e81]
|
|
30
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
31
|
+
|
|
32
|
+
## 4.0.0-beta.36
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- fb0c233: chore(provider/gateway): update gateway model settings files
|
|
37
|
+
- d1f0d2b: feat (provider/gateway): add quotaEntityId gateway provider option
|
|
38
|
+
|
|
39
|
+
## 4.0.0-beta.35
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [46d1149]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
45
|
+
|
|
46
|
+
## 4.0.0-beta.34
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- 71b0e7d: feat (provider/gateway): add hipaaCompliant gateway provider option
|
|
51
|
+
|
|
52
|
+
## 4.0.0-beta.33
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [6fd51c0]
|
|
57
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
58
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
59
|
+
|
|
60
|
+
## 4.0.0-beta.32
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- 11746ca: chore(provider/gateway): update gateway model settings files
|
|
65
|
+
|
|
66
|
+
## 4.0.0-beta.31
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [c29a26f]
|
|
71
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
72
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
73
|
+
|
|
74
|
+
## 4.0.0-beta.30
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 4552cbf: chore(provider/gateway): update gateway model settings files
|
|
79
|
+
|
|
80
|
+
## 4.0.0-beta.29
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [2e17091]
|
|
85
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
86
|
+
|
|
87
|
+
## 4.0.0-beta.28
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [986c6fd]
|
|
92
|
+
- Updated dependencies [493295c]
|
|
93
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
94
|
+
|
|
95
|
+
## 4.0.0-beta.27
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- 70a9aae: feat (provider/gateway): add disallowPromptTraining gateway provider option
|
|
100
|
+
|
|
101
|
+
## 4.0.0-beta.26
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- 294cbe7: chore(provider/gateway): update gateway model settings files
|
|
106
|
+
|
|
107
|
+
## 4.0.0-beta.25
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- 435895b: feat (provider/gateway): add get-generation support
|
|
112
|
+
|
|
113
|
+
## 4.0.0-beta.24
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- d30466c: feat (provider/gateway): add spend reporting support
|
|
118
|
+
|
|
119
|
+
## 4.0.0-beta.23
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- 4ec78cd: chore(provider/gateway): rename GatewayLanguageModelOptions back to GatewayProviderOptions
|
|
124
|
+
|
|
125
|
+
## 4.0.0-beta.22
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- 7ceff62: chore(provider/gateway): update gateway model settings files
|
|
130
|
+
|
|
131
|
+
## 4.0.0-beta.21
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Updated dependencies [1f509d4]
|
|
136
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
137
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
138
|
+
|
|
139
|
+
## 4.0.0-beta.20
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
|
|
144
|
+
|
|
145
|
+
## 4.0.0-beta.19
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- 72889f8: chore(provider/gateway): update gateway model settings files
|
|
150
|
+
|
|
151
|
+
## 4.0.0-beta.18
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- 165b97a: chore(provider/gateway): update gateway model settings files
|
|
156
|
+
|
|
157
|
+
## 4.0.0-beta.17
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [3887c70]
|
|
162
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
163
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
164
|
+
|
|
165
|
+
## 4.0.0-beta.16
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- Updated dependencies [776b617]
|
|
170
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
171
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
172
|
+
|
|
173
|
+
## 4.0.0-beta.15
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- Updated dependencies [61753c3]
|
|
178
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
179
|
+
|
|
180
|
+
## 4.0.0-beta.14
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- ead9144: chore(provider/gateway): update gateway model settings files
|
|
185
|
+
|
|
186
|
+
## 4.0.0-beta.13
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- 2095655: chore(provider/gateway): update gateway model settings files
|
|
191
|
+
|
|
192
|
+
## 4.0.0-beta.12
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- Updated dependencies [f7d4f01]
|
|
197
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
198
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
199
|
+
|
|
200
|
+
## 4.0.0-beta.11
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- Updated dependencies [5c2a5a2]
|
|
205
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
206
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
207
|
+
|
|
208
|
+
## 4.0.0-beta.10
|
|
209
|
+
|
|
210
|
+
### Patch Changes
|
|
211
|
+
|
|
212
|
+
- 4d6ab9a: chore(provider/gateway): update gateway model settings files
|
|
213
|
+
|
|
214
|
+
## 4.0.0-beta.9
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- 980f777: chore(provider/gateway): update gateway model settings files
|
|
219
|
+
- 7185ba2: bump `@vercel/oidc` dependency to 3.2.0
|
|
220
|
+
|
|
221
|
+
## 4.0.0-beta.8
|
|
222
|
+
|
|
223
|
+
### Patch Changes
|
|
224
|
+
|
|
225
|
+
- 4adc485: chore(provider/gateway): update gateway model settings files
|
|
226
|
+
|
|
227
|
+
## 4.0.0-beta.7
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- e046ea3: chore(provider/gateway): update gateway model settings files
|
|
232
|
+
|
|
233
|
+
## 4.0.0-beta.6
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- 82288b0: feat(provider/google): add `gemini-embedding-2-preview` and fix multimodal embedding support with `embedMany`
|
|
238
|
+
|
|
239
|
+
## 4.0.0-beta.5
|
|
240
|
+
|
|
241
|
+
### Patch Changes
|
|
242
|
+
|
|
243
|
+
- aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
|
|
244
|
+
|
|
3
245
|
## 4.0.0-beta.4
|
|
4
246
|
|
|
5
247
|
### Patch Changes
|
|
@@ -495,13 +737,13 @@
|
|
|
495
737
|
Before
|
|
496
738
|
|
|
497
739
|
```ts
|
|
498
|
-
model.textEmbeddingModel(
|
|
740
|
+
model.textEmbeddingModel("my-model-id");
|
|
499
741
|
```
|
|
500
742
|
|
|
501
743
|
After
|
|
502
744
|
|
|
503
745
|
```ts
|
|
504
|
-
model.embeddingModel(
|
|
746
|
+
model.embeddingModel("my-model-id");
|
|
505
747
|
```
|
|
506
748
|
|
|
507
749
|
- aaf5ebf: feat(provider/gateway): Add new Qwen models to Gateway model string autocomplete
|
|
@@ -783,13 +1025,13 @@
|
|
|
783
1025
|
Before
|
|
784
1026
|
|
|
785
1027
|
```ts
|
|
786
|
-
model.textEmbeddingModel(
|
|
1028
|
+
model.textEmbeddingModel("my-model-id");
|
|
787
1029
|
```
|
|
788
1030
|
|
|
789
1031
|
After
|
|
790
1032
|
|
|
791
1033
|
```ts
|
|
792
|
-
model.embeddingModel(
|
|
1034
|
+
model.embeddingModel("my-model-id");
|
|
793
1035
|
```
|
|
794
1036
|
|
|
795
1037
|
- Updated dependencies [8d9e8ad]
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, TypeValidationError } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { FetchFunction, InferSchema } 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-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'amazon/nova-2-lite' | '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
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | '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.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | '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' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | '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-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | '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-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
6
|
+
|
|
7
|
+
type GatewayRerankingModelId = 'cohere/rerank-v3.5' | (string & {});
|
|
6
8
|
|
|
7
9
|
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
8
10
|
|
|
@@ -52,7 +54,7 @@ interface GatewayLanguageModelEntry {
|
|
|
52
54
|
*/
|
|
53
55
|
modelType?: 'language' | 'embedding' | 'image' | 'video' | null;
|
|
54
56
|
}
|
|
55
|
-
type GatewayLanguageModelSpecification = Pick<
|
|
57
|
+
type GatewayLanguageModelSpecification = Pick<LanguageModelV4, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
56
58
|
|
|
57
59
|
interface GatewayFetchMetadataResponse {
|
|
58
60
|
models: GatewayLanguageModelEntry[];
|
|
@@ -64,9 +66,108 @@ interface GatewayCreditsResponse {
|
|
|
64
66
|
totalUsed: string;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
interface GatewaySpendReportParams {
|
|
70
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
71
|
+
startDate: string;
|
|
72
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
73
|
+
endDate: string;
|
|
74
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
75
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
76
|
+
/** Time granularity when groupBy is 'day'. */
|
|
77
|
+
datePart?: 'day' | 'hour';
|
|
78
|
+
/** Filter to a specific user's spend. */
|
|
79
|
+
userId?: string;
|
|
80
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
81
|
+
model?: string;
|
|
82
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
83
|
+
provider?: string;
|
|
84
|
+
/** Filter to BYOK or system credentials. */
|
|
85
|
+
credentialType?: 'byok' | 'system';
|
|
86
|
+
/** Filter to requests with these tags. */
|
|
87
|
+
tags?: string[];
|
|
88
|
+
}
|
|
89
|
+
interface GatewaySpendReportRow {
|
|
90
|
+
/** Date string (present when groupBy is 'day') */
|
|
91
|
+
day?: string;
|
|
92
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
93
|
+
hour?: string;
|
|
94
|
+
/** User identifier (present when groupBy is 'user') */
|
|
95
|
+
user?: string;
|
|
96
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
97
|
+
model?: string;
|
|
98
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
99
|
+
tag?: string;
|
|
100
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
101
|
+
provider?: string;
|
|
102
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
103
|
+
credentialType?: 'byok' | 'system';
|
|
104
|
+
/** Total cost in USD */
|
|
105
|
+
totalCost: number;
|
|
106
|
+
/** Market cost in USD */
|
|
107
|
+
marketCost?: number;
|
|
108
|
+
/** Number of input tokens */
|
|
109
|
+
inputTokens?: number;
|
|
110
|
+
/** Number of output tokens */
|
|
111
|
+
outputTokens?: number;
|
|
112
|
+
/** Number of cached input tokens */
|
|
113
|
+
cachedInputTokens?: number;
|
|
114
|
+
/** Number of cache creation input tokens */
|
|
115
|
+
cacheCreationInputTokens?: number;
|
|
116
|
+
/** Number of reasoning tokens */
|
|
117
|
+
reasoningTokens?: number;
|
|
118
|
+
/** Number of requests */
|
|
119
|
+
requestCount?: number;
|
|
120
|
+
}
|
|
121
|
+
interface GatewaySpendReportResponse {
|
|
122
|
+
results: GatewaySpendReportRow[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface GatewayGenerationInfoParams {
|
|
126
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
127
|
+
id: string;
|
|
128
|
+
}
|
|
129
|
+
interface GatewayGenerationInfo {
|
|
130
|
+
/** The generation ID */
|
|
131
|
+
id: string;
|
|
132
|
+
/** Total cost in USD */
|
|
133
|
+
totalCost: number;
|
|
134
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
135
|
+
upstreamInferenceCost: number;
|
|
136
|
+
/** Usage cost in USD (same as totalCost) */
|
|
137
|
+
usage: number;
|
|
138
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
139
|
+
createdAt: string;
|
|
140
|
+
/** Model identifier */
|
|
141
|
+
model: string;
|
|
142
|
+
/** Whether BYOK credentials were used */
|
|
143
|
+
isByok: boolean;
|
|
144
|
+
/** Provider that served this generation */
|
|
145
|
+
providerName: string;
|
|
146
|
+
/** Whether streaming was used */
|
|
147
|
+
streamed: boolean;
|
|
148
|
+
/** Finish reason (e.g. 'stop') */
|
|
149
|
+
finishReason: string;
|
|
150
|
+
/** Time to first token in milliseconds */
|
|
151
|
+
latency: number;
|
|
152
|
+
/** Total generation time in milliseconds */
|
|
153
|
+
generationTime: number;
|
|
154
|
+
/** Number of prompt tokens */
|
|
155
|
+
promptTokens: number;
|
|
156
|
+
/** Number of completion tokens */
|
|
157
|
+
completionTokens: number;
|
|
158
|
+
/** Reasoning tokens used */
|
|
159
|
+
reasoningTokens: number;
|
|
160
|
+
/** Cached tokens used */
|
|
161
|
+
cachedTokens: number;
|
|
162
|
+
/** Cache creation input tokens */
|
|
163
|
+
cacheCreationTokens: number;
|
|
164
|
+
/** Billable web search calls */
|
|
165
|
+
billableWebSearchCalls: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | '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-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
68
169
|
|
|
69
|
-
type GatewayImageModelId = 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
|
|
170
|
+
type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
|
|
70
171
|
|
|
71
172
|
interface PerplexitySearchConfig {
|
|
72
173
|
/**
|
|
@@ -194,7 +295,7 @@ interface PerplexitySearchInput {
|
|
|
194
295
|
search_recency_filter?: 'day' | 'week' | 'month' | 'year';
|
|
195
296
|
}
|
|
196
297
|
type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
|
|
197
|
-
declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
|
|
298
|
+
declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig, {}>;
|
|
198
299
|
|
|
199
300
|
interface ParallelSearchSourcePolicy {
|
|
200
301
|
/**
|
|
@@ -327,7 +428,7 @@ interface ParallelSearchInput {
|
|
|
327
428
|
};
|
|
328
429
|
}
|
|
329
430
|
type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
|
|
330
|
-
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
|
|
431
|
+
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig, {}>;
|
|
331
432
|
|
|
332
433
|
/**
|
|
333
434
|
* Gateway-specific provider-defined tools.
|
|
@@ -352,16 +453,16 @@ declare const gatewayTools: {
|
|
|
352
453
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
353
454
|
};
|
|
354
455
|
|
|
355
|
-
interface GatewayProvider extends
|
|
356
|
-
(modelId: GatewayModelId):
|
|
456
|
+
interface GatewayProvider extends ProviderV4 {
|
|
457
|
+
(modelId: GatewayModelId): LanguageModelV4;
|
|
357
458
|
/**
|
|
358
459
|
* Creates a model for text generation.
|
|
359
460
|
*/
|
|
360
|
-
chat(modelId: GatewayModelId):
|
|
461
|
+
chat(modelId: GatewayModelId): LanguageModelV4;
|
|
361
462
|
/**
|
|
362
463
|
* Creates a model for text generation.
|
|
363
464
|
*/
|
|
364
|
-
languageModel(modelId: GatewayModelId):
|
|
465
|
+
languageModel(modelId: GatewayModelId): LanguageModelV4;
|
|
365
466
|
/**
|
|
366
467
|
* Returns available providers and models for use with the remote provider.
|
|
367
468
|
*/
|
|
@@ -370,34 +471,52 @@ interface GatewayProvider extends ProviderV3 {
|
|
|
370
471
|
* Returns credit information for the authenticated user.
|
|
371
472
|
*/
|
|
372
473
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
474
|
+
/**
|
|
475
|
+
* Returns a spend report with cost, token, and request count data,
|
|
476
|
+
* aggregated by the specified dimension.
|
|
477
|
+
*/
|
|
478
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
479
|
+
/**
|
|
480
|
+
* Returns detailed information about a specific generation by its ID,
|
|
481
|
+
* including cost, token usage, latency, and provider details.
|
|
482
|
+
*/
|
|
483
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
373
484
|
/**
|
|
374
485
|
* Creates a model for generating text embeddings.
|
|
375
486
|
*/
|
|
376
|
-
embedding(modelId: GatewayEmbeddingModelId):
|
|
487
|
+
embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
377
488
|
/**
|
|
378
489
|
* Creates a model for generating text embeddings.
|
|
379
490
|
*/
|
|
380
|
-
embeddingModel(modelId: GatewayEmbeddingModelId):
|
|
491
|
+
embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
381
492
|
/**
|
|
382
493
|
* @deprecated Use `embeddingModel` instead.
|
|
383
494
|
*/
|
|
384
|
-
textEmbeddingModel(modelId: GatewayEmbeddingModelId):
|
|
495
|
+
textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
385
496
|
/**
|
|
386
497
|
* Creates a model for generating images.
|
|
387
498
|
*/
|
|
388
|
-
image(modelId: GatewayImageModelId):
|
|
499
|
+
image(modelId: GatewayImageModelId): ImageModelV4;
|
|
389
500
|
/**
|
|
390
501
|
* Creates a model for generating images.
|
|
391
502
|
*/
|
|
392
|
-
imageModel(modelId: GatewayImageModelId):
|
|
503
|
+
imageModel(modelId: GatewayImageModelId): ImageModelV4;
|
|
393
504
|
/**
|
|
394
505
|
* Creates a model for generating videos.
|
|
395
506
|
*/
|
|
396
|
-
video(modelId: GatewayVideoModelId):
|
|
507
|
+
video(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
|
|
397
508
|
/**
|
|
398
509
|
* Creates a model for generating videos.
|
|
399
510
|
*/
|
|
400
|
-
videoModel(modelId: GatewayVideoModelId):
|
|
511
|
+
videoModel(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
|
|
512
|
+
/**
|
|
513
|
+
* Creates a model for reranking documents.
|
|
514
|
+
*/
|
|
515
|
+
reranking(modelId: GatewayRerankingModelId): RerankingModelV4;
|
|
516
|
+
/**
|
|
517
|
+
* Creates a model for reranking documents.
|
|
518
|
+
*/
|
|
519
|
+
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV4;
|
|
401
520
|
/**
|
|
402
521
|
* Gateway-specific tools executed server-side.
|
|
403
522
|
*/
|
|
@@ -432,7 +551,7 @@ interface GatewayProviderSettings {
|
|
|
432
551
|
declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
|
|
433
552
|
declare const gateway: GatewayProvider;
|
|
434
553
|
|
|
435
|
-
declare const
|
|
554
|
+
declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
436
555
|
only?: string[] | undefined;
|
|
437
556
|
order?: string[] | undefined;
|
|
438
557
|
user?: string | undefined;
|
|
@@ -440,11 +559,14 @@ declare const gatewayLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
440
559
|
models?: string[] | undefined;
|
|
441
560
|
byok?: Record<string, Record<string, unknown>[]> | undefined;
|
|
442
561
|
zeroDataRetention?: boolean | undefined;
|
|
562
|
+
disallowPromptTraining?: boolean | undefined;
|
|
563
|
+
hipaaCompliant?: boolean | undefined;
|
|
564
|
+
quotaEntityId?: string | undefined;
|
|
443
565
|
providerTimeouts?: {
|
|
444
566
|
byok?: Record<string, number> | undefined;
|
|
445
567
|
} | undefined;
|
|
446
568
|
}>;
|
|
447
|
-
type
|
|
569
|
+
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
448
570
|
|
|
449
571
|
declare const symbol$6: unique symbol;
|
|
450
572
|
declare abstract class GatewayError extends Error {
|
|
@@ -599,4 +721,4 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
599
721
|
static isInstance(error: unknown): error is GatewayResponseError;
|
|
600
722
|
}
|
|
601
723
|
|
|
602
|
-
export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type
|
|
724
|
+
export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, type GatewayGenerationInfo, type GatewayGenerationInfoParams, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
|