@axemere/gateway 0.1.6 → 0.1.8

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.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare class AiGatewayClient {
32
32
  * @param params - Request parameters: messages plus optional provider, model,
33
33
  * attribution fields, delegation token, and provider-specific passthrough.
34
34
  * @returns The completed response, or a stream of chunks when `stream: true`.
35
- * @throws {GatewayError} On missing config (gateway_url/provider/model),
35
+ * @throws {GatewayError} On missing config (provider/model),
36
36
  * network failure, or non-OK gateway/provider status.
37
37
  * @throws {PolicyDeniedError} When the gateway denies the request by policy.
38
38
  * @throws {QuotaExceededError} When a spend/quota limit is exceeded (HTTP 429).
package/dist/client.js CHANGED
@@ -27,9 +27,6 @@ class AiGatewayClient {
27
27
  this.config = config;
28
28
  }
29
29
  async execute(params) {
30
- if (!this.config.gateway_url) {
31
- throw new errors_1.GatewayError("gateway_url is required; set AXEMERE_GATEWAY_URL or pass it to AiGatewayConfig");
32
- }
33
30
  const provider = params.provider ?? this.config.default_provider;
34
31
  const model = params.model ?? this.config.default_model;
35
32
  if (!provider) {
@@ -54,6 +51,7 @@ class AiGatewayClient {
54
51
  const provider_params = {
55
52
  model,
56
53
  messages,
54
+ max_tokens: extra_params["max_tokens"] ?? 256,
57
55
  ...extra_params,
58
56
  };
59
57
  if (stream) {
package/dist/config.d.ts CHANGED
@@ -19,6 +19,10 @@ export interface AiGatewayOptions {
19
19
  * safe default. Values are read once at construction time. Also builds the
20
20
  * proxy base URL used by the OpenAI/Anthropic drop-in wrappers.
21
21
  *
22
+ * `gateway_url` defaults to `"http://localhost:7080"` when neither the option
23
+ * nor `AXEMERE_GATEWAY_URL` is set, matching the Python SDK behaviour so local
24
+ * development works without any `.env` configuration.
25
+ *
22
26
  * @example
23
27
  * ```ts
24
28
  * // From env (AXEMERE_GATEWAY_URL, AXEMERE_GATEWAY_TOKEN, ...)
package/dist/config.js CHANGED
@@ -25,6 +25,10 @@ function parseLabelsEnv(raw) {
25
25
  * safe default. Values are read once at construction time. Also builds the
26
26
  * proxy base URL used by the OpenAI/Anthropic drop-in wrappers.
27
27
  *
28
+ * `gateway_url` defaults to `"http://localhost:7080"` when neither the option
29
+ * nor `AXEMERE_GATEWAY_URL` is set, matching the Python SDK behaviour so local
30
+ * development works without any `.env` configuration.
31
+ *
28
32
  * @example
29
33
  * ```ts
30
34
  * // From env (AXEMERE_GATEWAY_URL, AXEMERE_GATEWAY_TOKEN, ...)
@@ -37,7 +41,7 @@ class AiGatewayConfig {
37
41
  constructor(opts = {}) {
38
42
  // Constructor args take precedence over env vars (read at construction time).
39
43
  this.gateway_url =
40
- opts.gateway_url ?? process.env["AXEMERE_GATEWAY_URL"] ?? "";
44
+ opts.gateway_url ?? process.env["AXEMERE_GATEWAY_URL"] ?? "http://localhost:7080";
41
45
  this.gateway_token =
42
46
  opts.gateway_token ?? process.env["AXEMERE_GATEWAY_TOKEN"] ?? "";
43
47
  this.default_provider =
package/dist/types.d.ts CHANGED
@@ -38,6 +38,15 @@ export interface StreamChunk {
38
38
  record_id?: string;
39
39
  metering?: Metering;
40
40
  }
41
+ /**
42
+ * Parameters for {@link AiGatewayClient.execute}.
43
+ *
44
+ * Any extra keys beyond the named fields are forwarded verbatim to the
45
+ * provider as `provider_params`. Notable passthrough field:
46
+ *
47
+ * - `max_tokens` — defaults to `256` when omitted (Anthropic requires this
48
+ * field and rejects requests without it). Pass an explicit value to override.
49
+ */
41
50
  export interface ExecuteParams {
42
51
  messages: Message[];
43
52
  provider?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axemere/gateway",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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",