@hebo-ai/gateway 0.11.4 → 0.11.5

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebo-ai/gateway",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "AI gateway as a framework. For full control over models, routing & lifecycle. OpenAI /chat/completions, OpenResponses /responses & Anthropic /messages.",
5
5
  "keywords": [
6
6
  "ai",
@@ -252,36 +252,36 @@
252
252
  "fix": "bun lint:staged && bun format:staged"
253
253
  },
254
254
  "dependencies": {
255
- "@ai-sdk/provider": "^3.0.9",
256
- "ai": "^6.0.169",
257
- "lru-cache": "^11.3.5",
255
+ "@ai-sdk/provider": "^3.0.10",
256
+ "ai": "^6.0.176",
257
+ "lru-cache": "^11.3.6",
258
258
  "uuid": "^14.0.0",
259
259
  "zod": "^4.3.6"
260
260
  },
261
261
  "devDependencies": {
262
- "@ai-sdk/alibaba": "^1.0.18",
263
- "@ai-sdk/amazon-bedrock": "^4.0.97",
264
- "@ai-sdk/anthropic": "^3.0.72",
265
- "@ai-sdk/cohere": "^3.0.31",
266
- "@ai-sdk/deepinfra": "^2.0.46",
267
- "@ai-sdk/deepseek": "^2.0.30",
268
- "@ai-sdk/fireworks": "^2.0.47",
269
- "@ai-sdk/google-vertex": "^4.0.113",
270
- "@ai-sdk/groq": "^3.0.36",
271
- "@ai-sdk/moonshotai": "^2.0.17",
272
- "@ai-sdk/openai": "^3.0.54",
273
- "@ai-sdk/togetherai": "^2.0.46",
274
- "@ai-sdk/xai": "^3.0.84",
262
+ "@ai-sdk/alibaba": "^1.0.23",
263
+ "@ai-sdk/amazon-bedrock": "^4.0.103",
264
+ "@ai-sdk/anthropic": "^3.0.76",
265
+ "@ai-sdk/cohere": "^3.0.35",
266
+ "@ai-sdk/deepinfra": "^2.0.51",
267
+ "@ai-sdk/deepseek": "^2.0.34",
268
+ "@ai-sdk/fireworks": "^2.0.52",
269
+ "@ai-sdk/google-vertex": "^4.0.124",
270
+ "@ai-sdk/groq": "^3.0.39",
271
+ "@ai-sdk/moonshotai": "^2.0.22",
272
+ "@ai-sdk/openai": "^3.0.63",
273
+ "@ai-sdk/togetherai": "^2.0.51",
274
+ "@ai-sdk/xai": "^3.0.89",
275
275
  "@anthropic-ai/sdk": "^0.91.1",
276
- "@aws-sdk/credential-providers": "^3.1038.0",
277
- "@langfuse/otel": "^5.2.0",
276
+ "@aws-sdk/credential-providers": "^3.1045.0",
277
+ "@langfuse/otel": "^5.3.0",
278
278
  "@libsql/client": "^0.17.3",
279
279
  "@mjackson/node-fetch-server": "^0.7.0",
280
280
  "@opentelemetry/api": "^1.9.1",
281
- "@opentelemetry/context-async-hooks": "^2.7.0",
282
- "@opentelemetry/sdk-trace-base": "^2.7.0",
283
- "@tanstack/react-router": "^1.168.25",
284
- "@tanstack/react-start": "^1.167.50",
281
+ "@opentelemetry/context-async-hooks": "^2.7.1",
282
+ "@opentelemetry/sdk-trace-base": "^2.7.1",
283
+ "@tanstack/react-router": "^1.169.2",
284
+ "@tanstack/react-start": "^1.167.65",
285
285
  "@types/better-sqlite3": "^7.6.13",
286
286
  "@types/bun": "1.3.13",
287
287
  "@types/pg": "^8.20.0",
@@ -290,48 +290,46 @@
290
290
  "@types/uuid": "^11.0.0",
291
291
  "better-sqlite3": "^12.9.0",
292
292
  "elysia": "^1.4.28",
293
- "hono": "^4.12.15",
293
+ "hono": "^4.12.18",
294
294
  "lefthook": "^2.1.6",
295
295
  "mysql2": "^3.22.3",
296
- "next": "^16.2.4",
297
- "openai": "^6.35.0",
296
+ "next": "^16.2.6",
297
+ "openai": "^6.37.0",
298
298
  "oxfmt": "^0.46.0",
299
- "oxlint": "^1.62.0",
299
+ "oxlint": "^1.63.0",
300
300
  "oxlint-tsgolint": "^0.22.1",
301
301
  "pg": "^8.20.0",
302
302
  "pino": "^10.3.1",
303
303
  "postgres": "^3.4.9",
304
304
  "typescript": "^6.0.3",
305
- "vite": "^8.0.10",
305
+ "vite": "^8.0.11",
306
306
  "vite-tsconfig-paths": "^6.1.1",
307
307
  "voyage-ai-provider": "^3.0.0",
308
- "zhipu-ai-provider": "^0.3.0"
308
+ "zhipu-ai-provider": "^0.3.1"
309
309
  },
