Codex CLI Plugin
Thecodex-sync plugin syncs your OpenAI Codex CLI sessions to OpenSync. It reads the JSONL session logs that Codex produces and pushes them to your dashboard.
Source identifier: codex-cli
Installation
Install globally with npm:Setup
Generate an API key
Log in to opensync.dev, go to Settings, and click Generate API Key. Copy the key (starts with
osk_).Run login
- Convex URL:
https://polished-penguin-622.convex.cloud(for hosted) or your self-hosted URL - API Key: The key you copied from Settings
Config file
Credentials are stored in~/.codex-sync/config.json:
Commands
codex-sync login
Stores your Convex URL and API key.codex-sync status
Shows connection info and sync stats:codex-sync sync
Manually triggers a sync of all sessions from~/.codex/.
codex-sync logout
Clears stored credentials.How syncing works
- Codex CLI writes JSONL session logs to
~/.codex/. - The plugin parses these logs, extracting session metadata, messages, token counts, and model information.
- Each session is pushed to
/sync/sessionwithsource: "codex-cli". - Messages are pushed to
/sync/messagewith role, content, and per-message token data. - Deduplication is handled via
externalId, so re-syncing is safe.
What gets synced
| Data | Description |
|---|---|
| Conversation messages | Full history with user and assistant turns |
| Model name | GPT-4o, o3-mini, o1-mini, etc. |
| Token counts | Prompt and completion tokens from the JSONL logs |
| Cost | Estimated based on OpenAI pricing |
| Session metadata | Timestamps, duration, project context |
Supported models
All OpenAI models used through Codex CLI are supported:| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| gpt-4o | $2.50 | $10.00 |
| gpt-4o-mini | $0.15 | $0.60 |
| o3-mini | $1.10 | $4.40 |
| o1-mini | $1.10 | $4.40 |
| gpt-4-turbo | $10.00 | $30.00 |
Troubleshooting
No sessions syncing
- Check that Codex CLI is installed and has been used:
ls ~/.codex/ - Verify plugin status:
codex-sync status - Confirm your API key is valid in the dashboard Settings.
- Run
codex-sync syncto force a manual push.
Token counts missing
Older versions of Codex CLI may not include token counts in their JSONL logs. Update Codex CLI to the latest version:Permission errors
The plugin needs read access to~/.codex/. Check permissions: