@openclaw/venice-provider 2026.7.1-beta.2 → 2026.7.1-beta.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.
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as discoverVeniceModels, i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-BKami47m.js";
1
+ import { a as discoverVeniceModels, i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-C5WznQTA.js";
2
2
  import { buildVeniceProvider } from "./provider-catalog.js";
3
3
  export { VENICE_BASE_URL, VENICE_DEFAULT_MODEL_REF, VENICE_MODEL_CATALOG, buildVeniceModelDefinition, buildVeniceProvider, discoverVeniceModels };
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import { n as VENICE_DEFAULT_MODEL_REF } from "./models-BKami47m.js";
1
+ import { n as VENICE_DEFAULT_MODEL_REF } from "./models-C5WznQTA.js";
2
2
  import { buildVeniceProvider } from "./provider-catalog.js";
3
3
  import { applyVeniceConfig } from "./onboard.js";
4
4
  import { createVeniceDeepSeekV4Wrapper } from "./stream.js";
5
+ import { fetchVeniceUsage } from "./usage.js";
5
6
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
6
7
  import { applyModelCompatPatch } from "openclaw/plugin-sdk/provider-model-shared";
7
8
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -53,7 +54,16 @@ var venice_default = defineSingleProviderPluginEntry({
53
54
  }],
54
55
  catalog: { buildProvider: buildVeniceProvider },
55
56
  normalizeResolvedModel: ({ modelId, model }) => isXaiBackedVeniceModel(modelId) ? applyXaiModelCompat(model) : void 0,
56
- wrapStreamFn: (ctx) => createVeniceDeepSeekV4Wrapper(ctx.streamFn, ctx.thinkingLevel)
57
+ wrapStreamFn: (ctx) => createVeniceDeepSeekV4Wrapper(ctx.streamFn, ctx.thinkingLevel),
58
+ resolveUsageAuth: async (ctx) => {
59
+ const apiKey = ctx.resolveApiKeyFromConfigAndStore({ envDirect: [ctx.env.VENICE_API_KEY] });
60
+ return apiKey ? { token: apiKey } : null;
61
+ },
62
+ fetchUsageSnapshot: async (ctx) => await fetchVeniceUsage({
63
+ token: ctx.token,
64
+ timeoutMs: ctx.timeoutMs,
65
+ fetchFn: ctx.fetchFn
66
+ })
57
67
  }
58
68
  });
59
69
  //#endregion
@@ -384,7 +384,7 @@ const VENICE_DEFAULT_MAX_TOKENS = 4096;
384
384
  const VENICE_DISCOVERY_HARD_MAX_TOKENS = 131072;
385
385
  const VENICE_DISCOVERY_TIMEOUT_MS = 1e4;
386
386
  const VENICE_DISCOVERY_CACHE_TTL_MS = 6e4;
