Sign up Log in
n/serv00 · 1d ago · 291 views
u/gubhostDiamond
n/serv00u/gubhost · 1d ago
Red envelope

Setting Up Sub2API on CT8 (Built Entirely with Muse)

As the title says,
Prerequisites:

  1. A CT8 or serv00 (I appealed and got mine unbanned later)
  2. A domain (I used the forum's loc.cc) PS: suggest not using community domains for now, because the cert wouldn't issue and I got stuck there for a while
  3. A Muse (pros don't need it, only noobs like me do)
  4. An OpenAI account (any plan works, all require phone verification) PS: when browsing card sites today I saw a $0 one that hadn't passed phone verification; I have a phone number so I grabbed one to try. Not recommended, I was just messing around

Below is Muse's summary and walkthrough

Full Process of Setting Up Sub2API on CT8 Free Hosting (Redacted Version)

Organized: 2026-11-28
Goal: reverse proxy a free ChatGPT account into an OpenAI-compatible API, public address [entry redacted]
Result: working, account connected and tested, balance topped up (virtual), only need to generate an API Key to call it.

Redaction note: all passwords, keys, Tokens, OAuth auth codes, personal emails, account names, entry addresses, port numbers and database names have been removed. Passwords are written as [密码已脱敏], personal emails as [邮箱已脱敏], account names as [账号已脱敏] / [管理员账号已脱敏] / [账号名已脱敏], entry addresses and domains as [入口已脱敏] / [域名已脱敏], port numbers as [端口已脱敏], database names as [数据库名已脱敏]; authorization links keep only the structure, not the parameter values. Version numbers and other operational info are kept, otherwise the steps can't be reproduced.


I. Overview

Item Content
Host CT8 (ct8.pl), DevilWEB 2.2 free shared hosting, not a VPS
System FreeBSD 14.3-RELEASE-p19 (amd64)
Sub2API v0.2.24, FreeBSD build, source KiritoXDone/Sub2API-Freebsd
Entry [entry redacted] (plain HTTP, no cert)
Backend PostgreSQL + Redis
Upstream account 1 free ChatGPT account, OAuth, named [account name redacted]
Admin [admin account redacted] (local account, not a real email)
Keepalive start.sh / restart.sh + cron every 5 minutes

Chain: 用户 / 客户端 → [入口已脱敏] → CT8 反向代理 → 127.0.0.1:[端口已脱敏](Sub2API)→ ChatGPT 账号 → OpenAI


II. Starting Point: This Is Not a VPS

At first I tried to reproduce a LINUX DO post, "Idle Serv00 Deploy Sub2API Tutorial". On Serv00 it was a Redis + PostgreSQL setup with about 200M RAM.

The CT8 I actually got is not a VPS:

  • The panel is DevilWEB 2.2 (MyDevil free hosting), no server list, no boot / shutdown / reinstall.
  • Plan FREE, valid until 2027-02-26, home directory /usr/home/[账号已脱敏]/, hostname s1.
  • Quota: 3GB disk (only about 17MB used at the time), 512MB RAM, 100% CPU, 20 processes, 500 emails/day.
  • Panel sections: Dashboard, Websites, DNS Zones, Mail, FTP, Databases, Repositories, Cron Jobs, Port reservation, File manager, SSH terminal.

Conclusion: same class as Serv00, with a web SSH terminal + port reservation. Sub2API can run, but it has to be deployed within shared hosting limits, not treated like a VPS.


III. Prep: Port + Database (19:38–19:40)

All done in the CT8 panel, account [account redacted].

1. Reserve a port

  • Port reservation -> reserve TCP port [port redacted], description Sub2API.
  • Pitfall: I tried one port first and got This port is already taken; changed to [port redacted] and it worked, panel showed Port has been reserved.

2. Create PostgreSQL

  • Databases -> PostgreSQL, create:
    • Database name / username: [数据库名已脱敏]
    • Password: [密码已脱敏]
    • Host: pgsql.ct8.pl, port [port redacted]
    • Charset: C.UTF-8
  • Panel showed The database has been added, initial size about 7.44 MB.

IV. Install Sub2API + Redis (19:40–20:00)

Done in the panel SSH terminal, prompt was [[账号已脱敏]@s1]:~$.

1. Enable Binexec first

The Binexec (custom software) switch in the panel was off by default. Running your own binary requires it. After enabling it, reconnect the SSH session for it to take effect.

2. Download Sub2API

Download v0.2.24 from KiritoXDone/Sub2API-Freebsd:

  • Package: sub2api_0.2.24_freebsd_amd64.tar.gz
  • Extract to ~/sub2api/, add execute permission.
  • ./sub2api --version shows 0.2.24.

redis-server 8.0.3 and other tools are already preinstalled, no need to install them separately.

3. Run the setup wizard

Run ./sub2api -setup, config is written to ~/sub2api/config.yaml:

  • Sub2API listen: 0.0.0.0:[端口已脱敏]
  • PostgreSQL: pgsql.ct8.pl:[端口已脱敏], database / user [数据库名已脱敏], SSL disable, connection test OK.
  • Redis: localhost:[端口已脱敏], DB 0, TLS off, connection test OK.

4. Two forced changes

(1) Redis can't use [port redacted]

The host only allows binding reserved ports. Reserving [port redacted] was rejected; a Python bind test confirmed [port redacted] and random ports both return Operation not permitted, and only reserved ports can be bound.

Fix: reserved another port [port redacted] for Redis. Redis actually runs on 127.0.0.1:[端口已脱敏], and the Sub2API config was also changed to [port redacted].

(2) Admin username must be in email format

The wizard requires the login name to be in email format; entering admin gives Invalid email format.

Fix: created [管理员账号已脱敏], password [密码已脱敏]. This is not a real email, just a local login name.

Other non-fatal messages: JWT secret auto-generated; Sub2API log initialization failed (tried to create /app/data/logs without permission), fell back to stdout, nohup writes to ~/sub2api/sub2api.log.

5. Verified

Final checks:

  • Redis is running, redis-server 127.0.0.1:[端口已脱敏], password auth returns PONG, version 8.0.3.
  • Sub2API is running, log shows Server started on 0.0.0.0:[端口已脱敏].
  • curl checks: http://127.0.0.1:[端口已脱敏]/ 200, /health 200, /login 200.
  • Admin login API POST /api/v1/auth/login returns code 0 and issues access_token.

V. Keepalive: Prevent the Process from Being Killed

Shared hosting doesn't guarantee background processes stay alive, so I added two layers of keepalive:

  • ~/sub2api/start.sh and ~/sub2api/restart.sh, both executable.
  • restart.sh tested: after stopping Redis and Sub2API, both came back with new PIDs, Redis PONG, Sub2API homepage HTTP 200.
  • Panel Cron Jobs: run start.sh every 5 minutes.
  • The existing ct8-keepalive cron job was left untouched.

Credentials are stored on the server in ~/.sub2api-creds, permission 600, values not recorded here.


VI. Bind Domain [domain redacted] (20:01–20:38, Plain HTTP)

1. CT8 panel: add reverse proxy site

  • Websites -> add site [域名已脱敏], type Proxy (Reverse Proxy).
  • Target: http://127.0.0.1:[端口已脱敏].
  • Site directory: /usr/home/[账号已脱敏]/domains/[域名已脱敏], create the default DNS zone at the same time.
  • SSL force off.
  • Existing site [账号已脱敏].ct8.pl (PHP 8.3) untouched, Sub2API itself untouched.

2. Yunamo: DNS resolution

Domain [域名已脱敏] was registered at Yunamo that day, account [account redacted], status normal.

  • DNS record: 1, A @ → 136.243.156.120, TTL 1 hour, DNS only.
  • Authoritative NS: cat.ns.yunamo.com / dog.ns.yunamo.com.

3. Pitfall: the IP was wrong at first

The IP I used initially, 198.18.3.147, was not the real IP of [账号已脱敏].ct8.pl. Testing showed both HTTP/HTTPS got ERR_CONNECTION_RESET and couldn't reach CT8.

After checking, public DNS showed [账号已脱敏].ct8.pl actually resolves to 136.243.156.120.

  • Tried changing CNAME to [账号已脱敏].ct8.pl, but the Yunamo UI stayed at "pending sync" for a long time and didn't publish.
  • Changed back to an A record pointing directly to the verified correct IP 136.243.156.120.
  • dnschecker.org checked about 26 global nodes and they were consistent, all resolving to the correct IP, proving the record was live (Yunamo UI still showed "pending sync", just UI lag).

4. Certificate: tried 3 times, decided not to issue

  • Refreshed CT8's WWW Certificates list and confirmed 0 certificates.
  • The previous 3 Let's Encrypt issuance attempts produced no certificate, with no panel error and no cert generated.
  • The user decided not to sign a certificate, stopped immediately, and went plain HTTP only.
  • Current state: [入口已脱敏] serves CT8's shared wildcard cert (CN=*.ct8.pl), which doesn't match the domain, so browsers will show a cert error. The currently usable access method is HTTP.

5. Verify it opens

  • On the server: curl [入口已脱敏]/ returns 200, page title Sub2API - AI API Gateway; local 127.0.0.1:[端口已脱敏] also returns 200, proving the whole reverse proxy chain works.
  • External: check-host.net checks from multiple locations all return HTTP 200 (3389 bytes); dnschecker global resolution is consistent.
  • Exception: the cloud browser machine still showed ERR_CONNECTION_RESET because its local DNS cache still had the old A record (TTL 3600). Not a site issue; it opens normally after the cache expires.

Other: CT8 sessions expire after about 15 minutes; I had to log in again once during the process.

6. Yunamo warning

There's a warning at the top of the Yunamo page: "Due to long-term health check failures, this domain will be automatically deleted within 30 days". This was generated during the period when the domain was unreachable. It should clear once the site recovers and health checks pass, but keep an eye on it.


VII. Connect a Free ChatGPT Account (20:43–20:56, Environment 2)

The core use of Sub2API is reverse proxying ChatGPT membership / free accounts into an API. It doesn't use an API Key, but account OAuth.

1. Create a group

The backend originally only had one group, default (Anthropic, rate 1x), with no OpenAI group.

Create a group: platform OpenAI, name ChatGPT, rate 1, everything else default.

2. Add account

Account management -> add account:

  • Platform: OpenAI
  • Type: OAuth (ChatGPT OAuth)
  • Name: [account name redacted]
  • Models: clicked "clear all models", model list became 0 (supports all models, auto-compatible later)
  • Concurrency: default 10
  • Group: check the newly created ChatGPT group

Then click "Generate Authorization URL".

3. OAuth authorization (must be done by the user in their own browser)

The generated authorization link structure is roughly:

https://auth.openai.com/oauth/authorize?client_id=[已脱敏]&redirect_uri=http://localhost:[端口已脱敏]/auth/callback&response_type=code&scope=openid+profile+email+offline_access&state=[已脱敏]

Flow:

  1. Send the link to the user, open it in a browser already logged into that free ChatGPT account.
  2. Log in / click authorize.
  3. After authorization it jumps to http://localhost:[端口已脱敏]/auth/callback?code=...; the page not opening is normal.
  4. Copy the full redirect URL from the address bar back.
  5. Paste it back into the Code input in the Sub2API add account dialog; the system parses the code automatically, click "Complete Authorization".
  6. The page first shows "Verifying authorization code, please wait...", then "Account added successfully!".

Note: the ChatGPT password was never given out; the password was only used in the user's own browser.

4. Account status and test

After adding successfully, the account appears in the list (created 2026-11-28 20:56, ID #1):

  • Name: [account name redacted]
  • Account email: [邮箱已脱敏]
  • Platform / Type: OpenAI / OAuth
  • Subscription: Free, Private, Compact Auto, training data sharing off
  • Status: normal; scheduling: on; group: ChatGPT; capacity 0 / 10; priority 1
  • Usage window: 5h 0%, 7d 0%; quota sampled at 2026-11-28 20:56:04; last used: never; expires: -

Test: account "More -> Test connection", default model GPT-Reserve, test message hi, click "Start test", shows "Test complete!", returned:

Hi! What can I help you with?

Available models, 12 total (confirmed by scrolling the test dialog dropdown to the bottom, no more):

GPT-Reserve, GPT-6-Luna, GPT-5.6-Terra, GPT-5.6-Luna, Codex Auto Review, GPT Image 1, GPT Image 1.5, GPT Image 2, GPT Image 2.5 Flare, GPT Image 2.5 Sunburst, GPT Image 2.6 Flare, GPT Image 2.6 Sunburst

GPT-Reserve has been tested and works normally.


VIII. Balance: Two Separate Accounts

1. The ChatGPT account itself

Sub2API doesn't show exactly how many messages / tokens are left, only the usage window:

  • 5 hours: 0%
  • 7 days: 0%, with 29d 23h next to it
  • Count: 0; points: 0
  • The "Reset" button says "No resets available" and isn't clickable

Meaning it hasn't been used yet and the quota is full. Free account quota is calculated by time window, not by money.

2. Sub2API account balance

In user management, the admin account:

  • Before top-up: $0.00, total top-up $0.00, no change records.
  • 2026-11-28 21:03 topped up $9999 (virtual balance, not real payment), note left blank, page said "Success".
  • After top-up, refreshing the user list shows $9999.00.
  • Minor issue: the top bar balance still shows $0.00 and hasn't synced, but the list confirms $9999.00, doesn't affect use.

IX. Current Status (as of 2026-11-28 21:03)

  • CT8 panel confirmed: shared hosting, not a VPS
  • Port [port redacted] reserved, PostgreSQL created
  • Redis running on [port redacted], Sub2API v0.2.24 running on [port redacted], verified
  • Keepalive scripts + cron every 5 minutes
  • [domain redacted] reverse proxy + DNS resolution, HTTP 200 opens
  • Free ChatGPT account OAuth connected, tested
  • Admin balance topped up to $9999
  • API Key not generated yet; after generating it can be used by clients
  • HTTPS cert not issued, HTTP only

Next step: go to Sub2API backend API Keys, generate a Key, configure it in Codex / Claude Code / OpenClaw etc clients, and fill in [入口已脱敏] as the address.


X. Pitfall Summary

  1. Don't treat CT8 as a VPS: no server list, no power on/off, only the DevilWEB panel + SSH terminal + port reservation + Cron.
  2. Ports must be reserved before binding: an unreserved port like [port redacted] directly gives Operation not permitted; Redis can only use the reserved [port redacted].
  3. Admin login name must be email format: admin won't work, write it as [管理员账号已脱敏].
  4. Binexec must be enabled first: without it your own binary won't run; after enabling, reconnect SSH for it to take effect.
  5. Verify the IP by testing: the IP given at first was wrong and caused ERR_CONNECTION_RESET; use public DNS queries as the source of truth, don't just trust the IP in the task.
  6. DNS sync has delay: Yunamo UI "pending sync" may be lagging; rely on dnschecker / check-host external checks.
  7. Don't force the cert: Let's Encrypt failed 3 times and no cert came out; the user decided to stop, and plain HTTP works. Only HTTPS browser access will show a cert mismatch.
  8. CT8 sessions expire in 15 minutes: during long operations you'll need to log in again once.
  9. OAuth callback page not opening is normal: it jumps to localhost:[port redacted], don't panic, just copy the full URL from the address bar back.
  10. Balance has two layers: ChatGPT account quota is the usage window percentage; Sub2API calls use the admin account balance. At $0 you can't call it, top up virtual balance first.
  11. Yunamo has a 30-day deletion warning: triggered by the domain being unreachable for a long time; it should clear after the site recovers, but still keep an eye on it.
  12. Free account quota is limited: fewer models, limited daily messages, throttling at peak. When it's not enough, switch to a Plus / Pro / Team account, same process.

Translated by AI from 简体中文

5
10
Log into join the discussion.
QuicksilverVPN

快银 VPN,一键连接全球节点,线路稳定、延迟低。支持 Windows、macOS 等多平台,TUN 全局模式覆盖全部应用流量。无需复杂配置,下载即用。

umami.dnsl.top Learn more

10 replies

Sort order
  1. fxz Gold 3 YEARS 1d ago

    Just here to learn.

    Translated by AI from 简体中文

    0
  2. cdkfgv Bronze 1d ago

    Thanks for sharing, gonna give it a try

    Translated by AI from 简体中文

    0
  3. CUI-hyg Silver 3 YEARS 1d ago

    Thanks for sharing.

    Translated by AI from 简体中文

    0
  4. ljx Silver 1d ago

    Grab a red packet

    Translated by AI from 简体中文

    0
  5. fyy5210 Gold 3 YEARS 1d ago

    Nice

    Translated by AI from 简体中文

    0
  6. mc838 Diamond 1d ago

    Thanks
    Grabbing a red packet

    Translated by AI from 简体中文

    0
  7. gubhost Diamond OP Diamond member 1d ago

    @James when's the certificate gonna get signed?

    Translated by AI from 简体中文

    0
  8. cdkfgv Bronze 1d ago

    Thanks for sharing, this is exactly what I needed — saved!

    Translated by AI from 简体中文

    0
  9. kefeng Gold 15h ago

    Thanks, that's very detailed

    Translated by AI from 简体中文

    0
  10. vendyy Silver 15h ago

    Man, skills like this are more than enough to start teaching a course on it.

    Translated by AI from 简体中文

    0