3.8 KiB
ProxyPilot Rust Replatform
This branch carries the Rust rewrite line for ProxyPilot.
Branch contract
- Go
mainremains the shipping line while Rust grows. - Rust lives under
rust/. - The Rust line is terminal-first and does not treat the browser dashboard as a required early target.
- The first real milestone is a working Rust executable that can proxy a Codex-compatible request end-to-end.
Current milestone
proxypilot-rs is the first Rust binary in the repo. It currently provides:
- a
runcommand that starts a local proxy server - a
tuicommand that opens a minimal terminal operator view - a TOML config model plus a separate local state file for saved accounts
- explicit Codex-facing routes for
/v1/models,/v1/chat/completions, and/v1/responses - a local
/v0/runtime/statsoperator surface for runtime-memory counters, auth-health, and last refresh status - CLI account commands for adding, importing, device-login, refresh, listing, activating, and removing Codex accounts; these manage saved disk state only and do not pretend a running proxy has already adopted the change
- optional
codex.refresh_token_urlconfig support for redirecting Codex refresh exchanges to a local stub during validation, while preserving the live OpenAI default when unset - a TUI operator console that shows live runtime stats, runtime-unavailable copy, local accounts, selected-account details, token state labels, terminal actions for activate/refresh/delete, separate selected-account vs active-account refresh handling, and the
r/creload-clear controls - runtime credential resolution that prefers the active saved account over the config fallback key
- proactive Codex token refresh when the active saved account is already expired or within the refresh window, plus the existing 401-retry refresh fallback
- end-to-end tests against a mocked upstream server
Design defaults
- Go is the behavioral reference, not a line-by-line port target.
- The Rust branch is allowed to redesign config and management surfaces.
- The product identity does not change: ProxyPilot still exists to be a local proxy for coding tools.
Local workflow
From the repo root:
cd rust
cargo run -p proxypilot-rs -- init
cargo run -p proxypilot-rs -- account add-codex --name primary --api-key sk-...
cargo run -p proxypilot-rs -- account import-codex --file ../auths/codex-example.json --activate
cargo run -p proxypilot-rs -- account login-codex-device --activate
cargo run -p proxypilot-rs -- account refresh-codex
cargo run -p proxypilot-rs -- account remove --name old-account
cargo run -p proxypilot-rs -- run --config proxypilot-rs.toml
Run the local Codex-compatible smoke check without touching real provider accounts:
cd rust
./scripts/codex-smoke.sh
The smoke check starts a local mock upstream, saves a temporary Codex account,
starts the Rust proxy, and verifies /healthz, /v0/runtime/stats,
/v1/models, /v1/chat/completions, and /v1/responses.
Run the local Claude API-key smoke check:
cd rust
./scripts/claude-smoke.sh
The Claude smoke starts a local mock Anthropic-compatible upstream, starts the
Rust proxy with providers.active = "claude", and verifies Claude API-key
headers on /v1/models and /v1/messages.
Current Codex Gaps
The Rust line is not ready to replace the Go Codex surface yet. These Go routes and behaviors are still unsupported or intentionally deferred:
/backend-api/codex/responses/backend-api/codex/responses/{response_id}/compact/v1/responses/compact- Codex websocket streaming
- Codex image generation and image edit handling
- Browser dashboard and
/v0/management/**routes - Go model registry and model-mapping behavior
Open the TUI with:
cd rust
cargo run -p proxypilot-rs -- tui --config proxypilot-rs.toml