ai-model-nodejs

Generate text and images from Node.js backends via Tencent CloudBase.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mrpersimmon/xiao-han-studio --skill ai-model-nodejs-mrpersimmon
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ai-model-nodejs
Source: https://github.com/mrpersimmon/xiao-han-studio/tree/main/.agents/skills/cloudbase/references/ai-model-nodejs
Command: npx skills add https://github.com/mrpersimmon/xiao-han-studio --skill ai-model-nodejs-mrpersimmon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It enables reliable server-side AI calls from Node.js backends (including Cloud Functions and CloudRun) with proper model enablement and Token Credits readiness checks.

Core Features & Use Cases

  • Managed multi-vendor text generation: Calls LLMs via @cloudbase/node-sdk using the managed cloudbase model group, with model IDs placed in the model field of generateText/streamText.
  • Server-side orchestration and streaming: Supports non-streaming generateText and streaming streamText for long responses and agent workflows.
  • Hunyuan image generation from Node.js: Uses ai.createImageModel("hunyuan-image") with generateImage, including guidance for cloud-function timeouts.
  • Guardrails for production correctness: Provides a mandatory two-step preflight (Token Credits eligibility + model group readiness via DescribeAIModels and DescribeManagedAIModelList) before any SDK code.

Quick Start

Use the backend to generate text by calling ai.createModel("cloudbase") and then using generateText with a verified model id like deepseek-v4-flash after the two-step preflight passes.

Frequently Asked Questions about ai-model-nodejs

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

FAQPage Schema
How do I generate text from a Node.js cloud function using Tencent CloudBase?▼

To generate text from a Node.js cloud function, use the @cloudbase/node-sdk to call ai.createModel("cloudbase") and execute generateText with a verified model id after passing the mandatory preflight checks for Token Credits and model group readiness.

Why do my server-side AI calls fail despite having Token Credits?▼

Server-side AI calls fail if you skip the mandatory two-step preflight. You must verify Token Credits eligibility and model group readiness via DescribeAIModels and DescribeManagedAIModelList before executing any generateText, streamText, or generateImage operations in your Node.js backend.

Can I use streaming text generation for long responses in Express or NestJS serverless APIs?▼

Yes, you can use streaming text generation in Express or NestJS serverless APIs by implementing the streamText method from @cloudbase/node-sdk, which supports long responses and agent orchestration workflows while keeping secrets server-side.

What's the best way to generate images with Hunyuan from a Node.js backend?▼

The best way to generate images is using ai.createImageModel("hunyuan-image") followed by generateImage. You must complete the Token Credits and model group readiness preflight, and configure appropriate cloud-function timeouts to handle image processing.

Does this approach support running scheduled jobs and agent orchestration with server-side secrets?▼

Yes, this approach supports scheduled jobs and agent orchestration by executing server-side AI calls through Tencent CloudBase. It ensures secrets remain server-side by using the @cloudbase/node-sdk within Cloud Functions and CloudRun environments.