310
310
  "peerDependencies": {
311
- "@ai-sdk/alibaba": "^1.0.0",
312
- "@ai-sdk/amazon-bedrock": "^4.0.77",
313
- "@ai-sdk/anthropic": "^3.0.58",
314
- "@ai-sdk/cohere": "^3.0.25",
315
- "@ai-sdk/deepinfra": "^2.0.45",
316
- "@ai-sdk/deepseek": "^2.0.29",
317
- "@ai-sdk/fireworks": "^2.0.46",
318
- "@ai-sdk/google": "^3.0.65",
319
- "@ai-sdk/google-vertex": "^4.0.80",
320
- "@ai-sdk/groq": "^3.0.29",
321
- "@ai-sdk/moonshotai": "^2.0.16",
322
- "@ai-sdk/openai": "^3.0.41",
323
- "@ai-sdk/openai-compatible": "^2.0.42",
324
- "@ai-sdk/togetherai": "^2.0.45",
325
- "@ai-sdk/xai": "^3.0.83",
326
- "@libsql/client": "^0.14.0",
311
+ "@ai-sdk/alibaba": "^1.0.23",
312
+ "@ai-sdk/amazon-bedrock": "^4.0.103",
313
+ "@ai-sdk/anthropic": "^3.0.76",
314
+ "@ai-sdk/cohere": "^3.0.35",
315
+ "@ai-sdk/deepinfra": "^2.0.51",
316
+ "@ai-sdk/deepseek": "^2.0.34",
317
+ "@ai-sdk/fireworks": "^2.0.52",
318
+ "@ai-sdk/google-vertex": "^4.0.124",
319
+ "@ai-sdk/groq": "^3.0.39",
320
+ "@ai-sdk/moonshotai": "^2.0.22",
321
+ "@ai-sdk/openai": "^3.0.63",
322
+ "@ai-sdk/togetherai": "^2.0.51",
323
+ "@ai-sdk/xai": "^3.0.89",
324
+ "@libsql/client": "^0.17.3",
327
325
  "@opentelemetry/api": "^1.9.1",
328
- "better-sqlite3": "^11.0.0",
329
- "mysql2": "^3.11.0",
330
- "pg": "^8.13.0",
331
- "postgres": "^3.4.0",
326
+ "better-sqlite3": "^12.9.0",
327
+ "mysql2": "^3.22.3",
328
+ "pg": "^8.20.0",
329
+ "postgres": "^3.4.9",
332
330
  "typescript": ">=5.9.3",
333
331
  "voyage-ai-provider": "^3.0.0",
334
- "zhipu-ai-provider": "^0.3.0"
332
+ "zhipu-ai-provider": "^0.3.1"
335
333
  },
336
334
  "peerDependenciesMeta": {
337
335
  "@ai-sdk/alibaba": {
@@ -346,9 +344,6 @@
346
344
  "@ai-sdk/cohere": {
347
345
  "optional": true
348
346
  },
349
- "@ai-sdk/google": {
350
- "optional": true
351
- },
352
347
  "@ai-sdk/google-vertex": {
353
348
  "optional": true
354
349
  },
@@ -370,9 +365,6 @@
370
365
  "@ai-sdk/openai": {
371
366
  "optional": true
372
367
  },
373
- "@ai-sdk/openai-compatible": {
374
- "optional": true
375
- },
376
368
  "@ai-sdk/togetherai": {
377
369
  "optional": true
378
370
  },