- Home
- Skills
- Tencentcloudbase
- Cloudbase Mcp
- Ai Model Cloudbase
ai-model-cloudbase_skill
- TypeScript
947
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill tencentcloudbase/cloudbase-mcp --skill ai-model-cloudbase- SKILL.md11.4 KB
Overview
This skill is a practical guide for calling AI models with CloudBase across web, Node.js, HTTP, and WeChat Mini Program platforms. It covers JS/Node SDK initialization, text generation (streaming and non-streaming), image generation on Node, and the HTTP/OpenAI-compatible gateway. The goal is to help developers pick the correct API shape and implement robust, platform-specific integrations quickly.
How this skill works
It explains SDK initialization differences (web vs Node vs wx.cloud), the shared AI API for JS/Node, and the distinct WeChat Mini Program API shape. It shows how to call generateText, streamText, and generateImage (Node only), and how to use the CloudBase HTTP gateway and OpenAI-compatible client. The guide highlights return formats, streaming iteration, callbacks for Mini Program, and token/usage reporting.
When to use it
- Building chat or assistant features that call CloudBase-hosted AI models from browser or server.
- Implementing streaming responses for long-form or interactive text generation.
- Generating images server-side using CloudBase Node SDK (image API is Node-only).
- Connecting third-party OpenAI-compatible clients to CloudBase via the HTTP gateway.
- Integrating AI in WeChat Mini Program where the API shape and callbacks differ.
Best practices
- Choose streaming for long responses to improve UX and reduce perceived latency.
- Wrap all AI calls in try/catch and surface friendly errors to users.
- Never embed secret keys in client-side code; use server or cloud functions for sensitive calls.
- Initialize CloudBase SDK or wx.cloud at app entry point to reuse clients.
- For Mini Program streaming, wrap parameters in data and check event.data === "[DONE]" to detect completion.
Example use cases
- Browser chat widget using @cloudbase/js-sdk with generateText and streamText for live replies.
- Server-side batch prompt processing and image generation using @cloudbase/node-sdk in cloud functions.
- Mobile app backend calling the CloudBase HTTP gateway via OpenAI-compatible client for unified API usage.
- WeChat Mini Program chat feature using wx.cloud.extend.AI.streamText with onText and onFinish callbacks.
- Edge function that proxies requests, keeps API keys secure, and returns streaming chunks to clients.
FAQ
Image generation is supported only in the Node SDK (cloud functions/server) via the Hunyuan image model.
Can I use the same API code between web and Node?
Yes. JS SDK and Node SDK share the same AI API shapes; only initialization differs. WeChat Mini Program uses a different API shape.