Files
chatgpt-codex-router/QUICK_START.md
mars 0dd6fe2c7d feat: 实现ChatGPT Codex路由器的核心功能
- 添加完整的项目基础结构,包括配置、类型定义和常量
- 实现OAuth认证流程和令牌管理
- 开发请求转换和响应处理逻辑
- 添加SSE流处理和ChatCompletions API转换
- 实现模型映射和提示指令系统
- 包含Docker部署配置和快速启动文档
- 添加自动登录功能和测试脚本
2026-01-07 10:51:54 +08:00

2.6 KiB

Quick Start Guide

First Time Setup (Auto Login)

  1. Start the server:

    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:

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

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

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:

# 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:

curl -X POST http://localhost:3000/auth/login

View Logs

# 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:

{
  "server": {
    "port": 3000
  },
  "logging": {
    "level": "info",
    "enableRequestLogging": false
  }
}

More Information