For WeChat Developers · 微信开发者

Build a WeChat AI bot users actually trust

Official Account, Mini Program, or enterprise WeCom bot. 16 AI models through one API — GPT-5.4 and Claude accessible from inside China, plus DeepSeek / Qwen for native-quality Chinese. Pay in CNY via WeChat Pay or Alipay.

Start free — 2 calls, no card · 免费试用

Works with every WeChat surface

📰

公众号 Official Account

Subscription + Service

📱

小程序 Mini Program

Cloud function + UI

💼

企业微信 WeCom

Internal enterprise bot

🤝

WeChat Customer Service

微信客服 for brands

🎬

视频号 Video Account

Comment auto-reply

🛒

小商店 Mini Shop

Product Q&A bot

📞

WeCom Customer Acquisition

Sales assistant

🔌

Custom WeChat app

Any WeChat OpenAPI

What makes WeChat bots hard (and how we fix it)

🚫

Blocked from OpenAI / Anthropic

Problem: Mainland China can't reach api.openai.com or api.anthropic.com directly. Your bot fails at network layer.

With AIPower: AIPower's gateway is CDN-accelerated for China. GPT-5.4 and Claude Opus work from any mainland IP. No VPN or proxy config in your bot code.

💳

No foreign card? No API.

Problem: OpenAI and Anthropic require a non-Chinese payment card. Your CFO won't approve foreign USD subscriptions without fapiao.

With AIPower: Pay via WeChat Pay / Alipay in CNY. Get fapiao (专票/普票) on the enterprise plan. Billing entity: AI POWER LIMITED (Hong Kong).

🗣️

GPT sounds un-Chinese

Problem: GPT/Claude translate Chinese through English internally. Replies feel stiff, miss idioms, over-formal.

With AIPower: Route native Chinese traffic to Qwen, DeepSeek, or Kimi. Native-trained, feels natural. Same API — just change the model string.

⏱️

WeChat 5-second reply timeout

Problem: 公众号 webhook must respond in ≤5 seconds. GPT can take 8+ seconds on long replies. Your users see 'service busy'.

With AIPower: Use auto-fast (Qwen Turbo, <500ms first-token) or return 200 immediately + reply via 客服消息 API when LLM finishes.

公众号 Official Account example

User sends text to your 公众号 → WeChat POSTs to your server → you call AIPower → reply via 客服消息 API within 5 seconds.

// Node.js — WeChat Official Account webhook
import OpenAI from "openai";
import xml2js from "xml2js";

const aipower = new OpenAI({
  baseURL: "https://api.aipower.me/v1",
  apiKey: process.env.AIPOWER_API_KEY,
});

export async function handleWeChatMessage(req, res) {
  // Parse WeChat XML POST
  const body = await readBody(req);
  const parsed = await xml2js.parseStringPromise(body);
  const msg = parsed.xml;

  const userId = msg.FromUserName[0];
  const text = msg.Content?.[0];
  if (!text) return res.status(200).send("");

  // Quick reply with AIPower — use auto-fast for <2s latency
  const completion = await aipower.chat.completions.create({
    model: "qwen/qwen-turbo",  // fastest for Chinese text, <500ms first token
    messages: [
      { role: "system", content: "你是公众号客服助手。回答简短(2-3句),必要时引导用户去菜单或官网。" },
      { role: "user", content: text },
    ],
    max_tokens: 200,
    user: userId,
  });

  const reply = completion.choices[0].message.content;

  // Build WeChat XML response
  const xmlReply = `<xml>
<ToUserName><![CDATA[${userId}]]></ToUserName>
<FromUserName><![CDATA[${msg.ToUserName[0]}]]></FromUserName>
<CreateTime>${Math.floor(Date.now()/1000)}</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[${reply}]]></Content>
</xml>`;
  res.setHeader("Content-Type", "application/xml");
  res.status(200).send(xmlReply);
}

⚠️ WeChat's 5-second response deadline — always use fast models (qwen-turbo, auto-fast) for immediate replies. Use 客服消息 API for longer responses that need streaming.

小程序 Mini Program example

WeChat Mini Program calls your cloud function → cloud function calls AIPower → stream tokens back via WebSocket or 云开发 realtime.

// WeChat Cloud Function (Node.js)
const OpenAI = require("openai");
const cloud = require("wx-server-sdk");
cloud.init();

const aipower = new OpenAI({
  baseURL: "https://api.aipower.me/v1",
  apiKey: process.env.AIPOWER_API_KEY,
});

exports.main = async (event, context) => {
  const { userId, question, model = "auto" } = event;

  // Pick model based on user tier / question type
  const modelId = {
    auto: "deepseek/deepseek-chat",   // default — $0.34/M, great Chinese
    premium: "anthropic/claude-sonnet", // VIP users — $3.45/M
    free: "zhipu/glm-4-flash",         // nearly free — $0.01/M
  }[model] || "deepseek/deepseek-chat";

  const res = await aipower.chat.completions.create({
    model: modelId,
    messages: [
      { role: "system", content: "你是小程序内的 AI 助手,回答中文,结构清晰。" },
      { role: "user", content: question },
    ],
    user: userId,  // for per-user billing analytics
  });

  return {
    reply: res.choices[0].message.content,
    tokens: res.usage.total_tokens,
    model: modelId,
  };
};

Which model for Chinese users

Use case · 场景ModelCost/MWhy · 理由
公众号客服 5s 硬限qwen/qwen-turbo$0.12首字 <500ms,中文质量强
小程序 AI 助手auto → DeepSeek V3$0.34性价比最高,中文流利
企业 WeCom 智能客服auto-code → Claude Sonnet$3.45复杂业务咨询高准确率
中英翻译 / 跨境 SaaSqwen/qwen-plus$0.13CN↔EN 翻译业界最强
免费用户 / 引流 botzhipu/glm-4-flash$0.01近零成本,适合免费层
数学 / 复杂推理deepseek/deepseek-reasoner$0.55MATH-500 超 GPT-4o

Why Chinese developers use AIPower

🌏

GPT + Claude accessible in China

Our gateway routes OpenAI/Anthropic requests through CDN-optimized paths. Works from any mainland China IP with normal latency.

网关加速直连,国内 IP 可访问 GPT-5.4 和 Claude Opus,平均延迟 800ms-1.5s,无需 VPN。

💴

WeChat Pay + Alipay + fapiao

Pay in CNY via WeChat Pay or Alipay. Get proper 专票 or 普票 for enterprise accounting.

支持微信支付和支付宝人民币充值。企业版可开专票/普票,AI POWER LIMITED(香港实体)出账。

🏆

All major Chinese models

Qwen (Alibaba), DeepSeek, GLM (Zhipu), Kimi (Moonshot), Doubao (ByteDance), MiniMax — through the same API.

通义千问、DeepSeek、智谱 GLM、Kimi、豆包、MiniMax — 全部接入,模型名一改即切换。

📊

分场景按模型路由

Route cheap queries to DeepSeek, premium to Claude, translation to Qwen. One API, different model per request.

每次调用选择模型:闲聊走 DeepSeek(便宜)、深度分析走 Claude(高质量)、中英翻译走 Qwen(最强)。

WeChat-specific gotchas 微信平台坑点

5-second response deadline on 公众号 webhooks

If your LLM call exceeds 5s, WeChat shows 'service unavailable' to the user. Solution: respond with 200 OK + empty body, then push the real reply via 客服消息 API (kfaccount message). Or use qwen-turbo / auto-fast (sub-second first token).

Content safety pre-check required by platform

Route all user input and AI output through WeChat's msg_sec_check API before replying. Fails gracefully if user's text is flagged. Saves your 公众号 from being suspended for user-generated violations.

Mini Program cloud functions have cold starts

First call after idle takes 1-3s extra (container spin-up). Keep your cloud function warm with a scheduled ping every 2 minutes, or use 云托管 (持久化容器) for production bots.

Token limits differ from Web API

WeChat Service Account token (access_token) expires in 2h and has a global rate limit. Cache it aggressively. Don't confuse with your AIPower API key (sk-aipower-xxx) which is user-scoped and doesn't expire.

48-hour messaging window

WeChat Service Accounts can only send unsolicited 客服消息 within 48h of user's last interaction. For broadcast, use 群发消息 (rate-limited by user tier). Plan your flow around this.

📋 合规建议 Compliance notes

  • 备案内容:AI 生成内容必须符合《生成式人工智能服务管理暂行办法》。DeepSeek / Qwen / GLM / Kimi / Doubao 都是国内已备案模型,建议公众号/小程序默认使用。
  • 内容安全:接入微信内容安全 API(msg_sec_check),所有用户输入和 AI 输出都要走一遍再返回。
  • 未成年人保护:如果你的 bot 面向 C 端,内置敏感话题拒答(system prompt + 关键词过滤双保险)。
  • 发票:AIPower 企业版支持专票/普票,方便财务走账。联系 enterprise@aipower.me。

FAQ

Can AIPower be called from inside China? 国内能直接调用吗?

Yes. Our gateway has CDN acceleration for mainland China. GPT-5.4 and Claude Opus work from any Chinese IP with normal latency (800ms-1.5s). No VPN, no proxy, no /etc/hosts hacks.

How do I pay in RMB? 能开人民币账单吗?

Top up via WeChat Pay or Alipay on your dashboard (https://aipower.me/dashboard/billing). Amounts are billed in CNY. Enterprise accounts can request 专票 or 普票 — email enterprise@aipower.me.

Which Chinese model for a 公众号 customer support bot?

Qwen Turbo for speed-critical replies (5-second webhook deadline). DeepSeek V3 for balanced quality/cost. Claude Sonnet via auto-code only for complex B2B or enterprise support where accuracy > speed.

Does the API support streaming for Mini Programs?

Yes, with stream=true. But Mini Programs can't consume SSE directly — your cloud function must convert. Pattern: cloud function streams from AIPower → buffers → pushes to client via wx.connectSocket WebSocket or 云开发 realtime subscription.

How do I prevent abusive users from running up bill?

Tag each AIPower call with user="wechat_openid_xxx". Query /api/usage/logs by user to find top spenders. Combine with daily_cap_cents at account level + your app-side per-openid rate limit (e.g., 20 msg/day for free tier users).

What about compliance for AI content in China?

Stick to 国内备案模型 by default (DeepSeek, Qwen, GLM, Kimi, Doubao). Route through WeChat's content safety check before replying. We don't provide legal advice, but these are the standard 2026 practices for 公众号/小程序 AI products.

Is there a Chinese-language dashboard?

Yes — /zh for Chinese homepage, pricing, docs. Dashboard UI detects your browser locale. Support email in Chinese: support@aipower.me (中文邮件 OK).

Building a different kind of bot?

Ship your WeChat AI bot this week.

2 free trial calls. +100 bonus on first $5 top-up. 微信/支付宝付款都支持。