Files
autoreg-skills-max/skills/chat2api-proxy/references/wrong-server-instance-2026-07-04.md

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 Error
  • netstat showed 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 — no AUTH_KEY, no AUTHORIZATION
  • No data/ directory (so /tokens page crashed)
  • Empty tokens.txt (0 bytes)

The AppData copy had:

  • tokens.txt — 1980 bytes, valid K12 token ([REDACTED-NAME]@gmail.com)
  • data/ — with token.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":

  1. Check which process is on the port
  2. Verify it's running from the correct project directory
  3. Check that tokens.txt exists and has content
  4. Check that data/ directory exists (for /tokens page)