How to Connect DeepSeek LLM to a WeChat Public Account in 7 Steps

This step‑by‑step guide shows how to obtain a DeepSeek API key, set up an Alibaba Cloud ECS instance, configure the WeChat public platform, clone the open‑source COW project, edit its JSON configuration, and run the service so that a WeChat public account can interact with the DeepSeek large language model.

Java Web Project
Java Web Project
Java Web Project
How to Connect DeepSeek LLM to a WeChat Public Account in 7 Steps

Core Principle and Risk Overview

The tutorial uses the open‑source GitHub project chatgpt-on-wechat to connect DeepSeek’s API with a WeChat public account. A server receives messages from the account, forwards them to DeepSeek, and returns the model’s reply. Risks include accidental misuse of the WeChat admin interface, potential cloud‑server charges after free credits expire, and API‑usage fees once the free quota is exhausted.

Obtain DeepSeek API Key

Log in to the DeepSeek developer portal at https://platform.deepseek.com/, navigate to API keys → Create API key , give the key any name, copy it, and store it safely.

Collect WeChat Public Platform Credentials

Log in to the WeChat public platform, enable developer mode under Settings & Development → Interface Management , and copy the AppID and AppSecret . Generate a random 43‑character AESKey via the “Random generate” button, and set a Token (any 3‑32‑character string).

Create Free Alibaba Cloud ECS Instance

Visit https://www.aliyun.com/, claim the free ECS trial, and select the Hong Kong region (avoids SSL requirements). Choose a 2‑CPU 2 GiB instance with Ubuntu 22.04 64‑bit, no pre‑installed applications. After creation, open the security group and add an inbound rule allowing HTTP (port 80) from 0.0.0.0/0. Record the public IP address.

Project Code Configuration

Clone Repository

git clone https://github.com/zhayujie/chatgpt-on-wechat.git

Install Dependencies

pip3 install -r ./chatgpt-on-wechat/requirements.txt
pip3 install -r ./chatgpt-on-wechat/requirements-optional.txt

Both commands should eventually output “Requirement already satisfied:” for each package.

Edit JSON Configuration

Create config.json (e.g., vi config.json) with the following content, replacing placeholder values with the credentials collected earlier:

{
  "channel_type": "wechatmp",
  "model": "deepseek-chat",
  "open_ai_api_key": "YOUR_DEEPSEEK_API_KEY",
  "open_ai_api_base": "https://api.deepseek.com/v1",
  "single_chat_prefix": [""],
  "single_chat_reply_prefix": "",
  "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 powered by a large language model, capable of answering any question in multiple languages.",
  "temperature": 0.8,
  "subscribe_msg": "Thanks for following! The public account is now connected to DeepSeek‑V3. Longer replies will first show a ‘thinking’ message; send any text to receive the full output.",
  "use_linkai": false
}

Save with Esc :wq and verify using cat config.json.

Run the Service

sudo python3 app.py

If the terminal shows no errors, the service is listening on port 80.

Configure WeChat Public Platform

In the WeChat console, go to Settings & Development → Interface Management → Modify Server Configuration and fill in:

URL: http://YOUR_SERVER_PUBLIC_IP/wx Token: the same token used in config.json AESKey: the same AESKey used in config.json Encryption Mode: Compatibility mode

Submit and enable; a “Submission successful” message confirms the connection.

Post‑Deployment Tips

Keep the service running after closing the SSH session:

(cd chatgpt-on-wechat && nohup python3 app.py &) ; tail -f ./chatgpt-on-wechat/nohup.out

Periodically restart the ECS instance and re‑run the above command.

Customize config.json to switch to other DeepSeek models, change trigger formats, or adjust reply styles.

Monitor the free Alibaba Cloud trial credit (≈ 300 CNY) and DeepSeek free API quota (10 CNY) to avoid unexpected charges.

open-sourceDeepSeekLLM integrationWeChatcloud serverAPI keyBackend tutorial
Java Web Project
Written by

Java Web Project

Focused on Java backend technologies, trending internet tech, and the latest industry developments. The platform serves over 200,000 Java developers, inviting you to learn and exchange ideas together. Check the menu for Java learning resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.