Skip to content

console: request-logs has no per-request billing source (go quota vs zen balance) #55643

Open

Description

@niwinz

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

The Console v2 request-logs API (GET /console/api/request-logs) returns one row per inference request, but rows carry no field telling whether the request was covered by the OpenCode Go plan quota or debited from the Zen balance. With "Use your balance after reaching the limits" enabled, Go-key requests that overflow the quota look identical to covered ones, so a precise month split of Go-covered traffic vs. balance spending cannot be built from the API.

Environment

  • opencode version: 2.0.26 (client only; the gap is server-side, on the Console API)
  • OS: Linux 6.12.107+deb13-amd64 (Debian 13, x86_64) — not relevant here; API-side report
  • Terminal: tmux (TERM=tmux-256color, TERM_PROGRAM=tmux)
  • Shell: /bin/bash
  • Install/channel: latest (opencode --version → v2.0.26)
  • Active plugins: none besides the custom global opencode-usage plugin, the client that reads this API to build monthly spend reports

Auth: Console session (auth / __Host-console_session cookies + x-org-id header), the same access pattern as the Console web app (#51806).

Reproduction

  1. Workspace with an active Go subscription, a non-zero Zen balance, and "Use your balance after reaching the limits" enabled.
  2. Keep sending requests through the Go key (/inference/go…) until the Go meters are spent, so later requests fall back to the balance.
  3. Read the overflow period with GET /console/api/request-logs?category=inference&since=<ms>&until=<ms>&limit=20, then read GET /console/api/billing/ledger.

Expected Behavior

Either of these would let a client split the two buckets exactly:

  1. request-logs rows expose a per-request billing source, e.g. billingSource: "go" | "balance" (the legacy /usage/rows shape carried a per-row billingSource, go / credit; the v2 endpoint dropped it), or
  2. billing/ledger accepts since/until and a cursor, so balance debits can be listed for a whole month.

Actual Behavior

  • Overflow rows still read product:"go" / path /inference/go… with a cost: nothing marks them as balance-charged, so they are indistinguishable from quota-covered rows.
  • go/status meters (fiveHour / week / month, usedMicroCents / limitMicroCents / resetsAt) only say when coverage ran out; the month meter pins at its limit once spent and cannot say how much fell outside.
  • billing/ledger has the exact data (one usage_debit per balance-charged request, amount matching the row cost) but returns only the last ~25 entries with no paging.

Additional Context

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up, @niwinz!

    To restate the request: Console v2 request-logs should show for each request whether the OpenCode Go quota covered it or the Zen balance paid for it. That could be a per-row field like billingSource: "go" | "balance". Alternatively, billing/ledger could accept since/until and support paging. Either would let usage tools split a month's spend exactly. Maintainers will look at this and decide whether to add it.

    Related issues you may want to follow:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions