                                                                              
    ████████╗██╗  ██╗███████╗ ██████╗ ██╗     ██████╗ ██╗     ██╗     ███╗   ███╗
    ╚══██╔══╝██║  ██║██╔════╝██╔═══██╗██║     ██╔══██╗██║     ██║     ████╗ ████║
       ██║   ███████║█████╗  ██║   ██║██║     ██║  ██║██║     ██║     ██╔████╔██║
       ██║   ██╔══██║██╔══╝  ██║   ██║██║     ██║  ██║██║     ██║     ██║╚██╔╝██║
       ██║   ██║  ██║███████╗╚██████╔╝███████╗██████╔╝███████╗███████╗██║ ╚═╝ ██║
       ╚═╝   ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚══════╝╚═╝     ╚═╝
                                                                              
                       ██████╗ ██████╗  ██████╗ ██╗  ██╗██╗   ██╗
                       ██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝╚██╗ ██╔╝
                       ██████╔╝██████╔╝██║   ██║ ╚███╔╝  ╚████╔╝ 
                       ██╔═══╝ ██╔══██╗██║   ██║ ██╔██╗   ╚██╔╝  
                       ██║     ██║  ██║╚██████╔╝██╔╝ ██╗   ██║   
                       ╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝   
                                                                              
    ┌────────────────────────────────────────────────────────────────────────────────┐
    │                         » OpenAI-Compatible API Proxy «                        │
    │                            » GPT & Claude Models «                             │
    │                                » Version 3.3.0 «                               │
    └────────────────────────────────────────────────────────────────────────────────┘


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                              » DESCRIPTION «                                   ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         This proxy server provides an OpenAI-compatible API interface for
         accessing LLM models through theoldllm.vercel.app. It captures
         authentication tokens via a TamperMonkey browser script and proxies
         requests with full streaming support.

         ┌─────────────────────────────────────────────────────────────────┐
         │  SUPPORTED MODELS                                               │
         ├─────────────────────────────────────────────────────────────────┤
         │  ◆ GPT-5 series    (5.2, 5.1, 5, 5-mini, 5-nano)                │
         │  ◆ O-series        (o4-mini, o3, o3-mini, o1, o1-preview)       │
         │  ◆ GPT-4 series    (4.1, 4o, 4o-mini, 4-turbo, 4)               │
         │  ◆ GPT-3.5 series  (3.5-turbo, 3.5-turbo-16k)                   │
         │  ◆ Claude Opus     (4.5, 4.1, 4)                                │
         │  ◆ Claude Sonnet   (4.5, 4, 3.7, 3.5)                           │
         │  ◆ Claude Haiku    (4.5, 3.5)                                   │
         │  ◆ Claude 3        (Opus, Haiku)                                │
         └─────────────────────────────────────────────────────────────────┘


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                              » REQUIREMENTS «                                  ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  ■ Python 3.10 or higher                                        │
         │  ■ Browser with TamperMonkey extension                          │
         │  ■ Internet connection                                          │
         └─────────────────────────────────────────────────────────────────┘


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                              » INSTALLATION «                                  ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  STEP 1: Install Python Dependencies                            │
         └─────────────────────────────────────────────────────────────────┘

              pip install fastapi uvicorn httpx

              - OR using requirements.txt:

              pip install -r requirements.txt

         ┌─────────────────────────────────────────────────────────────────┐
         │  STEP 2: Install TamperMonkey Script                            │
         └─────────────────────────────────────────────────────────────────┘

              a) Install TamperMonkey extension:

                 » Chrome:
                   https://chrome.google.com/webstore/detail/tampermonkey

                 » Firefox:
                   https://addons.mozilla.org/firefox/addon/tampermonkey

                 » Edge:
                   https://microsoftedge.microsoft.com/addons/detail/tampermonkey

              b) Click TamperMonkey icon → "Create a new script"

              c) Delete template, paste contents of:
                 tampermonkey_token_grabber.user.js

              d) Save (Ctrl+S)


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                                 » USAGE «                                      ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  QUICK START                                                    │
         └─────────────────────────────────────────────────────────────────┘

              1. Start the proxy server:

                 python proxy_server.py

                 Server runs at: http://localhost:8001

              2. Open target website in browser:

                 https://theoldllm.vercel.app

              3. TamperMonkey auto-captures token (look for 🔑 icon)

              4. Use proxy API at:

                 http://localhost:8001/v1


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                             » API ENDPOINTS «                                  ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌──────────┬─────────────────────────┬──────────────────────────────┐
         │  METHOD  │  ENDPOINT               │  DESCRIPTION                 │
         ├──────────┼─────────────────────────┼──────────────────────────────┤
         │  GET     │  /                      │  Dashboard with status       │
         │  GET     │  /v1/models             │  List available models       │
         │  POST    │  /v1/chat/completions   │  Chat (stream & non-stream)  │
         │  GET     │  /token-status          │  Check token status          │
         │  POST    │  /receive-token         │  Token receiver endpoint     │
         └──────────┴─────────────────────────┴──────────────────────────────┘


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                               » EXAMPLES «                                     ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  CURL - Non-Streaming                                           │
         └─────────────────────────────────────────────────────────────────┘

              curl http://localhost:8001/v1/chat/completions \
                -H "Content-Type: application/json" \
                -d '{
                  "model": "ent-gpt-4o",
                  "messages": [{"role": "user", "content": "Hello!"}]
                }'

         ┌─────────────────────────────────────────────────────────────────┐
         │  CURL - Streaming                                               │
         └─────────────────────────────────────────────────────────────────┘

              curl http://localhost:8001/v1/chat/completions \
                -H "Content-Type: application/json" \
                -d '{
                  "model": "ent-gpt-4o",
                  "messages": [{"role": "user", "content": "Count 1 to 10"}],
                  "stream": true
                }'

         ┌─────────────────────────────────────────────────────────────────┐
         │  PYTHON - OpenAI SDK                                            │
         └─────────────────────────────────────────────────────────────────┘

              from openai import OpenAI

              client = OpenAI(
                  base_url="http://localhost:8001/v1",
                  api_key="not-needed"
              )

              # Non-streaming
              response = client.chat.completions.create(
                  model="ent-gpt-4o",
                  messages=[{"role": "user", "content": "Hello!"}]
              )
              print(response.choices[0].message.content)

              # Streaming
              stream = client.chat.completions.create(
                  model="ent-claude-3.5-sonnet",
                  messages=[{"role": "user", "content": "Write a poem"}],
                  stream=True
              )
              for chunk in stream:
                  if chunk.choices[0].delta.content:
                      print(chunk.choices[0].delta.content, end="", flush=True)

         ┌─────────────────────────────────────────────────────────────────┐
         │  PYTHON - Requests                                              │
         └─────────────────────────────────────────────────────────────────┘

              import requests

              response = requests.post(
                  "http://localhost:8001/v1/chat/completions",
                  json={
                      "model": "ent-gpt-4o",
                      "messages": [{"role": "user", "content": "Hello!"}]
                  }
              )
              print(response.json()["choices"][0]["message"]["content"])


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                           » AVAILABLE MODELS «                                 ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  GPT MODELS                                                     │
         └─────────────────────────────────────────────────────────────────┘

              ent-gpt-5.2 ................ GPT-5.2
              ent-gpt-5.1 ................ GPT-5.1
              ent-gpt-5 .................. GPT-5
              ent-gpt-5-mini ............. GPT-5 Mini
              ent-gpt-5-nano ............. GPT-5 Nano
              ent-o4-mini ................ O4 Mini
              ent-o3 ..................... O3
              ent-o3-mini ................ O3 Mini
              ent-o1 ..................... O1
              ent-o1-preview ............. O1 Preview
              ent-o1-mini ................ O1 Mini
              ent-gpt-4.1 ................ GPT-4.1
              ent-gpt-4o ................. GPT-4o
              ent-gpt-4o-mini ............ GPT-4o Mini
              ent-gpt-4-turbo ............ GPT-4 Turbo
              ent-gpt-4 .................. GPT-4
              ent-gpt-3.5-turbo .......... GPT-3.5 Turbo

         ┌─────────────────────────────────────────────────────────────────┐
         │  CLAUDE MODELS                                                  │
         └─────────────────────────────────────────────────────────────────┘

              ent-claude-opus-4.5 ........ Claude Opus 4.5
              ent-claude-opus-4.1 ........ Claude Opus 4.1
              ent-claude-opus-4 .......... Claude Opus 4
              ent-claude-sonnet-4.5 ...... Claude Sonnet 4.5
              ent-claude-sonnet-4 ........ Claude Sonnet 4
              ent-claude-3.7-sonnet ...... Claude 3.7 Sonnet
              ent-claude-3.5-sonnet ...... Claude 3.5 Sonnet
              ent-claude-haiku-4.5 ....... Claude Haiku 4.5
              ent-claude-3.5-haiku ....... Claude 3.5 Haiku
              ent-claude-3-opus .......... Claude 3 Opus
              ent-claude-3-haiku ......... Claude 3 Haiku


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                            » CONFIGURATION «                                   ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  PORT                                                           │
         └─────────────────────────────────────────────────────────────────┘

              Default: 8001

              To change, edit PORT variable in proxy_server.py:

                  PORT = 8001

         ┌─────────────────────────────────────────────────────────────────┐
         │  TOKEN STORAGE                                                  │
         └─────────────────────────────────────────────────────────────────┘

              Location: current_token.txt
              
              ■ Tokens persist across server restarts
              ■ New tokens automatically replace old ones
              ■ File is auto-created on first token capture


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                           » TROUBLESHOOTING «                                  ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  "No token available" error                                     │
         └─────────────────────────────────────────────────────────────────┘

              ■ Open https://theoldllm.vercel.app in browser
              ■ Check TamperMonkey script is enabled (look for 🔑 icon)
              ■ Make any request on the site to trigger capture
              ■ Check browser console for "[TokenGrabber]" logs

         ┌─────────────────────────────────────────────────────────────────┐
         │  "403 Forbidden" error                                          │
         └─────────────────────────────────────────────────────────────────┘

              ■ Token has expired
              ■ Refresh the target website
              ■ TamperMonkey will auto-capture new token

         ┌─────────────────────────────────────────────────────────────────┐
         │  "Connection refused" error                                     │
         └─────────────────────────────────────────────────────────────────┘

              ■ Make sure proxy server is running
              ■ Check if port 8001 is available
              ■ Run: lsof -i:8001 (to check port usage)

         ┌─────────────────────────────────────────────────────────────────┐
         │  Streaming not working                                          │
         └─────────────────────────────────────────────────────────────────┘

              ■ Verify "stream": true in your request
              ■ Check server logs for errors
              ■ Ensure client supports SSE (Server-Sent Events)

         ┌─────────────────────────────────────────────────────────────────┐
         │  TamperMonkey script not working                                │
         └─────────────────────────────────────────────────────────────────┘

              ■ Check script is enabled in TamperMonkey dashboard
              ■ Make sure you're on https://theoldllm.vercel.app
              ■ Open console (F12) → look for "[TokenGrabber]" logs
              ■ Click 🔑 button → "Force Capture"


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                               » FILES «                                        ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌────────────────────────────────────┬───────────────────────────────────┐
         │  FILE                              │  DESCRIPTION                      │
         ├────────────────────────────────────┼───────────────────────────────────┤
         │  proxy_server.py                   │  Main proxy server (Python)       │
         │  tampermonkey_token_grabber.user.js│  Browser token capture script     │
         │  requirements.txt                  │  Python dependencies              │
         │  current_token.txt                 │  Token storage (auto-created)     │
         │  README.txt                        │  This file                        │
         └────────────────────────────────────┴───────────────────────────────────┘


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                              » CHANGELOG «                                     ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         ┌─────────────────────────────────────────────────────────────────┐
         │  v3.3.0 (Current)                                               │
         └─────────────────────────────────────────────────────────────────┘
              ■ Fixed streaming: client stays open for entire stream
              ■ Removed non-GPT/Claude models
              ■ Combined proxy and token receiver into single server
              ■ Improved error handling and logging

         ┌─────────────────────────────────────────────────────────────────┐
         │  v3.2.0                                                         │
         └─────────────────────────────────────────────────────────────────┘
              ■ Added proper type checking for API responses
              ■ Better error messages

         ┌─────────────────────────────────────────────────────────────────┐
         │  v3.1.0                                                         │
         └─────────────────────────────────────────────────────────────────┘
              ■ Improved token capture reliability
              ■ Added detailed logging

         ┌─────────────────────────────────────────────────────────────────┐
         │  v3.0.0                                                         │
         └─────────────────────────────────────────────────────────────────┘
              ■ Initial release
              ■ OpenAI-compatible API
              ■ Streaming support
              ■ TamperMonkey integration


    ╔════════════════════════════════════════════════════════════════════════════════╗
    ║                               » LICENSE «                                      ║
    ╚════════════════════════════════════════════════════════════════════════════════╝

         This software is provided for educational purposes only.
         Use responsibly and in accordance with the terms of service
         of any APIs you access.


    ┌────────────────────────────────────────────────────────────────────────────────┐
    │                                                                                │
    │                            ★ END OF README ★                                   │
    │                                                                                │
    │                    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │
    │                    ░  TheOldLLM Proxy v3.3.0           ░                       │
    │                    ░  http://localhost:8001            ░                       │
    │                    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │
    │                                                                                │
    └────────────────────────────────────────────────────────────────────────────────┘