Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
tencentcloudbase avatar

Ai Model Wechat

  • 7 installs
  • 417 repo stars
  • Updated August 4, 2026
  • tencentcloudbase/awesome-cloudbase-examples

Helps with ai & agent building tasks during AI-assisted development.

About

ai-model-wechat is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • ai-model-wechat
  • AI & Agent Building
  • AI-coding skill

Ai Model Wechat by the numbers

  • 7 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #12,545 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tencentcloudbase/awesome-cloudbase-examples --skill ai-model-wechat

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs7
repo stars417
Last updatedAugust 4, 2026
Repositorytencentcloudbase/awesome-cloudbase-examples

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

When to use this skill

Use this skill for calling AI models in WeChat Mini Program using wx.cloud.extend.AI.

Use it when you need to:

  • Integrate AI text generation in a Mini Program
  • Stream AI responses with callback support
  • Call Hunyuan models from WeChat environment

Do NOT use for:

  • Browser/Web apps → use ai-model-web skill
  • Node.js backend or cloud functions → use ai-model-nodejs skill
  • Image generation → use ai-model-nodejs skill (not available in Mini Program)
  • HTTP API integration → use http-api skill

---

Available Providers and Models

CloudBase provides these built-in providers and models:

ProviderModelsRecommended
hunyuan-exphunyuan-turbos-latest, hunyuan-t1-latest, hunyuan-2.0-thinking-20251109, hunyuan-2.0-instruct-20251111hunyuan-2.0-instruct-20251111
deepseekdeepseek-r1-0528, deepseek-v3-0324, deepseek-v3.2deepseek-v3.2

---

Prerequisites

  • WeChat base library 3.7.1+
  • No extra SDK installation needed

---

Initialization

// app.js
App({
  onLaunch: function() {
    wx.cloud.init({ env: "<YOUR_ENV_ID>" });
  }
})

---

generateText() - Non-streaming

⚠️ Different from JS/Node SDK: Return value is raw model response.

const model = wx.cloud.extend.AI.createModel("hunyuan-exp");

const res = await model.generateText({
  model: "hunyuan-2.0-instruct-20251111",  // Recommended model
  messages: [{ role: "user", content: "你好" }],
});

// ⚠️ Return value is RAW model response, NOT wrapped like JS/Node SDK
console.log(res.choices[0].message.content);  // Access via choices array
console.log(res.usage);                        // Token usage

---

streamText() - Streaming

⚠️ Different from JS/Node SDK: Must wrap parameters in data object, supports callbacks.

const model = wx.cloud.extend.AI.createModel("hunyuan-exp");

// ⚠️ Parameters MUST be wrapped in `data` object
const res = await model.streamText({
  data: {                              // ⚠️ Required wrapper
    model: "hunyuan-2.0-instruct-20251111",  // Recommended model
    messages: [{ role: "user", content: "hi" }]
  },
  onText: (text) => {                  // Optional: incremental text callback
    console.log("New text:", text);
  },
  onEvent: ({ data }) => {             // Optional: raw event callback
    console.log("Event:", data);
  },
  onFinish: (fullText) => {            // Optional: completion callback
    console.log("Done:", fullText);
  }
});

// Async iteration also available
for await (let str of res.textStream) {
  console.log(str);
}

// Check for completion with eventStream
for await (let event of res.eventStream) {
  console.log(event);
  if (event.data === "[DONE]") {       // ⚠️ Check for [DONE] to stop
    break;
  }
}

---

API Comparison: JS/Node SDK vs WeChat Mini Program

FeatureJS/Node SDKWeChat Mini Program
Namespaceapp.ai()wx.cloud.extend.AI
generateText paramsDirect objectDirect object
generateText return{ text, usage, messages }Raw: { choices, usage }
streamText paramsDirect object⚠️ Wrapped in data: {...}
streamText return{ textStream, dataStream }{ textStream, eventStream }
CallbacksNot supportedonText, onEvent, onFinish
Image generationNode SDK onlyNot available

---

Type Definitions

streamText() Input

interface WxStreamTextInput {
  data: {                              // ⚠️ Required wrapper object
    model: string;
    messages: Array<{
      role: "user" | "system" | "assistant";
      content: string;
    }>;
  };
  onText?: (text: string) => void;     // Incremental text callback
  onEvent?: (prop: { data: string }) => void;  // Raw event callback
  onFinish?: (text: string) => void;   // Completion callback
}

streamText() Return

interface WxStreamTextResult {
  textStream: AsyncIterable<string>;   // Incremental text stream
  eventStream: AsyncIterable<{         // Raw event stream
    event?: unknown;
    id?: unknown;
    data: string;                      // "[DONE]" when complete
  }>;
}

generateText() Return

// Raw model response (OpenAI-compatible format)
interface WxGenerateTextResponse {
  id: string;
  object: "chat.completion";
  created: number;
  model: string;
  choices: Array<{
    index: number;
    message: {
      role: "assistant";
      content: string;
    };
    finish_reason: string;
  }>;
  usage: {
    prompt_tokens: number;
    completion_tokens: number;
    total_tokens: number;
  };
}

---

Best Practices

1. Check base library version - Ensure 3.7.1+ for AI support 2. Use callbacks for UI updates - onText is great for real-time display 3. Check for [DONE] - When using eventStream, check event.data === "[DONE]" to stop 4. Handle errors gracefully - Wrap AI calls in try/catch 5. Remember the `data` wrapper - streamText params must be wrapped in data: {...}

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.