@ai-sdk/gateway 4.0.0-beta.6 → 4.0.0-beta.61

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/dist/index.d.mts DELETED
@@ -1,602 +0,0 @@
1
- import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, TypeValidationError } from '@ai-sdk/provider';
2
- import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
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-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | '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' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | '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' | '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-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/codex-mini' | '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-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' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | '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-code-fast-1' | 'xiaomi/mimo-v2-flash' | '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' | (string & {});
6
-
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
-
9
- interface GatewayLanguageModelEntry {
10
- /**
11
- * The model id used by the remote provider in model settings and for specifying the
12
- * intended model for text generation.
13
- */
14
- id: string;
15
- /**
16
- * The display name of the model for presentation in user-facing contexts.
17
- */
18
- name: string;
19
- /**
20
- * Optional description of the model.
21
- */
22
- description?: string | null;
23
- /**
24
- * Optional pricing information for the model.
25
- */
26
- pricing?: {
27
- /**
28
- * Cost per input token in USD.
29
- */
30
- input: string;
31
- /**
32
- * Cost per output token in USD.
33
- */
34
- output: string;
35
- /**
36
- * Cost per cached input token in USD.
37
- * Only present for providers/models that support prompt caching.
38
- */
39
- cachedInputTokens?: string;
40
- /**
41
- * Cost per input token to create/write cache entries in USD.
42
- * Only present for providers/models that support prompt caching.
43
- */
44
- cacheCreationInputTokens?: string;
45
- } | null;
46
- /**
47
- * Additional AI SDK language model specifications for the model.
48
- */
49
- specification: GatewayLanguageModelSpecification;
50
- /**
51
- * Optional field to differentiate between model types.
52
- */
53
- modelType?: 'language' | 'embedding' | 'image' | 'video' | null;
54
- }
55
- type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
56
-
57
- interface GatewayFetchMetadataResponse {
58
- models: GatewayLanguageModelEntry[];
59
- }
60
- interface GatewayCreditsResponse {
61
- /** The remaining gateway credit balance available for API usage */
62
- balance: string;
63
- /** The total amount of gateway credits that have been consumed */
64
- totalUsed: string;
65
- }
66
-
67
- 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-preview' | '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
-
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 & {});
70
-
71
- interface PerplexitySearchConfig {
72
- /**
73
- * Default maximum number of search results to return (1-20, default: 10).
74
- */
75
- maxResults?: number;
76
- /**
77
- * Default maximum tokens to extract per search result page (256-2048, default: 2048).
78
- */
79
- maxTokensPerPage?: number;
80
- /**
81
- * Default maximum total tokens across all search results (default: 25000, max: 1000000).
82
- */
83
- maxTokens?: number;
84
- /**
85
- * Default two-letter ISO 3166-1 alpha-2 country code for regional search results.
86
- * Examples: 'US', 'GB', 'FR'
87
- */
88
- country?: string;
89
- /**
90
- * Default list of domains to include or exclude from search results (max 20).
91
- * To include: ['nature.com', 'science.org']
92
- * To exclude: ['-example.com', '-spam.net']
93
- */
94
- searchDomainFilter?: string[];
95
- /**
96
- * Default list of ISO 639-1 language codes to filter results (max 10, lowercase).
97
- * Examples: ['en', 'fr', 'de']
98
- */
99
- searchLanguageFilter?: string[];
100
- /**
101
- * Default recency filter for results.
102
- * Cannot be combined with searchAfterDate/searchBeforeDate at runtime.
103
- */
104
- searchRecencyFilter?: 'day' | 'week' | 'month' | 'year';
105
- }
106
- interface PerplexitySearchResult {
107
- /** Title of the search result */
108
- title: string;
109
- /** URL of the search result */
110
- url: string;
111
- /** Text snippet/preview of the content */
112
- snippet: string;
113
- /** Publication date of the content */
114
- date?: string;
115
- /** Last updated date of the content */
116
- lastUpdated?: string;
117
- }
118
- interface PerplexitySearchResponse {
119
- /** Array of search results */
120
- results: PerplexitySearchResult[];
121
- /** Unique identifier for this search request */
122
- id: string;
123
- }
124
- interface PerplexitySearchError {
125
- /** Error type */
126
- error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'unknown';
127
- /** HTTP status code if applicable */
128
- statusCode?: number;
129
- /** Human-readable error message */
130
- message: string;
131
- }
132
- interface PerplexitySearchInput {
133
- /**
134
- * Search query (string) or multiple queries (array of up to 5 strings).
135
- * Multi-query searches return combined results from all queries.
136
- */
137
- query: string | string[];
138
- /**
139
- * Maximum number of search results to return (1-20, default: 10).
140
- */
141
- max_results?: number;
142
- /**
143
- * Maximum number of tokens to extract per search result page (256-2048, default: 2048).
144
- */
145
- max_tokens_per_page?: number;
146
- /**
147
- * Maximum total tokens across all search results (default: 25000, max: 1000000).
148
- */
149
- max_tokens?: number;
150
- /**
151
- * Two-letter ISO 3166-1 alpha-2 country code for regional search results.
152
- * Examples: 'US', 'GB', 'FR'
153
- */
154
- country?: string;
155
- /**
156
- * List of domains to include or exclude from search results (max 20).
157
- * To include: ['nature.com', 'science.org']
158
- * To exclude: ['-example.com', '-spam.net']
159
- */
160
- search_domain_filter?: string[];
161
- /**
162
- * List of ISO 639-1 language codes to filter results (max 10, lowercase).
163
- * Examples: ['en', 'fr', 'de']
164
- */
165
- search_language_filter?: string[];
166
- /**
167
- * Include only results published after this date.
168
- * Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
169
- * Cannot be used with search_recency_filter.
170
- */
171
- search_after_date?: string;
172
- /**
173
- * Include only results published before this date.
174
- * Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
175
- * Cannot be used with search_recency_filter.
176
- */
177
- search_before_date?: string;
178
- /**
179
- * Include only results last updated after this date.
180
- * Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
181
- * Cannot be used with search_recency_filter.
182
- */
183
- last_updated_after_filter?: string;
184
- /**
185
- * Include only results last updated before this date.
186
- * Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
187
- * Cannot be used with search_recency_filter.
188
- */
189
- last_updated_before_filter?: string;
190
- /**
191
- * Filter results by relative time period.
192
- * Cannot be used with search_after_date or search_before_date.
193
- */
194
- search_recency_filter?: 'day' | 'week' | 'month' | 'year';
195
- }
196
- type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
197
- declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
198
-
199
- interface ParallelSearchSourcePolicy {
200
- /**
201
- * List of domains to include in search results.
202
- * Example: ['wikipedia.org', 'nature.com']
203
- */
204
- includeDomains?: string[];
205
- /**
206
- * List of domains to exclude from search results.
207
- * Example: ['reddit.com', 'twitter.com']
208
- */
209
- excludeDomains?: string[];
210
- /**
211
- * Only include results published after this date (ISO 8601 format).
212
- * Example: '2024-01-01'
213
- */
214
- afterDate?: string;
215
- }
216
- interface ParallelSearchExcerpts {
217
- /**
218
- * Maximum characters per result.
219
- */
220
- maxCharsPerResult?: number;
221
- /**
222
- * Maximum total characters across all results.
223
- */
224
- maxCharsTotal?: number;
225
- }
226
- interface ParallelSearchFetchPolicy {
227
- /**
228
- * Maximum age in seconds for cached content.
229
- * Set to 0 to always fetch fresh content.
230
- */
231
- maxAgeSeconds?: number;
232
- }
233
- interface ParallelSearchConfig {
234
- /**
235
- * Mode preset for different use cases:
236
- * - "one-shot": Comprehensive results with longer excerpts for single-response answers (default)
237
- * - "agentic": Concise, token-efficient results for multi-step agentic workflows
238
- */
239
- mode?: 'one-shot' | 'agentic';
240
- /**
241
- * Default maximum number of results to return (1-20).
242
- * Defaults to 10 if not specified.
243
- */
244
- maxResults?: number;
245
- /**
246
- * Default source policy for controlling which domains to include/exclude.
247
- */
248
- sourcePolicy?: ParallelSearchSourcePolicy;
249
- /**
250
- * Default excerpt configuration for controlling result length.
251
- */
252
- excerpts?: ParallelSearchExcerpts;
253
- /**
254
- * Default fetch policy for controlling content freshness.
255
- */
256
- fetchPolicy?: ParallelSearchFetchPolicy;
257
- }
258
- interface ParallelSearchResult {
259
- /** URL of the search result */
260
- url: string;
261
- /** Title of the search result */
262
- title: string;
263
- /** Extracted text excerpt/content from the page */
264
- excerpt: string;
265
- /** Publication date of the content (may be null) */
266
- publishDate?: string | null;
267
- /** Relevance score for the result */
268
- relevanceScore?: number;
269
- }
270
- interface ParallelSearchResponse {
271
- /** Unique identifier for this search request */
272
- searchId: string;
273
- /** Array of search results */
274
- results: ParallelSearchResult[];
275
- }
276
- interface ParallelSearchError {
277
- /** Error type */
278
- error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'unknown';
279
- /** HTTP status code if applicable */
280
- statusCode?: number;
281
- /** Human-readable error message */
282
- message: string;
283
- }
284
- interface ParallelSearchInput {
285
- /**
286
- * Natural-language description of the web research goal.
287
- * Include source or freshness guidance and broader context from the task.
288
- * Maximum 5000 characters.
289
- */
290
- objective: string;
291
- /**
292
- * Optional search queries to supplement the objective.
293
- * Maximum 200 characters per query.
294
- */
295
- search_queries?: string[];
296
- /**
297
- * Mode preset for different use cases:
298
- * - "one-shot": Comprehensive results with longer excerpts
299
- * - "agentic": Concise, token-efficient results for multi-step workflows
300
- */
301
- mode?: 'one-shot' | 'agentic';
302
- /**
303
- * Maximum number of results to return (1-20).
304
- * Defaults to 10 if not specified.
305
- */
306
- max_results?: number;
307
- /**
308
- * Source policy for controlling which domains to include/exclude.
309
- */
310
- source_policy?: {
311
- include_domains?: string[];
312
- exclude_domains?: string[];
313
- after_date?: string;
314
- };
315
- /**
316
- * Excerpt configuration for controlling result length.
317
- */
318
- excerpts?: {
319
- max_chars_per_result?: number;
320
- max_chars_total?: number;
321
- };
322
- /**
323
- * Fetch policy for controlling content freshness.
324
- */
325
- fetch_policy?: {
326
- max_age_seconds?: number;
327
- };
328
- }
329
- type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
330
- declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
331
-
332
- /**
333
- * Gateway-specific provider-defined tools.
334
- */
335
- declare const gatewayTools: {
336
- /**
337
- * Search the web using Parallel AI's Search API for LLM-optimized excerpts.
338
- *
339
- * Takes a natural language objective and returns relevant excerpts,
340
- * replacing multiple keyword searches with a single call for broad
341
- * or complex queries. Supports different search types for depth vs
342
- * breadth tradeoffs.
343
- */
344
- parallelSearch: (config?: ParallelSearchConfig) => ReturnType<typeof parallelSearchToolFactory>;
345
- /**
346
- * Search the web using Perplexity's Search API for real-time information,
347
- * news, research papers, and articles.
348
- *
349
- * Provides ranked search results with advanced filtering options including
350
- * domain, language, date range, and recency filters.
351
- */
352
- perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
353
- };
354
-
355
- interface GatewayProvider extends ProviderV3 {
356
- (modelId: GatewayModelId): LanguageModelV3;
357
- /**
358
- * Creates a model for text generation.
359
- */
360
- chat(modelId: GatewayModelId): LanguageModelV3;
361
- /**
362
- * Creates a model for text generation.
363
- */
364
- languageModel(modelId: GatewayModelId): LanguageModelV3;
365
- /**
366
- * Returns available providers and models for use with the remote provider.
367
- */
368
- getAvailableModels(): Promise<GatewayFetchMetadataResponse>;
369
- /**
370
- * Returns credit information for the authenticated user.
371
- */
372
- getCredits(): Promise<GatewayCreditsResponse>;
373
- /**
374
- * Creates a model for generating text embeddings.
375
- */
376
- embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
377
- /**
378
- * Creates a model for generating text embeddings.
379
- */
380
- embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
381
- /**
382
- * @deprecated Use `embeddingModel` instead.
383
- */
384
- textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
385
- /**
386
- * Creates a model for generating images.
387
- */
388
- image(modelId: GatewayImageModelId): ImageModelV3;
389
- /**
390
- * Creates a model for generating images.
391
- */
392
- imageModel(modelId: GatewayImageModelId): ImageModelV3;
393
- /**
394
- * Creates a model for generating videos.
395
- */
396
- video(modelId: GatewayVideoModelId): Experimental_VideoModelV3;
397
- /**
398
- * Creates a model for generating videos.
399
- */
400
- videoModel(modelId: GatewayVideoModelId): Experimental_VideoModelV3;
401
- /**
402
- * Gateway-specific tools executed server-side.
403
- */
404
- tools: typeof gatewayTools;
405
- }
406
- interface GatewayProviderSettings {
407
- /**
408
- * The base URL prefix for API calls. Defaults to `https://ai-gateway.vercel.sh/v1/ai`.
409
- */
410
- baseURL?: string;
411
- /**
412
- * API key that is being sent using the `Authorization` header.
413
- */
414
- apiKey?: string;
415
- /**
416
- * Custom headers to include in the requests.
417
- */
418
- headers?: Record<string, string>;
419
- /**
420
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
421
- * or to provide a custom fetch implementation for e.g. testing.
422
- */
423
- fetch?: FetchFunction;
424
- /**
425
- * How frequently to refresh the metadata cache in milliseconds.
426
- */
427
- metadataCacheRefreshMillis?: number;
428
- }
429
- /**
430
- * Create a remote provider instance.
431
- */
432
- declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
433
- declare const gateway: GatewayProvider;
434
-
435
- declare const gatewayLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
436
- only?: string[] | undefined;
437
- order?: string[] | undefined;
438
- user?: string | undefined;
439
- tags?: string[] | undefined;
440
- models?: string[] | undefined;
441
- byok?: Record<string, Record<string, unknown>[]> | undefined;
442
- zeroDataRetention?: boolean | undefined;
443
- providerTimeouts?: {
444
- byok?: Record<string, number> | undefined;
445
- } | undefined;
446
- }>;
447
- type GatewayLanguageModelOptions = InferSchema<typeof gatewayLanguageModelOptions>;
448
-
449
- declare const symbol$6: unique symbol;
450
- declare abstract class GatewayError extends Error {
451
- private readonly [symbol$6];
452
- abstract readonly name: string;
453
- abstract readonly type: string;
454
- readonly statusCode: number;
455
- readonly cause?: unknown;
456
- readonly generationId?: string;
457
- constructor({ message, statusCode, cause, generationId, }: {
458
- message: string;
459
- statusCode?: number;
460
- cause?: unknown;
461
- generationId?: string;
462
- });
463
- /**
464
- * Checks if the given error is a Gateway Error.
465
- * @param {unknown} error - The error to check.
466
- * @returns {boolean} True if the error is a Gateway Error, false otherwise.
467
- */
468
- static isInstance(error: unknown): error is GatewayError;
469
- static hasMarker(error: unknown): error is GatewayError;
470
- }
471
-
472
- declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
473
- error: {
474
- message: string;
475
- type?: string | null | undefined;
476
- param?: unknown;
477
- code?: string | number | null | undefined;
478
- };
479
- generationId?: string | null | undefined;
480
- }>;
481
- type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
482
-
483
- declare const symbol$5: unique symbol;
484
- /**
485
- * Authentication failed - invalid API key or OIDC token
486
- */
487
- declare class GatewayAuthenticationError extends GatewayError {
488
- private readonly [symbol$5];
489
- readonly name = "GatewayAuthenticationError";
490
- readonly type = "authentication_error";
491
- constructor({ message, statusCode, cause, generationId, }?: {
492
- message?: string;
493
- statusCode?: number;
494
- cause?: unknown;
495
- generationId?: string;
496
- });
497
- static isInstance(error: unknown): error is GatewayAuthenticationError;
498
- /**
499
- * Creates a contextual error message when authentication fails
500
- */
501
- static createContextualError({ apiKeyProvided, oidcTokenProvided, message, statusCode, cause, generationId, }: {
502
- apiKeyProvided: boolean;
503
- oidcTokenProvided: boolean;
504
- message?: string;
505
- statusCode?: number;
506
- cause?: unknown;
507
- generationId?: string;
508
- }): GatewayAuthenticationError;
509
- }
510
-
511
- declare const symbol$4: unique symbol;
512
- /**
513
- * Internal server error from the Gateway
514
- */
515
- declare class GatewayInternalServerError extends GatewayError {
516
- private readonly [symbol$4];
517
- readonly name = "GatewayInternalServerError";
518
- readonly type = "internal_server_error";
519
- constructor({ message, statusCode, cause, generationId, }?: {
520
- message?: string;
521
- statusCode?: number;
522
- cause?: unknown;
523
- generationId?: string;
524
- });
525
- static isInstance(error: unknown): error is GatewayInternalServerError;
526
- }
527
-
528
- declare const symbol$3: unique symbol;
529
- /**
530
- * Invalid request - missing headers, malformed data, etc.
531
- */
532
- declare class GatewayInvalidRequestError extends GatewayError {
533
- private readonly [symbol$3];
534
- readonly name = "GatewayInvalidRequestError";
535
- readonly type = "invalid_request_error";
536
- constructor({ message, statusCode, cause, generationId, }?: {
537
- message?: string;
538
- statusCode?: number;
539
- cause?: unknown;
540
- generationId?: string;
541
- });
542
- static isInstance(error: unknown): error is GatewayInvalidRequestError;
543
- }
544
-
545
- declare const symbol$2: unique symbol;
546
- /**
547
- * Model not found or not available
548
- */
549
- declare class GatewayModelNotFoundError extends GatewayError {
550
- private readonly [symbol$2];
551
- readonly name = "GatewayModelNotFoundError";
552
- readonly type = "model_not_found";
553
- readonly modelId?: string;
554
- constructor({ message, statusCode, modelId, cause, generationId, }?: {
555
- message?: string;
556
- statusCode?: number;
557
- modelId?: string;
558
- cause?: unknown;
559
- generationId?: string;
560
- });
561
- static isInstance(error: unknown): error is GatewayModelNotFoundError;
562
- }
563
-
564
- declare const symbol$1: unique symbol;
565
- /**
566
- * Rate limit exceeded.
567
- */
568
- declare class GatewayRateLimitError extends GatewayError {
569
- private readonly [symbol$1];
570
- readonly name = "GatewayRateLimitError";
571
- readonly type = "rate_limit_exceeded";
572
- constructor({ message, statusCode, cause, generationId, }?: {
573
- message?: string;
574
- statusCode?: number;
575
- cause?: unknown;
576
- generationId?: string;
577
- });
578
- static isInstance(error: unknown): error is GatewayRateLimitError;
579
- }
580
-
581
- declare const symbol: unique symbol;
582
- /**
583
- * Gateway response parsing error
584
- */
585
- declare class GatewayResponseError extends GatewayError {
586
- private readonly [symbol];
587
- readonly name = "GatewayResponseError";
588
- readonly type = "response_error";
589
- readonly response?: unknown;
590
- readonly validationError?: TypeValidationError;
591
- constructor({ message, statusCode, response, validationError, cause, generationId, }?: {
592
- message?: string;
593
- statusCode?: number;
594
- response?: unknown;
595
- validationError?: TypeValidationError;
596
- cause?: unknown;
597
- generationId?: string;
598
- });
599
- static isInstance(error: unknown): error is GatewayResponseError;
600
- }
601
-
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 GatewayLanguageModelOptions as GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, GatewayResponseError, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };