Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>otak-usageNew to Visual Studio Code? Get it now.
otak-usage

otak-usage

Tsuyoshi Otake

odangoo.com
|
539 installs
| (1) | Free
Otak Usage displays estimated API-equivalent costs of Claude Code and OpenAI Codex CLI sessions in the VS Code status bar, with per-model breakdowns for today and the current month.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

otak-usage

See what your AI pair programmers would cost, right in the VS Code status bar.
otak-usage reads local Claude Code and OpenAI Codex CLI session logs, converts token counts into API-equivalent USD, shows how much of your subscription rate limits is used, and can add RTK savings plus optional OpenTelemetry export.

VS Marketplace VS Code engine License: MIT GitHub

Claude Code Codex CLI RTK savings OpenTelemetry Local-first Context optimization

Install · GitHub · Report an issue


[!IMPORTANT] Context optimization is enabled by default for both Claude Code and Codex CLI, with each provider tuned independently. Claude keeps a 250k context window and compacts at 85% — 212.5k tokens — leaving 37.5k to produce its summary. Codex uses a smaller 180k configured window and starts its context transition at 150k; on supported Codex setups, experimental context management can continue in a fresh window and selectively recover prior conversation through notes/history. The larger 272k Codex preset remains available. Use Optimize in the status-bar tooltip to choose a provider, select a preset, enter custom values, or turn that provider off. Turning optimization off restores the values that existed before otak-usage took ownership.

AI coding tools leave useful token-count metadata in local session logs, but comparing day-to-day usage across providers usually means opening separate files or tools. otak-usage turns those logs into one status-bar readout: today or month-to-date, combined or per provider/model, with configurable alerts and optional metric export when you want dashboards.

Quick Start

  1. Install from the VS Code Marketplace.
  2. Use Claude Code or OpenAI Codex CLI normally on the machine where VS Code is running. Context optimization for both providers is already on by default.
  3. Check the right side of the VS Code status bar:
$18.01

Hover the status-bar item for a per-model breakdown of today and the current month. Click it to cycle between Today, This Month, and Limits (subscription rate-limit usage).

The hover tooltip puts Claude Code and Codex CLI side by side — each with its brand logo, rate-limit windows, per-model cost, and a provider total — followed by RTK token savings:

otak-usage — API-equivalent cost

OpenAI + Claude Total: $9.80 / $297.45

Claude Code — Limits (max)        │ Codex CLI — Limits (pro)
5h · 28% used · resets 16:39      │ 5h · 5% used · resets 18:59
7d · 13% used · resets 07-15      │ 7d · 21% used · resets 07-18
claude-opus-5:    $6.20 / $142.30 │ gpt-5.5:      $2.14 / $88.60
claude-sonnet-5:  $1.05 / $58.40  │ gpt-5.4-mini: $0.41 / $6.05
claude-haiku-4-5: $0.00 / $2.10   │
Total:            $7.25 / $202.80 │ Total:        $2.55 / $94.65

RTK — Token Savings
Period       Input    Output   Saved    Rate
Today        7.1M     2.9M     4.2M     59.5%
This Month   12.4M    5.1M     7.3M     58.9%
All Time     3.0B     110.1M   2.9B     96.4%

Period: This Month · Updated 16:09 · Click to switch view

Amounts above are illustrative. The status bar shows the combined total; the two provider columns, the limit windows, and the RTK table each appear only when that data is available and enabled.

Disclaimer: The amounts shown are API-equivalent estimates computed from local session logs and per-token API prices. If you use a subscription plan such as Claude Pro/Max or ChatGPT Plus/Pro, this is not what you actually pay; it is what the same usage would have cost through the API.

