Skip to content

Add codex-shim doctor command#8

Open
luckeyfaraday wants to merge 1 commit into
mainfrom
claude-oauth
Open

Add codex-shim doctor command#8
luckeyfaraday wants to merge 1 commit into
mainfrom
claude-oauth

Conversation

@luckeyfaraday

Copy link
Copy Markdown
Owner

Summary

  • Adds a read-only codex-shim doctor command that inspects and reports on the full shim setup without modifying anything
  • Accepts an optional provider argument to narrow checks: codex-shim doctor openrouter, codex-shim doctor minimax
  • Exit 0 if all checks pass or only warnings; exit 1 on hard failures

What it checks

Check Details
imports codex_shim loads correctly, reports version
codex-cli codex binary on PATH
port N available, occupied by another process, or shim already running
settings ~/.codex-shim/models.json exists, parses, lists slugs + providers; flags missing API keys
codex.toml ~/.codex/config.toml managed status, active model, which keys would be preserved on enable/disable
auth.json gpt-5.5 passthrough availability
per-provider settings file exists, parses, models have valid provider + base_url + API key

Sample output

  ok    imports     codex_shim 0.1.0 loaded
  ok    codex-cli   /usr/local/bin/codex
  ok    port 8765   available
  warn  settings    ~/.codex-shim/models.json not found — create it or use --settings
  warn  codex.toml  ~/.codex/config.toml exists but shim not installed — run codex-shim enable
  ok    auth.json   gpt-5.5 passthrough available

  OpenRouter
  warn  settings    ~/.codex-shim/openrouter-models.json not found — run: codex-shim setup openrouter

  MiniMax Token Plan
  warn  settings    ~/.codex-shim/minimax-models.json not found — run: codex-shim setup minimax

Test plan

  • codex-shim doctor runs without errors on a clean install
  • codex-shim doctor openrouter and codex-shim doctor minimax run correctly
  • All 36 existing non-async tests pass
  • API keys are never printed — only present / MISSING
  • No files are modified — strictly read-only

🤖 Generated with Claude Code

Lets users run Claude models through Codex Desktop without a separate
Anthropic API key by reusing the OAuth token Claude Code already holds
in ~/.claude/.credentials.json.

- New `anthropic-oauth` provider in PROVIDER_SPECS (port 8768)
- `codex-shim setup anthropic-oauth` writes keyless settings with
  Opus 4.7 + Sonnet 4.6 pre-configured; works non-interactively
- `codex-shim anthropic-oauth .` runs Codex through that provider
- Server reads the OAuth access token at request time, checks expiry,
  and injects it as Bearer — no token ever stored in settings
- `requires_api_key=False` on ProviderSpec skips the key prompt/check
  for the whole provider lifecycle (setup, status, doctor)
- `ShimModel.is_anthropic` now covers `anthropic-oauth` so routing
  and translation work without changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant