Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
tencentcloudbase avatar

Ai Model Web

  • 6 installs
  • 417 repo stars
  • Updated August 4, 2026
  • tencentcloudbase/awesome-cloudbase-examples

Helps with ai & agent building tasks during AI-assisted development.

About

ai-model-web is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • ai-model-web
  • AI & Agent Building
  • AI-coding skill

Ai Model Web by the numbers

  • 6 all-time installs (skills.sh)
  • Ranked #12,825 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tencentcloudbase/awesome-cloudbase-examples --skill ai-model-web

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs6
repo stars417
Last updatedAugust 4, 2026
Repositorytencentcloudbase/awesome-cloudbase-examples

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

When to use this skill

Use this skill for calling AI models in browser/Web applications using @cloudbase/js-sdk.

Use it when you need to:

  • Integrate AI text generation in a frontend Web app
  • Stream AI responses for better user experience
  • Call Hunyuan or DeepSeek models from browser

Do NOT use for:

  • Node.js backend or cloud functions → use ai-model-nodejs skill
  • WeChat Mini Program → use ai-model-wechat skill
  • Image generation → use ai-model-nodejs skill (Node SDK only)
  • HTTP API integration → use http-api skill

---

Available Providers and Models

CloudBase provides these built-in providers and models:

ProviderModelsRecommended
hunyuan-exphunyuan-turbos-latest, hunyuan-t1-latest, hunyuan-2.0-thinking-20251109, hunyuan-2.0-instruct-20251111hunyuan-2.0-instruct-20251111
deepseekdeepseek-r1-0528, deepseek-v3-0324, deepseek-v3.2deepseek-v3.2

---

Installation

npm install @cloudbase/js-sdk

Initialization

import cloudbase from "@cloudbase/js-sdk";

const app = cloudbase.init({
  env: "<YOUR_ENV_ID>",
  accessKey: "<YOUR_PUBLISHABLE_KEY>"  // Get from CloudBase console
});

const auth = app.auth();
await auth.signInAnonymously();

const ai = app.ai();

Important notes:

  • Always use synchronous initialization with top-level import
  • User must be authenticated before using AI features
  • Get accessKey from CloudBase console

---

generateText() - Non-streaming

const model = ai.createModel("hunyuan-exp");

const result = await model.generateText({
  model: "hunyuan-2.0-instruct-20251111",  // Recommended model
  messages: [{ role: "user", content: "你好,请你介绍一下李白" }],
});

console.log(result.text);           // Generated text string
console.log(result.usage);          // { prompt_tokens, completion_tokens, total_tokens }
console.log(result.messages);       // Full message history
console.log(result.rawResponses);   // Raw model responses

---

streamText() - Streaming

const model = ai.createModel("hunyuan-exp");

const res = await model.streamText({
  model: "hunyuan-2.0-instruct-20251111",  // Recommended model
  messages: [{ role: "user", content: "你好,请你介绍一下李白" }],
});

// Option 1: Iterate text stream (recommended)
for await (let text of res.textStream) {
  console.log(text);  // Incremental text chunks
}

// Option 2: Iterate data stream for full response data
for await (let data of res.dataStream) {
  console.log(data);  // Full response chunk with metadata
}

// Option 3: Get final results
const messages = await res.messages;  // Full message history
const usage = await res.usage;        // Token usage

---

Type Definitions

interface BaseChatModelInput {
  model: string;                        // Required: model name
  messages: Array<ChatModelMessage>;    // Required: message array
  temperature?: number;                 // Optional: sampling temperature
  topP?: number;                        // Optional: nucleus sampling
}

type ChatModelMessage =
  | { role: "user"; content: string }
  | { role: "system"; content: string }
  | { role: "assistant"; content: string };

interface GenerateTextResult {
  text: string;                         // Generated text
  messages: Array<ChatModelMessage>;    // Full message history
  usage: Usage;                         // Token usage
  rawResponses: Array<unknown>;         // Raw model responses
  error?: unknown;                      // Error if any
}

interface StreamTextResult {
  textStream: AsyncIterable<string>;    // Incremental text stream
  dataStream: AsyncIterable<DataChunk>; // Full data stream
  messages: Promise<ChatModelMessage[]>;// Final message history
  usage: Promise<Usage>;                // Final token usage
  error?: unknown;                      // Error if any
}

interface Usage {
  prompt_tokens: number;
  completion_tokens: number;
  total_tokens: number;
}

---

Best Practices

1. Use streaming for long responses - Better user experience 2. Handle errors gracefully - Wrap AI calls in try/catch 3. Keep accessKey secure - Use publishable key, not secret key 4. Initialize early - Initialize SDK in app entry point 5. Ensure authentication - User must be signed in before AI calls

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.