Capturing sessions
A session is one signed-in ChatGPT account, captured to a JSON file the gateway can replay. Add several and the pool rotates between them, failing over when one stops working.
Capture with the CLI
get_session.py opens a real Chromium window; sign in, and it saves the session. Name each capture so it becomes its own file and browser profile:
python get_session.py --name main
This writes sessions/main.json and keeps a dedicated browser profile under chrome_profile/main/, so each account stays isolated and signed in.
Auto-upload into the running gateway
Set two environment variables and the capture uploads straight into the pool — no separate "add it in the dashboard" step:
export MSE_GATEWAY_URL=__BASE__ export MSE_GATEWAY_KEY=your-server-master-key python get_session.py --name main
Pass --no-push to capture locally without uploading. The MSE_GATEWAY_KEY is the deployed gateway's master key, which is intentionally different from any key a local gateway uses.
Add from the dashboard
No CLI on hand? Open the dashboard, expand Add a session, and paste (or drop) a captured JSON file. It joins the pool immediately under the name you give it.
Many accounts, one rule: separate profiles
Signing out of an account in a shared browser invalidates its session server-side, which looks like the gateway "losing" the account. Give every account its own --name (its own profile) and never sign out of one to sign into another. The bundled browser extension can also capture the current tab's session for many accounts at once.
How the pool keeps itself healthy
Each request picks the least-recently-used healthy session, and the gateway reacts to upstream signals automatically:
| Signal | What happens | Env |
|---|---|---|
| Rate limited (429) | Session benched for a cooldown, then retried. | MSE_SESSION_RATE_COOLDOWN (300s) |
| Transient error (network / 5xx) | Short cooldown; benched. | MSE_SESSION_ERROR_COOLDOWN (30s) |
| Repeated failures | Marked dead and taken out of rotation. | MSE_SESSION_DEAD_AFTER (3) |
| Expired token (401 / 403) | Killed immediately — needs a fresh capture. | — |
Failover happens before the first token reaches the client: if the chosen session fails to start a stream, the request quietly moves to another account (up to MSE_SESSION_MAX_RETRIES). A conversation stays pinned to its session for MSE_STICKY_TTL (1 hour) so multi-turn chats stay coherent.
Managing the pool
The dashboard shows every session's state and lets you delete stale ones. Fixed something upstream? Click Revive to clear all cooldowns and return benched accounts to rotation at once (an expired token still needs a new capture).