Skip to content

Feature: Per-call cost tracking & auth profile attribution #11894

Description

@aolinger

Feature Request

Problem

When using multiple auth profiles (e.g. anthropic:manual as primary and anthropic:payg as fallback), there's currently no way to see:

  1. Which auth profile was actually used for a given API call
  2. Per-call cost (input/output tokens × model pricing)

Use Case

I have a free-tier Anthropic key (anthropic:manual) as primary and a pay-as-you-go key (anthropic:payg) as fallback. When the free tier is exhausted and fallback kicks in, I'd like to know:

  • That the payg profile was used (not the free one)
  • How much that specific call cost (rounded to the cent)

Current Behavior

session_status shows the current auth profile and cumulative token counts, but:

  • No per-call breakdown
  • No indication when a fallback profile was used vs primary
  • No cost calculation based on model pricing

Proposed Solution

Options (any would help):

  1. Per-call metadata in session transcript: Include authProfile and cost fields in the transcript/response metadata
  2. Cost summary in session_status: Show cost breakdown per auth profile (e.g. "anthropic:manual: $0.00 | anthropic:payg: $0.42")
  3. System event on fallback: Emit a system event when a fallback profile is used, so the agent can inform the user

Environment

  • OpenClaw 2026.2.6-3
  • Two Anthropic profiles (manual + payg) with Sonnet 4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions