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

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.ts CHANGED
@@ -1,11 +1,15 @@
1
- import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, TypeValidationError } from '@ai-sdk/provider';
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-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 & {});
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.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-opus-4.7' | '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-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
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 & {});
7
+ type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
8
8
 
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-2.0' | 'bytedance/seedance-2.0-fast' | '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 & {});
10
+
11
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
12
+ type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
9
13
  interface GatewayLanguageModelEntry {
10
14
  /**
11
15
  * The model id used by the remote provider in model settings and for specifying the
@@ -50,9 +54,9 @@ interface GatewayLanguageModelEntry {
50
54
  /**
51
55
  * Optional field to differentiate between model types.
52
56
  */
53
- modelType?: 'language' | 'embedding' | 'image' | 'video' | null;
57
+ modelType?: KnownModelType | null;
54
58
  }
55
- type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
59
+ type GatewayLanguageModelSpecification = Pick<LanguageModelV4, 'specificationVersion' | 'provider' | 'modelId'>;
56
60
 
57
61
  interface GatewayFetchMetadataResponse {
58
62
  models: GatewayLanguageModelEntry[];
@@ -64,9 +68,108 @@ interface GatewayCreditsResponse {
64
68
  totalUsed: string;
65
69
  }
66
70
 
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 & {});
71
+ interface GatewaySpendReportParams {
72
+ /** Start date in YYYY-MM-DD format (inclusive) */
73
+ startDate: string;
74
+ /** End date in YYYY-MM-DD format (inclusive) */
75
+ endDate: string;
76
+ /** Primary aggregation dimension. Defaults to 'day'. */
77
+ groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
78
+ /** Time granularity when groupBy is 'day'. */
79
+ datePart?: 'day' | 'hour';
80
+ /** Filter to a specific user's spend. */
81
+ userId?: string;
82
+ /** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
83
+ model?: string;
84
+ /** Filter to a specific provider (e.g. 'anthropic'). */
85
+ provider?: string;
86
+ /** Filter to BYOK or system credentials. */
87
+ credentialType?: 'byok' | 'system';
88
+ /** Filter to requests with these tags. */
89
+ tags?: string[];
90
+ }
91
+ interface GatewaySpendReportRow {
92
+ /** Date string (present when groupBy is 'day') */
93
+ day?: string;
94
+ /** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
95
+ hour?: string;
96
+ /** User identifier (present when groupBy is 'user') */
97
+ user?: string;
98
+ /** Model identifier (present when groupBy is 'model') */
99
+ model?: string;
100
+ /** Tag value (present when groupBy is 'tag') */
101
+ tag?: string;
102
+ /** Provider name (present when groupBy is 'provider') */
103
+ provider?: string;
104
+ /** Credential type (present when groupBy is 'credential_type') */
105
+ credentialType?: 'byok' | 'system';
106
+ /** Total cost in USD */
107
+ totalCost: number;
108
+ /** Market cost in USD */
109
+ marketCost?: number;
110
+ /** Number of input tokens */
111
+ inputTokens?: number;
112
+ /** Number of output tokens */
113
+ outputTokens?: number;
114
+ /** Number of cached input tokens */
115
+ cachedInputTokens?: number;
116
+ /** Number of cache creation input tokens */
117
+ cacheCreationInputTokens?: number;
118
+ /** Number of reasoning tokens */
119
+ reasoningTokens?: number;
120
+ /** Number of requests */
121
+ requestCount?: number;
122
+ }
123
+ interface GatewaySpendReportResponse {
124
+ results: GatewaySpendReportRow[];
125
+ }
126
+
127
+ interface GatewayGenerationInfoParams {
128
+ /** The generation ID to look up (format: gen_<ulid>) */
129
+ id: string;
130
+ }
131
+ interface GatewayGenerationInfo {
132
+ /** The generation ID */
133
+ id: string;
134
+ /** Total cost in USD */
135
+ totalCost: number;
136
+ /** Upstream inference cost in USD (BYOK only) */
137
+ upstreamInferenceCost: number;
138
+ /** Usage cost in USD (same as totalCost) */
139
+ usage: number;
140
+ /** ISO 8601 timestamp when the generation was created */
141
+ createdAt: string;
142
+ /** Model identifier */
143
+ model: string;
144
+ /** Whether BYOK credentials were used */
145
+ isByok: boolean;
146
+ /** Provider that served this generation */
147
+ providerName: string;
148
+ /** Whether streaming was used */
149
+ streamed: boolean;
150
+ /** Finish reason (e.g. 'stop') */
151
+ finishReason: string;
152
+ /** Time to first token in milliseconds */
153
+ latency: number;
154
+ /** Total generation time in milliseconds */
155
+ generationTime: number;
156
+ /** Number of prompt tokens */
157
+ promptTokens: number;
158
+ /** Number of completion tokens */
159
+ completionTokens: number;
160
+ /** Reasoning tokens used */
161
+ reasoningTokens: number;
162
+ /** Cached tokens used */
163
+ cachedTokens: number;
164
+ /** Cache creation input tokens */
165
+ cacheCreationTokens: number;
166
+ /** Billable web search calls */
167
+ billableWebSearchCalls: number;
168
+ }
169
+
170
+ 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
171
 
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 & {});
172
+ 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' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | '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
173
 
