@ai-sdk/gateway 4.0.0-beta.3 → 4.0.0-beta.31
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 +189 -4
- package/dist/index.d.mts +131 -21
- package/dist/index.d.ts +131 -21
- package/dist/index.js +359 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +415 -186
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +219 -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 +18 -6
- package/src/gateway-language-model.ts +19 -19
- package/src/gateway-model-entry.ts +2 -2
- package/src/gateway-provider-options.ts +8 -4
- package/src/gateway-provider.ts +75 -17
- package/src/gateway-spend-report.ts +191 -0
- package/src/gateway-video-model.ts +15 -15
- package/src/index.ts +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,190 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [c29a26f]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
9
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.30
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 4552cbf: chore(provider/gateway): update gateway model settings files
|
|
16
|
+
|
|
17
|
+
## 4.0.0-beta.29
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [2e17091]
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
23
|
+
|
|
24
|
+
## 4.0.0-beta.28
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [986c6fd]
|
|
29
|
+
- Updated dependencies [493295c]
|
|
30
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
31
|
+
|
|
32
|
+
## 4.0.0-beta.27
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 70a9aae: feat (provider/gateway): add disallowPromptTraining gateway provider option
|
|
37
|
+
|
|
38
|
+
## 4.0.0-beta.26
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 294cbe7: chore(provider/gateway): update gateway model settings files
|
|
43
|
+
|
|
44
|
+
## 4.0.0-beta.25
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- 435895b: feat (provider/gateway): add get-generation support
|
|
49
|
+
|
|
50
|
+
## 4.0.0-beta.24
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- d30466c: feat (provider/gateway): add spend reporting support
|
|
55
|
+
|
|
56
|
+
## 4.0.0-beta.23
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- 4ec78cd: chore(provider/gateway): rename GatewayLanguageModelOptions back to GatewayProviderOptions
|
|
61
|
+
|
|
62
|
+
## 4.0.0-beta.22
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- 7ceff62: chore(provider/gateway): update gateway model settings files
|
|
67
|
+
|
|
68
|
+
## 4.0.0-beta.21
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [1f509d4]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
74
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
75
|
+
|
|
76
|
+
## 4.0.0-beta.20
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
|
|
81
|
+
|
|
82
|
+
## 4.0.0-beta.19
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- 72889f8: chore(provider/gateway): update gateway model settings files
|
|
87
|
+
|
|
88
|
+
## 4.0.0-beta.18
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- 165b97a: chore(provider/gateway): update gateway model settings files
|
|
93
|
+
|
|
94
|
+
## 4.0.0-beta.17
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [3887c70]
|
|
99
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
100
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
101
|
+
|
|
102
|
+
## 4.0.0-beta.16
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [776b617]
|
|
107
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
108
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
109
|
+
|
|
110
|
+
## 4.0.0-beta.15
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [61753c3]
|
|
115
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
116
|
+
|
|
117
|
+
## 4.0.0-beta.14
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- ead9144: chore(provider/gateway): update gateway model settings files
|
|
122
|
+
|
|
123
|
+
## 4.0.0-beta.13
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- 2095655: chore(provider/gateway): update gateway model settings files
|
|
128
|
+
|
|
129
|
+
## 4.0.0-beta.12
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [f7d4f01]
|
|
134
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
135
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
136
|
+
|
|
137
|
+
## 4.0.0-beta.11
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [5c2a5a2]
|
|
142
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
143
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
144
|
+
|
|
145
|
+
## 4.0.0-beta.10
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- 4d6ab9a: chore(provider/gateway): update gateway model settings files
|
|
150
|
+
|
|
151
|
+
## 4.0.0-beta.9
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- 980f777: chore(provider/gateway): update gateway model settings files
|
|
156
|
+
- 7185ba2: bump `@vercel/oidc` dependency to 3.2.0
|
|
157
|
+
|
|
158
|
+
## 4.0.0-beta.8
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- 4adc485: chore(provider/gateway): update gateway model settings files
|
|
163
|
+
|
|
164
|
+
## 4.0.0-beta.7
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- e046ea3: chore(provider/gateway): update gateway model settings files
|
|
169
|
+
|
|
170
|
+
## 4.0.0-beta.6
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- 82288b0: feat(provider/google): add `gemini-embedding-2-preview` and fix multimodal embedding support with `embedMany`
|
|
175
|
+
|
|
176
|
+
## 4.0.0-beta.5
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
|
|
181
|
+
|
|
182
|
+
## 4.0.0-beta.4
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- f32d84a: chore(provider/gateway): update gateway model settings files
|
|
187
|
+
|
|
3
188
|
## 4.0.0-beta.3
|
|
4
189
|
|
|
5
190
|
### Patch Changes
|
|
@@ -489,13 +674,13 @@
|
|
|
489
674
|
Before
|
|
490
675
|
|
|
491
676
|
```ts
|
|
492
|
-
model.textEmbeddingModel(
|
|
677
|
+
model.textEmbeddingModel("my-model-id");
|
|
493
678
|
```
|
|
494
679
|
|
|
495
680
|
After
|
|
496
681
|
|
|
497
682
|
```ts
|
|
498
|
-
model.embeddingModel(
|
|
683
|
+
model.embeddingModel("my-model-id");
|
|
499
684
|
```
|
|
500
685
|
|
|
501
686
|
- aaf5ebf: feat(provider/gateway): Add new Qwen models to Gateway model string autocomplete
|
|
@@ -777,13 +962,13 @@
|
|
|
777
962
|
Before
|
|
778
963
|
|
|
779
964
|
```ts
|
|
780
|
-
model.textEmbeddingModel(
|
|
965
|
+
model.textEmbeddingModel("my-model-id");
|
|
781
966
|
```
|
|
782
967
|
|
|
783
968
|
After
|
|
784
969
|
|
|
785
970
|
```ts
|
|
786
|
-
model.embeddingModel(
|
|
971
|
+
model.embeddingModel("my-model-id");
|
|
787
972
|
```
|
|
788
973
|
|
|
789
974
|
- Updated dependencies [8d9e8ad]
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, 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-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | '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-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-
|
|
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-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | '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-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' | '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' | '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-5v-turbo' | (string & {});
|
|
6
6
|
|
|
7
7
|
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
8
|
|
|
@@ -52,7 +52,7 @@ interface GatewayLanguageModelEntry {
|
|
|
52
52
|
*/
|
|
53
53
|
modelType?: 'language' | 'embedding' | 'image' | 'video' | null;
|
|
54
54
|
}
|
|
55
|
-
type GatewayLanguageModelSpecification = Pick<
|
|
55
|
+
type GatewayLanguageModelSpecification = Pick<LanguageModelV4, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
56
56
|
|
|
57
57
|
interface GatewayFetchMetadataResponse {
|
|
58
58
|
models: GatewayLanguageModelEntry[];
|
|
@@ -64,9 +64,108 @@ interface GatewayCreditsResponse {
|
|
|
64
64
|
totalUsed: string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
interface GatewaySpendReportParams {
|
|
68
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
69
|
+
startDate: string;
|
|
70
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
71
|
+
endDate: string;
|
|
72
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
73
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
74
|
+
/** Time granularity when groupBy is 'day'. */
|
|
75
|
+
datePart?: 'day' | 'hour';
|
|
76
|
+
/** Filter to a specific user's spend. */
|
|
77
|
+
userId?: string;
|
|
78
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
79
|
+
model?: string;
|
|
80
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
81
|
+
provider?: string;
|
|
82
|
+
/** Filter to BYOK or system credentials. */
|
|
83
|
+
credentialType?: 'byok' | 'system';
|
|
84
|
+
/** Filter to requests with these tags. */
|
|
85
|
+
tags?: string[];
|
|
86
|
+
}
|
|
87
|
+
interface GatewaySpendReportRow {
|
|
88
|
+
/** Date string (present when groupBy is 'day') */
|
|
89
|
+
day?: string;
|
|
90
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
91
|
+
hour?: string;
|
|
92
|
+
/** User identifier (present when groupBy is 'user') */
|
|
93
|
+
user?: string;
|
|
94
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
95
|
+
model?: string;
|
|
96
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
97
|
+
tag?: string;
|
|
98
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
99
|
+
provider?: string;
|
|
100
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
101
|
+
credentialType?: 'byok' | 'system';
|
|
102
|
+
/** Total cost in USD */
|
|
103
|
+
totalCost: number;
|
|
104
|
+
/** Market cost in USD */
|
|
105
|
+
marketCost?: number;
|
|
106
|
+
/** Number of input tokens */
|
|
107
|
+
inputTokens?: number;
|
|
108
|
+
/** Number of output tokens */
|
|
109
|
+
outputTokens?: number;
|
|
110
|
+
/** Number of cached input tokens */
|
|
111
|
+
cachedInputTokens?: number;
|
|
112
|
+
/** Number of cache creation input tokens */
|
|
113
|
+
cacheCreationInputTokens?: number;
|
|
114
|
+
/** Number of reasoning tokens */
|
|
115
|
+
reasoningTokens?: number;
|
|
116
|
+
/** Number of requests */
|
|
117
|
+
requestCount?: number;
|
|
118
|
+
}
|
|
119
|
+
interface GatewaySpendReportResponse {
|
|
120
|
+
results: GatewaySpendReportRow[];
|
|
121
|
+
}
|
|
68
122
|
|
|
69
|
-
|
|
123
|
+
interface GatewayGenerationInfoParams {
|
|
124
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
125
|
+
id: string;
|
|
126
|
+
}
|
|
127
|
+
interface GatewayGenerationInfo {
|
|
128
|
+
/** The generation ID */
|
|
129
|
+
id: string;
|
|
130
|
+
/** Total cost in USD */
|
|
131
|
+
totalCost: number;
|
|
132
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
133
|
+
upstreamInferenceCost: number;
|
|
134
|
+
/** Usage cost in USD (same as totalCost) */
|
|
135
|
+
usage: number;
|
|
136
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
137
|
+
createdAt: string;
|
|
138
|
+
/** Model identifier */
|
|
139
|
+
model: string;
|
|
140
|
+
/** Whether BYOK credentials were used */
|
|
141
|
+
isByok: boolean;
|
|
142
|
+
/** Provider that served this generation */
|
|
143
|
+
providerName: string;
|
|
144
|
+
/** Whether streaming was used */
|
|
145
|
+
streamed: boolean;
|
|
146
|
+
/** Finish reason (e.g. 'stop') */
|
|
147
|
+
finishReason: string;
|
|
148
|
+
/** Time to first token in milliseconds */
|
|
149
|
+
latency: number;
|
|
150
|
+
/** Total generation time in milliseconds */
|
|
151
|
+
generationTime: number;
|
|
152
|
+
/** Number of prompt tokens */
|
|
153
|
+
promptTokens: number;
|
|
154
|
+
/** Number of completion tokens */
|
|
155
|
+
completionTokens: number;
|
|
156
|
+
/** Reasoning tokens used */
|
|
157
|
+
reasoningTokens: number;
|
|
158
|
+
/** Cached tokens used */
|
|
159
|
+
cachedTokens: number;
|
|
160
|
+
/** Cache creation input tokens */
|
|
161
|
+
cacheCreationTokens: number;
|
|
162
|
+
/** Billable web search calls */
|
|
163
|
+
billableWebSearchCalls: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
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 & {});
|
|
167
|
+
|
|
168
|
+
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
169
|
|
|
71
170
|
interface PerplexitySearchConfig {
|
|
72
171
|
/**
|
|
@@ -194,7 +293,7 @@ interface PerplexitySearchInput {
|
|
|
194
293
|
search_recency_filter?: 'day' | 'week' | 'month' | 'year';
|
|
195
294
|
}
|
|
196
295
|
type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
|
|
197
|
-
declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
|
|
296
|
+
declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig, {}>;
|
|
198
297
|
|
|
199
298
|
interface ParallelSearchSourcePolicy {
|
|
200
299
|
/**
|
|
@@ -327,7 +426,7 @@ interface ParallelSearchInput {
|
|
|
327
426
|
};
|
|
328
427
|
}
|
|
329
428
|
type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
|
|
330
|
-
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
|
|
429
|
+
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig, {}>;
|
|
331
430
|
|
|
332
431
|
/**
|
|
333
432
|
* Gateway-specific provider-defined tools.
|
|
@@ -352,16 +451,16 @@ declare const gatewayTools: {
|
|
|
352
451
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
353
452
|
};
|
|
354
453
|
|
|
355
|
-
interface GatewayProvider extends
|
|
356
|
-
(modelId: GatewayModelId):
|
|
454
|
+
interface GatewayProvider extends ProviderV4 {
|
|
455
|
+
(modelId: GatewayModelId): LanguageModelV4;
|
|
357
456
|
/**
|
|
358
457
|
* Creates a model for text generation.
|
|
359
458
|
*/
|
|
360
|
-
chat(modelId: GatewayModelId):
|
|
459
|
+
chat(modelId: GatewayModelId): LanguageModelV4;
|
|
361
460
|
/**
|
|
362
461
|
* Creates a model for text generation.
|
|
363
462
|
*/
|
|
364
|
-
languageModel(modelId: GatewayModelId):
|
|
463
|
+
languageModel(modelId: GatewayModelId): LanguageModelV4;
|
|
365
464
|
/**
|
|
366
465
|
* Returns available providers and models for use with the remote provider.
|
|
367
466
|
*/
|
|
@@ -370,34 +469,44 @@ interface GatewayProvider extends ProviderV3 {
|
|
|
370
469
|
* Returns credit information for the authenticated user.
|
|
371
470
|
*/
|
|
372
471
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
472
|
+
/**
|
|
473
|
+
* Returns a spend report with cost, token, and request count data,
|
|
474
|
+
* aggregated by the specified dimension.
|
|
475
|
+
*/
|
|
476
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
477
|
+
/**
|
|
478
|
+
* Returns detailed information about a specific generation by its ID,
|
|
479
|
+
* including cost, token usage, latency, and provider details.
|
|
480
|
+
*/
|
|
481
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
373
482
|
/**
|
|
374
483
|
* Creates a model for generating text embeddings.
|
|
375
484
|
*/
|
|
376
|
-
embedding(modelId: GatewayEmbeddingModelId):
|
|
485
|
+
embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
377
486
|
/**
|
|
378
487
|
* Creates a model for generating text embeddings.
|
|
379
488
|
*/
|
|
380
|
-
embeddingModel(modelId: GatewayEmbeddingModelId):
|
|
489
|
+
embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
381
490
|
/**
|
|
382
491
|
* @deprecated Use `embeddingModel` instead.
|
|
383
492
|
*/
|
|
384
|
-
textEmbeddingModel(modelId: GatewayEmbeddingModelId):
|
|
493
|
+
textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
|
|
385
494
|
/**
|
|
386
495
|
* Creates a model for generating images.
|
|
387
496
|
*/
|
|
388
|
-
image(modelId: GatewayImageModelId):
|
|
497
|
+
image(modelId: GatewayImageModelId): ImageModelV4;
|
|
389
498
|
/**
|
|
390
499
|
* Creates a model for generating images.
|
|
391
500
|
*/
|
|
392
|
-
imageModel(modelId: GatewayImageModelId):
|
|
501
|
+
imageModel(modelId: GatewayImageModelId): ImageModelV4;
|
|
393
502
|
/**
|
|
394
503
|
* Creates a model for generating videos.
|
|
395
504
|
*/
|
|
396
|
-
video(modelId: GatewayVideoModelId):
|
|
505
|
+
video(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
|
|
397
506
|
/**
|
|
398
507
|
* Creates a model for generating videos.
|
|
399
508
|
*/
|
|
400
|
-
videoModel(modelId: GatewayVideoModelId):
|
|
509
|
+
videoModel(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
|
|
401
510
|
/**
|
|
402
511
|
* Gateway-specific tools executed server-side.
|
|
403
512
|
*/
|
|
@@ -432,7 +541,7 @@ interface GatewayProviderSettings {
|
|
|
432
541
|
declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
|
|
433
542
|
declare const gateway: GatewayProvider;
|
|
434
543
|
|
|
435
|
-
declare const
|
|
544
|
+
declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
436
545
|
only?: string[] | undefined;
|
|
437
546
|
order?: string[] | undefined;
|
|
438
547
|
user?: string | undefined;
|
|
@@ -440,11 +549,12 @@ declare const gatewayLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
440
549
|
models?: string[] | undefined;
|
|
441
550
|
byok?: Record<string, Record<string, unknown>[]> | undefined;
|
|
442
551
|
zeroDataRetention?: boolean | undefined;
|
|
552
|
+
disallowPromptTraining?: boolean | undefined;
|
|
443
553
|
providerTimeouts?: {
|
|
444
554
|
byok?: Record<string, number> | undefined;
|
|
445
555
|
} | undefined;
|
|
446
556
|
}>;
|
|
447
|
-
type
|
|
557
|
+
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
448
558
|
|
|
449
559
|
declare const symbol$6: unique symbol;
|
|
450
560
|
declare abstract class GatewayError extends Error {
|
|
@@ -599,4 +709,4 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
599
709
|
static isInstance(error: unknown): error is GatewayResponseError;
|
|
600
710
|
}
|
|
601
711
|
|
|
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
|
|
712
|
+
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, GatewayResponseError, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
|