387
- const VENICE_DISCOVERY_RETRYABLE_HTTP_STATUS = new Set([
387
+ const VENICE_DISCOVERY_RETRYABLE_HTTP_STATUS = /* @__PURE__ */ new Set([
388
388
  408,
389
389
  425,
390
390
  429,
@@ -393,7 +393,7 @@ const VENICE_DISCOVERY_RETRYABLE_HTTP_STATUS = new Set([
393
393
  503,
394
394
  504
395
395
  ]);
396
- const VENICE_DISCOVERY_RETRYABLE_NETWORK_CODES = new Set([
396
+ const VENICE_DISCOVERY_RETRYABLE_NETWORK_CODES = /* @__PURE__ */ new Set([
397
397
  "ECONNABORTED",
398
398
  "ECONNREFUSED",
399
399
  "ECONNRESET",
package/dist/models.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as discoverVeniceModels, i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-BKami47m.js";
1
+ import { a as discoverVeniceModels, i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-C5WznQTA.js";
2
2
  export { VENICE_BASE_URL, VENICE_DEFAULT_MODEL_REF, VENICE_MODEL_CATALOG, buildVeniceModelDefinition, discoverVeniceModels };
package/dist/onboard.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-BKami47m.js";
1
+ import { i as buildVeniceModelDefinition, n as VENICE_DEFAULT_MODEL_REF, r as VENICE_MODEL_CATALOG, t as VENICE_BASE_URL } from "./models-C5WznQTA.js";
2
2
  import "./api.js";
3
3
  import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
4
4
  //#region extensions/venice/onboard.ts
@@ -1,4 +1,4 @@
1
- import { a as discoverVeniceModels, t as VENICE_BASE_URL } from "./models-BKami47m.js";
1
+ import { a as discoverVeniceModels, t as VENICE_BASE_URL } from "./models-C5WznQTA.js";
2
2
  //#region extensions/venice/provider-catalog.ts
3
3
  async function buildVeniceProvider() {
4
4
  return {
package/dist/usage.js ADDED
@@ -0,0 +1,99 @@
1
+ import { buildUsageHttpErrorSnapshot } from "openclaw/plugin-sdk/provider-usage";
2
+ import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
3
+ //#region extensions/venice/usage.ts
4
+ const VENICE_BALANCE_URL = "https://api.venice.ai/api/v1/billing/balance";
5
+ const VENICE_USAGE_RESPONSE_MAX_BYTES = 1024 * 1024;
6
+ function nonNegativeNumber(value) {
7
+ const parsed = typeof value === "number" ? value : typeof value === "string" && value.trim() ? Number(value) : NaN;
8
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
9
+ }
10
+ function objectRecord(value) {
11
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
12
+ }
13
+ async function readPayload(response, timeoutMs) {
14
+ const buffer = await readResponseWithLimit(response, VENICE_USAGE_RESPONSE_MAX_BYTES, {
15
+ chunkTimeoutMs: timeoutMs,
16
+ onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Venice usage response exceeds ${maxBytes} bytes`),
17
+ onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`Venice usage response stalled for ${chunkTimeoutMs}ms`)
18
+ });
19
+ const data = objectRecord(JSON.parse(new TextDecoder().decode(buffer)));
20
+ if (!data) throw new Error("Venice usage response is not an object");
21
+ return data;
22
+ }
23
+ async function fetchVeniceUsage(params) {
24
+ let response;
25
+ try {
26
+ response = await params.fetchFn(VENICE_BALANCE_URL, {
27
+ headers: {
28
+ Accept: "application/json",
29
+ Authorization: `Bearer ${params.token}`
30
+ },
31
+ signal: AbortSignal.timeout(params.timeoutMs)
32
+ });
33
+ } catch {
34
+ return {
35
+ provider: "venice",
36
+ displayName: "Venice",
37
+ windows: [],
38
+ error: "Usage unavailable"
39
+ };
40
+ }
41
+ if (!response.ok) {
42
+ await response.body?.cancel().catch(() => void 0);
43
+ return buildUsageHttpErrorSnapshot({
44
+ provider: "venice",
45
+ status: response.status
46
+ });
47
+ }
48
+ let data;
49
+ try {
50
+ data = await readPayload(response, params.timeoutMs);
51
+ } catch {
52
+ return {
53
+ provider: "venice",
54
+ displayName: "Venice",
55
+ windows: [],
56
+ error: "Malformed usage response"
57
+ };
58
+ }
59
+ const diem = nonNegativeNumber(data.balances?.diem);
60
+ const usd = nonNegativeNumber(data.balances?.usd);
61
+ const allocation = nonNegativeNumber(data.diemEpochAllocation);
62
+ const windows = [];
63
+ if (diem !== void 0 && allocation !== void 0 && allocation > 0) windows.push({
64
+ label: "DIEM epoch",
65
+ usedPercent: Math.min(100, Math.max(0, (allocation - diem) / allocation * 100))
66
+ });
67
+ const billing = [];
68
+ if (diem !== void 0) billing.push({
69
+ type: "balance",
70
+ label: "DIEM balance",
71
+ amount: diem,
72
+ unit: "DIEM"
73
+ });
74
+ if (usd !== void 0) billing.push({
75
+ type: "balance",
76
+ label: "USD balance",
77
+ amount: usd,
78
+ unit: "USD"
79
+ });
80
+ if (diem !== void 0 && allocation !== void 0 && allocation > 0) billing.push({
81
+ type: "budget",
82
+ label: "DIEM epoch",
83
+ used: Math.max(0, allocation - diem),
84
+ limit: allocation,
85
+ unit: "DIEM",
86
+ period: "epoch"
87
+ });
88
+ const consumptionCurrency = typeof data.consumptionCurrency === "string" ? data.consumptionCurrency.trim().toUpperCase() : "";
89
+ return {
90
+ provider: "venice",
91
+ displayName: "Venice",
92
+ windows,
93
+ ...billing.length > 0 ? { billing } : {},
94
+ ...consumptionCurrency ? { plan: `${consumptionCurrency} billing` } : {},
95
+ ...data.canConsume === false ? { summary: "API consumption unavailable" } : {}
96
+ };
97
+ }
98
+ //#endregion
99
+ export { fetchVeniceUsage };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/venice-provider",
3
- "version": "2026.7.1-beta.2",
3
+ "version": "2026.7.1-beta.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/venice-provider",
9
- "version": "2026.7.1-beta.2"
9
+ "version": "2026.7.1-beta.5"
10
10
  }
11
11
  }
12
12
  }
@@ -5,11 +5,15 @@
5
5
  },
6
6
  "enabledByDefault": true,
7
7
  "providers": ["venice"],
8
+ "contracts": {
9
+ "usageProviders": ["venice"]
10
+ },
8
11
  "providerAuthChoices": [
9
12
  {
10
13
  "provider": "venice",
11
14
  "method": "api-key",
12
15
  "choiceId": "venice-api-key",
16
+ "appGuidedSecret": true,
13
17
  "choiceLabel": "Venice AI API key",
14
18
  "groupId": "venice",
15
19
  "groupLabel": "Venice AI",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/venice-provider",
3
- "version": "2026.7.1-beta.2",
3
+ "version": "2026.7.1-beta.5",
4
4
  "description": "OpenClaw Venice provider plugin",
5
5
  "type": "module",
6
6
  "openclaw": {
@@ -14,10 +14,10 @@
14
14
  "minHostVersion": ">=2026.6.9"
15
15
  },
16
16
  "compat": {
17
- "pluginApi": ">=2026.7.1-beta.2"
17
+ "pluginApi": ">=2026.7.1-beta.5"
18
18
  },
19
19
  "build": {
20
- "openclawVersion": "2026.7.1-beta.2",
20
+ "openclawVersion": "2026.7.1-beta.5",
21
21
  "bundledDist": false
22
22
  },
23
23
  "release": {
@@ -39,7 +39,7 @@
39
39
  "README.md"
40
40
  ],
41
41
  "peerDependencies": {
42
- "openclaw": ">=2026.7.1-beta.2"
42
+ "openclaw": ">=2026.7.1-beta.5"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "openclaw": {