Skip to content

Latest commit

 

History

History

coze-js-node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Coze Node.js Example

English | 简体中文

This guide will help you quickly set up and run the Coze Node.js example.

Quick Start

1. Install Dependencies

npm run run-preinstall
npm install

2. Configure Environment

  1. Modify your configuration file:
cd src/config/config.ts
  1. Update the following values in config.ts:
  • COZE_BOT_ID: Your bot ID
  • COZE_BASE_URL: API base URL
  • auth.pat.COZE_API_KEY: Your Coze API key

3. Run the Example

Choose one of the following commands based on your Base URL:

# For China region (api.coze.cn)
COZE_ENV=zh npx tsx ./src/chat.ts            # macOS/Linux
set "COZE_ENV=zh" && npx tsx ./src/chat.ts   # Windows CMD
$env:COZE_ENV="zh"; npx tsx ./src/chat.ts    # Windows PowerShell

# For Global region (api.coze.com)
npx tsx ./src/chat.ts