Integrating DeepSeek API with a WeChat Public Account: Step‑by‑Step Tutorial
This tutorial guides beginners through the complete process of integrating DeepSeek's large language model API into a WeChat public account, covering API key acquisition, WeChat platform configuration, free Alibaba Cloud ECS setup, code deployment, dependency installation, configuration file editing, and final server verification.
Recent releases of DeepSeek provide an extremely low‑cost API that is almost fully compatible with the OpenAI SDK, simplifying deployment. This guide explains how to connect DeepSeek to a personal WeChat public account from scratch.
1. Basic Principles & Risks – The tutorial uses a GitHub open‑source project to forward messages received by the public account to a cloud server, where the DeepSeek model generates replies. Users are warned about potential misconfiguration of the WeChat admin interface and possible cloud‑server or API usage fees.
2. Obtain DeepSeek API Key – Register on the DeepSeek developer platform (https://platform.deepseek.com/), create an API key on the API keys page, and copy it for later use.
3. Gather WeChat Public Platform Information – In the WeChat console, enable developer mode, copy the AppID , AppSecret , generate an AESKey , and note the Token .
4. Create a Free Alibaba Cloud ECS Instance – Register at https://www.aliyun.com/, claim the free ECS trial (Hong Kong region, 2 CPU + 2 GiB, Ubuntu 22.04), open port 80 in the security group, and obtain the public IP address.
5. Project Code Configuration
5.1 Clone the Repository
git clone https://github.com/zhayujie/chatgpt-on-wechat.git5.2 Install Dependencies
pip3 install -r ./chatgpt-on-wechat/requirements.txt pip3 install -r ./chatgpt-on-wechat/requirements-optional.txt5.3 Edit the Configuration File
Create config.json with the following template (replace placeholder values with the keys obtained above):
{
"channel_type": "wechatmp",
"model": "deepseek-chat",
"open_ai_api_key": "YOUR_DEEPSEEK_API_KEY",
"open_ai_api_base": "https://api.deepseek.com/v1",
"wechatmp_app_id": "YOUR_APPID",
"wechatmp_app_secret": "YOUR_APPSECRET",
"wechatmp_aes_key": "YOUR_AESKEY",
"wechatmp_token": "YOUR_TOKEN",
"wechatmp_port": 80,
"conversation_max_tokens": 3000,
"expires_in_seconds": 3600,
"character_desc": "You are an AI assistant based on a large language model.",
"temperature": 0.8,
"subscribe_msg": "Thank you for following! The public account is now connected to DeepSeek.",
"use_linkai": false
}5.4 Run the Application
sudo python3 app.pyFor unattended operation, use:
(cd chatgpt-on-wechat && nohup python3 app.py &) ; tail -f ./chatgpt-on-wechat/nohup.out6. Configure the WeChat Public Platform – Set the server URL to http://YOUR_SERVER_IP/wx , and use the same Token and AESKey from the configuration file. Choose “compatible mode” for encryption, submit, and enable the server.
After these steps the WeChat public account will be able to converse with users via the DeepSeek model.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.