Skip to content

JamesChan21/codex-probe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  ██████╗ ██████╗ ██████╗ ███████╗██╗  ██╗      ██████╗ ██████╗  ██████╗ ██████╗ ███████╗
 ██╔════╝██╔═══██╗██╔══██╗██╔════╝╚██╗██╔╝      ██╔══██╗██╔══██╗██╔═══██╗██╔══██╗██╔════╝
 ██║     ██║   ██║██║  ██║█████╗   ╚███╔╝ █████╗██████╔╝██████╔╝██║   ██║██████╔╝█████╗
 ██║     ██║   ██║██║  ██║██╔══╝   ██╔██╗ ╚════╝██╔═══╝ ██╔══██╗██║   ██║██╔══██╗██╔══╝
 ╚██████╗╚██████╔╝██████╔╝███████╗██╔╝ ██╗      ██║     ██║  ██║╚██████╔╝██████╔╝███████╗
  ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝      ╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝

Codex Credential & Diagnostics CLI

Release Go License Platform

English · 中文


Login · check quota · test models · export CSV — all in one binary. Works on Windows / Linux / macOS.


Install

Pre-built binary (recommended)

Download from Releases:

Platform File
Linux x86-64 codex-probe-linux-amd64
Linux ARM64 codex-probe-linux-arm64
macOS Intel codex-probe-darwin-amd64
macOS Apple Silicon codex-probe-darwin-arm64
Windows x86-64 codex-probe-windows-amd64.exe

macOS users: The binary is not signed with an Apple Developer certificate. You need to remove the quarantine attribute before running:

xattr -d com.apple.quarantine codex-probe-darwin-*
chmod +x codex-probe-darwin-*
./codex-probe-darwin-*

Build from source

git clone https://github.com/yourname/codex-probe
cd codex-probe
go build -o codex-probe ./cmd/codex-probe/

Quick Start

# Login and save credential
codex-probe --login -o ./tokens/

# Check remaining quota
codex-probe --status ./tokens/my.json

# Test all model endpoints
codex-probe --apitest ./tokens/

# Quota + apitest, export to CSV
codex-probe --status --apitest --output result.csv ./tokens/

# Use proxy
codex-probe --proxy http://127.0.0.1:7890 --status ./tokens/my.json

Options

Usage:
  codex-probe [options] <file-or-dir>

Options:
  --login          OAuth PKCE login, listen on :1455, write credential JSON
  -o       <path>  Output file or directory for --login (required with --login)
  --status         Query remaining quota (5h window + weekly window)
  --apitest        Test availability of every model endpoint (--test is an alias)
  --output <path>  Write results to a CSV file (must end in .csv)
  --proxy  <url>   Proxy URL  e.g. http://127.0.0.1:7890  or  socks5://...
                   Pass "" to force direct connection
                   Omit flag to auto-detect system proxy
  --help           Show this help

Positional argument (required for --status / --apitest):

Description
<file> A single credential JSON file
<dir> Directory — processes all *.json files inside

Credential JSON format:

{
  "access_token": "eyJ...",
  "refresh_token": "...",
  "account_id": "user-...",
  "email": "you@example.com"
}

Proxy Detection Order

When --proxy is not specified, the following are tried in order:

  1. HTTPS_PROXY / HTTP_PROXY / ALL_PROXY environment variables
  2. macOS — scutil --proxy
  3. Windows — HKCU\...\Internet Settings registry
  4. Direct connection (fallback)

CSV Output

--status

Column Description
file Credential file path
account_id Account ID
email Email
plan_type Plan type
5h_used_pct 5-hour window usage %
5h_reset_at 5-hour window reset time
weekly_used_pct Weekly window usage %
weekly_reset_at Weekly window reset time
upstream_status HTTP status code
error Error message if any

--apitest — one row per token

Column Description
file Credential file path
account_id Account ID
sample_models 3 randomly sampled model names (;-separated)
available true if at least one sampled model responded successfully

How It Works

codex-probe replicates the Codex CLI OAuth PKCE flow:

  1. Generates random state + PKCE verifier / S256 challenge
  2. Opens https://auth.openai.com/oauth/authorize with Codex CLI's client_id
  3. Listens on localhost:1455/auth/callback for the browser redirect
  4. Exchanges code + verifieraccess_token + refresh_token
  5. Decodes JWT to extract account_id and email

Expired tokens are refreshed automatically on 401/403.


License

MIT


Credits


Community

LinuxDO

Discuss, share tips, and get help at linux.do.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages