Skip to content

[Feature]: make routed account identity obvious in request logs (which Codex/OpenRouter account served each request) #4057

Description

@nordz0r

Area

Multiple areas

What are you trying to accomplish?

I run a provider setup with multiple accounts/credentials behind one provider name: a Codex main+pool, several OpenRouter API keys (free-tier rotation), and chained clients. When debugging quota exhaustion, cache anomalies, or routing behavior, I need to see which specific account served each request directly in the logs — dashboard Logs panel, CLI ocx logs, and usage.jsonl.

What prevents this today?

  • usage.jsonl has accountLogLabel, but it is Codex-only ("main" | p{hex}). Other OAuth providers have no per-account labeling (see closed [Feature]: persist per-account usage for OAuth providers (xai/cursor), not only Codex main/pN labels #2699).
  • For OpenRouter, multiple API keys under one provider are indistinguishable: the provider field shows only the provider name (e.g. openrouter), never which key made the upstream call.
  • The dashboard Logs panel shows model, latency, tokens — but account/credential identity is absent or requires manually cross-referencing usage.jsonl rows.

What should OpenCodex do?

When a request is routed through a provider that has multiple configured accounts or keys, each log row (dashboard Logs table, ocx logs output, and usage.jsonl) should display a stable per-account label identifying the credential that served the request. A reader should be able to answer "which account handled request X" without reading raw JSONL or the source code.

Example usage or interface

Dashboard Logs table gains an Account column:

Time Provider Model Account Tokens Latency
12:01 openai gpt-5.6 p3 12k 2.1s
12:02 openrouter free/x key-2 8k 1.4s

CLI:

ocx logs --account p3          # filter rows by account label
ocx logs --last 50 --account key-2

usage.jsonl row gains a populated accountLogLabel for every multi-account provider (e.g. "accountLogLabel": "key-2" on OpenRouter rows), not just Codex.

Alternatives or workarounds

  • Manually grepping usage.jsonl — only works for Codex rows today.
  • One provider entry per API key (openrouter-key1, openrouter-key2) — bloats the provider catalog and breaks free-tier rotation logic.
  • feat(pricing): apply base-provider price overlays to all account log labels #3817 (closed) improved price overlays for account log labels — the labeling machinery exists, it just does not cover non-Codex providers or surface in the UI.

Additional context

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

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

    account-poolOAuth, credentials, Codex pool, quota, failover, plansenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions