@teith/openclaw-runware-provider 0.3.4 → 0.3.6
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/cost-metric.d.ts +44 -67
- package/dist/cost-metric.d.ts.map +1 -1
- package/dist/cost-metric.js +186 -129
- package/dist/cost-metric.js.map +1 -1
- package/package.json +1 -1
package/dist/cost-metric.d.ts
CHANGED
|
@@ -1,78 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Emits `openclaw.cost.usd` OpenTelemetry counter for runware completions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* sources:
|
|
4
|
+
* In openclaw 2026.6.x, session transcripts live as
|
|
5
|
+
* `~/.openclaw/agents/<agentId>/sessions/<sessionId>.trajectory.jsonl`
|
|
6
|
+
* with this per-entry shape:
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* {
|
|
9
|
+
* "traceSchema": "openclaw-trajectory", "schemaVersion": 1,
|
|
10
|
+
* "traceId": "...", "type": "model.completed",
|
|
11
|
+
* "sessionKey": "agent:main:<channel>[:<frag>]",
|
|
12
|
+
* "provider": "runware", "modelId": "qwen35-397b-a17b-fp8",
|
|
13
|
+
* "data": {
|
|
14
|
+
* "usage": { "input", "output", "cacheRead", "total" },
|
|
15
|
+
* "promptCache": { "lastCallUsage": { "cacheWrite" } }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
14
18
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* None of those carry runware pricing — pricing flows through the
|
|
24
|
-
* plugin's runtime `catalog.run`, which is invisible to this resolver.
|
|
25
|
-
* So `costUsd` is undefined, the diagnostics-otel handler's
|
|
26
|
-
* `if (evt.costUsd) costCounter.add(...)` guard is falsy, and the
|
|
27
|
-
* `openclaw_cost_usd_total` counter stays at zero.
|
|
19
|
+
* Transcripts DO NOT carry the dollar cost — openclaw's Usage UI multiplies
|
|
20
|
+
* tokens by the live `model.cost` from the plugin's ProviderShape at render
|
|
21
|
+
* time. The diagnostic-path counter `openclaw.cost.usd` tries to do the
|
|
22
|
+
* same thing through `resolveModelCostConfig(...)`, which reads from a
|
|
23
|
+
* cache that's never seeded for runware (cache only accepts manifest
|
|
24
|
+
* `modelCatalog` rows + openclaw.json + OpenRouter/LiteLLM catalogs;
|
|
25
|
+
* runtime `catalog.run` results don't reach it). Result: counter stays at
|
|
26
|
+
* zero even though everything else works.
|
|
28
27
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
28
|
+
* This module fills that gap from inside the plugin. We:
|
|
29
|
+
* 1. Maintain a per-modelId pricing snapshot (input/output/cacheRead/
|
|
30
|
+
* cacheWrite per-million-token USD) refreshed every 30s from the
|
|
31
|
+
* same `fetchModels()` cache that feeds catalog.run. So pricing is
|
|
32
|
+
* genuinely real-time, no static manifest field, no build step.
|
|
33
|
+
* 2. Tail every `*.trajectory.jsonl` under `~/.openclaw/agents/<id>/sessions/`
|
|
34
|
+
* on a 2s interval, filtering to `type === "model.completed"`. The
|
|
35
|
+
* sibling `trace.artifacts` event duplicates the same usage data, so
|
|
36
|
+
* filtering by type prevents double-counting.
|
|
37
|
+
* 3. Compute USD with openclaw's own formula:
|
|
38
|
+
* cost = (cost_per_1M * tokens) / 1_000_000
|
|
39
|
+
* 4. Write to the global OTel counter `openclaw.cost.usd` with
|
|
40
|
+
* attributes (`openclaw.provider`, `openclaw.model`, `openclaw.channel`)
|
|
41
|
+
* that match what diagnostics-otel uses for `openclaw.tokens` —
|
|
42
|
+
* same labels → same Prometheus time series.
|
|
41
43
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* non-bundled plugins unless `plugins.entries.<id>.hooks
|
|
46
|
-
* .allowConversationAccess: true` is set in openclaw.json — i.e. in the
|
|
47
|
-
* manager. `model_call_ended` is bundled-accessible but only carries
|
|
48
|
-
* sanitized metadata (no usage). `wrapStreamFn` is a provider-runtime
|
|
49
|
-
* hook on `registerProvider` but `register(api)` is not invoked for
|
|
50
|
-
* external plugins in 2026.5.x and behavior is unverified in 2026.6.1.
|
|
51
|
-
* Tailing the transcript file is the one path that does not depend on
|
|
52
|
-
* any of those (the transcripts are written by the completion path
|
|
53
|
-
* regardless of hooks).
|
|
44
|
+
* Anchors at file size on first sighting, so only entries written after
|
|
45
|
+
* gateway start count (no replay of historical transcripts on every
|
|
46
|
+
* restart). Survives plugin hot-reload via globalThis state.
|
|
54
47
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* after startup emit metrics. Gateway restart resets all offsets, which
|
|
61
|
-
* is the correct behavior for a process-scoped counter (Prometheus
|
|
62
|
-
* `rate()` handles counter resets).
|
|
63
|
-
*
|
|
64
|
-
* If openclaw eventually fixes the diagnostic path so that
|
|
65
|
-
* `evt.costUsd` is populated for runware, both writers will increment
|
|
66
|
-
* the same series and the metric will double for runware. At that point
|
|
67
|
-
* delete this module. (We do not attempt to detect that case at runtime
|
|
68
|
-
* because diagnostics-otel does not expose its emit-or-skip decision to
|
|
69
|
-
* other plugins.)
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* Idempotent. Safe to call from multiple plugin entry files; only the
|
|
73
|
-
* first call starts the interval, subsequent calls return immediately.
|
|
74
|
-
* Survives openclaw plugin hot-reload because state lives on
|
|
75
|
-
* `globalThis`.
|
|
48
|
+
* Polling instead of a runtime hook because openclaw blocks `llm_output`
|
|
49
|
+
* and `agent_end` for non-bundled plugins unless
|
|
50
|
+
* `plugins.entries.<id>.hooks.allowConversationAccess: true` is set in
|
|
51
|
+
* openclaw.json — i.e. the manager. The trajectory file is written
|
|
52
|
+
* unconditionally and is plugin-readable, so no config flag needed.
|
|
76
53
|
*/
|
|
77
54
|
export declare function startCostMetricPoller(opts?: {
|
|
78
55
|
openclawHome?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-metric.d.ts","sourceRoot":"","sources":["../src/cost-metric.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost-metric.d.ts","sourceRoot":"","sources":["../src/cost-metric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AA0EH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAiCP"}
|
package/dist/cost-metric.js
CHANGED
|
@@ -1,82 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Emits `openclaw.cost.usd` OpenTelemetry counter for runware completions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* sources:
|
|
4
|
+
* In openclaw 2026.6.x, session transcripts live as
|
|
5
|
+
* `~/.openclaw/agents/<agentId>/sessions/<sessionId>.trajectory.jsonl`
|
|
6
|
+
* with this per-entry shape:
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* {
|
|
9
|
+
* "traceSchema": "openclaw-trajectory", "schemaVersion": 1,
|
|
10
|
+
* "traceId": "...", "type": "model.completed",
|
|
11
|
+
* "sessionKey": "agent:main:<channel>[:<frag>]",
|
|
12
|
+
* "provider": "runware", "modelId": "qwen35-397b-a17b-fp8",
|
|
13
|
+
* "data": {
|
|
14
|
+
* "usage": { "input", "output", "cacheRead", "total" },
|
|
15
|
+
* "promptCache": { "lastCallUsage": { "cacheWrite" } }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
14
18
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* None of those carry runware pricing — pricing flows through the
|
|
24
|
-
* plugin's runtime `catalog.run`, which is invisible to this resolver.
|
|
25
|
-
* So `costUsd` is undefined, the diagnostics-otel handler's
|
|
26
|
-
* `if (evt.costUsd) costCounter.add(...)` guard is falsy, and the
|
|
27
|
-
* `openclaw_cost_usd_total` counter stays at zero.
|
|
19
|
+
* Transcripts DO NOT carry the dollar cost — openclaw's Usage UI multiplies
|
|
20
|
+
* tokens by the live `model.cost` from the plugin's ProviderShape at render
|
|
21
|
+
* time. The diagnostic-path counter `openclaw.cost.usd` tries to do the
|
|
22
|
+
* same thing through `resolveModelCostConfig(...)`, which reads from a
|
|
23
|
+
* cache that's never seeded for runware (cache only accepts manifest
|
|
24
|
+
* `modelCatalog` rows + openclaw.json + OpenRouter/LiteLLM catalogs;
|
|
25
|
+
* runtime `catalog.run` results don't reach it). Result: counter stays at
|
|
26
|
+
* zero even though everything else works.
|
|
28
27
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
28
|
+
* This module fills that gap from inside the plugin. We:
|
|
29
|
+
* 1. Maintain a per-modelId pricing snapshot (input/output/cacheRead/
|
|
30
|
+
* cacheWrite per-million-token USD) refreshed every 30s from the
|
|
31
|
+
* same `fetchModels()` cache that feeds catalog.run. So pricing is
|
|
32
|
+
* genuinely real-time, no static manifest field, no build step.
|
|
33
|
+
* 2. Tail every `*.trajectory.jsonl` under `~/.openclaw/agents/<id>/sessions/`
|
|
34
|
+
* on a 2s interval, filtering to `type === "model.completed"`. The
|
|
35
|
+
* sibling `trace.artifacts` event duplicates the same usage data, so
|
|
36
|
+
* filtering by type prevents double-counting.
|
|
37
|
+
* 3. Compute USD with openclaw's own formula:
|
|
38
|
+
* cost = (cost_per_1M * tokens) / 1_000_000
|
|
39
|
+
* 4. Write to the global OTel counter `openclaw.cost.usd` with
|
|
40
|
+
* attributes (`openclaw.provider`, `openclaw.model`, `openclaw.channel`)
|
|
41
|
+
* that match what diagnostics-otel uses for `openclaw.tokens` —
|
|
42
|
+
* same labels → same Prometheus time series.
|
|
41
43
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* non-bundled plugins unless `plugins.entries.<id>.hooks
|
|
46
|
-
* .allowConversationAccess: true` is set in openclaw.json — i.e. in the
|
|
47
|
-
* manager. `model_call_ended` is bundled-accessible but only carries
|
|
48
|
-
* sanitized metadata (no usage). `wrapStreamFn` is a provider-runtime
|
|
49
|
-
* hook on `registerProvider` but `register(api)` is not invoked for
|
|
50
|
-
* external plugins in 2026.5.x and behavior is unverified in 2026.6.1.
|
|
51
|
-
* Tailing the transcript file is the one path that does not depend on
|
|
52
|
-
* any of those (the transcripts are written by the completion path
|
|
53
|
-
* regardless of hooks).
|
|
44
|
+
* Anchors at file size on first sighting, so only entries written after
|
|
45
|
+
* gateway start count (no replay of historical transcripts on every
|
|
46
|
+
* restart). Survives plugin hot-reload via globalThis state.
|
|
54
47
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* after startup emit metrics. Gateway restart resets all offsets, which
|
|
61
|
-
* is the correct behavior for a process-scoped counter (Prometheus
|
|
62
|
-
* `rate()` handles counter resets).
|
|
63
|
-
*
|
|
64
|
-
* If openclaw eventually fixes the diagnostic path so that
|
|
65
|
-
* `evt.costUsd` is populated for runware, both writers will increment
|
|
66
|
-
* the same series and the metric will double for runware. At that point
|
|
67
|
-
* delete this module. (We do not attempt to detect that case at runtime
|
|
68
|
-
* because diagnostics-otel does not expose its emit-or-skip decision to
|
|
69
|
-
* other plugins.)
|
|
48
|
+
* Polling instead of a runtime hook because openclaw blocks `llm_output`
|
|
49
|
+
* and `agent_end` for non-bundled plugins unless
|
|
50
|
+
* `plugins.entries.<id>.hooks.allowConversationAccess: true` is set in
|
|
51
|
+
* openclaw.json — i.e. the manager. The trajectory file is written
|
|
52
|
+
* unconditionally and is plugin-readable, so no config flag needed.
|
|
70
53
|
*/
|
|
71
54
|
import { createReadStream } from "node:fs";
|
|
72
55
|
import { readdir, stat } from "node:fs/promises";
|
|
73
56
|
import { homedir } from "node:os";
|
|
74
57
|
import { join } from "node:path";
|
|
58
|
+
import { fetchModels } from "./catalog.js";
|
|
59
|
+
import { resolveApiKey, resolveBaseUrl } from "./models.js";
|
|
75
60
|
const GLOBAL_KEY = "__runware_openclaw_cost_metric__";
|
|
76
61
|
const POLL_INTERVAL_MS = 2000;
|
|
62
|
+
const PRICING_REFRESH_MS = 30_000;
|
|
77
63
|
const RUNWARE_PROVIDER = "runware";
|
|
78
64
|
const METER_NAME = "runware-openclaw-provider";
|
|
79
65
|
const METRIC_NAME = "openclaw.cost.usd";
|
|
66
|
+
const TARGET_ENTRY_TYPE = "model.completed";
|
|
80
67
|
function loadState() {
|
|
81
68
|
const g = globalThis;
|
|
82
69
|
const existing = g[GLOBAL_KEY];
|
|
@@ -89,16 +76,17 @@ function loadState() {
|
|
|
89
76
|
emittedAny: false,
|
|
90
77
|
fileStates: new Map(),
|
|
91
78
|
intervalHandle: null,
|
|
79
|
+
pricingByModelId: new Map(),
|
|
80
|
+
lastPricingFetchAt: 0,
|
|
81
|
+
pricingFetchInFlight: null,
|
|
82
|
+
pricingLoadedLogged: false,
|
|
83
|
+
warnedMissingPricing: new Set(),
|
|
84
|
+
warnedNoApiKey: false,
|
|
85
|
+
warnedPricingFetchFailed: false,
|
|
92
86
|
};
|
|
93
87
|
g[GLOBAL_KEY] = fresh;
|
|
94
88
|
return fresh;
|
|
95
89
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Idempotent. Safe to call from multiple plugin entry files; only the
|
|
98
|
-
* first call starts the interval, subsequent calls return immediately.
|
|
99
|
-
* Survives openclaw plugin hot-reload because state lives on
|
|
100
|
-
* `globalThis`.
|
|
101
|
-
*/
|
|
102
90
|
export function startCostMetricPoller(opts) {
|
|
103
91
|
const state = loadState();
|
|
104
92
|
if (state.initialized)
|
|
@@ -128,10 +116,6 @@ export function startCostMetricPoller(opts) {
|
|
|
128
116
|
console.log(`[runware-cost-metric] started, intervalMs=${intervalMs} openclawHome=${openclawHome}`);
|
|
129
117
|
}
|
|
130
118
|
async function initCounter() {
|
|
131
|
-
// Dynamic import so a missing @opentelemetry/api doesn't break the
|
|
132
|
-
// plugin entry. Typed structurally — we don't import OTel types
|
|
133
|
-
// statically because verbatimModuleSyntax disallows type-only imports
|
|
134
|
-
// here without `import type`, and the dynamic shape is all we need.
|
|
135
119
|
const otel = (await import("@opentelemetry/api"));
|
|
136
120
|
const meter = otel.metrics.getMeter(METER_NAME);
|
|
137
121
|
return meter.createCounter(METRIC_NAME, {
|
|
@@ -139,6 +123,59 @@ async function initCounter() {
|
|
|
139
123
|
unit: "USD",
|
|
140
124
|
});
|
|
141
125
|
}
|
|
126
|
+
async function refreshPricingIfStale(state) {
|
|
127
|
+
if (state.pricingFetchInFlight) {
|
|
128
|
+
await state.pricingFetchInFlight;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const now = Date.now();
|
|
132
|
+
if (state.pricingByModelId.size > 0 &&
|
|
133
|
+
now - state.lastPricingFetchAt < PRICING_REFRESH_MS) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const apiKey = resolveApiKey({ env: process.env });
|
|
137
|
+
if (!apiKey) {
|
|
138
|
+
if (!state.warnedNoApiKey) {
|
|
139
|
+
state.warnedNoApiKey = true;
|
|
140
|
+
console.warn("[runware-cost-metric] RUNWARE_API_KEY not in env, pricing unavailable");
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
state.warnedNoApiKey = false;
|
|
145
|
+
const baseUrl = resolveBaseUrl(process.env);
|
|
146
|
+
state.pricingFetchInFlight = (async () => {
|
|
147
|
+
try {
|
|
148
|
+
const models = await fetchModels(baseUrl, apiKey);
|
|
149
|
+
const next = new Map();
|
|
150
|
+
for (const m of models) {
|
|
151
|
+
next.set(m.id, {
|
|
152
|
+
input: m.inputCost ?? 0,
|
|
153
|
+
output: m.outputCost ?? 0,
|
|
154
|
+
cacheRead: m.cacheReadCost ?? 0,
|
|
155
|
+
cacheWrite: m.cacheWriteCost ?? 0,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
state.pricingByModelId = next;
|
|
159
|
+
state.lastPricingFetchAt = Date.now();
|
|
160
|
+
state.warnedPricingFetchFailed = false;
|
|
161
|
+
if (!state.pricingLoadedLogged) {
|
|
162
|
+
state.pricingLoadedLogged = true;
|
|
163
|
+
const sample = Array.from(next.keys()).slice(0, 3).join(", ");
|
|
164
|
+
console.log(`[runware-cost-metric] loaded pricing for ${next.size} models (e.g. ${sample})`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
if (state.pricingByModelId.size === 0 && !state.warnedPricingFetchFailed) {
|
|
169
|
+
state.warnedPricingFetchFailed = true;
|
|
170
|
+
console.warn("[runware-cost-metric] pricing fetch failed (no cached pricing):", err);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
state.pricingFetchInFlight = null;
|
|
175
|
+
}
|
|
176
|
+
})();
|
|
177
|
+
await state.pricingFetchInFlight;
|
|
178
|
+
}
|
|
142
179
|
async function pollOnce(openclawHome, state) {
|
|
143
180
|
if (state.counterInit) {
|
|
144
181
|
await state.counterInit;
|
|
@@ -146,6 +183,9 @@ async function pollOnce(openclawHome, state) {
|
|
|
146
183
|
}
|
|
147
184
|
if (!state.counter)
|
|
148
185
|
return;
|
|
186
|
+
await refreshPricingIfStale(state);
|
|
187
|
+
if (state.pricingByModelId.size === 0)
|
|
188
|
+
return;
|
|
149
189
|
const agentsDir = join(openclawHome, "agents");
|
|
150
190
|
let agents;
|
|
151
191
|
try {
|
|
@@ -167,7 +207,7 @@ async function pollSessionsDir(sessionsDir, state) {
|
|
|
167
207
|
return;
|
|
168
208
|
}
|
|
169
209
|
for (const entry of entries) {
|
|
170
|
-
if (!entry.endsWith(".jsonl"))
|
|
210
|
+
if (!entry.endsWith(".trajectory.jsonl"))
|
|
171
211
|
continue;
|
|
172
212
|
await pollSessionFile(join(sessionsDir, entry), state);
|
|
173
213
|
}
|
|
@@ -183,21 +223,31 @@ async function pollSessionFile(path, state) {
|
|
|
183
223
|
return;
|
|
184
224
|
}
|
|
185
225
|
const prev = state.fileStates.get(path);
|
|
186
|
-
// First sighting:
|
|
187
|
-
//
|
|
188
|
-
//
|
|
226
|
+
// First sighting: read from offset 0. New sessions created after gateway
|
|
227
|
+
// start would otherwise lose their early entries (anchor-on-first-sight
|
|
228
|
+
// skips everything written between session creation and our next tick).
|
|
229
|
+
// Trade-off: gateway restart re-reads existing transcripts once, causing
|
|
230
|
+
// a one-shot counter bump. Prometheus `rate()` and `increase()` handle
|
|
231
|
+
// counter resets idiomatically, and the cost-metric counter is reset on
|
|
232
|
+
// every gateway restart anyway (it lives in process memory).
|
|
189
233
|
if (!prev) {
|
|
234
|
+
console.log(`[runware-cost-metric] tracking new file: ${path} (size=${info.size})`);
|
|
235
|
+
const chunk = info.size > 0 ? await readBytes(path, 0, info.size) : "";
|
|
236
|
+
const consumed = parseAndEmit(chunk, state);
|
|
190
237
|
state.fileStates.set(path, {
|
|
191
|
-
offset:
|
|
238
|
+
offset: consumed,
|
|
192
239
|
inode: info.ino,
|
|
193
240
|
size: info.size,
|
|
194
241
|
});
|
|
195
242
|
return;
|
|
196
243
|
}
|
|
197
|
-
// Rotation
|
|
244
|
+
// Rotation / truncation: re-anchor at 0 and read whole file again.
|
|
198
245
|
if (prev.inode !== info.ino || info.size < prev.size) {
|
|
246
|
+
console.log(`[runware-cost-metric] file rotated/truncated, re-reading: ${path}`);
|
|
247
|
+
const chunk = info.size > 0 ? await readBytes(path, 0, info.size) : "";
|
|
248
|
+
const consumed = parseAndEmit(chunk, state);
|
|
199
249
|
state.fileStates.set(path, {
|
|
200
|
-
offset:
|
|
250
|
+
offset: consumed,
|
|
201
251
|
inode: info.ino,
|
|
202
252
|
size: info.size,
|
|
203
253
|
});
|
|
@@ -237,8 +287,6 @@ function readBytes(path, start, end) {
|
|
|
237
287
|
function parseAndEmit(chunk, state) {
|
|
238
288
|
if (chunk.length === 0)
|
|
239
289
|
return 0;
|
|
240
|
-
// Trailing bytes after the last `\n` are a partial line still being
|
|
241
|
-
// flushed by openclaw. Leave them for the next tick.
|
|
242
290
|
const lastNewline = chunk.lastIndexOf("\n");
|
|
243
291
|
if (lastNewline === -1)
|
|
244
292
|
return 0;
|
|
@@ -260,75 +308,84 @@ function parseAndEmit(chunk, state) {
|
|
|
260
308
|
function emitFromEntry(entry, state) {
|
|
261
309
|
if (!state.counter || !isRecord(entry))
|
|
262
310
|
return;
|
|
263
|
-
if (
|
|
311
|
+
if (entry.type !== TARGET_ENTRY_TYPE)
|
|
312
|
+
return;
|
|
313
|
+
if (entry.provider !== RUNWARE_PROVIDER) {
|
|
314
|
+
// Different provider (anthropic-direct, openai, etc) — not our metric.
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (typeof entry.modelId !== "string" || entry.modelId.length === 0) {
|
|
318
|
+
console.warn(`[runware-cost-metric] model.completed entry missing modelId: ${JSON.stringify(entry).slice(0, 300)}`);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const modelId = entry.modelId;
|
|
322
|
+
const data = entry.data;
|
|
323
|
+
if (!isRecord(data))
|
|
324
|
+
return;
|
|
325
|
+
const usage = data.usage;
|
|
326
|
+
if (!isRecord(usage))
|
|
327
|
+
return;
|
|
328
|
+
const cost = state.pricingByModelId.get(modelId);
|
|
329
|
+
if (!cost) {
|
|
330
|
+
if (!state.warnedMissingPricing.has(modelId)) {
|
|
331
|
+
state.warnedMissingPricing.add(modelId);
|
|
332
|
+
console.warn(`[runware-cost-metric] no pricing for model "${modelId}" — skipping cost emit (will retry on next /v1/models refresh)`);
|
|
333
|
+
}
|
|
264
334
|
return;
|
|
265
|
-
|
|
266
|
-
|
|
335
|
+
}
|
|
336
|
+
const input = nonNegNumber(usage.input);
|
|
337
|
+
const output = nonNegNumber(usage.output);
|
|
338
|
+
const cacheRead = nonNegNumber(usage.cacheRead);
|
|
339
|
+
const cacheWrite = readCacheWrite(data);
|
|
340
|
+
const costUsd = (cost.input * input +
|
|
341
|
+
cost.output * output +
|
|
342
|
+
cost.cacheRead * cacheRead +
|
|
343
|
+
cost.cacheWrite * cacheWrite) /
|
|
344
|
+
1_000_000;
|
|
345
|
+
if (!Number.isFinite(costUsd) || costUsd <= 0)
|
|
267
346
|
return;
|
|
268
347
|
const attrs = {
|
|
269
348
|
"openclaw.provider": RUNWARE_PROVIDER,
|
|
270
|
-
"openclaw.model":
|
|
349
|
+
"openclaw.model": modelId,
|
|
271
350
|
};
|
|
272
|
-
const channel =
|
|
351
|
+
const channel = parseChannelFromSessionKey(entry.sessionKey);
|
|
273
352
|
if (channel)
|
|
274
353
|
attrs["openclaw.channel"] = channel;
|
|
275
354
|
try {
|
|
276
|
-
state.counter.add(
|
|
355
|
+
state.counter.add(costUsd, attrs);
|
|
277
356
|
if (!state.emittedAny) {
|
|
278
357
|
state.emittedAny = true;
|
|
279
|
-
console.log(`[runware-cost-metric] first emit: ${
|
|
358
|
+
console.log(`[runware-cost-metric] first emit: ${costUsd.toFixed(6)} USD attrs=${JSON.stringify(attrs)} tokens=${JSON.stringify({ input, output, cacheRead, cacheWrite })}`);
|
|
280
359
|
}
|
|
281
360
|
}
|
|
282
361
|
catch (err) {
|
|
283
362
|
console.error("[runware-cost-metric] counter.add failed:", err);
|
|
284
363
|
}
|
|
285
364
|
}
|
|
286
|
-
function
|
|
287
|
-
|
|
365
|
+
function readCacheWrite(data) {
|
|
366
|
+
const pc = data.promptCache;
|
|
367
|
+
if (!isRecord(pc))
|
|
368
|
+
return 0;
|
|
369
|
+
const lcu = pc.lastCallUsage;
|
|
370
|
+
if (!isRecord(lcu))
|
|
371
|
+
return 0;
|
|
372
|
+
return nonNegNumber(lcu.cacheWrite);
|
|
288
373
|
}
|
|
289
|
-
function
|
|
290
|
-
if (typeof
|
|
291
|
-
return
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
374
|
+
function parseChannelFromSessionKey(sessionKey) {
|
|
375
|
+
if (typeof sessionKey !== "string")
|
|
376
|
+
return undefined;
|
|
377
|
+
// "agent:<agentId>:<channel>[:<sessionFragment>]"
|
|
378
|
+
const parts = sessionKey.split(":");
|
|
379
|
+
if (parts.length >= 3 && parts[0] === "agent") {
|
|
380
|
+
const ch = parts[2];
|
|
381
|
+
return typeof ch === "string" && ch.length > 0 ? ch : undefined;
|
|
297
382
|
}
|
|
298
383
|
return undefined;
|
|
299
384
|
}
|
|
300
|
-
function
|
|
301
|
-
|
|
302
|
-
if (isRecord(usage)) {
|
|
303
|
-
const cost = usage.cost;
|
|
304
|
-
if (isRecord(cost) &&
|
|
305
|
-
typeof cost.total === "number" &&
|
|
306
|
-
Number.isFinite(cost.total)) {
|
|
307
|
-
return cost.total;
|
|
308
|
-
}
|
|
309
|
-
if (typeof usage.costUsd === "number" &&
|
|
310
|
-
Number.isFinite(usage.costUsd)) {
|
|
311
|
-
return usage.costUsd;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
if (typeof entry.costUsd === "number" && Number.isFinite(entry.costUsd)) {
|
|
315
|
-
return entry.costUsd;
|
|
316
|
-
}
|
|
317
|
-
return 0;
|
|
318
|
-
}
|
|
319
|
-
function readModel(entry) {
|
|
320
|
-
if (typeof entry.model === "string")
|
|
321
|
-
return entry.model;
|
|
322
|
-
if (typeof entry.modelId === "string")
|
|
323
|
-
return entry.modelId;
|
|
324
|
-
return undefined;
|
|
385
|
+
function isRecord(v) {
|
|
386
|
+
return v !== null && typeof v === "object";
|
|
325
387
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
328
|
-
return entry.channel;
|
|
329
|
-
const meta = entry.metadata;
|
|
330
|
-
if (isRecord(meta) && typeof meta.channel === "string")
|
|
331
|
-
return meta.channel;
|
|
332
|
-
return undefined;
|
|
388
|
+
function nonNegNumber(v) {
|
|
389
|
+
return typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : 0;
|
|
333
390
|
}
|
|
334
391
|
//# sourceMappingURL=cost-metric.js.map
|
package/dist/cost-metric.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-metric.js","sourceRoot":"","sources":["../src/cost-metric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqBjC,MAAM,UAAU,GAAG,kCAAkC,CAAC;AACtD,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAC/C,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC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B;IACrD,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACrD,kDAAkD;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC7C,CAAC;AAED,SAAS,YAAY,CAAC,CAAU;IAC9B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teith/openclaw-runware-provider",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "OpenClaw provider plugin for Runware — unified OpenAI-compatible access to Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, and Gemma.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|