Status: [LIVE] Endpoints found: https://api.openai.com/v1/chat/completions https://api.openai.com/v1/chat Source: https://github.com/xblanc33/CodexProxy # Codex Proxy — OpenAI-Compatible Logging Proxy (Node/Express) A tiny Node/Express proxy that forwards OpenAI‑compatible API requests while writing rich NDJSON logs for easy analysis. It supports standard JSON and streaming (SSE) responses and is handy for tracing prompts, parameters, and tool/function calls. ## Features - OpenAI‑compatible proxy to any API base (default `https://api.openai.com`). - Logs every request/response to `logs/requests.ndjson` (one JSON per line). - Streams upstream SSE to the client while also logging the full response once. - Extracts assistant content into a concise `content` field (best‑effort). - Extracts tool/function calls into a `tool_calls` array for human‑readable auditing. - Simple CORS for browser clients; health endpoint at `/health`. ## Requirements - Node.js 18+ recommended. If you use Node <18, the proxy dynamically polyfills `fetch` via `node-fetch@3` (must be installed). ## Quick Start 1) Install dependencies ```bash npm i express dotenv # Optional on Node <18 npm i node-fetch@3 ``` 2) Create a `.env` file (example) ```ini PORT=5000 API_BASE=https://api.openai.com/v1 #API_BASE=https://generativelanguage.googleapis.com UPSTREAM_API_KEY=sk-... ALLOW_CLIENT_AUTH=false # Optional header helpers OPENAI_ORG= OPENAI_PROJECT= OPENAI_BETA= FORCE_OPENAI_HEADERS=false # Logging LOG_RAW_BODY=true ``` 3) Run the proxy ```bash node server.js ``` 4) Verify it’s up ```bash curl -sS http://localhost:5000/health ``` ## Usage Proxied endpoints (more can be added easily): - `POST /v1/responses` (primary for Codex v0.139.0+) - `POST /v1/chat/completions` (legacy OpenAI chat API) - Catch‑all passthrough: `POST /v1/:first` Examples: ```bash # Non‑stream example curl -sS -X POST \ http://localhost:5000/v1/chat/completions \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $OPENAI_API_KEY' \ -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}' # Stream example (SSE) c