Open-AutoGLM Implementation in JavaScript

January 6, 2026 · View on GitHub

banner


中文文档

Open-AutoGLM Implementation in JavaScript

AutoGLM.js is a powerful AI agent framework that can automatically control Android devices through natural language instructions to perform various complex mobile operation tasks.

cli.png

->TODO List<- Welcome to contribute and provide feedback!

🚀 Quick Start

npx @autoglm.js/cli

The model can directly use the autoglm-phone model provided for free by GLM.

✨ Features

  • 🎯 Natural Language Control: Control mobile operations through simple text commands
  • 📱 Android Automation: Supports screenshot analysis, app operations, UI interactions, and more
  • 🧠 Intelligent Decision Making: Intelligent task planning and execution based on large language models
  • 🔧 Flexible Configuration: Supports multiple invocation methods and configuration options
  • 🌍 Multi-language Support: Built-in Chinese and English support
  • 📦 Multiple Usage Methods: Provides three usage methods: CLI, API, and desktop application

Environment Requirements

  • Node.js >= 20.0.0

📖 Usage

AutoGLM.js provides three usage methods: CLI Command Line Tool, Core API Integration, and Desktop Application [🚧 Under Construction].

Method 1: CLI Command Line Tool

1. Global Installation

# Install from npm
npm install -g @autoglm.js/cli

2. Create Configuration File

Create ~/.autoglm/config.json file:

{
  "$schema": "https://unpkg.com/autoglm.js@latest/schema/agent-config.schema.json",
  "maxSteps": 200,
  "lang": "cn",
  "baseUrl": "https://open.bigmodel.cn/api/paas/v4/",
  "apiKey": "your-api-key-here",
  "model": "autoglm-phone",
  "deviceId": "your-device-id"
}

3. Run CLI

autoglm

4. Interactive Usage

CLI will launch an interactive interface where you can input natural language commands:

💬 Please enter task: Open WeChat and send "Hello" to Zhang San

Method 2: Core API Integration

1. Install Core Library

npm install autoglm.js

2. Basic Usage

import { AutoGLM } from 'autoglm.js'

// Create agent instance
const agent = new AutoGLM({
  maxSteps: 200,
  lang: 'cn',
  baseUrl: 'https://open.bigmodel.cn/api/paas/v4/',
  apiKey: 'your-api-key-here',
  model: 'autoglm-phone',
  deviceId: 'your-device-id'
})

// Execute task
agent.run('Open WeChat and send "Hello" to Zhang San')

3. Event Listening

import { AutoGLM, EventType } from 'autoglm.js'

const agent = new AutoGLM({
  baseUrl: 'https://open.bigmodel.cn/api/paas/v4/',
  apiKey: 'your-api-key-here',
  model: 'autoglm-phone',
})

// Listen to all events
agent.on('*', (type, data) => {
  console.log(`[${type}]`, data)
})

// Listen to specific events
agent.on(EventType.Thinking, (data) => {
  console.log('Thinking:', data)
})

agent.on(EventType.TaskComplete, (result) => {
  console.log('Task completed:', result)
})

// Execute task
agent.run('Open Douyin')

Method 3: Desktop Application [WIP]

The desktop application is under development and will provide a graphical interface to use all features of AutoGLM.js. Welcome to contribute and provide feedback.

⚙️ Configuration Options

Basic Configuration

ParameterTypeDefaultDescription
maxStepsnumber100Maximum number of execution steps
langstring'cn'Language setting ('cn' or 'en')
deviceIdstring-Android device ID
systemPromptstring-Custom system prompt
screenshotQualitynumber80Screenshot quality (1-100)

Model Configuration

ParameterTypeDefaultDescription
baseUrlstring'http://localhost:8000/v1'API base URL
apiKeystring-API key
modelstring'autoglm-phone'Model name
maxTokensnumber3000Maximum token count
temperaturenumber0.0Temperature parameter
topPnumber0.85Top P parameter
frequencyPenaltynumber0.2Frequency penalty parameter

📄 License

This project is open source under the MIT License.

🙏 Acknowledgments

📞 Support

🙇🏻‍♂️Sponsors

sponsors


If this project helps you, please give it a ⭐️ to support!

Made with ❤️ by @FliPPeDround