@hebo-ai/gateway 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/endpoints/messages/otel.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/models/types.d.ts +1 -1
- package/dist/models/types.js +1 -0
- package/dist/models/xai/middleware.js +6 -1
- package/dist/models/xai/presets.d.ts +36 -23
- package/dist/models/xai/presets.js +9 -1
- package/dist/providers/xai/canonical.js +1 -0
- package/dist/telemetry/gen-ai.js +2 -2
- package/dist/utils/headers.d.ts +1 -0
- package/dist/utils/headers.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -251,7 +251,7 @@ Out-of-the-box model presets:
|
|
|
251
251
|
Voyage: `voyage` (`v2`, `v3`, `v3.5`, `v4`, `v2.x`, `v3.x`, `v4.x`, `latest`, `all`)
|
|
252
252
|
|
|
253
253
|
- **xAI** — `@hebo-ai/gateway/models/xai`
|
|
254
|
-
Grok: `grok` (`v4.1`, `v4.2`, `latest`, `all`)
|
|
254
|
+
Grok: `grok` (`v4.1`, `v4.2`, `v4.3`, `latest`, `all`)
|
|
255
255
|
|
|
256
256
|
- **Z.ai** — `@hebo-ai/gateway/models/zai`
|
|
257
257
|
GLM: `glm` (`v5`, `v5.1`, `v5.x`, `latest`, `all`)
|
|
@@ -102,7 +102,6 @@ export const getMessagesRequestAttributes = (body, signalLevel) => {
|
|
|
102
102
|
if (signalLevel !== "required") {
|
|
103
103
|
Object.assign(attrs, {
|
|
104
104
|
"gen_ai.request.stream": body.stream,
|
|
105
|
-
"gen_ai.request.service_tier": body.service_tier,
|
|
106
105
|
"gen_ai.request.max_tokens": body.max_tokens,
|
|
107
106
|
"gen_ai.request.temperature": body.temperature,
|
|
108
107
|
"gen_ai.request.top_p": body.top_p,
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export * from "./models/catalog";
|
|
|
10
10
|
export * from "./models/types";
|
|
11
11
|
export * from "./providers/registry";
|
|
12
12
|
export * from "./providers/types";
|
|
13
|
-
export { FORWARD_HEADER_ALLOWLIST } from "./utils";
|
|
13
|
+
export { FORWARD_HEADER_ALLOWLIST, RESPONSE_HEADER_ALLOWLIST } from "./utils";
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,4 @@ export * from "./models/catalog";
|
|
|
9
9
|
export * from "./models/types";
|
|
10
10
|
export * from "./providers/registry";
|
|
11
11
|
export * from "./providers/types";
|
|
12
|
-
export { FORWARD_HEADER_ALLOWLIST } from "./utils";
|
|
12
|
+
export { FORWARD_HEADER_ALLOWLIST, RESPONSE_HEADER_ALLOWLIST } from "./utils";
|
package/dist/models/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderId } from "../providers/types";
|
|
2
|
-
export declare const CANONICAL_MODEL_IDS: readonly ["anthropic/claude-opus-4.7", "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.3-codex-spark", "openai/gpt-5.3-chat", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.4-nano", "openai/gpt-5.4-pro", "openai/gpt-5.5", "openai/gpt-5.5-pro", "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-codex-mini", "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.1-flash-lite-preview", "google/gemini-3.1-pro-preview", "google/gemini-embedding-2", "google/embedding-001", "google/gemma-3-1b", "google/gemma-3-4b", "google/gemma-3-12b", "google/gemma-3-27b", "google/gemma-4-e2b", "google/gemma-4-e4b", "google/gemma-4-26b-a4b", "google/gemma-4-31b", "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", "minimax/m2.5", "minimax/m2.7", "moonshot/kimi-k2.5", "moonshot/kimi-k2.6", "xai/grok-4.1-fast", "xai/grok-4.1-fast-reasoning", "xai/grok-4.2", "xai/grok-4.2-reasoning", "xai/grok-4.2-multi-agent", "deepseek/deepseek-v3.2", "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", "alibaba/qwen3-235b", "alibaba/qwen3-32b", "alibaba/qwen3.5-plus", "alibaba/qwen3.5-flash", "alibaba/qwen3.5-397b", "alibaba/qwen3.5-122b", "alibaba/qwen3.5-35b", "alibaba/qwen3.5-27b", "alibaba/qwen3.5-9b", "alibaba/qwen3.5-4b", "alibaba/qwen3.5-2b", "alibaba/qwen3.5-0.8b", "alibaba/qwen3.6-plus", "alibaba/qwen3.6-flash", "alibaba/qwen3.6-27b", "alibaba/qwen3.6-max-preview", "alibaba/qwen3-coder-next", "alibaba/qwen3-vl-235b", "alibaba/qwen3-embedding-0.6b", "alibaba/qwen3-embedding-4b", "alibaba/qwen3-embedding-8b", "zhipu/glm-5", "zhipu/glm-5-turbo", "zhipu/glm-5.1"];
|
|
2
|
+
export declare const CANONICAL_MODEL_IDS: readonly ["anthropic/claude-opus-4.7", "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.3-codex-spark", "openai/gpt-5.3-chat", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.4-nano", "openai/gpt-5.4-pro", "openai/gpt-5.5", "openai/gpt-5.5-pro", "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-codex-mini", "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.1-flash-lite-preview", "google/gemini-3.1-pro-preview", "google/gemini-embedding-2", "google/embedding-001", "google/gemma-3-1b", "google/gemma-3-4b", "google/gemma-3-12b", "google/gemma-3-27b", "google/gemma-4-e2b", "google/gemma-4-e4b", "google/gemma-4-26b-a4b", "google/gemma-4-31b", "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", "minimax/m2.5", "minimax/m2.7", "moonshot/kimi-k2.5", "moonshot/kimi-k2.6", "xai/grok-4.1-fast", "xai/grok-4.1-fast-reasoning", "xai/grok-4.2", "xai/grok-4.2-reasoning", "xai/grok-4.2-multi-agent", "xai/grok-4.3", "deepseek/deepseek-v3.2", "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", "alibaba/qwen3-235b", "alibaba/qwen3-32b", "alibaba/qwen3.5-plus", "alibaba/qwen3.5-flash", "alibaba/qwen3.5-397b", "alibaba/qwen3.5-122b", "alibaba/qwen3.5-35b", "alibaba/qwen3.5-27b", "alibaba/qwen3.5-9b", "alibaba/qwen3.5-4b", "alibaba/qwen3.5-2b", "alibaba/qwen3.5-0.8b", "alibaba/qwen3.6-plus", "alibaba/qwen3.6-flash", "alibaba/qwen3.6-27b", "alibaba/qwen3.6-max-preview", "alibaba/qwen3-coder-next", "alibaba/qwen3-vl-235b", "alibaba/qwen3-embedding-0.6b", "alibaba/qwen3-embedding-4b", "alibaba/qwen3-embedding-8b", "zhipu/glm-5", "zhipu/glm-5-turbo", "zhipu/glm-5.1"];
|
|
3
3
|
export type CanonicalModelId = (typeof CANONICAL_MODEL_IDS)[number];
|
|
4
4
|
export type ModelId = CanonicalModelId | (string & {});
|
|
5
5
|
export type CatalogModel = {
|
package/dist/models/types.js
CHANGED
|
@@ -34,4 +34,9 @@ export const xaiReasoningMiddleware = {
|
|
|
34
34
|
return params;
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
modelMiddlewareMatcher.useForModel([
|
|
37
|
+
modelMiddlewareMatcher.useForModel([
|
|
38
|
+
"xai/grok-4.1-fast-reasoning",
|
|
39
|
+
"xai/grok-4.2-reasoning",
|
|
40
|
+
"xai/grok-4.2-multi-agent",
|
|
41
|
+
"xai/grok-4.3",
|
|
42
|
+
], { language: [xaiReasoningMiddleware] });
|
|
@@ -59,40 +59,30 @@ export declare const grok42MultiAgent: import("../../utils").Preset<"xai/grok-4.
|
|
|
59
59
|
providers: readonly ["xai"];
|
|
60
60
|
context: number;
|
|
61
61
|
}>;
|
|
62
|
+
export declare const grok43: import("../../utils").Preset<"xai/grok-4.3", CatalogModel, {
|
|
63
|
+
name: string;
|
|
64
|
+
created: string;
|
|
65
|
+
knowledge: string;
|
|
66
|
+
context: number;
|
|
67
|
+
capabilities: readonly ["tool_call", "structured_output", "reasoning", "temperature"];
|
|
68
|
+
modalities: {
|
|
69
|
+
input: readonly ["text", "image"];
|
|
70
|
+
output: readonly ["text"];
|
|
71
|
+
};
|
|
72
|
+
providers: readonly ["xai"];
|
|
73
|
+
}>;
|
|
62
74
|
export declare const grok: {
|
|
63
|
-
readonly latest: readonly [import("../../utils").Preset<"xai/grok-4.
|
|
75
|
+
readonly latest: readonly [import("../../utils").Preset<"xai/grok-4.3", CatalogModel, {
|
|
64
76
|
name: string;
|
|
65
77
|
created: string;
|
|
66
78
|
knowledge: string;
|
|
67
|
-
modalities: {
|
|
68
|
-
input: readonly ["text", "image"];
|
|
69
|
-
output: readonly ["text"];
|
|
70
|
-
};
|
|
71
|
-
capabilities: readonly ["tool_call", "structured_output", "temperature"];
|
|
72
|
-
providers: readonly ["xai"];
|
|
73
|
-
context: number;
|
|
74
|
-
}>, import("../../utils").Preset<"xai/grok-4.2-reasoning", CatalogModel, {
|
|
75
|
-
name: string;
|
|
76
|
-
created: string;
|
|
77
|
-
knowledge: string;
|
|
78
|
-
capabilities: readonly ["tool_call", "structured_output", "reasoning", "temperature"];
|
|
79
|
-
modalities: {
|
|
80
|
-
input: readonly ["text", "image"];
|
|
81
|
-
output: readonly ["text"];
|
|
82
|
-
};
|
|
83
|
-
providers: readonly ["xai"];
|
|
84
79
|
context: number;
|
|
85
|
-
}>, import("../../utils").Preset<"xai/grok-4.2-multi-agent", CatalogModel, {
|
|
86
|
-
name: string;
|
|
87
|
-
created: string;
|
|
88
|
-
knowledge: string;
|
|
89
80
|
capabilities: readonly ["tool_call", "structured_output", "reasoning", "temperature"];
|
|
90
81
|
modalities: {
|
|
91
82
|
input: readonly ["text", "image"];
|
|
92
83
|
output: readonly ["text"];
|
|
93
84
|
};
|
|
94
85
|
providers: readonly ["xai"];
|
|
95
|
-
context: number;
|
|
96
86
|
}>];
|
|
97
87
|
readonly all: (import("../../utils").Preset<"xai/grok-4.1-fast", CatalogModel, {
|
|
98
88
|
name: string;
|
|
@@ -149,6 +139,17 @@ export declare const grok: {
|
|
|
149
139
|
};
|
|
150
140
|
providers: readonly ["xai"];
|
|
151
141
|
context: number;
|
|
142
|
+
}> | import("../../utils").Preset<"xai/grok-4.3", CatalogModel, {
|
|
143
|
+
name: string;
|
|
144
|
+
created: string;
|
|
145
|
+
knowledge: string;
|
|
146
|
+
context: number;
|
|
147
|
+
capabilities: readonly ["tool_call", "structured_output", "reasoning", "temperature"];
|
|
148
|
+
modalities: {
|
|
149
|
+
input: readonly ["text", "image"];
|
|
150
|
+
output: readonly ["text"];
|
|
151
|
+
};
|
|
152
|
+
providers: readonly ["xai"];
|
|
152
153
|
}>)[];
|
|
153
154
|
readonly "v4.1": readonly [import("../../utils").Preset<"xai/grok-4.1-fast", CatalogModel, {
|
|
154
155
|
name: string;
|
|
@@ -207,4 +208,16 @@ export declare const grok: {
|
|
|
207
208
|
providers: readonly ["xai"];
|
|
208
209
|
context: number;
|
|
209
210
|
}>];
|
|
211
|
+
readonly "v4.3": readonly [import("../../utils").Preset<"xai/grok-4.3", CatalogModel, {
|
|
212
|
+
name: string;
|
|
213
|
+
created: string;
|
|
214
|
+
knowledge: string;
|
|
215
|
+
context: number;
|
|
216
|
+
capabilities: readonly ["tool_call", "structured_output", "reasoning", "temperature"];
|
|
217
|
+
modalities: {
|
|
218
|
+
input: readonly ["text", "image"];
|
|
219
|
+
output: readonly ["text"];
|
|
220
|
+
};
|
|
221
|
+
providers: readonly ["xai"];
|
|
222
|
+
}>];
|
|
210
223
|
};
|
|
@@ -42,14 +42,22 @@ export const grok42MultiAgent = presetFor()("xai/grok-4.2-multi-agent", {
|
|
|
42
42
|
created: "2026-03-16",
|
|
43
43
|
knowledge: "2024-11",
|
|
44
44
|
});
|
|
45
|
+
export const grok43 = presetFor()("xai/grok-4.3", {
|
|
46
|
+
...GROK_REASONING_BASE,
|
|
47
|
+
name: "Grok 4.3",
|
|
48
|
+
created: "2026-05-01",
|
|
49
|
+
knowledge: "2024-11",
|
|
50
|
+
context: 1000000,
|
|
51
|
+
});
|
|
45
52
|
const grokAtomic = {
|
|
46
53
|
"v4.1": [grok41Fast, grok41FastReasoning],
|
|
47
54
|
"v4.2": [grok42, grok42Reasoning, grok42MultiAgent],
|
|
55
|
+
"v4.3": [grok43],
|
|
48
56
|
};
|
|
49
57
|
const grokGroups = {};
|
|
50
58
|
export const grok = {
|
|
51
59
|
...grokAtomic,
|
|
52
60
|
...grokGroups,
|
|
53
|
-
latest: [
|
|
61
|
+
latest: [grok43],
|
|
54
62
|
all: Object.values(grokAtomic).flat(),
|
|
55
63
|
};
|
|
@@ -5,6 +5,7 @@ const MAPPING = {
|
|
|
5
5
|
"xai/grok-4.2": "grok-4.20-0309-non-reasoning",
|
|
6
6
|
"xai/grok-4.2-reasoning": "grok-4.20-0309-reasoning",
|
|
7
7
|
"xai/grok-4.2-multi-agent": "grok-4.20-multi-agent-0309",
|
|
8
|
+
"xai/grok-4.3": "grok-4.3",
|
|
8
9
|
};
|
|
9
10
|
export const withCanonicalIdsForXai = (provider, extraMapping) => withCanonicalIds(provider, {
|
|
10
11
|
mapping: { ...MAPPING, ...extraMapping },
|
package/dist/telemetry/gen-ai.js
CHANGED
|
@@ -55,14 +55,14 @@ export const getGenAiGeneralAttributes = (ctx, signalLevel) => {
|
|
|
55
55
|
if (!signalLevel || signalLevel === "off")
|
|
56
56
|
return {};
|
|
57
57
|
const requestModel = typeof ctx.body?.model === "string" ? ctx.body.model : ctx.modelId;
|
|
58
|
-
const serviceTier = typeof ctx.body?.service_tier === "string" ? ctx.body.service_tier :
|
|
58
|
+
const serviceTier = typeof ctx.body?.service_tier === "string" ? ctx.body.service_tier : "auto";
|
|
59
59
|
const attrs = {
|
|
60
60
|
"gen_ai.operation.name": ctx.operation,
|
|
61
61
|
"gen_ai.request.model": requestModel,
|
|
62
62
|
"gen_ai.response.model": ctx.resolvedModelId,
|
|
63
63
|
"gen_ai.provider.name": ctx.resolvedProviderId,
|
|
64
64
|
};
|
|
65
|
-
if (signalLevel !== "required"
|
|
65
|
+
if (signalLevel !== "required") {
|
|
66
66
|
attrs["gen_ai.request.service_tier"] = serviceTier;
|
|
67
67
|
}
|
|
68
68
|
for (const [key, value] of Object.entries(ctx.otel)) {
|
package/dist/utils/headers.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const REQUEST_ID_HEADER = "x-request-id";
|
|
|
2
2
|
export declare const RETRY_AFTER_HEADER = "retry-after";
|
|
3
3
|
export declare const RETRY_AFTER_MS_HEADER = "retry-after-ms";
|
|
4
4
|
export declare const X_SHOULD_RETRY_HEADER = "x-should-retry";
|
|
5
|
+
export declare const RESPONSE_HEADER_ALLOWLIST: readonly ["retry-after", "retry-after-ms", "x-should-retry"];
|
|
5
6
|
type HeaderSource = Request | ResponseInit | undefined;
|
|
6
7
|
export declare const resolveRequestId: (source: HeaderSource) => string | undefined;
|
|
7
8
|
export declare const filterResponseHeaders: (upstream?: HeadersInit) => Record<string, string>;
|
package/dist/utils/headers.js
CHANGED
|
@@ -2,7 +2,7 @@ export const REQUEST_ID_HEADER = "x-request-id";
|
|
|
2
2
|
export const RETRY_AFTER_HEADER = "retry-after";
|
|
3
3
|
export const RETRY_AFTER_MS_HEADER = "retry-after-ms";
|
|
4
4
|
export const X_SHOULD_RETRY_HEADER = "x-should-retry";
|
|
5
|
-
const RESPONSE_HEADER_ALLOWLIST = [
|
|
5
|
+
export const RESPONSE_HEADER_ALLOWLIST = [
|
|
6
6
|
RETRY_AFTER_HEADER,
|
|
7
7
|
RETRY_AFTER_MS_HEADER,
|
|
8
8
|
X_SHOULD_RETRY_HEADER,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebo-ai/gateway",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
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",
|