# Quick Start Guide ## First Time Setup (Auto Login) 1. **Start the server:** ```bash cd /home/mars/project/chatgpt-codex-router npm start ``` 2. **Watch for auto-login messages:** ``` [WARN] No authentication token found. Initiating OAuth login... [INFO] OAuth login initiated. [INFO] Please complete the OAuth flow in your browser. ``` 3. **Complete OAuth in your browser:** - The browser should open automatically - Login to your ChatGPT account - Authorize the application - The browser will show "Authentication Successful" 4. **Server is now ready:** - Token is saved to `~/.chatgpt-codex-router/tokens.json` - Server is running on http://localhost:3000 ## Subsequent Starts After first authentication, subsequent starts will show: ``` [INFO] Authentication token found and valid. [INFO] Server started on http://0.0.0.0:3000 ``` No login required! ## Making API Calls ### Simple Chat Request ```bash curl http://localhost:3000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.2-codex", "messages": [ {"role": "user", "content": "Hello, world!"} ] }' ``` ### Streaming Request ```bash curl http://localhost:3000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.2-codex", "messages": [ {"role": "user", "content": "Tell me a joke"} ], "stream": true }' ``` ## Available Models - `gpt-5.1` - General purpose (none/low/medium/high) - `gpt-5.2` - General purpose (none/low/medium/high/xhigh) - `gpt-5.1-codex` - Coding (low/medium/high) - `gpt-5.1-codex-max` - Advanced coding (low/medium/high/xhigh) - `gpt-5.1-codex-mini` - Quick coding (medium/high) - `gpt-5.2-codex` - Latest coding (low/medium/high/xhigh) ## Troubleshooting ### Port Already in Use If port 1455 is occupied: ```bash # Find and kill the process lsof -ti:1455 | xargs kill -9 # Or use a different port # (See AUTO_LOGIN.md for configuration options) ``` ### Manual Login If auto-login fails: ```bash curl -X POST http://localhost:3000/auth/login ``` ### View Logs ```bash # All logs tail -f logs/*-info.log # Errors only tail -f logs/*-error.log # Warnings only tail -f logs/*-warn.log ``` ## Configuration Create `~/.chatgpt-codex-router/config.json`: ```json { "server": { "port": 3000 }, "logging": { "level": "info", "enableRequestLogging": false } } ``` ## More Information - **Full Documentation**: See [README.md](README.md) - **Auto-Login Details**: See [AUTO_LOGIN.md](AUTO_LOGIN.md) - **Project Plan**: See [plan.md](plan.md)