ai-model-nodejs
Use this skill for Node.js backend AI via @cloudbase/node-sdk (>=3.16.0) — cloud functions, CloudRun, Express, Koa, NestJS, serverless APIs, scheduled jobs, LLM proxies. Only SDK supporting image generation (ai.createImageModel + generateImage). Text models via ai.createModel with groups cloudbase, hunyuan-exp, or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the model field of generateText/streamText. MUST run two-step preflight before code — see body. Keywords: backend, 云函数, 云托管, serverless, LLM proxy, agent orchestration, gener
npx skills add TencentCloudBase/CloudBase-AI-Toolkit --skill ai-model-nodejs --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides a Node.js backend to call AI models using the @cloudbase/node-sdk (>=3.16.0) for cloud functions, CloudRun, Express, Koa, NestJS, and serverless APIs. It enables image generation via ai.createImageModel("hunyuan-image") and text generation via ai.createModel("cloudbase") with specific model IDs placed in the model field of generateText/streamText. It supports two-step preflight before emitting code and instructs on selecting among managed models in the cloudbase group or onboarding custom models. It distinguishes usage from client-side web or WeChat mini programs.
How it works
- Perform two-step preflight before any SDK code: Step 0 obtain EnvId via envQuery; Step 1 eligibility via DescribeEnvPostpayPackage to ensure a token credits pack is active; Step 2 group readiness via DescribeAIModels and, if needed, DescribeManagedAIModelList followed by UpdateAIModel to enable the target model. The process uses MCP tool calls with envId and specific actions, and requires that a target model is enabled in the cloudbase group before use.
- Use ai.createModel("cloudbase") for text models, placing the concrete model id (e.g., "deepseek-v4-flash") in the model field of generateText/streamText; ensure the model is enabled in DescribeAIModels. For image generation, use ai.createImageModel("hunyuan-image") and set model: "hunyuan-image".
- If a non-managed model is requested, follow Custom onboarding via console flow or programmatic onboarding using CreateAIModel with a custom GroupName starting with custom- and provide BaseUrl, Secrets, and Models, then describe AI models to verify readiness.
When to use it
Use this skill for calling AI models from Node.js backends, cloud functions, or CloudRun services via @cloudbase/node-sdk when the AI call belongs on the server (image generation, long-running agent jobs, orchestration, scheduled tasks, or flows needing secret handling). Do not wrap this behind a frontend proxy for browser apps; use ai-model-web for web usage.
What it can touch
- Tools: claude-code, cursor
- It references commands to call CloudBase APIs: DescribeEnvPostpayPackage, DescribeAIModels, DescribeManagedAIModelList, UpdateAIModel, CreateAIModel, and MCP envQuery. It requires EnvId and follows the exact parameter casing as shown in the guidance; the Model IDs and GroupName must be used exactly as specified by the catalog and DescribeAIModels results.
Caveats
- Two-step preflight is mandatory before code emission. Text generation and image generation share a Token Credits resource pack. Do not assume a model is enabled; verify via DescribeAIModels and, if needed, DescribeManagedAIModelList before enabling.
- Model naming follows exact catalog entries; do not guess model IDs. If the requested model is not in the managed catalog, proceed with custom onboarding.
- Image generation uses a separate entry point createImageModel("hunyuan-image"); do not mix with createModel for images.
## Standalone Install Note If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills. - CloudBase main entry: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md` - Current skill raw source: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/ai-model-nodejs/SKILL.md` Keep local `references/...` paths for files that ship with the current skill directory. When this file points to a sibling skill such as `auth-tool-cloudbase` or `web-development`, use the standalone fallback URL shown next to that reference. ## When to use this skill Use this skill for **calling AI models from Node.js backends, cloud functions, or CloudRun services** via `@cloudbase/node-sdk`. > 🧭 **Runtime-plane fit.** This is the right skill when the AI call truly belongs on the server: image generation (the only SDK that supports it), long-running agent jobs, orchestration across multiple tools, scheduled tasks, or flows that must keep secrets server-side. **If the user is building a Web page / frontend AI chat U
- Standalone Install Note
- When to use this skill
- ⛔ STOP — ai.createModel(...) argument is not a vendor / model name
- ❌ Do NOT write any of these — they are all wrong
- ✅ Correct pattern — GroupName vs Model are two different fields
- Decision procedure (when the user names a specific model)
- Mandatory Two-Step Preflight (before any SDK code)
- Step 0: obtain the environment ID
- Preflight ① — Eligibility (Token Credits resource pack)
- Preflight ② — Group readiness (DescribeAIModels → UpdateAIModel if needed)
- Available Providers and Models
- 1. "cloudbase" — the main managed group (recommended)
- 2. "hunyuan-exp" — legacy builtin group (kept for compatibility)
- 3. User-defined GroupName
npm install @cloudbase/node-sdk
What does the ai-model-nodejs skill do?
Use this skill for Node.js backend AI via @cloudbase/node-sdk (>=3.16.0) — cloud functions, CloudRun, Express, Koa, NestJS, serverless APIs, scheduled jobs, LLM proxies. Only SDK supporting image generation (ai.createImageModel + generateImage). Text models via ai.createModel with groups cloudbase, hunyuan-exp, or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the model field of generateText/streamText. MUST run two-step preflight before code — see body. Keywords: backend, 云函数, 云托管, serverless, LLM proxy, agent orchestration, gener
How do I install it?
Run `npx skills add TencentCloudBase/CloudBase-AI-Toolkit --skill ai-model-nodejs --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From TencentCloudBase/CloudBase-AI-Toolkit, a repository with 1,066 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
