Model Migration Guide After Purchasing a Token Resource Package
After purchasing a Token resource package, if your business code still uses legacy settings (such as hunyuan-exp/hunyuan-v3 and old model names), you need to complete a model migration. Otherwise, requests may fail or the selected model may not take effect.
Migration Target
Complete the following two replacements:
- Change the provider from
hunyuan-exp/hunyuan-v3tocloudbase - Replace the old model name with a model currently enabled on the console "AI -> Text Generation Models" page
How to Confirm the New Model Name
- Open the CloudBase Console
- Go to the "Text Generation Models" page
- Select an enabled model (for example,
hy3-preview,deepseek-v4-flash) - Put that model name into the
modelfield in your code
Code Migration Examples
Mini Program (wx.cloud.extend.AI)
// Before
const model = wx.cloud.extend.AI.createModel("hunyuan-exp");
const res = await model.streamText({
data: {
model: "hunyuan-2.0-instruct-20251111",
messages: [{ role: "user", content: "Hello" }],
},
});
// After
const model = wx.cloud.extend.AI.createModel("cloudbase");
const res = await model.streamText({
data: {
model: "hy3-preview", // Replace with an enabled model on Text Generation Models page
messages: [{ role: "user", content: "Hello" }],
},
});
Web SDK (@cloudbase/js-sdk)
// Before
const ai = app.ai();
const res = await ai.streamText({
provider: "hunyuan-exp",
model: "hunyuan-2.0-instruct-20251111",
messages: [{ role: "user", content: "Hello" }],
});
// After
const ai = app.ai();
const res = await ai.streamText({
provider: "cloudbase",
model: "hy3-preview", // Replace with an enabled model on Text Generation Models page
messages: [{ role: "user", content: "Hello" }],
});
Node.js SDK (@cloudbase/node-sdk)
// Before
const ai = app.ai();
const res = await ai.streamText({
provider: "hunyuan-exp",
model: "hunyuan-2.0-instruct-20251111",
messages: [{ role: "user", content: "Hello" }],
});
// After
const ai = app.ai();
const res = await ai.streamText({
provider: "cloudbase",
model: "hy3-preview", // Replace with an enabled model on Text Generation Models page
messages: [{ role: "user", content: "Hello" }],
});
OpenAI SDK (Compatibility Mode)
// Before
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "<YOUR_API_KEY>",
baseURL: "https://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/hunyuan-exp",
});
const res = await client.chat.completions.create({
model: "hunyuan-2.0-instruct-20251111",
messages: [{ role: "user", content: "Hello" }],
});
// After
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "<YOUR_API_KEY>",
baseURL: "https://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase",
});
const res = await client.chat.completions.create({
model: "hy3-preview", // Replace with an enabled model on Text Generation Models page
messages: [{ role: "user", content: "Hello" }],
});
Common Troubleshooting
Error: model cloudbase not found in definitions
This error usually means the WeChat Mini Program base library version is too low and does not support createModel("cloudbase").
Please upgrade the Mini Program base library to 3.15.1 or later and try again.
Model is still unavailable after migration
Usually this means the model value is not enabled or does not exist. Go back to the "Text Generation Models" page and confirm the model is enabled.
Still fails after changing to cloudbase
Check whether there are still legacy code paths (for example, old cloud functions, old branches, or config center entries) that are still using hunyuan-exp or hunyuan-v3.