Back to Codexbar

Amp Provider

docs/amp.md

0.49.62.4 KB
Original Source

Amp Provider

The Amp provider tracks Amp Free usage, monthly subscription pools, and individual and workspace credits. It prefers the local Amp CLI, then an Amp access token, and finally browser cookies.

Features

  • Amp Free meter: Shows how much daily free usage remains.
  • Daily reset: Percentage-based Amp Free usage resets at 8:00 PM America/New_York time.
  • Monthly subscriptions: Shows the independently metered “Other usage” and “Orb usage” pools for Megawatt and Gigawatt plans.
  • Time-to-full reset: Legacy dollar-based Amp Free output estimates when hourly replenishment reaches full.
  • Individual credits: Shows the remaining paid credit balance when Amp reports one.
  • Workspace credits: Shows each workspace's remaining paid credit balance separately.
  • CLI-first fetch: Uses amp usage when the Amp CLI is installed and signed in.
  • Access token support: Uses AMP_API_KEY or the access token saved in CodexBar settings.
  • Browser cookie fallback: Reads the legacy settings-page payload when the CLI and access token are unavailable.

Setup

  1. Open Settings → Providers
  2. Enable Amp
  3. Install and sign in to the Amp CLI, add an Amp access token, or leave Cookie source on Auto for web fallback

Access token (optional)

Create an access token in Amp settings, then paste it into Amp → Access token or set AMP_API_KEY.

  1. Open https://ampcode.com/settings
  2. Copy a Cookie: header from your browser’s Network tab
  3. Paste it into Amp → Cookie Source → Manual

How it works

  • Runs amp usage first in automatic mode
  • Calls POST https://ampcode.com/api/internal?userDisplayBalanceInfo with an Amp access token
  • Falls back to the settings page with browser cookies
  • Parses the same usage display format returned to the CLI
  • Uses Amp's calendar-month renewal period for subscriptions and its 8:00 PM New York reset for daily free usage
  • Computes time-to-full from the hourly replenishment rate for legacy dollar-based Amp Free output

“Amp access token is invalid or expired”

Create a new access token in Amp settings, update AMP_API_KEY or CodexBar settings, then refresh.

Troubleshooting

Log in to Amp in a supported browser (Safari or Chromium-based), then refresh in CodexBar.

Sign out and back in at https://ampcode.com/settings, then refresh.