Skip to content

Files

Latest commit

bed2c83 · Apr 29, 2025

History

History

coze-js-node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 4, 2024
Feb 11, 2025
Apr 29, 2025
Feb 11, 2025
Feb 11, 2025
Nov 18, 2024
Mar 28, 2025
Jan 14, 2025

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