71
174
  interface PerplexitySearchConfig {
72
175
  /**
@@ -194,7 +297,7 @@ interface PerplexitySearchInput {
194
297
  search_recency_filter?: 'day' | 'week' | 'month' | 'year';
195
298
  }
196
299
  type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
197
- declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
300
+ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig, {}>;
198
301
 
199
302
  interface ParallelSearchSourcePolicy {
200
303
  /**
@@ -327,7 +430,7 @@ interface ParallelSearchInput {
327
430
  };
328
431
  }
329
432
  type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
330
- declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
433
+ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig, {}>;
331
434
 
332
435
  /**
333
436
  * Gateway-specific provider-defined tools.
@@ -352,16 +455,16 @@ declare const gatewayTools: {
352
455
  perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
353
456
  };
354
457
 
355
- interface GatewayProvider extends ProviderV3 {
356
- (modelId: GatewayModelId): LanguageModelV3;
458
+ interface GatewayProvider extends ProviderV4 {
459
+ (modelId: GatewayModelId): LanguageModelV4;
357
460
  /**
358
461
  * Creates a model for text generation.
359
462
  */
360
- chat(modelId: GatewayModelId): LanguageModelV3;
463
+ chat(modelId: GatewayModelId): LanguageModelV4;
361
464
  /**
362
465
  * Creates a model for text generation.
363
466
  */
364
- languageModel(modelId: GatewayModelId): LanguageModelV3;
467
+ languageModel(modelId: GatewayModelId): LanguageModelV4;
365
468
  /**
366
469
  * Returns available providers and models for use with the remote provider.
367
470
  */
@@ -370,34 +473,52 @@ interface GatewayProvider extends ProviderV3 {
370
473
  * Returns credit information for the authenticated user.
371
474
  */
372
475
  getCredits(): Promise<GatewayCreditsResponse>;
476
+ /**
477
+ * Returns a spend report with cost, token, and request count data,
478
+ * aggregated by the specified dimension.
479
+ */
480
+ getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
481
+ /**
482
+ * Returns detailed information about a specific generation by its ID,
483
+ * including cost, token usage, latency, and provider details.
484
+ */
485
+ getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
373
486
  /**
374
487
  * Creates a model for generating text embeddings.
375
488
  */
376
- embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
489
+ embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
377
490
  /**
378
491
  * Creates a model for generating text embeddings.
379
492
  */
380
- embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
493
+ embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
381
494
  /**
382
495
  * @deprecated Use `embeddingModel` instead.
383
496
  */
384
- textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
497
+ textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV4;
385
498
  /**
386
499
  * Creates a model for generating images.
387
500
  */
388
- image(modelId: GatewayImageModelId): ImageModelV3;
501
+ image(modelId: GatewayImageModelId): ImageModelV4;
389
502
  /**
390
503
  * Creates a model for generating images.
391
504
  */
392
- imageModel(modelId: GatewayImageModelId): ImageModelV3;
505
+ imageModel(modelId: GatewayImageModelId): ImageModelV4;
393
506
  /**
394
507
  * Creates a model for generating videos.
395
508
  */
396
- video(modelId: GatewayVideoModelId): Experimental_VideoModelV3;
509
+ video(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
397
510
  /**
398
511
  * Creates a model for generating videos.
399
512
  */
400
- videoModel(modelId: GatewayVideoModelId): Experimental_VideoModelV3;
513
+ videoModel(modelId: GatewayVideoModelId): Experimental_VideoModelV4;
514
+ /**
515
+ * Creates a model for reranking documents.
516
+ */
517
+ reranking(modelId: GatewayRerankingModelId): RerankingModelV4;
518
+ /**
519
+ * Creates a model for reranking documents.
520
+ */
521
+ rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV4;
401
522
  /**
402
523
  * Gateway-specific tools executed server-side.
403
524
  */
@@ -432,19 +553,23 @@ interface GatewayProviderSettings {
432
553
  declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
433
554
  declare const gateway: GatewayProvider;
434
555
 
435
- declare const gatewayLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
556
+ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
436
557
  only?: string[] | undefined;
437
558
  order?: string[] | undefined;
559
+ sort?: "cost" | "ttft" | "tps" | undefined;
438
560
  user?: string | undefined;
439
561
  tags?: string[] | undefined;
440
562
  models?: string[] | undefined;
441
563
  byok?: Record<string, Record<string, unknown>[]> | undefined;
442
564
  zeroDataRetention?: boolean | undefined;
565
+ disallowPromptTraining?: boolean | undefined;
566
+ hipaaCompliant?: boolean | undefined;
567
+ quotaEntityId?: string | undefined;
443
568
  providerTimeouts?: {
444
569
  byok?: Record<string, number> | undefined;
445
570
  } | undefined;
446
571
  }>;
447
- type GatewayLanguageModelOptions = InferSchema<typeof gatewayLanguageModelOptions>;
572
+ type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
448
573
 
449
574
  declare const symbol$6: unique symbol;
450
575
  declare abstract class GatewayError extends Error {
@@ -498,7 +623,7 @@ declare class GatewayAuthenticationError extends GatewayError {
498
623
  /**
499
624
  * Creates a contextual error message when authentication fails
500
625
  */
501
- static createContextualError({ apiKeyProvided, oidcTokenProvided, message, statusCode, cause, generationId, }: {
626
+ static createContextualError({ apiKeyProvided, oidcTokenProvided, statusCode, cause, generationId, }: {
502
627
  apiKeyProvided: boolean;
503
628
  oidcTokenProvided: boolean;
504
629
  message?: string;
@@ -599,4 +724,4 @@ declare class GatewayResponseError extends GatewayError {
599
724
  static isInstance(error: unknown): error is GatewayResponseError;
600
725
  }
601
726
 
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 };
727
+ 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 };