@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.
@@ -5,7 +5,7 @@ export type GatewayEmbeddingModelId =
5
5
  | 'amazon/titan-embed-text-v2'
6
6
  | 'cohere/embed-v4.0'
7
7
  | 'google/gemini-embedding-001'
8
- | 'google/gemini-embedding-2-preview'
8
+ | 'google/gemini-embedding-2'
9
9
  | 'google/text-embedding-005'
10
10
  | 'google/text-multilingual-embedding-002'
11
11
  | 'mistral/codestral-embed'
@@ -1,6 +1,6 @@
1
1
  import type {
2
- EmbeddingModelV3,
3
- SharedV3ProviderMetadata,
2
+ EmbeddingModelV4,
3
+ SharedV4ProviderMetadata,
4
4
  } from '@ai-sdk/provider';
5
5
  import {
6
6
  combineHeaders,
@@ -9,6 +9,9 @@ import {
9
9
  lazySchema,
10
10
  postJsonToApi,
11
11
  resolve,
12
+ serializeModelOptions,
13
+ WORKFLOW_SERIALIZE,
14
+ WORKFLOW_DESERIALIZE,
12
15
  zodSchema,
13
16
  type Resolvable,
14
17
  } from '@ai-sdk/provider-utils';
@@ -17,17 +20,33 @@ import { asGatewayError } from './errors';
17
20
  import { parseAuthMethod } from './errors/parse-auth-method';
18
21
  import type { GatewayConfig } from './gateway-config';
19
22
 
20
- export class GatewayEmbeddingModel implements EmbeddingModelV3 {
21
- readonly specificationVersion = 'v3';
23
+ type GatewayEmbeddingConfig = GatewayConfig & {
24
+ provider: string;
25
+ o11yHeaders: Resolvable<Record<string, string>>;
26
+ };
27
+
28
+ export class GatewayEmbeddingModel implements EmbeddingModelV4 {
29
+ readonly specificationVersion = 'v4';
22
30
  readonly maxEmbeddingsPerCall = 2048;
23
31
  readonly supportsParallelCalls = true;
24
32
 
33
+ static [WORKFLOW_SERIALIZE](model: GatewayEmbeddingModel) {
34
+ return serializeModelOptions({
35
+ modelId: model.modelId,
36
+ config: model.config,
37
+ });
38
+ }
39
+
40
+ static [WORKFLOW_DESERIALIZE](options: {
41
+ modelId: string;
42
+ config: GatewayEmbeddingConfig;
43
+ }) {
44
+ return new GatewayEmbeddingModel(options.modelId, options.config);
45
+ }
46
+
25
47
  constructor(
26
48
  readonly modelId: string,
27
- private readonly config: GatewayConfig & {
28
- provider: string;
29
- o11yHeaders: Resolvable<Record<string, string>>;
30
- },
49
+ private readonly config: GatewayEmbeddingConfig,
31
50
  ) {}
32
51
 
33
52
  get provider(): string {
@@ -39,10 +58,12 @@ export class GatewayEmbeddingModel implements EmbeddingModelV3 {
39
58
  headers,
40
59
  abortSignal,
41
60
  providerOptions,
42
- }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<
43
- Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>
61
+ }: Parameters<EmbeddingModelV4['doEmbed']>[0]): Promise<
62
+ Awaited<ReturnType<EmbeddingModelV4['doEmbed']>>
44
63
  > {
45
- const resolvedHeaders = await resolve(this.config.headers());
64
+ const resolvedHeaders = this.config.headers
65
+ ? await resolve(this.config.headers)
66
+ : undefined;
46
67
  try {
47
68
  const {
48
69
  responseHeaders,
@@ -75,12 +96,15 @@ export class GatewayEmbeddingModel implements EmbeddingModelV3 {
75
96
  embeddings: responseBody.embeddings,
76
97
  usage: responseBody.usage ?? undefined,
77
98
  providerMetadata:
78
- responseBody.providerMetadata as unknown as SharedV3ProviderMetadata,
99
+ responseBody.providerMetadata as unknown as SharedV4ProviderMetadata,
79
100
  response: { headers: responseHeaders, body: rawValue },
80
101
  warnings: [],
81
102
  };
82
103
  } catch (error) {
83
- throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
104
+ throw await asGatewayError(
105
+ error,
106
+ await parseAuthMethod(resolvedHeaders ?? {}),
107
+ );
84
108
  }
85
109
  }
86
110
 
@@ -90,7 +114,7 @@ export class GatewayEmbeddingModel implements EmbeddingModelV3 {
90
114
 
91
115
  private getModelConfigHeaders() {
92
116
  return {
93
- 'ai-embedding-model-specification-version': '3',
117
+ 'ai-embedding-model-specification-version': '4',
94
118
  'ai-model-id': this.modelId,
95
119
  };
96
120
  }
@@ -9,7 +9,11 @@ import {
9
9
  import { z } from 'zod/v4';
10
10
  import { asGatewayError } from './errors';
11
11
  import type { GatewayConfig } from './gateway-config';
12
- import type { GatewayLanguageModelEntry } from './gateway-model-entry';
12
+ import {
13
+ KNOWN_MODEL_TYPES,
14
+ type GatewayLanguageModelEntry,
15
+ type KnownModelType,
16
+ } from './gateway-model-entry';
13
17
 
14
18
  type GatewayFetchMetadataConfig = GatewayConfig;
15
19
 
@@ -31,7 +35,9 @@ export class GatewayFetchMetadata {
31
35
  try {
32
36
  const { value } = await getFromApi({
33
37
  url: `${this.config.baseURL}/config`,
34
- headers: await resolve(this.config.headers()),
38
+ headers: this.config.headers
39
+ ? await resolve(this.config.headers)
40
+ : undefined,
35
41
  successfulResponseHandler: createJsonResponseHandler(
36
42
  gatewayAvailableModelsResponseSchema,
37
43
  ),
@@ -54,7 +60,9 @@ export class GatewayFetchMetadata {
54
60
 
55
61
  const { value } = await getFromApi({
56
62
  url: `${baseUrl.origin}/v1/credits`,
57
- headers: await resolve(this.config.headers()),
63
+ headers: this.config.headers
64
+ ? await resolve(this.config.headers)
65
+ : undefined,
58
66
  successfulResponseHandler: createJsonResponseHandler(
59
67
  gatewayCreditsResponseSchema,
60
68
  ),
@@ -75,41 +83,47 @@ export class GatewayFetchMetadata {
75
83
  const gatewayAvailableModelsResponseSchema = lazySchema(() =>
76
84
  zodSchema(
77
85
  z.object({
78
- models: z.array(
79
- z.object({
80
- id: z.string(),
81
- name: z.string(),
82
- description: z.string().nullish(),
83
- pricing: z
84
- .object({
85
- input: z.string(),
86
- output: z.string(),
87
- input_cache_read: z.string().nullish(),
88
- input_cache_write: z.string().nullish(),
89
- })
90
- .transform(
91
- ({ input, output, input_cache_read, input_cache_write }) => ({
92
- input,
93
- output,
94
- ...(input_cache_read
95
- ? { cachedInputTokens: input_cache_read }
96
- : {}),
97
- ...(input_cache_write
98
- ? { cacheCreationInputTokens: input_cache_write }
99
- : {}),
100
- }),
101
- )
102
- .nullish(),
103
- specification: z.object({
104
- specificationVersion: z.literal('v3'),
105
- provider: z.string(),
106
- modelId: z.string(),
86
+ models: z
87
+ .array(
88
+ z.object({
89
+ id: z.string(),
90
+ name: z.string(),
91
+ description: z.string().nullish(),
92
+ pricing: z
93
+ .object({
94
+ input: z.string(),
95
+ output: z.string(),
96
+ input_cache_read: z.string().nullish(),
97
+ input_cache_write: z.string().nullish(),
98
+ })
99
+ .transform(
100
+ ({ input, output, input_cache_read, input_cache_write }) => ({
101
+ input,
102
+ output,
103
+ ...(input_cache_read
104
+ ? { cachedInputTokens: input_cache_read }
105
+ : {}),
106
+ ...(input_cache_write
107
+ ? { cacheCreationInputTokens: input_cache_write }
108
+ : {}),
109
+ }),
110
+ )
111
+ .nullish(),
112
+ specification: z.object({
113
+ specificationVersion: z.literal('v4'),
114
+ provider: z.string(),
115
+ modelId: z.string(),
116
+ }),
117
+ modelType: z.string().nullish(),
107
118
  }),
108
- modelType: z
109
- .enum(['embedding', 'image', 'language', 'video'])
110
- .nullish(),
111
- }),
112
- ),
119
+ )
120
+ .transform(models =>
121
+ models.filter(
122
+ (m): m is typeof m & { modelType?: KnownModelType | null } =>
123
+ m.modelType == null ||
124
+ KNOWN_MODEL_TYPES.includes(m.modelType as KnownModelType),
125
+ ),
126
+ ),
113
127
  }),
114
128
  ),
115
129
  );
@@ -0,0 +1,149 @@
1
+ import {
2
+ createJsonErrorResponseHandler,
3
+ createJsonResponseHandler,
4
+ getFromApi,
5
+ lazySchema,
6
+ resolve,
7
+ zodSchema,
8
+ } from '@ai-sdk/provider-utils';
9
+ import { z } from 'zod/v4';
10
+ import { asGatewayError } from './errors';
11
+ import type { GatewayConfig } from './gateway-config';
12
+
13
+ export interface GatewayGenerationInfoParams {
14
+ /** The generation ID to look up (format: gen_<ulid>) */
15
+ id: string;
16
+ }
17
+
18
+ export interface GatewayGenerationInfo {
19
+ /** The generation ID */
20
+ id: string;
21
+ /** Total cost in USD */
22
+ totalCost: number;
23
+ /** Upstream inference cost in USD (BYOK only) */
24
+ upstreamInferenceCost: number;
25
+ /** Usage cost in USD (same as totalCost) */
26
+ usage: number;
27
+ /** ISO 8601 timestamp when the generation was created */
28
+ createdAt: string;
29
+ /** Model identifier */
30
+ model: string;
31
+ /** Whether BYOK credentials were used */
32
+ isByok: boolean;
33
+ /** Provider that served this generation */
34
+ providerName: string;
35
+ /** Whether streaming was used */
36
+ streamed: boolean;
37
+ /** Finish reason (e.g. 'stop') */
38
+ finishReason: string;
39
+ /** Time to first token in milliseconds */
40
+ latency: number;
41
+ /** Total generation time in milliseconds */
42
+ generationTime: number;
43
+ /** Number of prompt tokens */
44
+ promptTokens: number;
45
+ /** Number of completion tokens */
46
+ completionTokens: number;
47
+ /** Reasoning tokens used */
48
+ reasoningTokens: number;
49
+ /** Cached tokens used */
50
+ cachedTokens: number;
51
+ /** Cache creation input tokens */
52
+ cacheCreationTokens: number;
53
+ /** Billable web search calls */
54
+ billableWebSearchCalls: number;
55
+ }
56
+
57
+ export class GatewayGenerationInfoFetcher {
58
+ constructor(private readonly config: GatewayConfig) {}
59
+
60
+ async getGenerationInfo(
61
+ params: GatewayGenerationInfoParams,
62
+ ): Promise<GatewayGenerationInfo> {
63
+ try {
64
+ const baseUrl = new URL(this.config.baseURL);
65
+
66
+ const { value } = await getFromApi({
67
+ url: `${baseUrl.origin}/v1/generation?id=${encodeURIComponent(params.id)}`,
68
+ headers: this.config.headers
69
+ ? await resolve(this.config.headers)
70
+ : undefined,
71
+ successfulResponseHandler: createJsonResponseHandler(
72
+ gatewayGenerationInfoResponseSchema,
73
+ ),
74
+ failedResponseHandler: createJsonErrorResponseHandler({
75
+ errorSchema: z.any(),
76
+ errorToMessage: data => data,
77
+ }),
78
+ fetch: this.config.fetch,
79
+ });
80
+
81
+ return value;
82
+ } catch (error) {
83
+ throw await asGatewayError(error);
84
+ }
85
+ }
86
+ }
87
+
88
+ const gatewayGenerationInfoResponseSchema = lazySchema(() =>
89
+ zodSchema(
90
+ z
91
+ .object({
92
+ data: z
93
+ .object({
94
+ id: z.string(),
95
+ total_cost: z.number(),
96
+ upstream_inference_cost: z.number(),
97
+ usage: z.number(),
98
+ created_at: z.string(),
99
+ model: z.string(),
100
+ is_byok: z.boolean(),
101
+ provider_name: z.string(),
102
+ streamed: z.boolean(),
103
+ finish_reason: z.string(),
104
+ latency: z.number(),
105
+ generation_time: z.number(),
106
+ native_tokens_prompt: z.number(),
107
+ native_tokens_completion: z.number(),
108
+ native_tokens_reasoning: z.number(),
109
+ native_tokens_cached: z.number(),
110
+ native_tokens_cache_creation: z.number(),
111
+ billable_web_search_calls: z.number(),
112
+ })
113
+ .transform(
114
+ ({
115
+ total_cost,
116
+ upstream_inference_cost,
117
+ created_at,
118
+ is_byok,
119
+ provider_name,
120
+ finish_reason,
121
+ generation_time,
122
+ native_tokens_prompt,
123
+ native_tokens_completion,
124
+ native_tokens_reasoning,
125
+ native_tokens_cached,
126
+ native_tokens_cache_creation,
127
+ billable_web_search_calls,
128
+ ...rest
129
+ }) => ({
130
+ ...rest,
131
+ totalCost: total_cost,
132
+ upstreamInferenceCost: upstream_inference_cost,
133
+ createdAt: created_at,
134
+ isByok: is_byok,
135
+ providerName: provider_name,
136
+ finishReason: finish_reason,
137
+ generationTime: generation_time,
138
+ promptTokens: native_tokens_prompt,
139
+ completionTokens: native_tokens_completion,
140
+ reasoningTokens: native_tokens_reasoning,
141
+ cachedTokens: native_tokens_cached,
142
+ cacheCreationTokens: native_tokens_cache_creation,
143
+ billableWebSearchCalls: billable_web_search_calls,
144
+ }),
145
+ ),
146
+ })
147
+ .transform(({ data }) => data),
148
+ ),
149
+ );
@@ -1,15 +1,24 @@
1
1
  export type GatewayImageModelId =
2
+ | 'bfl/flux-2-flex'
3
+ | 'bfl/flux-2-klein-4b'
4
+ | 'bfl/flux-2-klein-9b'
5
+ | 'bfl/flux-2-max'
6
+ | 'bfl/flux-2-pro'
2
7
  | 'bfl/flux-kontext-max'
3
8
  | 'bfl/flux-kontext-pro'
4
9
  | 'bfl/flux-pro-1.0-fill'
5
10
  | 'bfl/flux-pro-1.1'
6
11
  | 'bfl/flux-pro-1.1-ultra'
12
+ | 'bytedance/seedream-4.0'
13
+ | 'bytedance/seedream-4.5'
14
+ | 'bytedance/seedream-5.0-lite'
7
15
  | 'google/imagen-4.0-fast-generate-001'
8
16
  | 'google/imagen-4.0-generate-001'
9
17
  | 'google/imagen-4.0-ultra-generate-001'
10
18
  | 'openai/gpt-image-1'
11
19
  | 'openai/gpt-image-1-mini'
12
20
  | 'openai/gpt-image-1.5'
21
+ | 'prodia/flux-fast-schnell'
13
22
  | 'recraft/recraft-v2'
14
23
  | 'recraft/recraft-v3'
15
24
  | 'recraft/recraft-v4'
@@ -1,7 +1,7 @@
1
1
  import type {
2
- ImageModelV3,
3
- ImageModelV3File,
4
- ImageModelV3ProviderMetadata,
2
+ ImageModelV4,
3
+ ImageModelV4File,
4
+ ImageModelV4ProviderMetadata,
5
5
  } from '@ai-sdk/provider';
6
6
  import {
7
7
  combineHeaders,
@@ -10,6 +10,9 @@ import {
10
10
  createJsonErrorResponseHandler,
11
11
  postJsonToApi,
12
12
  resolve,
13
+ serializeModelOptions,
14
+ WORKFLOW_SERIALIZE,
15
+ WORKFLOW_DESERIALIZE,
13
16
  type Resolvable,
14
17
  } from '@ai-sdk/provider-utils';
15
18
  import { z } from 'zod/v4';
@@ -17,17 +20,33 @@ import type { GatewayConfig } from './gateway-config';
17
20
  import { asGatewayError } from './errors';
18
21
  import { parseAuthMethod } from './errors/parse-auth-method';
19
22
 
20
- export class GatewayImageModel implements ImageModelV3 {
21
- readonly specificationVersion = 'v3' as const;
23
+ type GatewayImageConfig = GatewayConfig & {
24
+ provider: string;
25
+ o11yHeaders: Resolvable<Record<string, string>>;
26
+ };
27
+
28
+ export class GatewayImageModel implements ImageModelV4 {
29
+ readonly specificationVersion = 'v4' as const;
22
30
  // Set a very large number to prevent client-side splitting of requests
23
31
  readonly maxImagesPerCall = Number.MAX_SAFE_INTEGER;
24
32
 
33
+ static [WORKFLOW_SERIALIZE](model: GatewayImageModel) {
34
+ return serializeModelOptions({
35
+ modelId: model.modelId,
36
+ config: model.config,
37
+ });
38
+ }
39
+
40
+ static [WORKFLOW_DESERIALIZE](options: {
41
+ modelId: string;
42
+ config: GatewayImageConfig;
43
+ }) {
44
+ return new GatewayImageModel(options.modelId, options.config);
45
+ }
46
+
25
47
  constructor(
26
48
  readonly modelId: string,
27
- private readonly config: GatewayConfig & {
28
- provider: string;
29
- o11yHeaders: Resolvable<Record<string, string>>;
30
- },
49
+ private readonly config: GatewayImageConfig,
31
50
  ) {}
32
51
 
33
52
  get provider(): string {
@@ -45,16 +64,14 @@ export class GatewayImageModel implements ImageModelV3 {
45
64
  providerOptions,
46
65
  headers,
47
66
  abortSignal,
48
- }: Parameters<ImageModelV3['doGenerate']>[0]): Promise<
49
- Awaited<ReturnType<ImageModelV3['doGenerate']>>
67
+ }: Parameters<ImageModelV4['doGenerate']>[0]): Promise<
68
+ Awaited<ReturnType<ImageModelV4['doGenerate']>>
50
69
  > {
51
- const resolvedHeaders = await resolve(this.config.headers());
70
+ const resolvedHeaders = this.config.headers
71
+ ? await resolve(this.config.headers)
72
+ : undefined;
52
73
  try {
53
- const {
54
- responseHeaders,
55
- value: responseBody,
56
- rawValue,
57
- } = await postJsonToApi({
74
+ const { responseHeaders, value: responseBody } = await postJsonToApi({
58
75
  url: this.getUrl(),
59
76
  headers: combineHeaders(
60
77
  resolvedHeaders,
@@ -89,7 +106,7 @@ export class GatewayImageModel implements ImageModelV3 {
89
106
  images: responseBody.images, // Always base64 strings from server
90
107
  warnings: responseBody.warnings ?? [],
91
108
  providerMetadata:
92
- responseBody.providerMetadata as ImageModelV3ProviderMetadata,
109
+ responseBody.providerMetadata as ImageModelV4ProviderMetadata,
93
110
  response: {
94
111
  timestamp: new Date(),
95
112
  modelId: this.modelId,
@@ -104,7 +121,10 @@ export class GatewayImageModel implements ImageModelV3 {
104
121
  }),
105
122
  };
106
123
  } catch (error) {
107
- throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
124
+ throw await asGatewayError(
125
+ error,
126
+ await parseAuthMethod(resolvedHeaders ?? {}),
127
+ );
108
128
  }
109
129
  }
110
130
 
@@ -114,13 +134,13 @@ export class GatewayImageModel implements ImageModelV3 {
114
134
 
115
135
  private getModelConfigHeaders() {
116
136
  return {
117
- 'ai-image-model-specification-version': '3',
137
+ 'ai-image-model-specification-version': '4',
118
138
  'ai-model-id': this.modelId,
119
139
  };
120
140
  }
121
141
  }
122
142
 
123
- function maybeEncodeImageFile(file: ImageModelV3File) {
143
+ function maybeEncodeImageFile(file: ImageModelV4File) {
124
144
  if (file.type === 'file' && file.data instanceof Uint8Array) {
125
145
  return {
126
146
  ...file,
@@ -17,25 +17,25 @@ export type GatewayModelId =
17
17
  | 'alibaba/qwen3-vl-thinking'
18
18
  | 'alibaba/qwen3.5-flash'
19
19
  | 'alibaba/qwen3.5-plus'
20
+ | 'alibaba/qwen3.6-plus'
20
21
  | 'amazon/nova-2-lite'
21
22
  | 'amazon/nova-lite'
22
23
  | 'amazon/nova-micro'
23
24
  | 'amazon/nova-pro'
24
25
  | 'anthropic/claude-3-haiku'
25
- | 'anthropic/claude-3-opus'
26
26
  | 'anthropic/claude-3.5-haiku'
27
- | 'anthropic/claude-3.5-sonnet'
28
- | 'anthropic/claude-3.5-sonnet-20240620'
29
27
  | 'anthropic/claude-3.7-sonnet'
30
28
  | 'anthropic/claude-haiku-4.5'
31
29
  | 'anthropic/claude-opus-4'
32
30
  | 'anthropic/claude-opus-4.1'
33
31
  | 'anthropic/claude-opus-4.5'
34
32
  | 'anthropic/claude-opus-4.6'
33
+ | 'anthropic/claude-opus-4.7'
35
34
  | 'anthropic/claude-sonnet-4'
36
35
  | 'anthropic/claude-sonnet-4.5'
37
36
  | 'anthropic/claude-sonnet-4.6'
38
37
  | 'arcee-ai/trinity-large-preview'
38
+ | 'arcee-ai/trinity-large-thinking'
39
39
  | 'arcee-ai/trinity-mini'
40
40
  | 'bytedance/seed-1.6'
41
41
  | 'bytedance/seed-1.8'
@@ -51,8 +51,6 @@ export type GatewayModelId =
51
51
  | 'google/gemini-2.5-flash'
52
52
  | 'google/gemini-2.5-flash-image'
53
53
  | 'google/gemini-2.5-flash-lite'
54
- | 'google/gemini-2.5-flash-lite-preview-09-2025'
55
- | 'google/gemini-2.5-flash-preview-09-2025'
56
54
  | 'google/gemini-2.5-pro'
57
55
  | 'google/gemini-3-flash'
58
56
  | 'google/gemini-3-pro-image'
@@ -60,11 +58,14 @@ export type GatewayModelId =
60
58
  | 'google/gemini-3.1-flash-image-preview'
61
59
  | 'google/gemini-3.1-flash-lite-preview'
62
60
  | 'google/gemini-3.1-pro-preview'
61
+ | 'google/gemma-4-26b-a4b-it'
62
+ | 'google/gemma-4-31b-it'
63
63
  | 'inception/mercury-2'
64
64
  | 'inception/mercury-coder-small'
65
65
  | 'kwaipilot/kat-coder-pro-v1'
66
+ | 'kwaipilot/kat-coder-pro-v2'
66
67
  | 'meituan/longcat-flash-chat'
67
- | 'meituan/longcat-flash-thinking'
68
+ | 'meituan/longcat-flash-thinking-2601'
68
69
  | 'meta/llama-3.1-70b'
69
70
  | 'meta/llama-3.1-8b'
70
71
  | 'meta/llama-3.2-11b'
@@ -79,6 +80,8 @@ export type GatewayModelId =
79
80
  | 'minimax/minimax-m2.1-lightning'
80
81
  | 'minimax/minimax-m2.5'
81
82
  | 'minimax/minimax-m2.5-highspeed'
83
+ | 'minimax/minimax-m2.7'
84
+ | 'minimax/minimax-m2.7-highspeed'
82
85
  | 'mistral/codestral'
83
86
  | 'mistral/devstral-2'
84
87
  | 'mistral/devstral-small'
@@ -104,9 +107,9 @@ export type GatewayModelId =
104
107
  | 'morph/morph-v3-fast'
105
108
  | 'morph/morph-v3-large'
106
109
  | 'nvidia/nemotron-3-nano-30b-a3b'
110
+ | 'nvidia/nemotron-3-super-120b-a12b'
107
111
  | 'nvidia/nemotron-nano-12b-v2-vl'
108
112
  | 'nvidia/nemotron-nano-9b-v2'
109
- | 'openai/codex-mini'
110
113
  | 'openai/gpt-3.5-turbo'
111
114
  | 'openai/gpt-3.5-turbo-instruct'
112
115
  | 'openai/gpt-4-turbo'
@@ -134,6 +137,8 @@ export type GatewayModelId =
134
137
  | 'openai/gpt-5.3-chat'
135
138
  | 'openai/gpt-5.3-codex'
136
139
  | 'openai/gpt-5.4'
140
+ | 'openai/gpt-5.4-mini'
141
+ | 'openai/gpt-5.4-nano'
137
142
  | 'openai/gpt-5.4-pro'
138
143
  | 'openai/gpt-oss-120b'
139
144
  | 'openai/gpt-oss-20b'
@@ -146,11 +151,8 @@ export type GatewayModelId =
146
151
  | 'openai/o4-mini'
147
152
  | 'perplexity/sonar'
148
153
  | 'perplexity/sonar-pro'
149
- | 'perplexity/sonar-reasoning'
150
154
  | 'perplexity/sonar-reasoning-pro'
151
155
  | 'prime-intellect/intellect-3'
152
- | 'vercel/v0-1.0-md'
153
- | 'vercel/v0-1.5-md'
154
156
  | 'xai/grok-3'
155
157
  | 'xai/grok-3-fast'
156
158
  | 'xai/grok-3-mini'
@@ -160,8 +162,15 @@ export type GatewayModelId =
160
162
  | 'xai/grok-4-fast-reasoning'
161
163
  | 'xai/grok-4.1-fast-non-reasoning'
162
164
  | 'xai/grok-4.1-fast-reasoning'
165
+ | 'xai/grok-4.20-multi-agent'
166
+ | 'xai/grok-4.20-multi-agent-beta'
167
+ | 'xai/grok-4.20-non-reasoning'
168
+ | 'xai/grok-4.20-non-reasoning-beta'
169
+ | 'xai/grok-4.20-reasoning'
170
+ | 'xai/grok-4.20-reasoning-beta'
163
171
  | 'xai/grok-code-fast-1'
164
172
  | 'xiaomi/mimo-v2-flash'
173
+ | 'xiaomi/mimo-v2-pro'
165
174
  | 'zai/glm-4.5'
166
175
  | 'zai/glm-4.5-air'
167
176
  | 'zai/glm-4.5v'
@@ -172,4 +181,7 @@ export type GatewayModelId =
172
181
  | 'zai/glm-4.7-flash'
173
182
  | 'zai/glm-4.7-flashx'
174
183
  | 'zai/glm-5'
184
+ | 'zai/glm-5-turbo'
185
+ | 'zai/glm-5.1'
186
+ | 'zai/glm-5v-turbo'
175
187
  | (string & {});