Capabilities

  • Two providers, one glance: Claude Code (~/.claude/projects/**/*.jsonl) and OpenAI Codex CLI (~/.codex/sessions/**/rollout-*.jsonl) roll up into one status-bar total. Either provider can be used on its own.
  • Per-model cost breakdowns: the tooltip and copied summary show token usage and API-equivalent USD by provider, model, and period. In the tooltip, Claude Code and Codex sit side by side (with their brand logos) and RTK savings follow below.
  • Subscription rate limits: the tooltip shows how much of each provider's 5-hour and weekly rate-limit windows is used, with reset times and plan type — Codex from local session logs plus the ChatGPT usage endpoint for the banked reset count, Claude Code from the same Anthropic endpoint the CLI's /usage command uses (including the Fable weekly window). The status bar uses each provider's longer window for an apples-to-apples view, falling back to the shorter window when necessary.
  • Stable model ordering: per-provider breakdowns list known models newest-first; unrecognized models appear last in name order.
  • RTK token savings: when RTK (Rust Token Killer) is available, the tooltip adds Input / Output / Saved / Rate for Today, This Month, and All Time.
  • Usage alerts: a VS Code notification appears when today's combined Claude + Codex estimate reaches your configured USD threshold, and/or when a subscription rate-limit window (5-hour or weekly) reaches your configured percentage. otakUsage.alertMode chooses which triggers fire (cost, limit, both, or off).
  • Fast-mode warning: when Claude Code or Codex CLI fast mode turns on, the same warning notification the cost and limit alerts use points out that usage is billed at premium fast-mode rates. See Fast-mode detection.
  • Claude + Codex context optimization — on by default: Claude gets a 250k context window with native auto-compaction at 212.5k (85%). Codex gets a compact 180k configured window with a 150k transition target and experimental notes/history context management on supported setups. Click Optimize in the tooltip, choose a provider, then select a preset, enter Custom values, or Turn Off that provider. The configured values for both providers are shown directly in the tooltip.
  • Codex model controls — Max enabled automatically: On activation, otak-usage updates the Codex VS Code extension's persisted model state, preserves the reasoning efforts you already have selected, and appends max. If Codex is already open, its webviews are refreshed after a change so the picker updates immediately. This does not modify config.toml.
  • Optional conversation hooks (off by default): Tooltip toggles can prefix Claude Code and Codex conversation titles with the Git repository name and play prompt/stop chimes. The hook runner is a dependency-free Node script that works on Windows, macOS, Linux, WSL, SSH remotes, Dev Containers, and GitHub Codespaces; unrelated user hooks remain untouched.
  • OpenTelemetry telemetry: opt in to export aggregate token and cost metrics to any OTLP/HTTP endpoint, including a local OpenTelemetry Collector, Grafana Cloud, Honeycomb, or Datadog.
  • Fast incremental scanning: current-month files are streamed, only newly appended bytes are scanned after the first pass, and scan state survives VS Code restarts.
  • Remote-ready: the extension runs in the workspace extension host, so it reads logs where your CLIs run, including GitHub Codespaces, Dev Containers, and Remote-SSH hosts — and it says so when it ends up on the local side instead. See Codespaces, Dev Containers and other remotes.
  • Localized interface: commands, settings, notifications, and status messages follow your VS Code display language.

How It Works

On each refresh, otak-usage:

  1. Resolves the Claude Code config directory and Codex home directory.
  2. Streams current-month JSONL logs from the available providers.
  3. Deduplicates transcript records and normalizes token counters.
  4. Applies built-in pricing plus any otakUsage.pricingOverrides.
  5. Reads the latest Codex rate-limit snapshot from the session logs and, when otakUsage.showRateLimits is enabled, fetches Claude Code limits from the Anthropic usage endpoint and the Codex banked-reset count from ChatGPT's usage endpoint.
  6. Updates the status bar, tooltip, and copied summary data.
  7. Optionally reads RTK aggregate savings and exports OpenTelemetry metrics.

If a provider directory is missing, that provider is skipped without blocking the other one. Unknown-priced models are counted as usage but shown as n/a for cost until you add an override.

Incremental scanning

A refresh never re-reads a transcript it has already accounted for. Every file is tracked by size, mtime, and a byte offset, so a tick reads only the bytes appended since the last one, and an incomplete trailing line is left for the next pass.

Discovery is just as incremental. Directory listings are cached and only re-read when the directory's own mtime moves — which happens when a session file is created, renamed, or deleted, but not when an existing one is appended to. Entries are then re-checked on a backoff proportional to how long they have been idle, so the session you are working in is looked at every tick while a transcript last touched a week ago is not. Directories are never left unchecked for more than a minute, so a brand-new session still shows up on the next refresh, and a full re-listing runs every 30 minutes as a backstop against a filesystem whose directory mtimes cannot be trusted.

On a real 1,809-file history this makes a steady-state tick about 5x cheaper than a full walk (mean 449 vs ~2,228 filesystem calls, 24 ms vs 131 ms), and the persisted dedupe state is 8x smaller (1.2 MB vs 10.4 MB), cutting the serialization the extension does on every save.

One scan, however many windows are open

VS Code runs an extension host per window, so ten open windows would otherwise mean ten copies of everything above reading the same files — plus ten calls to the Anthropic and ChatGPT usage endpoints, ten rtk child processes, ten OpenTelemetry exports of the same numbers, and ten popups for one cost alert.

Instead the windows elect one of themselves. The leader scans and publishes the per-day, per-model token counts; every other window renders that. Costs are still computed per window, so otakUsage.pricingOverrides, the visibility toggles, the period and the status-bar view stay yours to set per window — and nothing about the display changes, because every window shows the same numbers it always did.

  • The election runs through the extension's own global storage directory, which is shared by every window of one installation on Windows, macOS, Linux, WSL, SSH remotes and Codespaces alike. In a remote the extension host lives on the remote side, so the windows attached to it elect a leader there, next to the logs they are actually reading.
  • Windows only share a leader when they would scan the same directories. Point otakUsage.claudeConfigDir or otakUsage.codexHome somewhere else in a workspace and that window scans for itself.
  • The leader renews a 30-second lease every 10 seconds. Close it and the lease is handed over at once; kill it and another window picks the work up within the lease. Refresh Usage always takes over on the spot, so the window you are working in is the one that rescans.

Codespaces, Dev Containers and Other Remotes

extensionKind is ["workspace", "ui"] with workspace first, so in a Codespace, Dev Container, WSL or SSH remote VS Code installs otak-usage on the remote side — the machine the CLIs actually run on, whose ~/.claude and ~/.codex are the logs worth reading. CLAUDE_CONFIG_DIR and CODEX_HOME are respected there like anywhere else.

When it lands on the wrong side

An installation that exists only locally falls back to the ui kind, and then the status bar describes your local ~/.claude while you work inside the remote — the same numbers, silently about the wrong computer. VS Code publishes exactly the two signals needed to catch that: env.remoteName is defined in every extension host, local and remote alike, once a remote one exists, and Extension.extensionKind says which side this instance runs on. So otak-usage names the problem instead of reporting the wrong machine:

  • the tooltip and the copied summary carry a line naming the host being read;
  • a notification states it once per remote kind, with a button that installs the extension on the remote.

Dismiss the notification and it does not come back. The tooltip line stays for as long as the situation does.

Installing it once instead of once per codespace

An extension cannot install itself into a remote, but the manual step is avoidable:

  • Per repository — list it in devcontainer.json and every codespace created from that repo gets it unasked:

    {
      "customizations": {
        "vscode": {
          "extensions": ["odangoo.otak-usage"]
        }
      }
    }
    

    Existing codespaces pick this up after Codespaces: Rebuild Container.

  • Per remote kind, for the remotes that offer it — dev.containers.defaultExtensions covers Dev Containers you build locally and remote.SSH.defaultExtensions covers SSH hosts. Neither applies to codespaces.

There is no per-account equivalent for Codespaces, and Settings Sync is not one: it "does not synchronize your extensions to or from a remote window, such as when you're connected to SSH, a development container (devcontainer), or WSL". So for a repository whose devcontainer.json you cannot edit, installing it stays a deliberate act — which is what the notification's button is for.

Usage belongs to the host that produced it

otak-usage reads local log files and does not aggregate across machines, so what a codespace shows is that codespace's usage:

  • disconnect, and your local window is back to local numbers — the codespace's totals are not merged in;
  • reconnect to the same codespace and they are there again;
  • rebuild the container or delete the codespace and they are gone, because ~/.claude and ~/.codex live outside /workspaces, which is the only thing a rebuild preserves.

Claude Code's rate-limit percentages are the exception. They come from the same account-level Anthropic endpoint the CLI's /usage command uses, so they read the same from any host. Codex rate limits are parsed out of its session logs and follow the host, exactly like the costs do.

Keeping ~/.claude across rebuilds

Session history — and the context-optimization values otak-usage writes into ~/.claude/settings.json and ~/.codex/config.toml — are discarded when the container is rebuilt. Named volumes keep both:

{
  "mounts": [
    "source=claude-home,target=/home/vscode/.claude,type=volume",
    "source=codex-home,target=/home/vscode/.codex,type=volume"
  ],
  // A fresh named volume is owned by root, which would leave the CLIs unable to
  // write to their own directories.
  "postCreateCommand": "sudo chown -R $(id -u):$(id -g) ~/.claude ~/.codex"
}

Replace /home/vscode with your image's remote user home. The volumes outlive rebuilds of the container, though not deletion of the codespace itself.

Pinning it to the local machine

To watch your local usage while working in a remote, force the UI kind in your local user settings:

"remote.extensionKind": { "odangoo.otak-usage": ["ui"] }

This is the arrangement the warning above describes, so it is worth choosing deliberately rather than arriving at by accident. Note that costs then cover only what you run locally, while Claude Code's rate-limit percentages remain account-wide and stay accurate either way.

Commands

