# prime-openai-codex-status

See your OpenAI Codex subscription usage inside [Prime Agent](https://github.com/PrimeIntellect-ai/prime-agent), with an in-chat `/status` report and a small live weekly-usage widget.

This is the Prime Agent edition of [`pi-openai-codex-status`](https://github.com/NxcOP1891/pi-openai-codex-status).

## Install

### From npm

```bash
prime-agent package install npm:prime-openai-codex-status
```

### From GitHub

```bash
prime-agent package install git:github.com/NxcOP1891/prime-openai-codex-status
```

### From a local checkout

```bash
git clone https://github.com/NxcOP1891/prime-openai-codex-status.git
cd prime-openai-codex-status
prime-agent package install "$PWD"
```

Start a new Prime Agent session after installation.

## Usage

1. Run `/login` and choose **OpenAI Codex**.
2. Use an `openai-codex` model.
3. Run `/status` for the complete usage report.

While an OpenAI Codex model is active, the widget below the editor shows the weekly percentage remaining and reset time. It refreshes when a session starts, the model changes, `/status` runs, or an agent loop finishes.

## Features

- Shows primary, secondary, and additional rate-limit windows.
- Includes plan, allowance, reset, and credit information when available.
- Posts `/status` as a plain in-chat report that works through Prime Agent's daemon UI bridge.
- Keeps a 60-second cache and shares concurrent requests to avoid repeatedly querying the endpoint.
- Hides the widget when the active model is not from `openai-codex`.

## Why it differs from the Pi edition

Pi can display the report in a custom overlay. Prime Agent's daemon-backed UI does not bridge arbitrary extension overlays, so this edition uses an in-chat report and a small widget instead.

## Compatibility

Version 0.1.x is developed and tested with Prime Agent 0.7.x and Node.js 22.8 or later.

The extension uses Prime Agent's built-in OpenAI Codex authentication. It is intended for ChatGPT Plus/Pro accounts with Codex access.

## Privacy and notes

- Usage is requested directly from `https://chatgpt.com/backend-api/wham/usage`.
- The existing OpenAI Codex access token and account ID are sent only to that official endpoint.
- No credentials or usage data are sent to this project or another third party.
- The endpoint and response format are internal OpenAI interfaces and may change.
- Visit <https://chatgpt.com/codex/settings/usage> for the authoritative status.

## Acknowledgements

Based on [`pi-openai-codex-status`](https://github.com/NxcOP1891/pi-openai-codex-status), adapted for Prime Agent's daemon-backed interface.

## License

MIT — see [LICENSE](./LICENSE).
