Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Codex Cost MonitorNew to Visual Studio Code? Get it now.
Codex Cost Monitor

Codex Cost Monitor

Hoàng Tuân

|
188 installs
| (2) | Free
Monitor Codex usage, warn about account quotas or daily USD budgets in Japanese and Vietnamese, and show a dashboard table view.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Codex Cost Monitor

VS Code extension for estimating Codex API costs from local Codex session logs.

The extension reads JSONL files under ~/.codex/sessions, extracts token usage and model metadata, applies the configured pricing catalog, and displays daily cost, month-to-date history, token usage, cache savings, and per-session details.

Costs are estimates derived from local logs. The extension does not reconcile against the Usage API.

Features

  • Daily cost dashboard with JPY, USD, and VND display options.
  • ChatGPT account limits, updated from Codex account notifications with a five-minute refresh fallback; hidden for API key and non-ChatGPT authentication.
  • Cross-platform Codex CLI account detection on Windows and macOS, including Windows npm .cmd shims and common macOS install paths.
  • Usage warnings in Japanese above Vietnamese, separated into matching language blocks; account quotas include both short-term and weekly windows.
  • Month-to-date and historical cost totals. There is no monthly spending limit.
  • Token summary: input, cached input, cache write, uncached input, output, reasoning, and billed output, with cost in JPY, USD, and VND.
  • Model and context breakdown, including Standard, Batch, Flex, Fast/Priority, and supported Ultrafast billing modes.
  • CSV export for all sessions found in the current day.
  • Automatic JSONL rescanning and history persistence.
  • Cache-hit ratio and estimated cache savings.
  • UTC-based day and month boundaries so reports are consistent across machine timezones.

Billing modes

The pricing catalog stores Standard per-token rates per model, including separate 30-minute and 12-hour cache-write rates where OpenAI publishes them. Runtime tier multipliers apply unless an explicit per-model tier rate is present:

Mode Source Multiplier
Standard service_tier: default or missing tier 1x
Batch Batch API provenance such as /v1/batches or batch_id 0.5x
Flex service_tier: flex 0.5x
Fast service_tier: fast or priority 2x
Ultrafast service_tier: ultrafast Published GPT-6 Astra rates only; other models without an explicit price remain unpriced

Published exceptions override these multipliers, including Fast rates for GPT-5.5, GPT-5-mini, GPT-4.1, GPT-4o, o3, and o4-mini, and rounded cached-input rates for GPT-5.4 Batch/Flex and o4-mini Flex.

Batch provenance takes precedence over service_tier. If a log does not contain tier metadata, the dashboard treats it as Standard and estimates the cost using Standard rates. Batch is only inferred when explicit Batch provenance exists.

The pricing values are based on OpenAI API pricing and each model's official page where needed. Batch and Flex rates are discounted, while Fast mode uses the applicable higher-priority rate. priority is accepted as the response alias for Fast mode. Ultrafast is priced only where OpenAI publishes an explicit model rate; currently the catalog includes GPT-6 Astra short- and long-context rates.

Log location

Default path:

~/.codex/sessions

Example:

~/.codex/sessions/
└── 2026/
    └── 09/
        └── 09/
            ├── rollout-*.jsonl
            └── rollout-*.jsonl

The parser supports both older log fields and the newer schema, including:

  • model in turn_context.model, payload.model, or payload.base_instructions.provenance.model;
  • service tier in request/response metadata;
  • Batch endpoint, batch_id, and explicit Batch metadata;
  • last_token_usage and cumulative total_token_usage.

Session folder dates and dashboard history use UTC. A session that crosses a UTC day or month is grouped by each event timestamp, independent of the computer's timezone.

Dashboard

The dashboard contains:

  • Today: current-day cost and daily budget usage;
  • Account Limits: ChatGPT 5-hour and weekly quota windows, using the Codex CLI account session;
  • Month: month-to-date cost without a monthly limit;
  • Token Summary: grouped by model, context, and billing mode, with costs in JPY, USD, and VND;
  • Daily History and Monthly History;
  • session rows with cost, cache ratio, missing-pricing status, and billing mode.

Daily history is recomputed for the current UTC month from the available logs. Each saved day records a SHA-256 catalog fingerprint and the USD/JPY rate used. Closed months keep their saved estimates; earlier records without this metadata are shown as legacy. History retains the latest 365 UTC calendar days.

Account Limits are read through codex app-server using the existing Codex CLI login. Codex account notifications update the dashboard promptly; a five-minute fallback refresh handles missed notifications. The extension supports Windows npm .cmd shims and searches common macOS CLI locations, including ~/.local/bin, Homebrew, nvm, and the active CODEX_HOME installation. The status-bar hover and Dashboard show available quota windows and banked resets. When Codex provides reset-credit details, both surfaces list each reset's type and expiry date/time in this machine's local time zone; Codex may return only some of the available reset details. API-key, Bedrock, and signed-out accounts do not show this section.

Click the currency button in the status bar to switch between JPY, VND, and USD. VND display uses a fixed conversion of 170 VND per JPY.

Usage warnings

Fresh ChatGPT account quotas trigger a warning when either quota window is over 85% Used, at least 95% Used, or fully used (100% or more). Short-term (for example, 5-hour), daily, and weekly windows are checked independently using the durations returned by Codex. Each warning identifies the window, actual percentage used, remaining percentage, and reset time when available. When both windows newly cross a threshold in the same update, one notification contains both.

Confirmed API-key authentication uses the configurable daily USD budget: at least 85% warns about the remaining budget; at least 100% warns that the budget has been reached or exceeded. The default is $3 USD, and you can increase it at any time in the codexCostMonitor.dailyBudgetUsd setting. ChatGPT account logins keep using account quota warnings as before; unavailable or stale quota data does not switch them to a spend warning. Other auth modes, unresolved auth, and signed-out accounts do not use this budget. Budget warnings use the same estimated daily USD cost as the dashboard and do not separate API-key and account sessions if both were used during the day. A budget of 0 disables API-key budget warnings.

Warnings use a modal dialog titled Codex Cost Monitor with multiline detail, because normal VS Code toasts collapse line breaks. The detail shows 日本語 first, a separator, then Tiếng Việt with the same content. Dismiss the dialog or use Open report to open the dashboard and continue. A direct jump to a higher threshold produces only the higher warning; reaching 100% after a 95% warning produces the exhausted-quota warning.

Warnings appear again whenever VS Code opens a new window or the extension reloads, once fresh quota data or today's budget calculation shows that a threshold is still reached. Startup waits for the first Codex account check before allowing a money-budget warning, preventing the cost scan from mistaking a still-loading ChatGPT account for API-key use. Each activation starts with empty warning history and uses the current usage level. Repeated updates within the same extension session remain quiet until a higher threshold or a new quota cycle is reached. Budget warnings also reset on a new UTC day; account warnings reset per quota window, so the weekly warning is not reset daily within a session. Only hashed account identities are held in memory, with history bounded to 64 account-window entries. If Codex does not supply reset timestamps, an observed drop to 85% or below rearms that window. Previously saved warning history is ignored.

The regression checklist is available in the source tree at docs/usage-alerts.md.

Installation and commands

  1. Open VS Code.
  2. Open Extensions and search for codex-cost-monitor.
  3. Install the extension.
  4. Click the Codex Cost Monitor status-bar item to open the dashboard.

To export session data, open the Command Palette (Ctrl+Shift+P) and run:

Codex Cost Monitor: Export Session CSV

Configuration

Available settings:

codexCostMonitor.baseDir
codexCostMonitor.dailyBudgetUsd
codexCostMonitor.usdToJpy
codexCostMonitor.showUsdInDashboard
codexCostMonitor.sessionSort
codexCostMonitor.pricing

Defaults:

baseDir = auto-detect ~/.codex/sessions
dailyBudgetUsd = 3
usdToJpy = 157
sessionSort = cost

The API-key daily budget defaults to $3 USD and has no upper limit. This setting affects API-key authentication only; ChatGPT account logins continue to use quota alerts. To raise the API-key budget, open VS Code Settings (Ctrl+, on Windows/Linux or Cmd+, on macOS), search for Codex Cost Monitor: Daily Budget USD, and enter the budget you want. You can also set it in settings.json, for example:

