@axemere/gateway 0.1.10 → 0.2.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.
package/dist/client.js CHANGED
@@ -39,6 +39,10 @@ class AiGatewayClient {
39
39
  if (!route) {
40
40
  throw new errors_1.GatewayError(`unknown provider: ${provider}`);
41
41
  }
42
+ const target_host = params.target_host ?? route.host;
43
+ if (!target_host) {
44
+ throw new errors_1.GatewayError(`provider "${provider}" has no default host; pass target_host explicitly`);
45
+ }
42
46
  const workload_id = params.workload_id ?? this.config.workload_id;
43
47
  const project_id = params.project_id ?? this.config.project_id;
44
48
  const account_id = params.account_id ?? this.config.account_id;
@@ -47,7 +51,7 @@ class AiGatewayClient {
47
51
  const provider_api_key = params.provider_api_key ?? this.config.provider_api_key;
48
52
  const target_path = route.path.replace("{model}", model);
49
53
  // Build provider_params: strip known SDK fields, pass remaining through.
50
- const { messages, provider: _p, model: _m, workload_id: _wl, project_id: _pi, account_id: _ai, customer_id: _ci, labels: _lb, provider_api_key: _pak, delegation_token, stream, ...extra_params } = params;
54
+ const { messages, provider: _p, model: _m, target_host: _th, workload_id: _wl, project_id: _pi, account_id: _ai, customer_id: _ci, labels: _lb, provider_api_key: _pak, delegation_token, stream, ...extra_params } = params;
51
55
  const provider_params = {
52
56
  model,
53
57
  messages,
@@ -65,9 +69,9 @@ class AiGatewayClient {
65
69
  workload_id: workload_id ?? "",
66
70
  ingress_mode: "explicit_action_request",
67
71
  action: {
68
- type: "llm_chat",
72
+ type: "ai.infer",
69
73
  method: "POST",
70
- target_host: route.host,
74
+ target_host,
71
75
  target_path,
72
76
  params: provider_params,
73
77
  },
@@ -1,5 +1,14 @@
1
+ /**
2
+ * Host, path, and body-shaping format for each provider the gateway routes to.
3
+ *
4
+ * Values must match the MVGC gateway's provider registry
5
+ * (`internal/types/provider_registry.go` `Hosts[0]`) and `openai_compat`
6
+ * profiles exactly — a wrong host is denied by auto-policy, a wrong path
7
+ * 404s upstream.
8
+ */
1
9
  export interface ProviderRoute {
2
10
  host: string;
3
11
  path: string;
12
+ format: "openai" | "anthropic" | "gemini";
4
13
  }
5
14
  export declare const PROVIDER_ROUTES: Record<string, ProviderRoute>;
package/dist/providers.js CHANGED
@@ -2,21 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROVIDER_ROUTES = void 0;
4
4
  exports.PROVIDER_ROUTES = {
5
- openai: { host: "api.openai.com", path: "/v1/chat/completions" },
6
- anthropic: { host: "api.anthropic.com", path: "/v1/messages" },
7
- gemini: { host: "generativelanguage.googleapis.com", path: "/v1beta/models/{model}:generateContent" },
8
- cohere: { host: "api.cohere.com", path: "/v2/chat" },
9
- mistral: { host: "api.mistral.ai", path: "/v1/chat/completions" },
10
- groq: { host: "api.groq.com", path: "/openai/v1/chat/completions" },
11
- deepseek: { host: "api.deepseek.com", path: "/v1/chat/completions" },
12
- together: { host: "api.together.ai", path: "/v1/chat/completions" },
13
- minimax: { host: "api.minimax.chat", path: "/v1/text/chatcompletion_v2" },
14
- moonshot: { host: "api.moonshot.ai", path: "/v1/chat/completions" },
15
- zhipu: { host: "api.z.ai", path: "/api/paas/v4/chat/completions" },
16
- xai: { host: "api.x.ai", path: "/v1/chat/completions" },
17
- perplexity: { host: "api.perplexity.ai", path: "/chat/completions" },
18
- openrouter: { host: "openrouter.ai", path: "/api/v1/chat/completions" },
19
- "nvidia-nim": { host: "integrate.api.nvidia.com", path: "/v1/chat/completions" },
20
- upstage: { host: "api.upstage.ai", path: "/v1/chat/completions" },
21
- fireworks: { host: "api.fireworks.ai", path: "/inference/v1/chat/completions" },
5
+ openai: { host: "api.openai.com", path: "/v1/chat/completions", format: "openai" },
6
+ anthropic: { host: "api.anthropic.com", path: "/v1/messages", format: "anthropic" },
7
+ gemini: { host: "generativelanguage.googleapis.com", path: "/v1beta/models/{model}:generateContent", format: "gemini" },
8
+ google: { host: "generativelanguage.googleapis.com", path: "/v1beta/models/{model}:generateContent", format: "gemini" },
9
+ cohere: { host: "api.cohere.com", path: "/v2/chat", format: "openai" },
10
+ mistral: { host: "api.mistral.ai", path: "/v1/chat/completions", format: "openai" },
11
+ groq: { host: "api.groq.com", path: "/openai/v1/chat/completions", format: "openai" },
12
+ deepseek: { host: "api.deepseek.com", path: "/v1/chat/completions", format: "openai" },
13
+ together: { host: "api.together.ai", path: "/v1/chat/completions", format: "openai" },
14
+ minimax: { host: "api.minimax.io", path: "/v1/chat/completions", format: "openai" },
15
+ moonshot: { host: "api.moonshot.ai", path: "/v1/chat/completions", format: "openai" },
16
+ zhipu: { host: "api.z.ai", path: "/api/paas/v4/chat/completions", format: "openai" },
17
+ xai: { host: "api.x.ai", path: "/v1/chat/completions", format: "openai" },
18
+ perplexity: { host: "api.perplexity.ai", path: "/chat/completions", format: "openai" },
19
+ openrouter: { host: "openrouter.ai", path: "/api/v1/chat/completions", format: "openai" },
20
+ "nvidia-nim": { host: "integrate.api.nvidia.com", path: "/v1/chat/completions", format: "openai" },
21
+ upstage: { host: "api.upstage.ai", path: "/v1/chat/completions", format: "openai" },
22
+ fireworks: { host: "api.fireworks.ai", path: "/inference/v1/chat/completions", format: "openai" },
23
+ qwen: { host: "dashscope-intl.aliyuncs.com", path: "/v1/chat/completions", format: "openai" },
24
+ bytedance: { host: "ark.cn-beijing.volces.com", path: "/api/v3/chat/completions", format: "openai" },
25
+ stepfun: { host: "api.stepfun.com", path: "/v1/chat/completions", format: "openai" },
26
+ bedrock: { host: "bedrock-runtime.us-east-1.amazonaws.com", path: "", format: "openai" },
27
+ vertex: { host: "us-central1-aiplatform.googleapis.com", path: "", format: "openai" },
28
+ // azure_openai has no static host — the registry gives only HostSuffixes,
29
+ // so callers must supply target_host explicitly.
30
+ azure_openai: { host: "", path: "/v1/chat/completions", format: "openai" },
22
31
  };
package/dist/types.d.ts CHANGED
@@ -51,6 +51,12 @@ export interface ExecuteParams {
51
51
  messages: Message[];
52
52
  provider?: string;
53
53
  model?: string;
54
+ /**
55
+ * Overrides the provider's registry host. Required for `azure_openai`,
56
+ * which has no static host; optional passthrough for every other
57
+ * provider.
58
+ */
59
+ target_host?: string;
54
60
  workload_id?: string;
55
61
  project_id?: string;
56
62
  account_id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axemere/gateway",
3
- "version": "0.1.10",
3
+ "version": "0.2.1",
4
4
  "description": "Axemere AI Gateway SDK — core client, config, and proxy URL builder",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",