@hebo-ai/gateway 0.4.0-beta.4 → 0.4.1

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 (42) hide show
  1. package/README.md +34 -7
  2. package/dist/endpoints/chat-completions/converters.d.ts +3 -3
  3. package/dist/endpoints/chat-completions/converters.js +15 -7
  4. package/dist/endpoints/chat-completions/handler.js +9 -9
  5. package/dist/endpoints/chat-completions/otel.js +10 -4
  6. package/dist/endpoints/embeddings/handler.js +5 -4
  7. package/dist/errors/gateway.d.ts +1 -1
  8. package/dist/errors/gateway.js +3 -3
  9. package/dist/errors/openai.js +2 -1
  10. package/dist/errors/utils.d.ts +2 -1
  11. package/dist/errors/utils.js +1 -0
  12. package/dist/lifecycle.js +14 -6
  13. package/dist/models/anthropic/presets.d.ts +463 -0
  14. package/dist/models/anthropic/presets.js +10 -2
  15. package/dist/models/types.d.ts +1 -1
  16. package/dist/models/types.js +1 -0
  17. package/dist/providers/bedrock/canonical.js +1 -0
  18. package/dist/telemetry/gen-ai.d.ts +2 -1
  19. package/dist/telemetry/gen-ai.js +21 -3
  20. package/dist/telemetry/memory.d.ts +2 -0
  21. package/dist/telemetry/memory.js +27 -0
  22. package/dist/telemetry/span.js +1 -1
  23. package/dist/telemetry/stream.d.ts +1 -1
  24. package/dist/telemetry/stream.js +25 -28
  25. package/dist/types.d.ts +2 -3
  26. package/package.json +2 -1
  27. package/src/endpoints/chat-completions/converters.ts +17 -10
  28. package/src/endpoints/chat-completions/handler.ts +13 -9
  29. package/src/endpoints/chat-completions/otel.ts +11 -4
  30. package/src/endpoints/embeddings/handler.ts +9 -4
  31. package/src/errors/gateway.ts +5 -4
  32. package/src/errors/openai.ts +2 -1
  33. package/src/errors/utils.ts +1 -0
  34. package/src/lifecycle.ts +17 -6
  35. package/src/models/anthropic/presets.ts +14 -2
  36. package/src/models/types.ts +1 -0
  37. package/src/providers/bedrock/canonical.ts +1 -0
  38. package/src/telemetry/gen-ai.ts +31 -3
  39. package/src/telemetry/memory.ts +36 -0
  40. package/src/telemetry/span.ts +1 -1
  41. package/src/telemetry/stream.ts +31 -31
  42. package/src/types.ts +3 -6
@@ -310,6 +310,84 @@ export declare const claudeSonnet45: <const O extends {
310
310
  context: number;
311
311
  providers: readonly ["anthropic", "bedrock", "vertex"];
312
312
  } & O>;
313
+ export declare const claudeSonnet46: <const O extends {
314
+ name?: string | undefined;
315
+ created?: string | undefined;
316
+ knowledge?: string | undefined;
317
+ modalities?: {
318
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
319
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
320
+ } | undefined;
321
+ context?: number | undefined;
322
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
323
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
324
+ readonly [x: number]: string | undefined;
325
+ toString?: (() => string) | undefined;
326
+ charAt?: {} | undefined;
327
+ charCodeAt?: {} | undefined;
328
+ concat?: {} | undefined;
329
+ indexOf?: {} | undefined;
330
+ lastIndexOf?: {} | undefined;
331
+ localeCompare?: {} | undefined;
332
+ match?: {} | undefined;
333
+ replace?: {} | undefined;
334
+ search?: {} | undefined;
335
+ slice?: {} | undefined;
336
+ split?: {} | undefined;
337
+ substring?: {} | undefined;
338
+ toLowerCase?: (() => string) | undefined;
339
+ toLocaleLowerCase?: {} | undefined;
340
+ toUpperCase?: (() => string) | undefined;
341
+ toLocaleUpperCase?: {} | undefined;
342
+ trim?: (() => string) | undefined;
343
+ readonly length?: number | undefined;
344
+ substr?: {} | undefined;
345
+ valueOf?: (() => string) | undefined;
346
+ codePointAt?: {} | undefined;
347
+ includes?: {} | undefined;
348
+ endsWith?: {} | undefined;
349
+ normalize?: {} | undefined;
350
+ repeat?: {} | undefined;
351
+ startsWith?: {} | undefined;
352
+ anchor?: {} | undefined;
353
+ big?: (() => string) | undefined;
354
+ blink?: (() => string) | undefined;
355
+ bold?: (() => string) | undefined;
356
+ fixed?: (() => string) | undefined;
357
+ fontcolor?: {} | undefined;
358
+ fontsize?: {} | undefined;
359
+ italics?: (() => string) | undefined;
360
+ link?: {} | undefined;
361
+ small?: (() => string) | undefined;
362
+ strike?: (() => string) | undefined;
363
+ sub?: (() => string) | undefined;
364
+ sup?: (() => string) | undefined;
365
+ padStart?: {} | undefined;
366
+ padEnd?: {} | undefined;
367
+ trimEnd?: (() => string) | undefined;
368
+ trimStart?: (() => string) | undefined;
369
+ trimLeft?: (() => string) | undefined;
370
+ trimRight?: (() => string) | undefined;
371
+ matchAll?: {} | undefined;
372
+ replaceAll?: {} | undefined;
373
+ at?: {} | undefined;
374
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
375
+ })[] | undefined;
376
+ additionalProperties?: {
377
+ [x: string]: unknown;
378
+ } | undefined;
379
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
380
+ name: string;
381
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
382
+ created: string;
383
+ knowledge: string;
384
+ modalities: {
385
+ input: readonly ["text", "image", "pdf", "file"];
386
+ output: readonly ["text"];
387
+ };
388
+ context: number;
389
+ providers: readonly ["anthropic", "bedrock", "vertex"];
390
+ } & O>;
313
391
  export declare const claudeSonnet4: <const O extends {
314
392
  name?: string | undefined;
315
393
  created?: string | undefined;
@@ -923,6 +1001,83 @@ export declare const claude: {
923
1001
  additionalProperties?: {
924
1002
  [x: string]: unknown;
925
1003
  } | undefined;
1004
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
1005
+ name: string;
1006
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
1007
+ created: string;
1008
+ knowledge: string;
1009
+ modalities: {
1010
+ input: readonly ["text", "image", "pdf", "file"];
1011
+ output: readonly ["text"];
1012
+ };
1013
+ context: number;
1014
+ providers: readonly ["anthropic", "bedrock", "vertex"];
1015
+ } & O>, <const O extends {
1016
+ name?: string | undefined;
1017
+ created?: string | undefined;
1018
+ knowledge?: string | undefined;
1019
+ modalities?: {
1020
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1021
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1022
+ } | undefined;
1023
+ context?: number | undefined;
1024
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
1025
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
1026
+ readonly [x: number]: string | undefined;
1027
+ toString?: (() => string) | undefined;
1028
+ charAt?: {} | undefined;
1029
+ charCodeAt?: {} | undefined;
1030
+ concat?: {} | undefined;
1031
+ indexOf?: {} | undefined;
1032
+ lastIndexOf?: {} | undefined;
1033
+ localeCompare?: {} | undefined;
1034
+ match?: {} | undefined;
1035
+ replace?: {} | undefined;
1036
+ search?: {} | undefined;
1037
+ slice?: {} | undefined;
1038
+ split?: {} | undefined;
1039
+ substring?: {} | undefined;
1040
+ toLowerCase?: (() => string) | undefined;
1041
+ toLocaleLowerCase?: {} | undefined;
1042
+ toUpperCase?: (() => string) | undefined;
1043
+ toLocaleUpperCase?: {} | undefined;
1044
+ trim?: (() => string) | undefined;
1045
+ readonly length?: number | undefined;
1046
+ substr?: {} | undefined;
1047
+ valueOf?: (() => string) | undefined;
1048
+ codePointAt?: {} | undefined;
1049
+ includes?: {} | undefined;
1050
+ endsWith?: {} | undefined;
1051
+ normalize?: {} | undefined;
1052
+ repeat?: {} | undefined;
1053
+ startsWith?: {} | undefined;
1054
+ anchor?: {} | undefined;
1055
+ big?: (() => string) | undefined;
1056
+ blink?: (() => string) | undefined;
1057
+ bold?: (() => string) | undefined;
1058
+ fixed?: (() => string) | undefined;
1059
+ fontcolor?: {} | undefined;
1060
+ fontsize?: {} | undefined;
1061
+ italics?: (() => string) | undefined;
1062
+ link?: {} | undefined;
1063
+ small?: (() => string) | undefined;
1064
+ strike?: (() => string) | undefined;
1065
+ sub?: (() => string) | undefined;
1066
+ sup?: (() => string) | undefined;
1067
+ padStart?: {} | undefined;
1068
+ padEnd?: {} | undefined;
1069
+ trimEnd?: (() => string) | undefined;
1070
+ trimStart?: (() => string) | undefined;
1071
+ trimLeft?: (() => string) | undefined;
1072
+ trimRight?: (() => string) | undefined;
1073
+ matchAll?: {} | undefined;
1074
+ replaceAll?: {} | undefined;
1075
+ at?: {} | undefined;
1076
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
1077
+ })[] | undefined;
1078
+ additionalProperties?: {
1079
+ [x: string]: unknown;
1080
+ } | undefined;
926
1081
  }>(override?: O | undefined) => Record<"anthropic/claude-opus-4.6", {
927
1082
  name: string;
928
1083
  capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
@@ -1309,6 +1464,83 @@ export declare const claude: {
1309
1464
  additionalProperties?: {
1310
1465
  [x: string]: unknown;
1311
1466
  } | undefined;
1467
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
1468
+ name: string;
1469
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
1470
+ created: string;
1471
+ knowledge: string;
1472
+ modalities: {
1473
+ input: readonly ["text", "image", "pdf", "file"];
1474
+ output: readonly ["text"];
1475
+ };
1476
+ context: number;
1477
+ providers: readonly ["anthropic", "bedrock", "vertex"];
1478
+ } & O>) | (<const O extends {
1479
+ name?: string | undefined;
1480
+ created?: string | undefined;
1481
+ knowledge?: string | undefined;
1482
+ modalities?: {
1483
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1484
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1485
+ } | undefined;
1486
+ context?: number | undefined;
1487
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
1488
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
1489
+ readonly [x: number]: string | undefined;
1490
+ toString?: (() => string) | undefined;
1491
+ charAt?: {} | undefined;
1492
+ charCodeAt?: {} | undefined;
1493
+ concat?: {} | undefined;
1494
+ indexOf?: {} | undefined;
1495
+ lastIndexOf?: {} | undefined;
1496
+ localeCompare?: {} | undefined;
1497
+ match?: {} | undefined;
1498
+ replace?: {} | undefined;
1499
+ search?: {} | undefined;
1500
+ slice?: {} | undefined;
1501
+ split?: {} | undefined;
1502
+ substring?: {} | undefined;
1503
+ toLowerCase?: (() => string) | undefined;
1504
+ toLocaleLowerCase?: {} | undefined;
1505
+ toUpperCase?: (() => string) | undefined;
1506
+ toLocaleUpperCase?: {} | undefined;
1507
+ trim?: (() => string) | undefined;
1508
+ readonly length?: number | undefined;
1509
+ substr?: {} | undefined;
1510
+ valueOf?: (() => string) | undefined;
1511
+ codePointAt?: {} | undefined;
1512
+ includes?: {} | undefined;
1513
+ endsWith?: {} | undefined;
1514
+ normalize?: {} | undefined;
1515
+ repeat?: {} | undefined;
1516
+ startsWith?: {} | undefined;
1517
+ anchor?: {} | undefined;
1518
+ big?: (() => string) | undefined;
1519
+ blink?: (() => string) | undefined;
1520
+ bold?: (() => string) | undefined;
1521
+ fixed?: (() => string) | undefined;
1522
+ fontcolor?: {} | undefined;
1523
+ fontsize?: {} | undefined;
1524
+ italics?: (() => string) | undefined;
1525
+ link?: {} | undefined;
1526
+ small?: (() => string) | undefined;
1527
+ strike?: (() => string) | undefined;
1528
+ sub?: (() => string) | undefined;
1529
+ sup?: (() => string) | undefined;
1530
+ padStart?: {} | undefined;
1531
+ padEnd?: {} | undefined;
1532
+ trimEnd?: (() => string) | undefined;
1533
+ trimStart?: (() => string) | undefined;
1534
+ trimLeft?: (() => string) | undefined;
1535
+ trimRight?: (() => string) | undefined;
1536
+ matchAll?: {} | undefined;
1537
+ replaceAll?: {} | undefined;
1538
+ at?: {} | undefined;
1539
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
1540
+ })[] | undefined;
1541
+ additionalProperties?: {
1542
+ [x: string]: unknown;
1543
+ } | undefined;
1312
1544
  }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4", {
1313
1545
  name: string;
1314
1546
  capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
@@ -1849,6 +2081,83 @@ export declare const claude: {
1849
2081
  additionalProperties?: {
1850
2082
  [x: string]: unknown;
1851
2083
  } | undefined;
2084
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
2085
+ name: string;
2086
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
2087
+ created: string;
2088
+ knowledge: string;
2089
+ modalities: {
2090
+ input: readonly ["text", "image", "pdf", "file"];
2091
+ output: readonly ["text"];
2092
+ };
2093
+ context: number;
2094
+ providers: readonly ["anthropic", "bedrock", "vertex"];
2095
+ } & O>, <const O extends {
2096
+ name?: string | undefined;
2097
+ created?: string | undefined;
2098
+ knowledge?: string | undefined;
2099
+ modalities?: {
2100
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2101
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2102
+ } | undefined;
2103
+ context?: number | undefined;
2104
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
2105
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
2106
+ readonly [x: number]: string | undefined;
2107
+ toString?: (() => string) | undefined;
2108
+ charAt?: {} | undefined;
2109
+ charCodeAt?: {} | undefined;
2110
+ concat?: {} | undefined;
2111
+ indexOf?: {} | undefined;
2112
+ lastIndexOf?: {} | undefined;
2113
+ localeCompare?: {} | undefined;
2114
+ match?: {} | undefined;
2115
+ replace?: {} | undefined;
2116
+ search?: {} | undefined;
2117
+ slice?: {} | undefined;
2118
+ split?: {} | undefined;
2119
+ substring?: {} | undefined;
2120
+ toLowerCase?: (() => string) | undefined;
2121
+ toLocaleLowerCase?: {} | undefined;
2122
+ toUpperCase?: (() => string) | undefined;
2123
+ toLocaleUpperCase?: {} | undefined;
2124
+ trim?: (() => string) | undefined;
2125
+ readonly length?: number | undefined;
2126
+ substr?: {} | undefined;
2127
+ valueOf?: (() => string) | undefined;
2128
+ codePointAt?: {} | undefined;
2129
+ includes?: {} | undefined;
2130
+ endsWith?: {} | undefined;
2131
+ normalize?: {} | undefined;
2132
+ repeat?: {} | undefined;
2133
+ startsWith?: {} | undefined;
2134
+ anchor?: {} | undefined;
2135
+ big?: (() => string) | undefined;
2136
+ blink?: (() => string) | undefined;
2137
+ bold?: (() => string) | undefined;
2138
+ fixed?: (() => string) | undefined;
2139
+ fontcolor?: {} | undefined;
2140
+ fontsize?: {} | undefined;
2141
+ italics?: (() => string) | undefined;
2142
+ link?: {} | undefined;
2143
+ small?: (() => string) | undefined;
2144
+ strike?: (() => string) | undefined;
2145
+ sub?: (() => string) | undefined;
2146
+ sup?: (() => string) | undefined;
2147
+ padStart?: {} | undefined;
2148
+ padEnd?: {} | undefined;
2149
+ trimEnd?: (() => string) | undefined;
2150
+ trimStart?: (() => string) | undefined;
2151
+ trimLeft?: (() => string) | undefined;
2152
+ trimRight?: (() => string) | undefined;
2153
+ matchAll?: {} | undefined;
2154
+ replaceAll?: {} | undefined;
2155
+ at?: {} | undefined;
2156
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
2157
+ })[] | undefined;
2158
+ additionalProperties?: {
2159
+ [x: string]: unknown;
2160
+ } | undefined;
1852
2161
  }>(override?: O | undefined) => Record<"anthropic/claude-opus-4.6", {
1853
2162
  name: string;
1854
2163
  capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
@@ -2698,6 +3007,83 @@ export declare const claude: {
2698
3007
  additionalProperties?: {
2699
3008
  [x: string]: unknown;
2700
3009
  } | undefined;
3010
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
3011
+ name: string;
3012
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
3013
+ created: string;
3014
+ knowledge: string;
3015
+ modalities: {
3016
+ input: readonly ["text", "image", "pdf", "file"];
3017
+ output: readonly ["text"];
3018
+ };
3019
+ context: number;
3020
+ providers: readonly ["anthropic", "bedrock", "vertex"];
3021
+ } & O>, <const O extends {
3022
+ name?: string | undefined;
3023
+ created?: string | undefined;
3024
+ knowledge?: string | undefined;
3025
+ modalities?: {
3026
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
3027
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
3028
+ } | undefined;
3029
+ context?: number | undefined;
3030
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
3031
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
3032
+ readonly [x: number]: string | undefined;
3033
+ toString?: (() => string) | undefined;
3034
+ charAt?: {} | undefined;
3035
+ charCodeAt?: {} | undefined;
3036
+ concat?: {} | undefined;
3037
+ indexOf?: {} | undefined;
3038
+ lastIndexOf?: {} | undefined;
3039
+ localeCompare?: {} | undefined;
3040
+ match?: {} | undefined;
3041
+ replace?: {} | undefined;
3042
+ search?: {} | undefined;
3043
+ slice?: {} | undefined;
3044
+ split?: {} | undefined;
3045
+ substring?: {} | undefined;
3046
+ toLowerCase?: (() => string) | undefined;
3047
+ toLocaleLowerCase?: {} | undefined;
3048
+ toUpperCase?: (() => string) | undefined;
3049
+ toLocaleUpperCase?: {} | undefined;
3050
+ trim?: (() => string) | undefined;
3051
+ readonly length?: number | undefined;
3052
+ substr?: {} | undefined;
3053
+ valueOf?: (() => string) | undefined;
3054
+ codePointAt?: {} | undefined;
3055
+ includes?: {} | undefined;
3056
+ endsWith?: {} | undefined;
3057
+ normalize?: {} | undefined;
3058
+ repeat?: {} | undefined;
3059
+ startsWith?: {} | undefined;
3060
+ anchor?: {} | undefined;
3061
+ big?: (() => string) | undefined;
3062
+ blink?: (() => string) | undefined;
3063
+ bold?: (() => string) | undefined;
3064
+ fixed?: (() => string) | undefined;
3065
+ fontcolor?: {} | undefined;
3066
+ fontsize?: {} | undefined;
3067
+ italics?: (() => string) | undefined;
3068
+ link?: {} | undefined;
3069
+ small?: (() => string) | undefined;
3070
+ strike?: (() => string) | undefined;
3071
+ sub?: (() => string) | undefined;
3072
+ sup?: (() => string) | undefined;
3073
+ padStart?: {} | undefined;
3074
+ padEnd?: {} | undefined;
3075
+ trimEnd?: (() => string) | undefined;
3076
+ trimStart?: (() => string) | undefined;
3077
+ trimLeft?: (() => string) | undefined;
3078
+ trimRight?: (() => string) | undefined;
3079
+ matchAll?: {} | undefined;
3080
+ replaceAll?: {} | undefined;
3081
+ at?: {} | undefined;
3082
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
3083
+ })[] | undefined;
3084
+ additionalProperties?: {
3085
+ [x: string]: unknown;
3086
+ } | undefined;
2701
3087
  }>(override?: O | undefined) => Record<"anthropic/claude-opus-4.6", {
2702
3088
  name: string;
2703
3089
  capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
@@ -3784,6 +4170,83 @@ export declare const claude: {
3784
4170
  additionalProperties?: {
3785
4171
  [x: string]: unknown;
3786
4172
  } | undefined;
4173
+ }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.6", {
4174
+ name: string;
4175
+ capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
4176
+ created: string;
4177
+ knowledge: string;
4178
+ modalities: {
4179
+ input: readonly ["text", "image", "pdf", "file"];
4180
+ output: readonly ["text"];
4181
+ };
4182
+ context: number;
4183
+ providers: readonly ["anthropic", "bedrock", "vertex"];
4184
+ } & O>, <const O extends {
4185
+ name?: string | undefined;
4186
+ created?: string | undefined;
4187
+ knowledge?: string | undefined;
4188
+ modalities?: {
4189
+ input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
4190
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
4191
+ } | undefined;
4192
+ context?: number | undefined;
4193
+ capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
4194
+ providers?: readonly ("anthropic" | "azure" | "bedrock" | "cohere" | "groq" | "openai" | "vertex" | "voyage" | {
4195
+ readonly [x: number]: string | undefined;
4196
+ toString?: (() => string) | undefined;
4197
+ charAt?: {} | undefined;
4198
+ charCodeAt?: {} | undefined;
4199
+ concat?: {} | undefined;
4200
+ indexOf?: {} | undefined;
4201
+ lastIndexOf?: {} | undefined;
4202
+ localeCompare?: {} | undefined;
4203
+ match?: {} | undefined;
4204
+ replace?: {} | undefined;
4205
+ search?: {} | undefined;
4206
+ slice?: {} | undefined;
4207
+ split?: {} | undefined;
4208
+ substring?: {} | undefined;
4209
+ toLowerCase?: (() => string) | undefined;
4210
+ toLocaleLowerCase?: {} | undefined;
4211
+ toUpperCase?: (() => string) | undefined;
4212
+ toLocaleUpperCase?: {} | undefined;
4213
+ trim?: (() => string) | undefined;
4214
+ readonly length?: number | undefined;
4215
+ substr?: {} | undefined;
4216
+ valueOf?: (() => string) | undefined;
4217
+ codePointAt?: {} | undefined;
4218
+ includes?: {} | undefined;
4219
+ endsWith?: {} | undefined;
4220
+ normalize?: {} | undefined;
4221
+ repeat?: {} | undefined;
4222
+ startsWith?: {} | undefined;
4223
+ anchor?: {} | undefined;
4224
+ big?: (() => string) | undefined;
4225
+ blink?: (() => string) | undefined;
4226
+ bold?: (() => string) | undefined;
4227
+ fixed?: (() => string) | undefined;
4228
+ fontcolor?: {} | undefined;
4229
+ fontsize?: {} | undefined;
4230
+ italics?: (() => string) | undefined;
4231
+ link?: {} | undefined;
4232
+ small?: (() => string) | undefined;
4233
+ strike?: (() => string) | undefined;
4234
+ sub?: (() => string) | undefined;
4235
+ sup?: (() => string) | undefined;
4236
+ padStart?: {} | undefined;
4237
+ padEnd?: {} | undefined;
4238
+ trimEnd?: (() => string) | undefined;
4239
+ trimStart?: (() => string) | undefined;
4240
+ trimLeft?: (() => string) | undefined;
4241
+ trimRight?: (() => string) | undefined;
4242
+ matchAll?: {} | undefined;
4243
+ replaceAll?: {} | undefined;
4244
+ at?: {} | undefined;
4245
+ [Symbol.iterator]?: (() => StringIterator<string>) | undefined;
4246
+ })[] | undefined;
4247
+ additionalProperties?: {
4248
+ [x: string]: unknown;
4249
+ } | undefined;
3787
4250
  }>(override?: O | undefined) => Record<"anthropic/claude-sonnet-4.5", {
3788
4251
  name: string;
3789
4252
  capabilities: ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[];
@@ -43,6 +43,14 @@ export const claudeSonnet45 = presetFor()("anthropic/claude-sonnet-4.5", {
43
43
  created: "2025-09-29",
44
44
  knowledge: "2025-07",
45
45
  });
46
+ export const claudeSonnet46 = presetFor()("anthropic/claude-sonnet-4.6", {
47
+ ...CLAUDE_BASE,
48
+ ...CLAUDE_PDF_MODALITIES,
49
+ name: "Claude Sonnet 4.6",
50
+ capabilities: [...CLAUDE_BASE.capabilities, "reasoning"],
51
+ created: "2026-02-17",
52
+ knowledge: "2025-08",
53
+ });
46
54
  export const claudeSonnet4 = presetFor()("anthropic/claude-sonnet-4", {
47
55
  ...CLAUDE_BASE,
48
56
  ...CLAUDE_PDF_MODALITIES,
@@ -99,7 +107,7 @@ export const claudeOpus4 = presetFor()("anthropic/claude-opus-4", {
99
107
  knowledge: "2025-03",
100
108
  });
101
109
  const claudeAtomic = {
102
- "v4.6": [claudeOpus46],
110
+ "v4.6": [claudeSonnet46, claudeOpus46],
103
111
  "v4.5": [claudeHaiku45, claudeSonnet45, claudeOpus45],
104
112
  "v4.1": [claudeOpus41],
105
113
  v4: [claudeSonnet4, claudeOpus4],
@@ -107,7 +115,7 @@ const claudeAtomic = {
107
115
  "v3.5": [claudeSonnet35, claudeHaiku35],
108
116
  v3: [claudeHaiku3],
109
117
  haiku: [claudeHaiku45, claudeHaiku35, claudeHaiku3],
110
- sonnet: [claudeSonnet45, claudeSonnet4, claudeSonnet37, claudeSonnet35],
118
+ sonnet: [claudeSonnet46, claudeSonnet45, claudeSonnet4, claudeSonnet37, claudeSonnet35],
111
119
  opus: [claudeOpus46, claudeOpus45, claudeOpus41, claudeOpus4],
112
120
  };
113
121
  const claudeGroups = {
@@ -1,5 +1,5 @@
1
1
  import type { ProviderId } from "../providers/types";
2
- export declare const CANONICAL_MODEL_IDS: readonly ["anthropic/claude-opus-4.6", "anthropic/claude-haiku-4.5", "anthropic/claude-sonnet-4.5", "anthropic/claude-opus-4.5", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-3.7", "anthropic/claude-sonnet-3.5", "anthropic/claude-haiku-3.5", "anthropic/claude-haiku-3", "openai/gpt-oss-20b", "openai/gpt-oss-120b", "openai/gpt-5", "openai/gpt-5-pro", "openai/gpt-5.2", "openai/gpt-5.2-chat", "openai/gpt-5.2-pro", "openai/gpt-5.2-codex", "openai/gpt-5.3-codex", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-5-codex", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-max", "openai/gpt-5.1-chat", "openai/gpt-5.1", "openai/text-embedding-3-small", "openai/text-embedding-3-large", "amazon/nova-micro", "amazon/nova-lite", "amazon/nova-pro", "amazon/nova-premier", "amazon/nova-2-lite", "amazon/nova-2-multimodal-embeddings", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash", "google/gemini-2.5-pro", "google/gemini-3-flash-preview", "google/gemini-3-pro-preview", "google/embedding-001", "meta/llama-3.1-8b", "meta/llama-3.1-70b", "meta/llama-3.1-405b", "meta/llama-3.2-1b", "meta/llama-3.2-3b", "meta/llama-3.2-11b", "meta/llama-3.2-90b", "meta/llama-3.3-70b", "meta/llama-4-scout", "meta/llama-4-maverick", "cohere/embed-v4.0", "cohere/embed-english-v3.0", "cohere/embed-english-light-v3.0", "cohere/embed-multilingual-v3.0", "cohere/embed-multilingual-light-v3.0", "cohere/command-a", "cohere/command-r7b", "cohere/command-a-translate", "cohere/command-a-reasoning", "cohere/command-a-vision", "cohere/command-r", "cohere/command-r-plus", "voyage/voyage-2-code", "voyage/voyage-2-law", "voyage/voyage-2-finance", "voyage/voyage-3-code", "voyage/voyage-3-large", "voyage/voyage-3.5-lite", "voyage/voyage-3.5", "voyage/voyage-4-lite", "voyage/voyage-4", "voyage/voyage-4-large"];
2
+ export declare const CANONICAL_MODEL_IDS: readonly ["anthropic/claude-opus-4.6", "anthropic/claude-sonnet-4.6", "anthropic/claude-haiku-4.5", "anthropic/claude-sonnet-4.5", "anthropic/claude-opus-4.5", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-3.7", "anthropic/claude-sonnet-3.5", "anthropic/claude-haiku-3.5", "anthropic/claude-haiku-3", "openai/gpt-oss-20b", "openai/gpt-oss-120b", "openai/gpt-5", "openai/gpt-5-pro", "openai/gpt-5.2", "openai/gpt-5.2-chat", "openai/gpt-5.2-pro", "openai/gpt-5.2-codex", "openai/gpt-5.3-codex", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-5-codex", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-max", "openai/gpt-5.1-chat", "openai/gpt-5.1", "openai/text-embedding-3-small", "openai/text-embedding-3-large", "amazon/nova-micro", "amazon/nova-lite", "amazon/nova-pro", "amazon/nova-premier", "amazon/nova-2-lite", "amazon/nova-2-multimodal-embeddings", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash", "google/gemini-2.5-pro", "google/gemini-3-flash-preview", "google/gemini-3-pro-preview", "google/embedding-001", "meta/llama-3.1-8b", "meta/llama-3.1-70b", "meta/llama-3.1-405b", "meta/llama-3.2-1b", "meta/llama-3.2-3b", "meta/llama-3.2-11b", "meta/llama-3.2-90b", "meta/llama-3.3-70b", "meta/llama-4-scout", "meta/llama-4-maverick", "cohere/embed-v4.0", "cohere/embed-english-v3.0", "cohere/embed-english-light-v3.0", "cohere/embed-multilingual-v3.0", "cohere/embed-multilingual-light-v3.0", "cohere/command-a", "cohere/command-r7b", "cohere/command-a-translate", "cohere/command-a-reasoning", "cohere/command-a-vision", "cohere/command-r", "cohere/command-r-plus", "voyage/voyage-2-code", "voyage/voyage-2-law", "voyage/voyage-2-finance", "voyage/voyage-3-code", "voyage/voyage-3-large", "voyage/voyage-3.5-lite", "voyage/voyage-3.5", "voyage/voyage-4-lite", "voyage/voyage-4", "voyage/voyage-4-large"];
3
3
  export type CanonicalModelId = (typeof CANONICAL_MODEL_IDS)[number];
4
4
  export type ModelId = CanonicalModelId | (string & {});
5
5
  export type CatalogModel = {
@@ -1,6 +1,7 @@
1
1
  export const CANONICAL_MODEL_IDS = [
2
2
  // Anthropic
3
3
  "anthropic/claude-opus-4.6",
4
+ "anthropic/claude-sonnet-4.6",
4
5
  "anthropic/claude-haiku-4.5",
5
6
  "anthropic/claude-sonnet-4.5",
6
7
  "anthropic/claude-opus-4.5",
@@ -9,6 +9,7 @@ import { withCanonicalIds } from "../registry";
9
9
  const MAPPING = {
10
10
  // Require Inference Profiles and can't be resolved from standard name mapping
11
11
  "anthropic/claude-haiku-4.5": "{ip}anthropic.claude-haiku-4-5-20251001-v1:0",
12
+ "anthropic/claude-sonnet-4.6": "{ip}anthropic.claude-sonnet-4-6",
12
13
  "anthropic/claude-sonnet-4.5": "{ip}anthropic.claude-sonnet-4-5-20250929-v1:0",
13
14
  "anthropic/claude-opus-4.6": "{ip}anthropic.claude-opus-4-6-v1",
14
15
  "anthropic/claude-opus-4.5": "{ip}anthropic.claude-opus-4-5-20251101-v1:0",
@@ -1,4 +1,5 @@
1
1
  import { type Attributes } from "@opentelemetry/api";
2
2
  import type { TelemetrySignalLevel } from "../types";
3
- export declare const recordRequestDuration: (duration: number, attrs: Attributes, signalLevel?: TelemetrySignalLevel) => void;
3
+ export declare const recordRequestDuration: (start: number, attrs: Attributes, signalLevel?: TelemetrySignalLevel) => void;
4
+ export declare const recordTimePerOutputToken: (start: number, tokenAttrs: Attributes, metricAttrs: Attributes, signalLevel?: TelemetrySignalLevel) => void;
4
5
  export declare const recordTokenUsage: (tokenAttrs: Attributes, metricAttrs: Attributes, signalLevel?: TelemetrySignalLevel) => void;
@@ -1,5 +1,5 @@
1
1
  import { metrics } from "@opentelemetry/api";
2
- const meter = metrics.getMeter("@hebo-ai/gateway");
2
+ const meter = metrics.getMeter("@hebo/gateway");
3
3
  const requestDurationHistogram = meter.createHistogram("gen_ai.server.request.duration", {
4
4
  description: "End-to-end gateway request duration",
5
5
  unit: "s",
@@ -9,6 +9,15 @@ const requestDurationHistogram = meter.createHistogram("gen_ai.server.request.du
9
9
  ],
10
10
  },
11
11
  });
12
+ const timePerOutputTokenHistogram = meter.createHistogram("gen_ai.server.time_per_output_token", {
13
+ description: "End-to-end gateway request duration per output token",
14
+ unit: "s",
15
+ advice: {
16
+ explicitBucketBoundaries: [
17
+ 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.75, 1.0, 2.5,
18
+ ],
19
+ },
20
+ });
12
21
  const tokenUsageHistogram = meter.createHistogram("gen_ai.client.token.usage", {
13
22
  description: "Token usage reported by upstream model responses",
14
23
  unit: "{token}",
@@ -20,10 +29,19 @@ const tokenUsageHistogram = meter.createHistogram("gen_ai.client.token.usage", {
20
29
  },
21
30
  });
22
31
  // FUTURE: record unsuccessful calls
23
- export const recordRequestDuration = (duration, attrs, signalLevel) => {
32
+ export const recordRequestDuration = (start, attrs, signalLevel) => {
24
33
  if (!signalLevel || signalLevel === "off")
25
34
  return;
26
- requestDurationHistogram.record(duration / 1000, attrs);
35
+ requestDurationHistogram.record((performance.now() - start) / 1000, attrs);
36
+ };
37
+ // FUTURE: record unsuccessful calls
38
+ export const recordTimePerOutputToken = (start, tokenAttrs, metricAttrs, signalLevel) => {
39
+ if (!signalLevel || (signalLevel !== "recommended" && signalLevel !== "full"))
40
+ return;
41
+ const outputTokens = tokenAttrs["gen_ai.usage.output_tokens"];
42
+ if (typeof outputTokens !== "number" || outputTokens <= 0)
43
+ return;
44
+ timePerOutputTokenHistogram.record((performance.now() - start) / 1000 / outputTokens, metricAttrs);
27
45
  };
28
46
  // FUTURE: record unsuccessful calls
29
47
  export const recordTokenUsage = (tokenAttrs, metricAttrs, signalLevel) => {
@@ -0,0 +1,2 @@
1
+ import type { TelemetrySignalLevel } from "../types";
2
+ export declare const recordV8jsMemory: (level?: TelemetrySignalLevel) => void;
@@ -0,0 +1,27 @@
1
+ import { metrics } from "@opentelemetry/api";
2
+ const meter = metrics.getMeter("@hebo/gateway");
3
+ const defaultHeapSpaceAttrs = { "v8js.heap.space.name": "total" };
4
+ const heapUsedCounter = meter.createUpDownCounter("v8js.memory.heap.used", {
5
+ description: "Used bytes in the V8 heap",
6
+ unit: "By",
7
+ });
8
+ const heapSpacePhysicalSizeCounter = meter.createUpDownCounter("v8js.memory.heap.space.physical_size", {
9
+ description: "Physical bytes allocated for the V8 heap space",
10
+ unit: "By",
11
+ });
12
+ const isEnabled = (level) => level === "recommended" || level === "full";
13
+ export const recordV8jsMemory = (level) => {
14
+ if (!isEnabled(level))
15
+ return;
16
+ let usage;
17
+ try {
18
+ usage = globalThis.process?.memoryUsage?.();
19
+ }
20
+ catch {
21
+ return;
22
+ }
23
+ if (!usage)
24
+ return;
25
+ heapUsedCounter.add(usage.heapUsed, defaultHeapSpaceAttrs);
26
+ heapSpacePhysicalSizeCounter.add(usage.rss, defaultHeapSpaceAttrs);
27
+ };
@@ -1,5 +1,5 @@
1
1
  import { INVALID_SPAN_CONTEXT, SpanKind, SpanStatusCode, context, trace } from "@opentelemetry/api";
2
- const DEFAULT_TRACER_NAME = "@hebo-ai/gateway";
2
+ const DEFAULT_TRACER_NAME = "@hebo/gateway";
3
3
  let spanTracer;
4
4
  let spanEventsEnabled = false;
5
5
  const NOOP_SPAN = {