"codexCostMonitor.dailyBudgetUsd": 10

The new value applies when the setting changes. API-key budget alerts remain at 85% and 100% of the configured amount; set it to 0 to turn them off.

monthlyBudgetJpy has been removed. Monthly history remains available, but it is informational only and is not treated as a limit or alert threshold.

Custom pricing entries use USD per 1M tokens. Flat fields represent Standard pricing; optional per-tier overrides can be supplied with tiers when a model requires rates that do not follow the default multipliers.

Supported pricing catalog

The built-in catalog includes the current flagship entries and the existing GPT/Codex/O-series entries. Long-context entries are selected automatically when input exceeds the configured long-context threshold.

Current flagship entries include:

  • gpt-6-astra
  • gpt-6.1-sol
  • gpt-6.1-terra
  • gpt-6-sol
  • gpt-6-luna
  • gpt-5.6-sol
  • gpt-5.6-terra
  • gpt-5.6-luna
  • gpt-5.5
  • gpt-5.4
  • gpt-5.4-nano (deprecated by OpenAI; retained for older logs)

The internal model id codex-auto-review has no separate public API rate, so the extension estimates it using the gpt-5.4 entry. This estimate can differ from tools that assume another model or billing tier.

The built-in catalog is in the codexCostMonitor.pricing default in package.json. Built-in model entries always use that packaged catalog even if a user setting contains an override. Custom model IDs can be added in the pricing setting. A missing or invalid packaged catalog stops the scan with an error rather than using duplicate hard-coded prices.

All 53 catalog entries were checked against official documentation on October 27, 2026. GPT-6 Astra, GPT-6.1 Terra, GPT-6 Sol/Luna, GPT-5.6 models, and GPT-5.4 Pro select long-context rates above 272,000 input tokens. GPT-6 and GPT-5.6 cache writes use the published 30-minute or 12-hour rate. Ultrafast rates are explicitly published for GPT-6 Astra. See the pricing audit and verification in docs/pricing-audit.md.

Development

npm install
npm run compile
npm test
npm run release:vsix

The TypeScript output is written to dist/. npm run release:vsix requires Node.js 20 or later and uses the locally installed vsce dependency. It writes a versioned VSIX under releases/, verifies the packaged catalog, and loads it from an extracted temporary directory with a different working directory.

Limitations

  • Costs are estimates and depend on the completeness of local logs.
  • History keeps 365 UTC calendar days; older days are removed on the next history write.
  • Missing service-tier or Batch metadata cannot be reconstructed after the fact.
  • Pricing changes by OpenAI may require updating the built-in catalog.
  • Built-in model prices take precedence over user settings; user settings can add custom models.
  • Tiers or cached-input rates absent from the published tables retain multiplier-based estimates; these are not confirmation that a model supports that billing mode. Regional surcharges are not included.

Changelog

2.1.5

  • Keep the API-key daily USD budget at a $3 default while making it editable to any higher amount through VS Code Settings or settings.json.
  • Apply the daily USD budget only to API-key authentication; keep ChatGPT account quota alerts unchanged.
  • Support Codex account detection on macOS when VS Code does not inherit the CLI install path, including the standard installer, Homebrew, nvm, and CODEX_HOME locations.
  • Run Windows npm-installed Codex .cmd shims through the Windows shell while keeping the console hidden.

2.1.4

  • Refresh the packaged catalog against OpenAI's current pricing tables and add GPT-6.1 Terra short- and long-context prices.
  • Calculate prompt caching with separate 30-minute and 12-hour write token counts, without billing cache writes again as ordinary input.
  • Change API-key and other non-ChatGPT daily spend alerts to a $3 USD budget.
  • Pin the VSIX packaging tool locally and update vulnerable build dependencies.

2.1.3

  • Show USD alongside JPY and VND in Today token summary costs.
  • Route usage warnings by the confirmed Codex auth mode; unresolved or signed-out states no longer fall through to API-key-style JPY budget alerts.
  • If Codex auth mode remains unresolved for five minutes, show one neutral bilingual warning and keep retrying; resume the correct quota or budget warning when detection recovers.

2.1.2

  • Rename usage warning dialogs to Codex Cost Monitor.
  • Show active quota and daily budget warnings again when VS Code opens or the extension reloads, while deduplicating repeated updates within each extension session.
  • Wait for Codex account detection before showing the daily JPY fallback warning; don't switch a confirmed ChatGPT account to spend warnings when quota data is unavailable.
  • Add published GPT-6 Astra Ultrafast prices and retain deprecated GPT-5.4 nano rates for historical logs.

2.1.1

  • Show individual banked reset details in the dashboard and status-bar hover, including reset type and expiry date/time in the machine's local time zone.
  • Sort resets by earliest expiry and normalize reset titles to English, including full resets and weekly bonus hours.
  • Distinguish non-expiring resets from unavailable expiry times and show when Codex returns only partial reset details.

2.1.0

  • Add GPT-6.1 Sol pricing, including Standard and long-context rates for input, cached input, cache writes, and output tokens.
  • Add Japanese-first and Vietnamese-second usage warnings with a separator, displayed in a multiline modal dialog with an Open report action.
  • Check both short-term/daily and weekly ChatGPT quota windows: warn above 85% Used, at 95% or more, and when fully used; combine simultaneous quota warnings and prioritize higher thresholds.
  • Use daily JPY budget warnings at 85% and 100% for API-key, non-ChatGPT, and unverified authentication; wait for startup account detection and avoid spend warnings after a ChatGPT login is confirmed.
  • Persist warning history across extension reloads and reset each quota window independently, keeping weekly warnings separate from daily budget resets.
  • Invalidate old quota data on account changes and prevent partial quota updates from reviving stale data or bypassing retry backoff.
  • Add regression coverage for bilingual content, quota thresholds, weekly resets, budget fallback, authentication races, persistence, and the Open report action.

2.0.9

  • Add ChatGPT Account Limits, quota reset times, and available banked resets to the dashboard and status-bar hover; hide quota details for API-key and non-ChatGPT authentication.
  • Fix account-usage app-server stream decoding and retry handling, including the StringDecoder is not a constructor runtime failure.
  • Simplify Daily History by removing the Catalog fingerprint and USD→JPY columns from the dashboard table while keeping those snapshots in saved history.

2.0.8

  • Use the packaged package.json catalog as the only built-in price source and fail visibly if it is unavailable or invalid.
  • Make report day boundaries UTC and record catalog/FX snapshots in daily history.
  • Add a versioned VSIX release command with packaged-catalog verification.
  • Harden token/settings validation, history writes, scan caching, watcher lifecycle, and exported/report text.

2.0.7

  • Added GPT-6 Sol and Luna Standard, long-context, Batch, Flex, and Fast pricing.
  • Added missing GPT-5.4 Pro long-context pricing.
  • Audited every existing Standard price and corrected published tier exceptions.
  • Added pricing verification covering the catalog, context boundaries, dated model IDs, fallback rates, and token-cost calculations.

2.0.4

  • Corrected built-in Standard pricing for the latest flagship model catalog.
  • Added gpt-6-astra and its long-context pricing.
  • Added Standard, Batch, Flex, Fast, and unknown billing-mode handling.
  • Added Batch provenance detection from Batch endpoint and metadata fields.
  • Added service_tier extraction, including fast and priority handling.
  • Updated model extraction for the newer session metadata schema.
  • Added billing mode to dashboard grouping and CSV export.
  • Removed the monthly budget limit and codexCostMonitor.monthlyBudgetJpy setting.
  • Changed the default USD/JPY conversion rate to 160.
  • Changed the fixed VND/JPY conversion rate to 170 VND per JPY.

2.0.2

  • Fixed per-turn usage calculation using last_token_usage.
  • Prevented double-counting reasoning output.
  • Improved model/date grouping and local-date handling.
  • Updated GPT-5.6 pricing and long-context pricing.

2.0.0

  • Added model history, context breakdown, cache-write accounting, cache savings, and CSV export.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft