Skip to main content

Crate shift_proxy

Crate shift_proxy 

Source
Expand description

SHIFT native proxy — Rust HTTP server that intercepts AI API requests, optimizes image payloads via shift-preflight, and forwards to upstream providers. Replaces the Node.js/Hono proxy with a single-binary server.

§Architecture

Client (OpenCode, Claude Code, Codex, etc.)
  │
  ├── POST /v1/messages         → Anthropic (optimize + forward)
  ├── POST /messages            → Anthropic (rewrite → /v1/messages)
  ├── POST /v1/chat/completions → OpenAI   (optimize + forward)
  ├── POST /v1beta/models/*     → Google   (passthrough)
  ├── GET  /health              → Status
  ├── GET  /stats               → Session stats
  └── POST /*                   → Auto-detect provider (passthrough)

Re-exports§

pub use state::ProxyConfig;
pub use state::ProxyState;

Modules§

body
Request body extraction with transparent decompression.
forward
Forward requests to upstream provider APIs and stream responses back.
optimize
Shared image optimization logic for provider route handlers.
routes
Route handlers for the SHIFT proxy.
state
Shared proxy state and configuration.

Functions§

create_app
Build the axum router with all proxy routes.
start_server
Start the proxy server, blocking until shutdown signal.