@hebo-ai/gateway 0.11.4 → 0.11.6

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.
Files changed (43) hide show
  1. package/README.md +8 -8
  2. package/dist/endpoints/chat-completions/converters.js +14 -8
  3. package/dist/endpoints/chat-completions/schema.d.ts +301 -281
  4. package/dist/endpoints/chat-completions/schema.js +40 -25
  5. package/dist/endpoints/conversations/handler.js +9 -2
  6. package/dist/endpoints/conversations/schema.d.ts +453 -453
  7. package/dist/endpoints/messages/converters.d.ts +2 -2
  8. package/dist/endpoints/messages/converters.js +12 -6
  9. package/dist/endpoints/messages/schema.d.ts +88 -70
  10. package/dist/endpoints/messages/schema.js +26 -13
  11. package/dist/endpoints/responses/converters.js +25 -19
  12. package/dist/endpoints/responses/otel.js +3 -1
  13. package/dist/endpoints/responses/schema.d.ts +543 -525
  14. package/dist/endpoints/responses/schema.js +49 -34
  15. package/dist/endpoints/shared/converters.d.ts +1 -1
  16. package/dist/endpoints/shared/converters.js +1 -1
  17. package/dist/endpoints/shared/schema.d.ts +2 -2
  18. package/dist/endpoints/shared/schema.js +1 -1
  19. package/dist/lifecycle.js +2 -0
  20. package/dist/models/alibaba/presets.d.ts +96 -27
  21. package/dist/models/alibaba/presets.js +27 -2
  22. package/dist/models/anthropic/middleware.js +11 -4
  23. package/dist/models/anthropic/presets.d.ts +96 -15
  24. package/dist/models/anthropic/presets.js +23 -2
  25. package/dist/models/deepseek/presets.d.ts +106 -3
  26. package/dist/models/deepseek/presets.js +19 -2
  27. package/dist/models/google/presets.d.ts +47 -23
  28. package/dist/models/google/presets.js +9 -2
  29. package/dist/models/minimax/presets.d.ts +49 -6
  30. package/dist/models/minimax/presets.js +24 -1
  31. package/dist/models/moonshot/presets.d.ts +49 -2
  32. package/dist/models/moonshot/presets.js +14 -2
  33. package/dist/models/types.d.ts +1 -1
  34. package/dist/models/types.js +12 -0
  35. package/dist/models/xai/presets.d.ts +81 -1
  36. package/dist/models/xai/presets.js +14 -1
  37. package/dist/models/zai/presets.d.ts +44 -2
  38. package/dist/models/zai/presets.js +10 -2
  39. package/dist/providers/bedrock/canonical.js +2 -0
  40. package/dist/providers/bedrock/middleware.js +7 -11
  41. package/dist/providers/xai/canonical.js +2 -0
  42. package/dist/providers/zai/canonical.js +1 -0
  43. package/package.json +57 -65
