ai-model-wechat

Generate and stream AI text in WeChat Mini Programs via wx.cloud.extend.AI.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mrpersimmon/xiao-han-studio --skill ai-model-wechat-mrpersimmon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-model-wechat
Source: https://github.com/mrpersimmon/xiao-han-studio/tree/main/.agents/skills/cloudbase/references/ai-model-wechat
Command: npx skills add https://github.com/mrpersimmon/xiao-han-studio --skill ai-model-wechat-mrpersimmon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of calling WeChat Mini Program AI text models reliably, including streaming partial responses, by wrapping the correct wx.cloud.extend.AI usage and the required CloudBase preflight checks.

Core Features & Use Cases

  • Mini Program AI text generation: Use wx.cloud.extend.AI.generateText for non-streaming chat completion with the correct return shape (raw model response).
  • Streaming with callbacks: Use wx.cloud.extend.AI.streamText with a required data wrapper plus onText, onEvent, and onFinish callbacks, or iterate textStream/eventStream.
  • Correct provider/model selection for CloudBase: Guides the eligibility decision (Growth Plan vs Token Credits resource pack vs custom onboarding) and enforces group readiness (DescribeAIModels → optional DescribeManagedAIModelList → optional UpdateAIModel) before business code.

Use Case: Build a WeChat Mini Program chat UI that streams tokens as the user types, while ensuring the selected model is billable and enabled for the current environment.

Quick Start

Use the ai-model-wechat skill to generate or stream text from an enrolled Mini Program environment, then ask the model to respond to: "Write a friendly onboarding message for my Mini Program chat."

Frequently Asked Questions about ai-model-wechat

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream AI text in a WeChat Mini Program chat interface?

To stream AI text in a WeChat Mini Program, use wx.cloud.extend.AI.streamText with required data wrapping plus onText, onEvent, and onFinish callbacks, or iterate textStream and eventStream for real-time chat completion responses.

Why does my WeChat Mini Program AI model call fail with a billing error?

WeChat Mini Program AI model calls fail if billing eligibility is incomplete, requiring a mandatory two-step preflight check using DescribeActivityInfo or DescribeEnvPostpayPackage before calling createModel or generateText.

What is the correct way to check AI model readiness in CloudBase tcb?

AI model readiness in CloudBase tcb is checked by calling DescribeAIModels and optionally DescribeManagedAIModelList, then using UpdateAIModel to enable the selected model group before executing business code.

Can I use wx.cloud.extend.AI generateText for non-streaming chat completion?

Yes, you can use wx.cloud.extend.AI.generateText for non-streaming chat completion in WeChat Mini Programs, which returns the raw model response shape directly without requiring streaming callbacks.

Do I need to enable a model group before calling streamText in a Mini Program?

Yes, you must complete group readiness by calling DescribeAIModels and UpdateAIModel to enable the model group, and verify billing eligibility before calling streamText or generateText in your Mini Program environment.