ai-model-nodejs

Integrate LLM text and image generation into Node.js backends via @cloudbase/node-sdk.

Updated May 14, 2026
One-click install
npx skills add https://github.com/study-yang/Vieb-Coding-- --skill ai-model-nodejs-study-yang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-model-nodejs
Source: https://github.com/study-yang/Vieb-Coding--/tree/main/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F-%E5%BF%AB%E8%AE%B0/.codebuddy/skills/ai-model-nodejs
Command: npx skills add https://github.com/study-yang/Vieb-Coding-- --skill ai-model-nodejs-study-yang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudbase/node-sdk.

What problem does it solve? It guides developers through calling AI models from Node.js server-side code (cloud functions, CloudRun, Express, Koa, NestJS) using @cloudbase/node-sdk, preventing common mistakes like passing vendor names to createModel, skipping the Token Credits eligibility check, or calling models that were never enabled in the environment. ## Core Features & Use Cases - Text generation: Non-streaming generateText and streaming streamText against the managed cloudbase model group (DeepSeek, Hunyuan, GLM, Kimi, MiniMax) or custom OpenAI-compatible endpoints. - Image generation: Server-side image creation via ai.createImageModel("hunyuan-image") + generateImage, the only SDK plane that supports it. - Mandatory two-step preflight: Verify the Token Credits resource pack (DescribeEnvPostpayPackage) and group/model readiness (DescribeAIModels → DescribeManagedAIModelList → UpdateAIModel) before writing any SDK code. - Use Case: Build a CloudBase cloud function that streams DeepSeek responses to clients, or a scheduled job that generates marketing images with Hunyuan Image, with correct timeouts and billing checks. ## Quick Start Ask the AI to write a CloudBase cloud function that calls deepseek-v4-flash with streamText after running the Token Credits and model-enablement preflight checks.

Frequently Asked Questions about ai-model-nodejs

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

FAQPage Schema
How do I call DeepSeek or Hunyuan models from a Node.js cloud function?

Install @cloudbase/node-sdk >= 3.16.0, call ai.createModel("cloudbase"), and pass the model id (e.g. deepseek-v4-flash) in the model field of generateText or streamText. First verify the model is enabled via DescribeAIModels and enable it with UpdateAIModel if missing.

What values are valid for ai.createModel in @cloudbase/node-sdk?

Only three shapes are legal: "cloudbase" (the main managed group), "hunyuan-exp" (legacy builtin), or a user-defined GroupName starting with "custom-" registered via CreateAIModel. Vendor or model names like "deepseek" or "kimi" are invalid; model ids belong in the model field.

Can I generate images with the CloudBase Node.js SDK?

Yes, image generation is only available in the Node SDK via ai.createImageModel("hunyuan-image") and generateImage with a prompt, size, and version. It consumes the same Token Credits pack, so set cloud function timeouts up to 900 seconds.

Why does my AI call fail even though the SDK code looks correct?

Most failures come from a missing Token Credits resource pack or a model that was never enabled in the environment. Run DescribeEnvPostpayPackage for eligibility and DescribeAIModels for group readiness before calling the SDK.

Should I use this SDK for browser or WeChat Mini Program AI features?

No. Browser and web apps should use the ai-model-web skill, and WeChat Mini Programs should use ai-model-wechat. This Node SDK is for server-side runtimes like cloud functions, CloudRun, and backend services.

How do I use a custom OpenAI-compatible model with CloudBase?

Onboard it with CreateAIModel using a GroupName starting with "custom-", your BaseUrl, model list, and Secret.ApiKey, or via the console. Then call ai.createModel with that custom GroupName; billing is handled by the third-party provider.