Skip to content

investigate: populate Models tab — find/add model usage data source #10

@maxdraki

Description

@maxdraki

Problem

The Models tab (/models) exists and the ingestion pipeline is ready, but it shows no data because OpenClaw gateway does not currently emit model:used (or equivalent) events.

The index.ts hook handler was written to handle conversation:start/end and model:used events, but these are not fired by the gateway in v2026.3.x.

Goal

Populate the Models tab with real per-model token, cost, and latency data from OpenClaw sessions.

Investigation paths

Option A — OpenClaw gateway emits model usage events

Check if OpenClaw has (or plans) any event that includes model name, token counts, and cost. If a model:used or session:complete event exists or can be added, update handler.ts to capture it and POST to POST /api/v1/ingest/model_usage.

Option B — Parse session status API

OpenClaw likely exposes per-session model usage via its status/billing API. Poll that endpoint periodically and ingest the delta.

Option C — Intercept at the HTTP layer

If OpenClaw proxies LLM calls, instrument the proxy layer to capture token usage from response headers/body before forwarding.

Option D — LiteLLM callback (if applicable)

If OpenClaw routes through LiteLLM, register agentwatch as a LiteLLM callback — it already has a LiteLLMCallbackHandler.

Acceptance criteria

  • Models tab shows at least model name, request count, and token totals from real OpenClaw sessions
  • Data updates within a reasonable lag (ideally <1 min)
  • No manual instrumentation required per-session

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions