Skip to content

Commit 441cf05

Browse files
committed
fix(diagnostics): cast config type for resolveModelCostConfig compat
1 parent c5e82d6 commit 441cf05

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/gateway/openresponses-http.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { createDefaultDeps } from "../cli/deps.js";
1717
import type { CliDeps } from "../cli/deps.types.js";
1818
import { agentCommandFromIngress } from "../commands/agent.js";
1919
import type { GatewayHttpResponsesConfig } from "../config/types.gateway.js";
20+
import type { OpenClawConfig } from "../config/types.openclaw.js";
2021
import { emitAgentEvent, onAgentEvent } from "../infra/agent-events.js";
2122
import { emitTrustedDiagnosticEvent, isDiagnosticsEnabled } from "../infra/diagnostic-events.js";
2223
import { logWarn } from "../logger.js";
@@ -783,7 +784,8 @@ export async function handleOpenResponsesHttpRequest(
783784
// Emit model.usage diagnostic so HTTP ingress traffic is visible to
784785
// diagnostics consumers (Langfuse, OTEL, Prometheus) just like channel
785786
// and cron turns. The raw usage from agentMeta carries the full breakdown.
786-
if (agentMeta?.usage && isDiagnosticsEnabled(opts.config)) {
787+
const cfg = opts.config as OpenClawConfig | undefined;
788+
if (agentMeta?.usage && isDiagnosticsEnabled(cfg)) {
787789
const normalized = normalizeUsage(agentMeta.usage as Parameters<typeof normalizeUsage>[0]);
788790
if (normalized) {
789791
const input = normalized.input ?? 0;
@@ -795,7 +797,7 @@ export async function handleOpenResponsesHttpRequest(
795797
const costConfig = resolveModelCostConfig({
796798
provider: agentMeta.provider ?? "",
797799
model: agentMeta.model ?? "",
798-
config: opts.config,
800+
config: cfg,
799801
});
800802
const costUsd = estimateUsageCost({ usage: normalized, cost: costConfig });
801803
emitTrustedDiagnosticEvent({

0 commit comments

Comments
 (0)