@@ -16,14 +16,14 @@ export const ResponsesInputTextSchema = z.object({
16
16
  const ResponsesInputImageURLSchema = z.object({
17
17
  type: z.literal("input_image"),
18
18
  image_url: z.string(),
19
- file_id: z.string().optional(),
20
- detail: ResponsesImageDetailSchema.optional(),
19
+ file_id: z.string().nullish(),
20
+ detail: ResponsesImageDetailSchema.nullish(),
21
21
  });
22
22
  const ResponsesInputImageIDSchema = z.object({
23
23
  type: z.literal("input_image"),
24
24
  file_id: z.string(),
25
- image_url: z.string().optional(),
26
- detail: ResponsesImageDetailSchema.optional(),
25
+ image_url: z.string().nullish(),
26
+ detail: ResponsesImageDetailSchema.nullish(),
27
27
  });
28
28
  export const ResponsesInputImageSchema = z.union([
29
29
  ResponsesInputImageURLSchema,
@@ -32,23 +32,23 @@ export const ResponsesInputImageSchema = z.union([
32
32
  const ResponsesInputFileDataSchema = z.object({
33
33
  type: z.literal("input_file"),
34
34
  file_data: z.string(),
35
- file_id: z.string().optional(),
36
- file_url: z.string().optional(),
37
- filename: z.string().optional(),
35
+ file_id: z.string().nullish(),
36
+ file_url: z.string().nullish(),
37
+ filename: z.string().nullish(),
38
38
  });
39
39
  const ResponsesInputFileIDSchema = z.object({
40
40
  type: z.literal("input_file"),
41
41
  file_id: z.string(),
42
- file_data: z.string().optional(),
43
- file_url: z.string().optional(),
44
- filename: z.string().optional(),
42
+ file_data: z.string().nullish(),
43
+ file_url: z.string().nullish(),
44
+ filename: z.string().nullish(),
45
45
  });
46
46
  const ResponsesInputFileURLSchema = z.object({
47
47
  type: z.literal("input_file"),
48
48
  file_url: z.string(),
49
- file_data: z.string().optional(),
50
- file_id: z.string().optional(),
51
- filename: z.string().optional(),
49
+ file_data: z.string().nullish(),
50
+ file_id: z.string().nullish(),
51
+ filename: z.string().nullish(),
52
52
  });
53
53
  export const ResponsesInputFileSchema = z.union([
54
54
  ResponsesInputFileDataSchema,
@@ -67,17 +67,17 @@ export const ResponsesInputContentSchema = z.union([
67
67
  export const ResponsesOutputTextSchema = z.object({
68
68
  type: z.literal("output_text"),
69
69
  text: z.string(),
70
- annotations: z.array(z.unknown()).optional(),
70
+ annotations: z.array(z.unknown()).nullish(),
71
71
  });
72
72
  // Message Items
73
73
  const ResponsesMessageItemBaseSchema = z.object({
74
74
  type: z.literal("message"),
75
- id: z.string().optional(),
76
- status: ResponsesItemStatusSchema.optional(),
75
+ id: z.string().nullish(),
76
+ status: ResponsesItemStatusSchema.nullish(),
77
77
  // Extension origin: Gemini
78
- extra_content: ResponsesProviderMetadataSchema.optional().meta({ extension: true }),
78
+ extra_content: ResponsesProviderMetadataSchema.nullish().meta({ extension: true }),
79
79
  // Extension origin: Anthropic/OpenRouter/Vercel
80
- cache_control: ResponsesCacheControlSchema.optional().meta({ extension: true }),
80
+ cache_control: ResponsesCacheControlSchema.nullish().meta({ extension: true }),
81
81
  });
82
82
  const ResponsesUserMessageSchema = ResponsesMessageItemBaseSchema.extend({
83
83
  role: z.literal("user"),
@@ -106,26 +106,26 @@ export const ResponsesMessageItemSchema = z.discriminatedUnion("role", [
106
106
  */
107
107
  export const ResponsesFunctionCallSchema = z.object({
108
108
  type: z.literal("function_call"),
109
- id: z.string().optional(),
109
+ id: z.string().nullish(),
110
110
  call_id: z.string(),
111
111
  name: z.string(),
112
112
  arguments: z.string(),
113
- status: ResponsesItemStatusSchema.optional(),
113
+ status: ResponsesItemStatusSchema.nullish(),
114
114
  // Extension origin: Gemini
115
- extra_content: ResponsesProviderMetadataSchema.optional().meta({ extension: true }),
115
+ extra_content: ResponsesProviderMetadataSchema.nullish().meta({ extension: true }),
116
116
  // Extension origin: Anthropic/OpenRouter/Vercel
117
- cache_control: ResponsesCacheControlSchema.optional().meta({ extension: true }),
117
+ cache_control: ResponsesCacheControlSchema.nullish().meta({ extension: true }),
118
118
  });
119
119
  export const ResponsesFunctionCallOutputSchema = z.object({
120
120
  type: z.literal("function_call_output"),
121
- id: z.string().optional(),
121
+ id: z.string().nullish(),
122
122
  call_id: z.string(),
123
123
  output: z.union([z.string(), z.array(ResponsesInputContentSchema)]),
124
- status: ResponsesItemStatusSchema.optional(),
124
+ status: ResponsesItemStatusSchema.nullish(),
125
125
  // Extension origin: Gemini
126
- extra_content: ResponsesProviderMetadataSchema.optional().meta({ extension: true }),
126
+ extra_content: ResponsesProviderMetadataSchema.nullish().meta({ extension: true }),
127
127
  // Extension origin: Anthropic/OpenRouter/Vercel
128
- cache_control: ResponsesCacheControlSchema.optional().meta({ extension: true }),
128
+ cache_control: ResponsesCacheControlSchema.nullish().meta({ extension: true }),
129
129
  });
130
130
  /**
131
131
  * --- Reasoning ---
@@ -140,15 +140,15 @@ export const ResponsesReasoningTextSchema = z.object({
140
140
  });
141
141
  export const ResponsesReasoningItemSchema = z.object({
142
142
  type: z.literal("reasoning"),
143
- id: z.string().optional(),
143
+ id: z.string().nullish(),
144
144
  summary: z.array(ResponsesSummaryTextSchema),
145
- content: z.array(ResponsesReasoningTextSchema).optional(),
146
- encrypted_content: z.string().optional(),
147
- status: ResponsesItemStatusSchema.optional(),
145
+ content: z.array(ResponsesReasoningTextSchema).nullish(),
146
+ encrypted_content: z.string().nullish(),
147
+ status: ResponsesItemStatusSchema.nullish(),
148
148
  // Extension origin: Gemini
149
- extra_content: ResponsesProviderMetadataSchema.optional().meta({ extension: true }),
149
+ extra_content: ResponsesProviderMetadataSchema.nullish().meta({ extension: true }),
150
150
  // Extension origin: Anthropic/OpenRouter
151
- signature: z.string().optional().meta({ extension: true }),
151
+ signature: z.string().nullish().meta({ extension: true }),
152
152
  });
153
153
  /**
154
154
  * --- Input Items ---
@@ -164,13 +164,28 @@ export { ResponsesCacheControlSchema, ResponsesReasoningEffortSchema, ResponsesR
164
164
  /**
165
165
  * --- Tools ---
166
166
  */
167
- export const ResponsesToolSchema = z.object({
167
+ export const ResponsesFunctionToolSchema = z.object({
168
168
  type: z.literal("function"),
169
169
  name: z.string(),
170
170
  description: z.string().optional(),
171
171
  parameters: z.record(z.string(), z.unknown()),
172
172
  strict: z.boolean().optional(),
173
173
  });
174
+ // Hosted/built-in tools (e.g. web_search, file_search, code_interpreter).
175
+ // Accepted at the edge so clients like Codex can send their default payload,
176
+ // but not executed by the gateway — they are dropped before the AI SDK call
177
+ // unless the downstream handler explicitly opts them in.
178
+ export const ResponsesHostedToolSchema = z
179
+ .looseObject({
180
+ type: z.string(),
181
+ })
182
+ .refine((value) => value.type !== "function", {
183
+ message: 'Function tools must use the function tool schema (type: "function")',
184
+ });
185
+ export const ResponsesToolSchema = z.union([
186
+ ResponsesFunctionToolSchema,
187
+ ResponsesHostedToolSchema,
188
+ ]);
174
189
  const ResponsesNamedFunctionToolChoiceSchema = z.object({
175
190
  type: z.literal("function"),
176
191
  name: z.string(),
@@ -225,7 +240,7 @@ const ResponsesInputsSchema = z.object({
225
240
  frequency_penalty: z.number().min(-2.0).max(2.0).optional(),
226
241
  presence_penalty: z.number().min(-2.0).max(2.0).optional(),
227
242
  max_output_tokens: z.number().int().nonnegative().optional(),
228
- reasoning: ResponsesReasoningConfigSchema.optional(),
243
+ reasoning: ResponsesReasoningConfigSchema.nullish(),
229
244
  prompt_cache_key: z.string().optional(),
230
245
  metadata: ResponsesMetadataSchema,
231
246
  service_tier: ResponsesServiceTierSchema.optional(),
@@ -33,7 +33,7 @@ export declare function parseImageInput(url: string): {
33
33
  image: string | URL;
34
34
  mediaType?: string;
35
35
  };
36
- export declare function parseReasoningOptions(reasoning_effort?: ReasoningEffort, reasoning?: ReasoningConfig): {
36
+ export declare function parseReasoningOptions(reasoning_effort?: ReasoningEffort | null, reasoning?: ReasoningConfig | null): {
37
37
  reasoning: ReasoningConfig;
38
38
  reasoning_effort?: ReasoningEffort;
39
39
  } | {
@@ -46,7 +46,7 @@ export function parseReasoningOptions(reasoning_effort, reasoning) {
46
46
  if (reasoning?.enabled === false || effort === "none") {
47
47
  return { reasoning: { enabled: false, effort: "none" }, reasoning_effort: "none" };
48
48
  }
49
- if (!reasoning && effort === undefined)
49
+ if (!reasoning && (effort === undefined || effort === null))
50
50
  return {};
51
51
  const out = { reasoning: {} };
52
52
  if (effort) {
@@ -91,13 +91,13 @@ export declare const ContentPartAudioSchema: z.ZodObject<{
91
91
  webm: "webm";
92
92
  }>;
93
93
  }, z.core.$strip>;
94
- cache_control: z.ZodOptional<z.ZodObject<{
94
+ cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{
95
95
  type: z.ZodLiteral<"ephemeral">;
96
96
  ttl: z.ZodOptional<z.ZodEnum<{
97
97
  "5m": "5m";
98
98
  "1h": "1h";
99
99
  "24h": "24h";
100
100
  }>>;
101
- }, z.core.$strip>>;
101
+ }, z.core.$strip>>>;
102
102
  }, z.core.$strip>;
103
103
  export type ContentPartAudio = z.infer<typeof ContentPartAudioSchema>;
@@ -62,5 +62,5 @@ export const ContentPartAudioSchema = z.object({
62
62
  type: z.literal("input_audio"),
63
63
  input_audio: InputAudioSchema,
64
64
  // Extension origin: OpenRouter/Vercel/Anthropic
65
- cache_control: CacheControlSchema.optional().meta({ extension: true }),
65
+ cache_control: CacheControlSchema.nullish().meta({ extension: true }),
66
66
  });
package/dist/lifecycle.js CHANGED
@@ -55,6 +55,8 @@ export const winterCgHandler = (run, config) => {
55
55
  requestId: ctx.requestId,
56
56
  err,
57
57
  });
58
+ // On error we may not reach the handler's own ctx.otel flush, so flush here.
59
+ span.setAttributes(ctx.otel);
58
60
  span.recordError(err, true);
59
61
  }
60
62
  span.setAttributes({ "http.response.status_code_effective": realStatus });
@@ -191,6 +191,30 @@ export declare const qwen36MaxPreview: import("../../utils").Preset<"alibaba/qwe
191
191
  created: string;
192
192
  knowledge: string;
193
193
  }>;
194
+ export declare const qwen37Plus: import("../../utils").Preset<"alibaba/qwen3.7-plus", CatalogModel, {
195
+ modalities: {
196
+ input: readonly ["text", "image", "file"];
197
+ output: readonly ["text"];
198
+ };
199
+ capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
200
+ providers: readonly ["alibaba"];
201
+ name: string;
202
+ context: number;
203
+ created: string;
204
+ knowledge: string;
205
+ }>;
206
+ export declare const qwen37Max: import("../../utils").Preset<"alibaba/qwen3.7-max", CatalogModel, {
207
+ modalities: {
208
+ input: readonly ["text"];
209
+ output: readonly ["text"];
210
+ };
211
+ capabilities: ("reasoning" | "temperature" | "tool_call" | "structured_output")[];
212
+ providers: readonly ["alibaba"];
213
+ name: string;
214
+ context: number;
215
+ created: string;
216
+ knowledge: string;
217
+ }>;
194
218
  export declare const qwen3CoderNext: import("../../utils").Preset<"alibaba/qwen3-coder-next", CatalogModel, {
195
219
  modalities: {
196
220
  input: readonly ["text", "file"];
@@ -246,9 +270,9 @@ export declare const qwen3Embedding8b: import("../../utils").Preset<"alibaba/qwe
246
270
  providers: readonly ["alibaba", "azure", "deepinfra"];
247
271
  }>;
248
272
  export declare const qwen: {
249
- readonly latest: readonly [import("../../utils").Preset<"alibaba/qwen3.6-plus", CatalogModel, {
273
+ readonly latest: readonly [import("../../utils").Preset<"alibaba/qwen3.7-plus", CatalogModel, {
250
274
  modalities: {
251
- input: readonly ["text", "image", "video", "file"];
275
+ input: readonly ["text", "image", "file"];
252
276
  output: readonly ["text"];
253
277
  };
254
278
  capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
@@ -257,34 +281,12 @@ export declare const qwen: {
257
281
  context: number;
258
282
  created: string;
259
283
  knowledge: string;
260
- }>, import("../../utils").Preset<"alibaba/qwen3.6-flash", CatalogModel, {
284
+ }>, import("../../utils").Preset<"alibaba/qwen3.7-max", CatalogModel, {
261
285
  modalities: {
262
- input: readonly ["text", "image", "video", "file"];
263
- output: readonly ["text"];
264
- };
265
- capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
266
- providers: readonly ["alibaba", "azure", "deepinfra"];
267
- name: string;
268
- context: number;
269
- created: string;
270
- knowledge: string;
271
- }>, import("../../utils").Preset<"alibaba/qwen3.6-27b", CatalogModel, {
272
- modalities: {
273
- input: readonly ["text", "image", "video", "file"];
274
- output: readonly ["text"];
275
- };
276
- capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
277
- providers: readonly ["alibaba"];
278
- name: string;
279
- context: number;
280
- created: string;
281
- knowledge: string;
282
- }>, import("../../utils").Preset<"alibaba/qwen3.6-max-preview", CatalogModel, {
283
- modalities: {
284
- input: readonly ["text", "image", "video", "file"];
286
+ input: readonly ["text"];
285
287
  output: readonly ["text"];
286
288
  };
287
- capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
289
+ capabilities: ("reasoning" | "temperature" | "tool_call" | "structured_output")[];
288
290
  providers: readonly ["alibaba"];
289
291
  name: string;
290
292
  context: number;
@@ -467,6 +469,28 @@ export declare const qwen: {
467
469
  context: number;
468
470
  created: string;
469
471
  knowledge: string;
472
+ }> | import("../../utils").Preset<"alibaba/qwen3.7-plus", CatalogModel, {
473
+ modalities: {
474
+ input: readonly ["text", "image", "file"];
475
+ output: readonly ["text"];
476
+ };
477
+ capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
478
+ providers: readonly ["alibaba"];
479
+ name: string;
480
+ context: number;
481
+ created: string;
482
+ knowledge: string;
483
+ }> | import("../../utils").Preset<"alibaba/qwen3.7-max", CatalogModel, {
484
+ modalities: {
485
+ input: readonly ["text"];
486
+ output: readonly ["text"];
487
+ };
488
+ capabilities: ("reasoning" | "temperature" | "tool_call" | "structured_output")[];
489
+ providers: readonly ["alibaba"];
490
+ name: string;
491
+ context: number;
492
+ created: string;
493
+ knowledge: string;
470
494
  }> | import("../../utils").Preset<"alibaba/qwen3-coder-next", CatalogModel, {
471
495
  modalities: {
472
496
  input: readonly ["text", "file"];
@@ -693,6 +717,28 @@ export declare const qwen: {
693
717
  context: number;
694
718
  created: string;
695
719
  knowledge: string;
720
+ }>, import("../../utils").Preset<"alibaba/qwen3.7-plus", CatalogModel, {
721
+ modalities: {
722
+ input: readonly ["text", "image", "file"];
723
+ output: readonly ["text"];
724
+ };
725
+ capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
726
+ providers: readonly ["alibaba"];
727
+ name: string;
728
+ context: number;
729
+ created: string;
730
+ knowledge: string;
731
+ }>, import("../../utils").Preset<"alibaba/qwen3.7-max", CatalogModel, {
732
+ modalities: {
733
+ input: readonly ["text"];
734
+ output: readonly ["text"];
735
+ };
736
+ capabilities: ("reasoning" | "temperature" | "tool_call" | "structured_output")[];
737
+ providers: readonly ["alibaba"];
738
+ name: string;
739
+ context: number;
740
+ created: string;
741
+ knowledge: string;
696
742
  }>];
697
743
  readonly embeddings: readonly [import("../../utils").Preset<"alibaba/qwen3-embedding-0.6b", CatalogModel, {
698
744
  name: string;
@@ -901,6 +947,29 @@ export declare const qwen: {
901
947
  created: string;
902
948
  knowledge: string;
903
949
  }>];
950
+ readonly "v3.7": readonly [import("../../utils").Preset<"alibaba/qwen3.7-plus", CatalogModel, {
951
+ modalities: {
952
+ input: readonly ["text", "image", "file"];
953
+ output: readonly ["text"];
954
+ };
955
+ capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
956
+ providers: readonly ["alibaba"];
957
+ name: string;
958
+ context: number;
959
+ created: string;
960
+ knowledge: string;
961
+ }>, import("../../utils").Preset<"alibaba/qwen3.7-max", CatalogModel, {
962
+ modalities: {
963
+ input: readonly ["text"];
964
+ output: readonly ["text"];
965
+ };
966
+ capabilities: ("reasoning" | "temperature" | "tool_call" | "structured_output")[];
967
+ providers: readonly ["alibaba"];
968
+ name: string;
969
+ context: number;
970
+ created: string;
971
+ knowledge: string;
972
+ }>];
904
973
  readonly coder: readonly [import("../../utils").Preset<"alibaba/qwen3-coder-next", CatalogModel, {
905
974
  modalities: {
906
975
  input: readonly ["text", "file"];
@@ -202,6 +202,30 @@ export const qwen36MaxPreview = presetFor()("alibaba/qwen3.6-max-preview", {
202
202
  created: "2026-04-21",
203
203
  knowledge: "2025-04",
204
204
  });
205
+ export const qwen37Plus = presetFor()("alibaba/qwen3.7-plus", {
206
+ modalities: {
207
+ input: ["text", "image", "file"],
208
+ output: ["text"],
209
+ },
210
+ capabilities: ["attachments", "reasoning", "tool_call", "structured_output", "temperature"],
211
+ providers: ["alibaba"],
212
+ name: "Qwen3.7 Plus",
213
+ context: 1_000_000,
214
+ created: "2026-06-02",
215
+ knowledge: "2025-04",
216
+ });
217
+ export const qwen37Max = presetFor()("alibaba/qwen3.7-max", {
218
+ modalities: {
219
+ input: ["text"],
220
+ output: ["text"],
221
+ },
222
+ capabilities: ["reasoning", "tool_call", "structured_output", "temperature"],
223
+ providers: ["alibaba"],
224
+ name: "Qwen3.7 Max",
225
+ context: 1_000_000,
226
+ created: "2026-05-21",
227
+ knowledge: "2025-04",
228
+ });
205
229
  export const qwen3CoderNext = presetFor()("alibaba/qwen3-coder-next", {
206
230
  modalities: {
207
231
  input: ["text", "file"],
@@ -248,17 +272,18 @@ const qwenAtomic = {
248
272
  v3: [qwen3_235b, qwen3_32b],
249
273
  "v3.5": [qwen35Plus, qwen35Flash, qwen35_397b, qwen35_122b, qwen35_35b, qwen35_27b, qwen35_9b, qwen35_4b, qwen35_2b, qwen35_08b],
250
274
  "v3.6": [qwen36Plus, qwen36Flash, qwen36_27b, qwen36MaxPreview],
275
+ "v3.7": [qwen37Plus, qwen37Max],
251
276
  coder: [qwen3CoderNext],
252
277
  vl: [qwen3Vl235b],
253
278
  embedding: [qwen3Embedding06b, qwen3Embedding4b, qwen3Embedding8b],
254
279
  };
255
280
  const qwenGroups = {
256
- "v3.x": [...qwenAtomic["v3"], ...qwenAtomic["v3.5"], ...qwenAtomic["v3.6"]],
281
+ "v3.x": [...qwenAtomic["v3"], ...qwenAtomic["v3.5"], ...qwenAtomic["v3.6"], ...qwenAtomic["v3.7"]],
257
282
  embeddings: [...qwenAtomic["embedding"]],
258
283
  };
259
284
  export const qwen = {
260
285
  ...qwenAtomic,
261
286
  ...qwenGroups,
262
- latest: [...qwenAtomic["v3.6"]],
287
+ latest: [...qwenAtomic["v3.7"]],
263
288
  all: Object.values(qwenAtomic).flat(),
264
289
  };
@@ -6,13 +6,16 @@ const isClaude = (family, version) => {
6
6
  modelId.includes(`claude-${family}-${dashed}`);
7
7
  };
8
8
  const isClaude4 = (modelId) => modelId.includes("claude-") && modelId.includes("-4");
9
+ const isFable5 = (modelId) => modelId.includes("claude-fable-5");
10
+ const isClaude4OrFable = (modelId) => isClaude4(modelId) || isFable5(modelId);
11
+ const isOpus48 = isClaude("opus", "4.8");
9
12
  const isOpus47 = isClaude("opus", "4.7");
10
13
  const isOpus46 = isClaude("opus", "4.6");
11
14
  const isOpus45 = isClaude("opus", "4.5");
12
15
  const isOpus4 = isClaude("opus", "4");
13
16
  const isSonnet46 = isClaude("sonnet", "4.6");
14
17
  export function mapClaudeReasoningEffort(effort, modelId) {
15
- if (isOpus47(modelId)) {
18
+ if (isOpus48(modelId) || isOpus47(modelId) || isFable5(modelId)) {
16
19
  switch (effort) {
17
20
  case "none":
18
21
  case "minimal":
@@ -58,6 +61,10 @@ export function mapClaudeReasoningEffort(effort, modelId) {
58
61
  return undefined;
59
62
  }
60
63
  function getMaxOutputTokens(modelId) {
64
+ if (isOpus48(modelId))
65
+ return 128_000;
66
+ if (isFable5(modelId))
67
+ return 128_000;
61
68
  if (isOpus47(modelId))
62
69
  return 128_000;
63
70
  if (isOpus46(modelId))
@@ -89,10 +96,10 @@ export const claudeReasoningMiddleware = {
89
96
  target.thinking = { type: "disabled" };
90
97
  }
91
98
  else if (reasoning.effort) {
92
- if (isClaude4(modelId)) {
99
+ if (isClaude4OrFable(modelId)) {
93
100
  target.effort = mapClaudeReasoningEffort(reasoning.effort, modelId);
94
101
  }
95
- if (isOpus47(modelId)) {
102
+ if (isOpus48(modelId) || isOpus47(modelId) || isFable5(modelId)) {
96
103
  target.thinking = { type: "adaptive" };
97
104
  }
98
105
  else if (isOpus46(modelId)) {
@@ -152,6 +159,6 @@ export const claudePromptCachingMiddleware = {
152
159
  return params;
153
160
  },
154
161
  };
155
- modelMiddlewareMatcher.useForModel(["anthropic/claude-*3*7*", "anthropic/claude-*4*"], {
162
+ modelMiddlewareMatcher.useForModel(["anthropic/claude-*3*7*", "anthropic/claude-*4*", "anthropic/claude-fable-*"], {
156
163
  language: [claudeReasoningMiddleware, claudePromptCachingMiddleware],
157
164
  });