Command Description
Otak Usage: Cycle Status Bar View (Today / This Month / Limits) Cycle the status bar through today's cost, this month's cost, and the rate-limit view. The status-bar item runs this command on click.
Otak Usage: Toggle Period (Today / This Month) Switch the status bar between today's and this month's cost without entering the limits view.
Otak Usage: Refresh Usage (Clear Cache and Rescan) Drop the incremental scan cache and rebuild the usage summary from local logs.
Otak Usage: Copy Usage Summary Copy a plain-text per-model breakdown to the clipboard. The tooltip also exposes this action.
Otak Usage: Configure Context Optimization Choose Claude Code or Codex CLI, then select a preset, enter arbitrary custom values, or turn optimization off for that provider. The tooltip's Optimize action runs this command.
Otak Usage: Toggle Repository Name in Conversation History Enable or disable the repository-name Stop hooks for both providers.
Otak Usage: Toggle Hook Sounds Enable or disable prompt/stop sound hooks for both providers.
Otak Usage: Silence Alerts for Today (Toggle) Silence every cost and rate-limit notification until the next local midnight, or lift the silence again. See Alerts.

Optional Conversation Hooks

These hooks are deliberately off by default. Use either Settings or the two links at the bottom of the otak-usage tooltip:

  • Repository name writes only managed hook entries to Claude Code settings.json and Codex hooks.json. On Stop, the runner resolves the Git origin name (falling back to the repository directory) and prefixes the existing conversation title as [repository] ....
  • Hook sounds adds UserPromptSubmit and Stop entries. The runner uses a configured sound path (OTAK_USAGE_PROMPT_SOUND / OTAK_USAGE_STOP_SOUND), then the conventional Claude sound files, then a generated short WAV. It uses PowerShell on Windows, afplay on macOS, and paplay/aplay/canberra-gtk-play on Linux; a missing audio device never blocks a turn.
  • The runner is copied to ~/.otak-usage/hooks/otak-usage-hook.js on the side where the extension host runs. That means a remote VS Code window installs and invokes it inside the Codespace, Dev Container, WSL, or SSH host alongside the CLI.
  • Turning either option off removes only otak-usage entries marked with its managed command marker; your own hooks and unrelated settings stay in place.

Alerts

Cost and rate-limit notifications carry two actions: Open Settings, which jumps to the threshold behind the alert, and Not Today, which silences every otak-usage notification until the next local midnight. A weekly window that sits above the threshold for days is the case Not Today exists for — you already know, and you would rather not turn the alerts off permanently to stop hearing about it. The next day the alert fires again, once.

The deadline is stored beside the leader lock in the extension's global storage rather than in this window's state, because the window that raises alerts is whichever one holds the lock at that moment, and that moves between windows. Silencing them anywhere silences them everywhere, and the setting survives a reload. Otak Usage: Silence Alerts for Today sets and clears the same deadline from the command palette.

Fast-Mode Detection

Both CLIs offer a fast mode that bills at premium per-token rates. otak-usage watches for it and warns with the same notification the cost and limit alerts use — Open Settings and Not Today buttons included, so one click silences it for the rest of the day:

  • Claude Code: fast mode leaves no config flag to read, but every fast response is marked in the session transcripts (usage.speed: "fast", tracked as <model>-fast and priced at the fast rates). The warning therefore fires on the first fast-billed response of a day.
  • Codex CLI: fast mode is declared as fast_mode = true under [features] in ~/.codex/config.toml, so the warning fires as soon as the flag appears — before any tokens are spent.

The warning fires once per off → on transition (for Claude, at most once per day of fast usage), is raised only by the leader window like every other alert, and stays quiet while otakUsage.alertMode is off or alerts are silenced with Not Today.

One-time context-optimization migration: the first time fast mode is detected while that provider's context optimization is turned off, otak-usage re-enables it once. At premium fast-mode prices a compact, auto-compacted context is where the savings are largest, so the trade-off that justified opting out at standard rates usually no longer holds. The migration runs exactly once per provider — turn the optimization off again afterwards and that choice is final. Cost tracking itself is unaffected: fast usage is priced with its own -fast table entries either way.

Settings

