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
1
Generate an API key
Log in to opensync.dev, go to Settings, and click Generate API Key. Copy the key (starts with
osk_).2
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
3
Verify the connection
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
Supported models
All OpenAI models used through Codex CLI are supported:
Cost calculations use these prices at the time of sync.
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: