LLM

Implement LLM chat completions and multi-turn conversations using the z-ai-web-dev-sdk.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/tmtgroupbot/lptracker-deploy --skill llm-tmtgroupbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: LLM
Source: https://github.com/tmtgroupbot/lptracker-deploy/tree/main/skills/LLM
Command: npx skills add https://github.com/tmtgroupbot/lptracker-deploy --skill llm-tmtgroupbot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires z-ai-web-dev-sdk, and includes scripts (resource) components.

What problem does it solve? Building conversational AI features like chatbots, assistants, and text generation requires managing message history, system prompts, and API calls. This Skill provides ready-to-use patterns for implementing LLM chat completions with the z-ai-web-dev-sdk, including conversation management, error handling, and context control. ## Core Features & Use Cases - Chat Completions: Send single or multi-turn messages with system prompts and optional chain-of-thought reasoning via SDK or CLI. - Conversation Management: Maintain message history, trim context to avoid token limits, and build contextual assistants. - Use Case: Build an Express.js chatbot API that stores per-session conversation history and returns AI responses for customer support, content generation, or code assistance. ## Quick Start Ask the AI to write a backend function using z-ai-web-dev-sdk that answers a user question with a custom system prompt.

Frequently Asked Questions about LLM

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

FAQPage Schema
How do I create a chat completion with z-ai-web-dev-sdk?

Call ZAI.create() to initialize the SDK, then use zai.chat.completions.create with a messages array containing an assistant system prompt and user message. The response text is available at completion.choices[0].message.content.

How do I build a multi-turn chatbot with conversation history?

Maintain a messages array that starts with a system prompt, append each user message and assistant response, and pass the full array to chat.completions.create on every turn. Trim older messages when the history grows too long to avoid token limits.

Can I use z-ai-web-dev-sdk in client-side browser code?

No, z-ai-web-dev-sdk must be used in backend code only. Importing it in client-side code exposes credentials and is not supported; route all chat requests through your server.

When should I use the z-ai CLI instead of the SDK?

Use the z-ai CLI for quick one-off questions, simple automation scripts, and prompt testing with commands like z-ai chat --prompt. Use the SDK for multi-turn conversations, web application integration, and production workflows.

Why do I get empty responses from chat completions?

Empty responses occur when completion.choices[0].message.content is missing or blank. Add validation that checks the response is non-empty, and implement retry logic with exponential backoff for transient failures.