@@ -17,6 +17,7 @@ import { createDefaultDeps } from "../cli/deps.js";
1717import type { CliDeps } from "../cli/deps.types.js" ;
1818import { agentCommandFromIngress } from "../commands/agent.js" ;
1919import type { GatewayHttpResponsesConfig } from "../config/types.gateway.js" ;
20+ import type { OpenClawConfig } from "../config/types.openclaw.js" ;
2021import { emitAgentEvent , onAgentEvent } from "../infra/agent-events.js" ;
2122import { emitTrustedDiagnosticEvent , isDiagnosticsEnabled } from "../infra/diagnostic-events.js" ;
2223import { 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