Content
# AIWriteX - Fully Automated Formatting and Publishing Tool for CrewAI WeChat Official Accounts
     
**AIWriteX** is an automation tool for WeChat Official Accounts based on CrewAI and [AIForge](https://iniwap.github.io/AIForge/). It automatically retrieves trending topics from platforms like Douyin and Weibo, integrating "search + reference + AI" to generate **high timeliness (real-time)**, high-quality, and well-formatted articles for publishing on WeChat Official Accounts.
> **Want to see the effect first?** 👉 [Article Preview](#-wechat-official-account-template-preview)
> **Ready to take action?** 👉 [Get Started Now](#-quick-start)
> **Like this project?** ⭐ Give it a Star to support!
<div style="display: flex; justify-content: space-between;">
<img src="image/preview/left.jpg" width="51%">
<img src="image/preview/right.jpg" width="48%">
</div>
## 💎 Basic Features
- **Automatically Retrieve Trending Topics**: Real-time fetching of trending topics from various platforms to ensure article titles and content are up-to-date.
- **Automatic Generation and Formatting**: Utilizing CrewAI's multi-role collaboration to automatically generate articles and complete stylish formatting.
- **💡 Real-time Article Generation**: Employing AIForge's multi-search strategy to reject outdated content and ensure article timeliness.
- **💡 Specify Topics and Reference Articles**: Supports custom article topics and provides reference articles, combining AI to generate high-quality content.
- **Automatic Publishing of Articles**: One-click publishing of articles to WeChat Official Accounts, simplifying the operational process.
- **UI Visual Management**: Provides a software interface that is simple and efficient to operate.
- **💡 Configuration Management**: Clearer editing of configuration items, easy to use.
- **💡 Template Management**: Supports various operations on templates, including adding, deleting, querying, and modifying.
- **💡 Article Publishing Management**: Supports various operations for article management, batch processing, publishing records, and account selection.
- **💡 Image Management**: Supports custom settings for article covers, images, and related operations.
- **Supports Two Operating Modes**:
- **Development Mode**: Suitable for technical users, supports flexible custom development to meet complex needs.
- **Software Mode**: No development environment required; just install the software and fill in the configuration, suitable for non-technical users to quickly experience.
### Personalization Features (Configuration)
Through the `config.yaml` and `aiforge.toml` configuration files, highly personalized features can be achieved (recommended to use the interface/software mode to edit configurations). Below are key configuration item descriptions:
- **`config.yaml` Configuration Items**
| Configuration Item | Description |
|-----------------------------|-----------------------------------------------------------------------------|
| **platforms** | Set the random selection weight for trending topics from various platforms, controlling selection priority. |
| **wechat** | Supports configuring multiple WeChat Official Accounts (when auto-publishing, **required** `appid`, `appsecret`, `author`). |
| **wechat.credentials** | `call_sendall`, `sendall`, `tag_id` to control mass sending (only applicable to verified accounts). |
| **api** | Supports multiple large model platforms, **required** `api_key`. |
| **api.api_type** | Supports multiple large model platforms; modify `api_type` to switch platforms, such as OpenRouter. |
| **api.OpenRouter.model_index** | Modify `model_index` to select specific models within the platform. |
| **api.OpenRouter.model** | Supports various models (e.g., openrouter/deepseek/deepseek-chat-v3-0324:free). |
| **api.OpenRouter.key_index** | Modify `key_index` to switch accounts (fully utilize free quotas; paid accounts do not require multiple). |
| **api.OpenRouter.api_key** | Supports multiple OpenRouter `api_key`. |
| **img_api** | Image generation model for WeChat cover images. |
| **img_api.api_type** | `ali` (requires `api_key`) or `picsum` (random images). |
| **img_api.picsum** | Random image generation method to reduce image generation consumption. |
| **use_template** | Whether to use built-in templates; if not used, AI generates article HTML directly based on requirements. |
| **template** | Specify template file name (e.g., `template1`); if empty or nonexistent, a random selection is made. |
| **template_category** | Template category, precisely matching topic types (e.g., health and wellness); specified templates must exist under the category. |
| **need_auditor** | Whether to enable quality audit agent/task; turning off can reduce token consumption (default off). |
| **use_compress** | Whether to compress template uploads to reduce token consumption. |
| **aiforge_search_max_results** | Maximum number of search results returned by AIForge, controlling search breadth. |
| **aiforge_search_min_results** | Minimum number of search results returned by AIForge; larger values yield richer content but higher failure rates. |
| **min_article_len** | Minimum word count for generated articles (default 1000). |
| **max_article_len** | Maximum word count for generated articles (default 2000). |
| **auto_publish** | Control automatic publishing; check (true) for automatic publishing, uncheck (false) for manual publishing. |
| **article_format** | Format of the generated article (HTML, Markdown, txt); if not HTML, only the article is generated without a template. |
| **format_publish** | When the article format is Markdown or txt (not supported by WeChat, direct publishing may be messy), format the publication. |
- **`aiforge.toml` Configuration Items**
| Configuration Item | Description |
|-----------------------------|---------------------------------------------------------------|
| **default_llm_provider** | Use model provider (default OpenRouter), which may differ from the model used by CrewAI. |
| **api_key** | API Key for the model provider (required). |
| **Other Optional** | Configure other parameters as needed (optional), refer to UI interface instructions for specifics. |
> *1. For detailed configuration information of `aiforge.toml`, refer to the [AIForge](https://github.com/iniwap/AIForge) project homepage.*
> *2. Through the configuration management interface, you can learn about the explanations of key parameters in detail (it is recommended to run in UI interface mode).*
> *3. ⚠️ WeChat Official Account AppID/AppSecret and API KEY of large model providers are required; others can be defaulted.*
## 🚀 Quick Start
### Development Mode
1. Clone the repository:
- `git clone https://github.com/iniwap/AIWriteX.git`
2. Install dependencies:
```shell
pip install uv
uv venv
uv pip install ./PySimpleGUI-4.60.5-py3-none-any.whl
uv pip install -r requirements.txt
```
3. Configure `config.yaml`, `aiforge.toml` (*WeChat Official Account AppID/AppSecret, API KEY of large model providers*).
4. Run:
- With UI: `python .\main.py -d` (**Recommended**)
- Without UI: `python -m src.ai_write_x.crew_main` (**Does not support article, template, or image management**)
### Software Mode
1. Please download `AIWriteX_Cloud_Version_Setup.exe` from the cloud drive 👇 and install it.
| Cloud Drive Type | Download Link | Extraction Code | Version | Is Latest | Remarks |
|-----------------------------|-----------------------------------------------------------------------------------------------------------|-----------------|---------|-----------|----------------------------------|
| **Baidu Cloud** | [Click to Download](https://pan.baidu.com/s/1F6gr2BD5RIBTYshzRyF9tA?pwd=56yt) | 56yt | V2.1.8 | ✅ | Uses the powerful AIForge version, will continue to use it. |
| **Google Drive** | [Click to Download](https://drive.google.com/file/d/1Ja11R5yaHbGSuw6uGJXeYVfvP5B75EaG/view?usp=sharing) | / | V2.1.8 | ✅ | Uses the powerful AIForge version, will continue to use it. |
| **Mobile Cloud** | [Click to Download](https://caiyun.139.com/w/i/2prAJm8oVjP2i) | lfdc | V2.1.8 | ✅ | Uses the powerful AIForge version, will continue to use it. |
| **Microsoft OneDrive** | [Click to Download](https://1drv.ms/u/c/c831e3cc9be11110/EYknOyGhhshPjO4Ky2I1O1kBNlSu0G_n8r_dCmXhMMIz8Q?e=AWUxXN) | / | V2.1.8 | ✅ | Uses the powerful AIForge version, will continue to use it. |
2. Open the software and configure the necessary settings (*WeChat Official Account AppID/AppSecret, API KEY of large model providers*).
3. Click `Start Execution`.
## 🔍 Problem Diagnosis
When encountering issues, please check the logs according to the operating mode and submit an Issue.
### Development Mode
- **With UI**:
- Check the log files in the `logs/` directory, such as `UI_2025-05-20.log`.
- Copy the relevant log content and submit it to [Issues](https://github.com/iniwap/AIWriteX/issues).
- **Without UI**:
- View the command line output logs, copy the relevant error information, and submit it to [Issues](https://github.com/iniwap/AIWriteX/issues).
- **CrewAI Version Issues**:
- Different CrewAI versions have significant differences in log output; it is recommended to temporarily switch to a stable version to view detailed process logs:
```shell
pip uninstall crewai
pip install crewai==0.102.0
```
- If the issue persists, submit the logs to [Issues](https://github.com/iniwap/AIWriteX/issues).
- Restore the latest version:
```shell
pip uninstall crewai
pip install crewai
```
### Software Mode
- Open the software interface, select `File -> Logs -> UI_2025-05-20.log` (select the log for the current day).
- Click to open the log file, copy the content, and submit it to [Issues](https://github.com/iniwap/AIWriteX/issues).
### AIForge Related Issues
**[AIForge](https://github.com/iniwap/AIForge) is my self-developed AIPy-like library (functionality far exceeds AIPy, powerful beyond imagination).**
- **Normal Phenomenon**:
- Not all topics can yield search results; failures are normal, and tasks will continue to execute.
- Errors may occur in search code generation, which can be ignored (the system has an automatic error correction mechanism, and subsequent runs will fix it).
- **Search Cache Optimization**:
- Search code generation has randomness; enabling AIForge cache mode (`aiforge.toml` `cache.code` enabled=True) and running multiple times can improve results.
- **Search Engine Limitations**:
- Due to search engine restrictions or manual verification, occasionally no results may be found, which is normal and does not affect overall operation.
- **⚠️ OpenRouter Free Service Limitations**:
- **Free OpenRouter may be unstable**; if execution fails, it is recommended to retry when fewer users are online.
- Each account supports about 5 executions per day; after failure, please switch accounts (modify `config.yaml`'s `api.OpenRouter.key_index`).
> **⚠️ Note**: Free OpenRouter services may become unstable due to high load; please arrange running times reasonably or switch accounts to ensure successful execution.
### Frequently Asked Questions
Please check the `closed` [Issues](https://github.com/iniwap/AIWriteX/issues?q=is%3Aissue%20state%3Aclosed) to understand common problems that have been resolved.
## 🔮 WeChat Official Account Template Preview
Below are carefully fine-tuned, adapted, and published WeChat Official Account templates covering multiple topic categories. Feel free to preview!
### Built-in Local Template List
- Category Templates
| Category | Template Name | Preview Link | Applicable Topics |
|--------------|---------------|------------------------------------|---------------------------------|
| Technology & Digital | t1 | [Click to Preview](https://mp.weixin.qq.com/s/UCjBHaZ_EZVBdEaSEH-6mQ) | Cutting-edge technology and digital reviews |
| Finance & Investment | t1 | [Click to Preview](https://mp.weixin.qq.com/s/uTfYVXUG3_bjqSZ-uuJKeg) | Investment trends and financial news |
| Education & Learning | t1 | [Click to Preview](https://mp.weixin.qq.com/s/DOr7sSBQ2sYSqu4WmlH__g) | Learning methods and educational news |
| Health & Wellness | t1 | [Click to Preview](https://mp.weixin.qq.com/s/ZG6SFUYSZlrxyRw6_GH9yg) | Tips for a healthy lifestyle |
| Food & Travel | t1 | [Click to Preview](https://mp.weixin.qq.com/s/Lw29haJDk4uKODh7rlBOrw) | Food recommendations and travel guides |
| Fashion & Lifestyle | t1 | [Click to Preview](https://mp.weixin.qq.com/s/ZgeIbl7l0KC1ex9ybrZBRg) | Fashion trends and lifestyle |
| Career Development | t1 | [Click to Preview](https://mp.weixin.qq.com/s/-jJ-OxCr7BMaaYY68vSecQ) | Workplace skills and career planning |
| Emotional & Psychological | t1 | [Click to Preview](https://mp.weixin.qq.com/s/2j-C1tBWkpYIQhhR6tOwSg) | Emotional stories and psychological insights |
| Entertainment & Gossip | t1 | [Click to Preview](https://mp.weixin.qq.com/s/3YeEH2Nvhsw8JqHIV0tftQ) | Latest entertainment news |
| News & Current Affairs | t1 | [Click to Preview](https://mp.weixin.qq.com/s/M_l2LCJjiGmCWRvSm7lYvA) | Global hotspots and current affairs analysis |
- Other Templates
| Category | Template Name | Preview Link | Applicable Topics |
|--------------|---------------|----------------------------------|---------------------------------|
| Other | template1 | [Click to Preview](https://mp.weixin.qq.com/s/9MoMFXgY7ieEMW0kqBqfvQ) | General template, no style restrictions |
| Other | template2 | [Click to Preview](https://mp.weixin.qq.com/s/0vCNvgbHfilSS77wKzM6Dg) | General template, no style restrictions |
| Other | template3 | [Click to Preview](https://mp.weixin.qq.com/s/ygroULs7dx5Q54FkR8P0uA) | General template, no style restrictions |
| Other | template4 | [Click to Preview](https://mp.weixin.qq.com/s/-SexfJ1yUcgNDtWay3eLnA) | General template, no style restrictions |
| Other | template5 | [Click to Preview](https://mp.weixin.qq.com/s/pDPkktE_5KnkQkJ1x2-y9Q) | General template, no style restrictions |
| Other | template6 | [Click to Preview](https://mp.weixin.qq.com/s/7F_Qdho-hzxeVV6NrsPmhQ) | General template, no style restrictions |
| Other | template7 | [Click to Preview](https://mp.weixin.qq.com/s/ug7NseZDziDMWBVwe3s1pw) | General template, no style restrictions |
| Other | template8 | [Click to Preview](https://mp.weixin.qq.com/s/uDjKVrWop4XNrM-csQ-IKw) | General template, no style restrictions |
| Other | template9 | [Click to Preview](https://mp.weixin.qq.com/s/EVhL67x8w35IuNnoxI1IEA) | General template, no style restrictions |
| Other | template10 | [Click to Preview](https://mp.weixin.qq.com/s/pDN5rgCgz0CbA8Q92CugYw) | General template, no style restrictions |
### Fully Automated Article Publishing Effect Preview
Utilizing local search and AIForge search to generate timely WeChat articles, here are the previews:
| Type | Template Usage | Preview Link | Description |
|----------------|----------------|----------------------------------|-----------------------------------|
| Automated Publishing | No Template Used | [Click to Preview](https://mp.weixin.qq.com/s/KI4yHYrjAt8hd_nUEZP8kA) | AI-generated article based on requirements, no local template used. |
| Automated Publishing | Using template9 | [Click to Preview](https://mp.weixin.qq.com/s/1XPMUPR09Ipuzm_yXgAvKw) | Using local template template9, visual effect optimized. |
| Automated Publishing | Using Category Template | [Click to Preview](https://mp.weixin.qq.com/s/Dys7eszxP33k6tonXMO1VA) | Specified category `Health & Wellness`, perfectly presented. |
### Light/Dark Mode Display Effect Comparison in WeChat
| Type | Theme Mode | Preview Link | Description |
|----------------|------------|------------------------------------------------------------------|-------------------------------------------|
| Manual Publishing | Light | [Click to Preview](https://mp.weixin.qq.com/s/GOiOxGiym1dgqA77wrrFLw) | Best template for browsers, but margins appear too large on mobile. |
| Manual Publishing | Light | [Click to Preview](https://mp.weixin.qq.com/s/MFKPQIBdldyC_dxcpooOSw) | Effect after uniform margin adjustment, looks more compact on mobile, but loses original design effect. |
| Manual Publishing | Dark | [Click to Preview](https://mp.weixin.qq.com/s/jOWDpRSAw9twSptzZbBODg) | Original version in dark mode, poorly displayed in WeChat, but displays normally in light mode. |
> *1. Adapted templates can display well on WeChat Official Accounts; those interested can continue to fine-tune built-in templates (e.g., margins, etc.).*
> *2. Currently, only **non-adapted** templates need adaptation to display perfectly (configuring **category random** may randomly select non-adapted templates).*
> *3. Currently, templates do not handle dark mode well, which is related to WeChat's rigid processing.*
## 📢 Future Plans
- **Currently developing [AIForge](https://iniwap.github.io/AIForge), new features for AIWriteX will be delivered later (with the help of powerful AIForge), stay tuned!**
- Optimize image management-related features.
- Gradually add creative features to make the software more fun and powerful.
- Increase functionality to improve output effects (ongoing).
- Optimize templates to reduce token consumption (ongoing).
- Optimize processing to reduce unnecessary token consumption (ongoing).
- Increase fault tolerance to improve success rates (ongoing).
## 📌 Other Notes
### About WeChat Official Accounts
The following are explanations regarding the development and automated publishing of WeChat Official Accounts:
- **CSS Limitations**:
- WeChat removes `position: absolute` when publishing articles (but retains `position: relative`), requiring alternative layouts to achieve similar effects.
- Limited animation support: `animateMotion` is available, but `animate` only supports opacity changes, further testing is needed (e.g., animation parts of template1 are supported).
- `<button>` and `background: url` will be automatically removed.
- The `id` of `<linearGradient id="catGradient">` will be removed, causing animations to fail.
- `background: linear-gradient(90deg, #4b6cb7 0%, #ff9a9e 100%); -webkit-background-clip: text; color: transparent;` does not support gradients in dark mode on mobile/computer themes, but supports in light mode.
- WeChat's dark mode will automatically add `js_darkmode__`, causing background colors to fail, and dark mode effects are generally poor (using !important to force no dark mode is ineffective, as it will be automatically removed).
- **Dark/Light Mode**: Currently, generation is more inclined to suit WeChat's light mode, with slightly poorer effects in dark mode; future efforts are needed to find a better balance between the two.
- **Article Display Issues**: Published articles (for unverified accounts) will not display in the official account article list, but followers will receive notifications (up to 3 articles per day).
- **⚠️ Permission Recovery**: Starting from July 2025, personal accounts, unverified corporate accounts, and accounts that do not support verification will lose the ability to publish drafts; unverified accounts may not be able to publish automatically.
- **⚠️ WeChat Official Account IP Whitelist Issues**:
- WeChat API requires the current IP to be added to the backend whitelist.
- Dynamic IPs need to manually update the whitelist or use a fixed IP proxy.
- Solution: Use cloud servers to forward requests or use Alibaba Cloud Function Computing (free, requires registration with Alibaba Cloud) to proxy WeChat API requests.
- **Official Account Article List Display Issues**:
- Unverified accounts: The API cannot display articles in the official account list, only backend operations are possible.
- Verified accounts: Must call the mass sending interface to display in the list. The `is_to_all` (True/False) and whether to call the `sendAll` interface should be tested by users; these three situations can be configured.
- When `is_to_all=False`, and calling the interface, `tag_id` (user tag group ID) seems to be required.
- For this, refer to the [official explanation](https://developers.weixin.qq.com/doc/service/guide/product/message/Batch_Sends.html) (which is quite confusing, why is there such a ridiculous product).
> **⚠️ Note**: After July 2025, unverified accounts may face automation publishing restrictions (can only publish to drafts, requiring backend operations to publish drafts, and published articles will display in the official account article list).
### About Software Mode
Software mode provides a quick experience for non-technical users:
- **Install Software**: A lot of debugging has been done to support software mode. Please give a ⭐ to support!
- **IP Whitelist**:
- Home network dynamic IPs need to be manually updated in WeChat's backend whitelist.
- Using a fixed IP proxy can enhance stability.
- **No UI Operation**: When running on a server without UI, you can delete `gui` and `main` code and run directly in non-UI mode.
> **⚠️ Note**: Before running in software mode, ensure the IP has been added to WeChat's backend whitelist; otherwise, API access will fail.
### About DeepSeek
To enable everyone to use DeepSeek, I invested 10 yuan for adaptation debugging; please give a star~🙏
- The CrewAI framework does not support DeepSeek by default and needs to be created manually (LiteLLM supports it).
- DeepSeek is slower during the `template filling stage`, please be patient (speed seems to be slower than OpenRouter's DeepSeek).
- Please be aware of **cost consumption** when using DeepSeek.
## 🤝 Contributions & Acknowledgments
### Contributions
- Submit code and optimization suggestions, new features, etc.
- Share new scenarios or improvements for automated publishing functionality.
### Acknowledgments
- Thanks to the open-source library [AIForge](https://github.com/iniwap/AIForge).
- Thanks to ChatGPT, Grok, Gemini, Deepseek, and others.
- Thanks to all contributors and community support.
## 📩 Contact Us
For details on configuration or to discuss expansion, customization, or commercial licensing, please contact QQ 522765228.
## 📜 License
This project is open-sourced under the [Apache License 2.0](./LICENSE) and comes with additional usage restrictions; see the [NOTICE](./NOTICE) file for details.
You Might Also Like
OpenWebUI
Open WebUI is an extensible web interface for customizable applications.

NextChat
NextChat is a light and fast AI assistant supporting Claude, DeepSeek, GPT4...

Continue
Continue is an open-source project for seamless server management.
semantic-kernel
Build and deploy intelligent AI agents with the Semantic Kernel framework.

repomix
Repomix packages your codebase into AI-friendly formats for easy use.
UI-TARS-desktop
UI-TARS-desktop is part of the TARS Multimodal AI Agent stack.