Deploy ChatGPT-on-WeChat — AI Chatbot for WeChat
Self-host an AI chatbot for WeChat. Your OpenAI key, deploy in 2 steps.
ChatGPT-on-WeChat
Just deployed
Deploy and Host ChatGPT-on-WeChat on Railway
ChatGPT-on-WeChat turns your WeChat account into an AI chatbot — connect OpenAI's models and your WeChat auto-replies to messages in private chats and groups. Scan one QR code to log in, and the bot answers on your behalf using GPT. Open source, self-hosted, and deployable in two steps with just your OpenAI API key.
Self-host on Railway for ~$5/month plus your OpenAI usage — an always-on WeChat AI assistant that runs in the cloud without keeping a computer on, with all conversation handling on infrastructure you own.
What This Template Deploys
| Service | Purpose |
|---|---|
| ChatGPT-on-WeChat | The bot service — connects to WeChat via QR login, routes incoming messages to OpenAI, and posts AI replies back to chats and groups |
Single container. No database required. Your OpenAI API key is the only required variable; everything else runs on the persistent container connection to WeChat.
About Hosting ChatGPT-on-WeChat
Running a WeChat AI bot means keeping a long-lived process connected to WeChat 24/7, holding the login session alive, and securely storing your OpenAI key. On a local machine that means leaving a computer running constantly; on a raw VPS it means process managers and manual setup.
Railway keeps the bot online as a managed container with your OpenAI key injected as an environment variable. Deploy, scan the QR code from the logs once to log in, and the bot stays connected and replying.
Account-safety note: this tool logs into WeChat as a userbot via QR scan. WeChat's terms restrict automation, and Tencent actively detects it — using a bot on a personal account can lead to temporary or permanent restrictions. Use a secondary or dedicated WeChat account you can afford to lose, not your primary one. This is inherent to WeChat automation, not specific to this template.
Typical cost: ~$5/month on Railway's Hobby plan for the container, plus OpenAI API usage
(a few cents per conversation with gpt-4o-mini-class models).
Deploy in Under 5 Minutes
- Click Deploy on Railway — the bot builds automatically (~1–2 minutes)
- Set
OPENAI_API_KEYin the Variables tab - Open the deploy logs and wait for a QR code to appear
- Scan it with your WeChat mobile app (same flow as logging into WeChat on desktop) and confirm
- The bot is live — it replies to messages and you'll see conversations stream in the logs
No SSH. No local machine kept running. No coding.
Common Use Cases
- Personal AI assistant on WeChat — message your own bot to ask questions, draft replies, translate, or summarize, from the app you already use daily
- Auto-reply bot for groups — let the bot answer common questions in WeChat groups so you don't have to respond to every message manually
- AI customer-response bot — handle first-line replies on a dedicated business WeChat account with GPT-generated answers
- Translation and language helper — use the bot to translate messages inline in Chinese/English conversations
- Always-on cloud bot — move a local WeChat bot to an always-available Railway deployment so it runs without keeping your computer on
- Private AI on your own infrastructure — the bot service runs on your Railway instance; only OpenAI sees the prompts you route to it
Configuration
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY | ✅ Required | Your OpenAI API key — powers the AI replies |
MODEL | Optional | Which OpenAI model to use — e.g. gpt-4o-mini for low cost, gpt-4o for quality |
TEMPERATURE | Optional | Response creativity (0–2); lower is more focused |
PORT | Auto-set | Railway injects the port automatically |
You only need
OPENAI_API_KEYto start. SetMODELto a current OpenAI model —gpt-4o-minikeeps per-message cost very low for personal use. Run a single instance only; multiple instances sharing one WeChat login cause session conflicts.
ChatGPT-on-WeChat vs. Alternatives
| ChatGPT-on-WeChat (Railway) | Official WeChat bots | Hosted chatbot SaaS | Local run | |
|---|---|---|---|---|
| Monthly cost | ~$5 + OpenAI usage | Enterprise approval | Subscription | Free (PC must run) |
| Setup | ✅ QR scan, 2 steps | ❌ Business verification | ⚠️ Account signup | ⚠️ Local install |
| Personal account | ✅ Yes (see safety note) | ❌ Official accounts only | ⚠️ Varies | ✅ Yes |
| Always-on | ✅ Cloud | ✅ Yes | ✅ Yes | ❌ PC must stay on |
| Bring your own model | ✅ OpenAI key | ⚠️ Fixed | ⚠️ Fixed | ✅ Yes |
| Open source | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
Dependencies for ChatGPT-on-WeChat Hosting
- Railway account — Hobby plan (~$5/month) for the bot container
- An OpenAI API key — pay-as-you-go;
gpt-4o-minikeeps cost minimal - A WeChat account you're comfortable using for automation (secondary account recommended)
Deployment Dependencies
- ChatGPT-on-WeChat GitHub — source and setup
- OpenAI API Keys — create your API key
- OpenAI Model List — pick a current model
- Railway Documentation — deployment and variables
Implementation Details
This template deploys the ChatGPT-on-WeChat bot as a single container. On first boot it prints a QR code to the deploy logs; scanning it with the WeChat mobile app authenticates the session, and the bot then listens for incoming messages, forwards them to OpenAI, and posts the replies back.
Run only one instance — WeChat allows a single active session per login, so multiple instances
sharing one account conflict. Because the session is tied to the QR login, a WeChat logout or a
platform restriction requires re-scanning to reconnect. Set a current MODEL value, since older
default model names may no longer be available on the OpenAI API.
Frequently Asked Questions
Is it safe to use on my WeChat account? This tool logs in as a userbot, which WeChat's terms restrict and Tencent actively detects. There is a real risk of temporary or permanent account restriction. Use a secondary or dedicated WeChat account, not your primary one. This risk is inherent to all WeChat automation tools, not unique to this template.
What does it cost to run?
About $5/month for the Railway container plus OpenAI API usage. With gpt-4o-mini, per-message
cost is a fraction of a cent, so light personal use typically stays under a dollar or two a month
in API fees on top of compute.
Which OpenAI model should I use?
Set MODEL to a current model — gpt-4o-mini for low-cost everyday replies, or gpt-4o for
higher quality. Avoid leaving an outdated default, since older model names may have been retired
from the OpenAI API.
Why do I need to scan a QR code? WeChat has no open bot API for personal accounts, so the tool authenticates the same way WeChat desktop does — by scanning a QR code with your phone. The session stays active until WeChat logs it out, at which point you re-scan from the logs.
Can I run more than one bot on the same account? No. WeChat permits one active session per login, so run a single instance. Multiple instances on one account cause session conflicts and dropped messages.
Does my conversation data stay private? The bot service runs on your Railway instance and stores nothing by default; message text is sent to OpenAI to generate replies, so OpenAI's API terms apply to those prompts. Nothing is routed through a third-party bot platform.
Why Deploy and Host ChatGPT-on-WeChat on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying ChatGPT-on-WeChat on Railway, you get an always-on AI chatbot for WeChat — powered by your own OpenAI key, running in the cloud without keeping a machine on — at ~$5/month plus usage, deployed with a single QR scan.
Template Content
ChatGPT-on-WeChat
kx-Huang/ChatGPT-on-WeChatOPENAI_API_KEY
Your OpenAI API key