Setting Default Description
otakUsage.period today Aggregation period shown in the status bar: today or month. Both use the local calendar (local midnight / local month start), not UTC days.
otakUsage.updateIntervalSeconds 60 How often to rescan usage logs, in seconds. Minimum: 10.
otakUsage.alertMode both What triggers desktop notifications: off, cost (the daily USD total), limit (a rate-limit window percentage), or both.
otakUsage.dailyAlertThresholdUsd 10 Daily combined Claude + Codex cost threshold in USD. Set to 0 to disable the cost alert.
otakUsage.limitAlertThresholdPercent 80 Subscription rate-limit alert threshold, as a percentage (0–100). Fires when any shown Claude or Codex 5-hour or weekly window reaches this utilization. Set to 0 to disable the limit alert.
otakUsage.showClaude true Include Claude Code usage in the status bar, tooltip, and copied summary.
otakUsage.showCodex true Include Codex CLI usage in the status bar, tooltip, and copied summary.
otakUsage.showRateLimits true Show subscription rate-limit usage (5-hour and weekly windows, Claude Fable, and Codex banked resets) in the tooltip. See Subscription Rate Limits.
otakUsage.statusBarMode cost What the status-bar item shows: cost (API-equivalent cost only), limits (each provider's longer available rate-limit window percentage, falling back to cost until a snapshot is available), or costAndLimits (both). Requires showRateLimits for the limit modes. On first run, if a subscription plan is detected (Claude Pro/Max or a Codex plan), otak-usage sets this to limits once; any choice you make afterwards is final.
otakUsage.showRtk true Show the RTK token-savings tooltip table. It is hidden automatically when rtk is unavailable.
otakUsage.rtkPath "" Path to the rtk executable. Empty means rtk on PATH.
otakUsage.pricingOverrides {} Per-model price overrides in USD per million tokens, for example {"gpt-6": {"input": 5, "cachedInput": 0.5, "output": 30}}.
otakUsage.claudeConfigDir "" Claude Code config directory. Empty means $CLAUDE_CONFIG_DIR or ~/.claude.
otakUsage.codexHome "" Codex home directory. Empty means $CODEX_HOME or ~/.codex.
otakUsage.includeRepositoryNameInHistory false When enabled from the tooltip or Settings, install a managed Stop hook for Claude Code and Codex that prefixes conversation history titles with the repository name.
otakUsage.enableHookSounds false When enabled from the tooltip or Settings, install managed UserPromptSubmit and Stop hooks that play short sounds. Uses platform players where available and degrades quietly on headless Codespaces.
otakUsage.optimizeClaudeContext true On by default. Writes the two official auto-compaction values below under env in Claude Code settings.json. Turning it off through Optimize restores the values that existed before otak-usage took ownership.
otakUsage.claudeContextWindow 250000 Effective context window written to CLAUDE_CODE_AUTO_COMPACT_WINDOW. Claude keeps this independently tuned window for native summary compaction.
otakUsage.claudeAutoCompactPercent 85 Trigger percentage written to CLAUDE_AUTOCOMPACT_PCT_OVERRIDE. Custom values may be 1–100; the default fires at 212.5k tokens, leaving 37.5k for the summary. That is above Anthropic's 200k long-context billing boundary — lower this or the window to stay under it.
otakUsage.optimizeCodexContext true When on, write model_context_window and model_auto_compact_token_limit (from the two settings below) into your Codex config.toml, rewriting them in place if present, and pin [features.context_management] experimental_mode = true for Astra's experimental context management; when off, remove those keys and that flag. While off, the file is left untouched.
otakUsage.codexContextWindow 180000 Value written for model_context_window when the optimization is on. The Optimize picker can set this to the compact 180k default or the 272k preset — 272k being OpenAI's long-context pricing threshold, the largest window still billed at the standard rate — or a custom positive integer.
otakUsage.codexAutoCompactLimit 150000 Value written for model_auto_compact_token_limit when the optimization is on. The 180k default starts its context transition at 150k, leaving 30k of configured headroom. The wider 272k preset pairs with 231.2k, and a custom window is suggested at 85%; custom values must remain below the context window.
otakUsage.telemetry.enabled false Send usage telemetry to an OpenTelemetry OTLP/HTTP endpoint. Off by default.
otakUsage.telemetry.includeTokenUsage true Include per-model token usage (gen_ai.client.token.usage) in telemetry.
otakUsage.telemetry.includeCost true Include per-model USD cost (otak_usage.cost.usd) in telemetry.
otakUsage.telemetry.includeRtkTokens true Include RTK token savings (otak_usage.rtk.tokens) in telemetry.
otakUsage.telemetry.endpoint http://localhost:4318 OTLP/HTTP base endpoint. The /v1/metrics path is appended automatically.
otakUsage.telemetry.headers {} Extra HTTP headers per request, for example {"Authorization": "Bearer <token>"} for Grafana Cloud or Honeycomb.
otakUsage.telemetry.serviceName otak-usage OpenTelemetry service.name resource attribute for exported metrics.
otakUsage.telemetry.serviceInstanceId "" Optional source identifier exported as service.instance.id, useful when multiple machines send metrics.

Context Optimization — Default On

Both providers are optimized immediately after installation unless you turn them off:

Provider Default Config written
Claude Code 250k context, compact at 212.5k (85%) env.CLAUDE_CODE_AUTO_COMPACT_WINDOW and env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in ~/.claude/settings.json (or the configured $CLAUDE_CONFIG_DIR)
Codex CLI 180k configured context, transition at 150k, experimental context management on model_context_window, model_auto_compact_token_limit, and [features.context_management] experimental_mode = true in ~/.codex/config.toml (or the configured $CODEX_HOME)

Upgrades migrate both providers. Whenever the shipped defaults move, otak-usage reconciles each provider's settings once: values that read as a pair this extension previously shipped — Codex's 250k/230k, 272k/250k, 200k/184k, 230k/195.5k, 240k/216k and 250k/212.5k, Claude's 200k/92%, 230k/85% and 240k/90% — are cleared so the current default applies, while anything else is treated as your own choice and kept exactly as it was. A half-configured pair keeps its meaning: the value you never set is pinned to the default it used to inherit, so only the half you left alone stops moving. A pair the current picker offers, such as Codex's 272k / 231.2k, is a choice and survives untouched; if you had picked the older 272k / 250k pair, choose the preset again to get the larger window back.

On Codex versions and accounts that honor experimental_mode, reaching the managed threshold prepares a fresh context window instead of relying on a full-history summary: concise notes survive the transition, and older conversation remains selectively available through history lookup. Stable prompt prefixes still benefit from OpenAI prompt caching; conversation content omitted from the fresh window is no longer sent or billed as cached input. Codex setups that do not activate the experimental feature retain their normal compaction behaviour.

Open the status-bar tooltip and click Optimize. The command palette first asks for Claude Code or Codex CLI, then offers:

  • a provider-specific preset;
  • Custom…, where every value is validated before it is saved;
  • Turn Off, which disables only the selected provider.

Claude's Custom flow accepts any positive context window and an auto-compaction percentage from 1 to 100. Codex's Custom flow accepts any positive context window and a smaller positive auto-compact token limit.

Claude Code officially supports environment variables under the env object in settings.json. With the defaults, otak-usage manages this semantic configuration:

{
  "env": {
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "250000",
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "85"
  }
}

Unrelated Claude settings and environment variables are preserved. On first enable, otak-usage records whether each value already existed; Turn Off restores those exact earlier values, or removes only the values it added. An installation upgraded from the release that managed the percentage alone captures whatever CLAUDE_CODE_AUTO_COMPACT_WINDOW it finds before writing one, so Turn Off still gives back the user's own window. Invalid JSON or a non-object env value causes a visible error and no file write. See the official Claude Code settings and environment variable reference.

The percentage applies to the managed window rather than the active model's native one, so a 1M model and a 200k model both compact at the same 212.5k. A shell variable, managed setting, or higher-priority project/local setting may override the user-level value; use Claude Code's /status and /context commands to inspect the effective configuration. DISABLE_AUTO_COMPACT, DISABLE_COMPACT, or autoCompactEnabled: false also prevents automatic compaction and is never silently removed by otak-usage.

Subscription Rate Limits

Subscription plans (Claude Pro/Max, ChatGPT Plus/Pro) meter usage in a rolling 5-hour window and a weekly window. With otakUsage.showRateLimits enabled (the default), each provider section in the tooltip shows how much of both windows is currently used, when they reset, and the plan type — one row per window:

Limits (max)
5h · 5% used · resets 16:40
7d · 8% used · resets 07-15 14:00
7d Fable · 68% used · resets 07-15 14:00
Banked resets · 2
  • Codex CLI: windows are read locally. Rollout session logs already contain the server-reported rate_limits snapshot on every turn; the extension reads the tail of the most recent log. A window whose reset time has already passed is shown as 0% used. A snapshot older than 6 hours (asOfMs) is treated as unknown — idle days do not keep showing the last session's high percentage. The banked reset count is not in those logs, so the extension also calls ChatGPT's /wham/usage endpoint — the same source as Codex /usage — with the ChatGPT token in ~/.codex/auth.json. The token is read-only: it is never refreshed, written, redeemed, or sent anywhere except chatgpt.com. API-key-only installs have no such token and omit the count.
  • Claude Code: local logs carry no rate-limit data, so the extension calls the Anthropic usage endpoint — the same source as the CLI's /usage command — authenticated with the OAuth token Claude Code stores in .credentials.json or the macOS Keychain. The token is read-only: it is never refreshed, written, or sent anywhere except api.anthropic.com. Missing, expired, malformed, or inaccessible credentials are explained in the tooltip. On macOS, the extension reads the current Keychain item first, including the hashed service name for a custom Claude configuration directory; it falls back to the credentials file only when the item is missing. A native lookup is limited to three seconds. After access is denied or the store is unavailable, automatic retries stop until you click Refresh or reload the window. Model-scoped weekly windows such as Fable are shown when the payload includes them.
  • Click the Limits heading (or the Codex banked-reset row) in the tooltip to open the official usage page in the browser.

Set otakUsage.statusBarMode to surface limits in the status-bar item itself. Each provider is shown with its brand logo (Claude / OpenAI, shipped as an icon font) followed by its 5-hour window percentage, so both providers read on the same scale; a snapshot without 5-hour data falls back to its weekly window.

Subscription users get limits by default: on first run, when a rate-limit snapshot proves a subscription plan (Claude Pro/Max via the OAuth credentials, or a Codex plan_type), the status bar switches to the limits view once. This never overrides you — if statusBarMode is already set in any settings scope, or showRateLimits is off, the detection marks itself done and every later change is yours.

  • cost (default): the API-equivalent cost, e.g. $18.01.
  • limits: the per-provider percentages instead of cost, e.g. {claude} 5% {openai} 100% (falls back to cost until a snapshot is available).
  • costAndLimits: both, e.g. $18.01 {claude} 5% {openai} 100%.

Clicking the status-bar item cycles the view: today's cost → this month's cost → limits → back to today's cost. Leaving the limits view restores your configured mode, so a costAndLimits preference survives the round trip.

Disabling otakUsage.showRateLimits hides everything, reverts the click to the classic Today/This Month toggle, and stops both usage requests.

Cost Model

  • Claude Code: each assistant message records input, output, cache-read, and cache-write token counts. Cost is calculated from input, output, cache reads, 5-minute cache writes, and 1-hour cache writes. Fast-mode responses are tracked as <model>-fast and priced separately when a matching table entry exists.
  • Codex CLI: each turn records last_token_usage. Cost is calculated from uncached input, cached input, and output tokens. Reasoning tokens are already included in output tokens. For GPT models with long-context pricing, the extension evaluates each turn independently and applies the published input/output multipliers when total input exceeds 272K tokens.
  • Pricing lookup: built-in tables cover Claude Fable/Mythos/Opus/Sonnet/Haiku families plus GPT-6 Astra, GPT-5.x, Codex, o-series, and GPT-4.x models. Exact match is tried first, then longest-prefix match, so dated model IDs resolve to their base entry.
  • codex-auto-review: Codex labels its automatic code-review turns with this slug, which is not a billable OpenAI model id and carries no published price. OpenAI's usage dashboard reports these requests under GPT-5.4, so they are billed at gpt-5.4's rates on every date and appear in the model breakdown as gpt-5.4.
  • Overrides: use otakUsage.pricingOverrides when a model is missing or a price changes. Unknown models count as $0 and appear as n/a per model until configured.

The built-in table records the date it was last checked against official pricing pages. Because provider pricing can change, treat the output as an estimate and configure overrides when exact reporting matters.

Telemetry

Telemetry is off by default. When otakUsage.telemetry.enabled is true, every refresh exports aggregate metrics as OTLP/JSON to the configured OTLP/HTTP endpoint. No OpenTelemetry SDK dependency is added; the extension posts plain OTLP/JSON. Payloads do not include session identifiers, log paths, or tokens; service.instance.id is sent only when you set otakUsage.telemetry.serviceInstanceId.

Labels follow the OpenTelemetry GenAI semantic conventions.

Metric Type Attributes
gen_ai.client.token.usage Sum, cumulative monotonic, {token} gen_ai.system (anthropic / openai), gen_ai.response.model, gen_ai.token.type (input / output / cache_read / cache_creation)
otak_usage.cost.usd Sum, cumulative monotonic, USD gen_ai.system, gen_ai.response.model; unknown-priced models are skipped
otak_usage.rtk.tokens Sum, cumulative monotonic, {token} otak_usage.rtk.type (saved / input / output), only when the rtk CLI is available

Token counts and cost are month-to-date and reset at the start of each month. RTK counts are all-time. Resource attributes include service.name, service.version, and, when configured, service.instance.id.

Security & Privacy

See the Privacy Notice for a concise description of the data the extension accesses, stores, and sends.

otak-usage is local by default:

  • Local log reading: it reads token-count metadata from local Claude Code and Codex CLI logs.
  • Local config optimization: by default it updates only Claude Code's documented auto-compaction percentage and Codex's documented context/auto-compaction keys. Both can be turned off from Optimize; Claude's previous percentage is restored.
  • No prompt collection: it does not collect, store, or export prompt content.
  • Read-only credential use, provider-only: for rate-limit display it reads the OAuth tokens Claude Code and Codex CLI already store locally and sends each only to that provider's usage endpoint (api.anthropic.com / chatgpt.com) — never modified, refreshed, or redeemed. Disable otakUsage.showRateLimits to prevent this entirely; no other feature touches credential files.
  • No other network use: apart from those usage requests (on by default, one call per provider per refresh interval), network access happens only when you explicitly enable OpenTelemetry export.
  • User-controlled endpoints: telemetry goes only to the OTLP/HTTP endpoint and headers you configure.
  • Local RTK integration: optional RTK support runs the local rtk gain command and reads only aggregate savings numbers.
  • Open source, MIT-licensed: the full implementation is auditable on GitHub.

Language Support

The interface follows your VS Code display language:

English · 日本語 · 简体中文 · 繁體中文 · 한국어 · Tiếng Việt · Español · Português (BR) · Français · Deutsch · हिन्दी · Bahasa Indonesia · Italiano · Русский · العربية · Türkçe

Requirements

  • VS Code 1.90.0 or newer
  • At least one of:
    • Claude Code with local session logs
    • OpenAI Codex CLI with local session logs
  • Optional: RTK (Rust Token Killer) for token-savings summaries

Installation

Install from the VS Code Marketplace, or run:

ext install odangoo.otak-usage
Build from source (VSIX)
npm install
npm run package
code --install-extension otak-usage-<version>.vsix

Reload VS Code after installing the VSIX.

Troubleshooting

  • The status bar does not show usage: confirm Claude Code or Codex CLI has created local session logs on the same machine or remote host where the VS Code extension host is running.
  • One provider is missing: check otakUsage.claudeConfigDir or otakUsage.codexHome if your logs are outside the default locations.
  • The numbers describe the wrong machine: in a Codespace, Dev Container or SSH remote, the tooltip names the host it is reading whenever that is not the remote you are attached to. Install the extension on the remote side — see Codespaces, Dev Containers and other remotes.
  • Usage from a codespace disappeared: it is read from ~/.claude and ~/.codex inside that container, so it is not merged into a local window and does not survive a container rebuild unless those directories are on named volumes.
  • A model shows n/a cost: add an entry to otakUsage.pricingOverrides for that model.
  • Rate limits are not showing: Codex windows appear after the first Codex turn on this machine (they come from session logs). Banked resets also need a ChatGPT login in ~/.codex/auth.json. Claude limits require a valid Claude Code OAuth login, read from the macOS Keychain or ~/.claude/.credentials.json. Check the tooltip for credential errors; after allowing Keychain access, click Refresh. Also confirm otakUsage.showRateLimits is enabled and reload the window after installing an update.
  • RTK savings are absent: install rtk, put it on PATH, or set otakUsage.rtkPath.
  • Telemetry is not appearing: confirm otakUsage.telemetry.enabled, the OTLP/HTTP base endpoint, custom headers, and the collector's /v1/metrics route.
  • The numbers differ from a subscription bill: otak-usage estimates API-equivalent cost, not subscription spend.

Related Extensions

More VS Code extensions by odangoo:

Extension Description
otak-paste Paste optimized screenshots into Markdown and keep repositories lighter
otak-proxy One-click proxy switching for VS Code, Git, npm, and integrated terminals
otak-monitor Real-time CPU, memory, and disk usage in the status bar
otak-committer AI-assisted commit messages, pull requests, and issues
otak-clipboard Copy a folder or the current tab to your clipboard in two clicks
otak-clock Dual time-zone clock for the status bar
otak-pomodoro A Pomodoro focus timer built into VS Code
otak-restart Quick Extension Host and window restart from the status bar
otak-zen A calm, distraction-free Zen mode for VS Code
otak-lsp Japanese morphological analysis with grammar checks, semantic highlights, and hovers

License

Released under the MIT License.


Built by tsuyoshi-otake · Marketplace · GitHub · Issues

macOS credential compatibility

The read-only Keychain lookup follows the official Claude Code 2.1.62 implementation (Claude Code-credentials, with a SHA-256 directory suffix for CLAUDE_CONFIG_DIR). Windows/Linux file credentials and macOS store outcomes are covered by automated mock tests. Real macOS Keychain access, including its permission dialog, still needs validation on a macOS machine; it was not exercised in the Windows development environment.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft