2.0 KiB
2.0 KiB
Wrong Server Instance — Debugging Session (2026-07-04)
Problem
User reported "не отвечает" — the chatgpt-web server wasn't responding to chat completions.
Symptoms
GET /v1/models→ 200 OK, 13 models (no auth needed)POST /v1/chat/completions→ 401"Not authenticated"GET /tokens→ 500 Internal Server Errornetstatshowed PID 3364 listening on :5005
Root Cause
The server was running from C:\Users\User\Desktop\chatgpt2api-pro\ — a fresh clone with no tokens, no data/ directory. The real project with tokens was at C:\Users\User\AppData\Local\hermes\chatgpt2api-pro\.
The Desktop copy had:
.env— noAUTH_KEY, noAUTHORIZATION- No
data/directory (so/tokenspage crashed) - Empty
tokens.txt(0 bytes)
The AppData copy had:
tokens.txt— 1980 bytes, valid K12 token ([REDACTED-NAME]@gmail.com)data/— withtoken.txt,error_token.txt,fp_map.json,pow_config_cache/
Fix
# Kill the wrong server
taskkill //F //PID 3364
# Start from correct location
cd "C:/Users/User/AppData/Local/hermes/chatgpt2api-pro"
PYTHONPATH="C:/Users/User/AppData/Local/hermes/chatgpt2api-pro;$PYTHONPATH" .venv/Scripts/python -u app.py
Verification
# Models still work
curl -s http://127.0.0.1:5005/v1/models | python -c "import sys,json; print(len(json.load(sys.stdin)['data']))"
# → 13
# Chat completions now work
curl -s -X POST http://127.0.0.1:5005/v1/chat/completions \
-H "Authorization: Bearer $(cat tokens.txt | tr -d '\n\r')" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}],"max_tokens":5}'
# → "Hi, Vlad 👋"
Key Takeaway
When debugging a chat2api server that "works for models but not chat":
- Check which process is on the port
- Verify it's running from the correct project directory
- Check that
tokens.txtexists and has content - Check that
data/directory exists (for/tokenspage)