Skip to main content

GLM 4.7

GLM 4.7 is Zhipu AI's latest coding-focused model, excelling at multilingual support and code generation.

Overview

GLM 4.7 provides:

  • Coding focus - Optimized for programming tasks
  • Multilingual - Strong in Chinese + English
  • Competitive pricing - Good value for quality
  • Fast inference - Quick response times

When to Use GLM

Ideal For

  • ✅ Multilingual projects
  • ✅ Chinese documentation/comments
  • ✅ Code generation tasks
  • ✅ Cost-effective coding
  • ✅ Fast iterations

Less Ideal For

  • ⚠️ English-only projects (Claude/Gemini better)
  • ⚠️ Very complex reasoning (use Codex)
  • ⚠️ Security-critical code (use Claude)

Setup

API Key

  1. Go to open.bigmodel.cn
  2. Create an account
  3. Generate API key
export GLM_API_KEY="your-glm-api-key"

Configuration

{
"agents": {
"glm": {
"enabled": true,
"model": "glm-4.7",
"autonomy": "workspace-write"
}
}
}

Model Options

ModelFocusSpeedCost
glm-4.7CodingFast$$
glm-4GeneralMedium$$
glm-4-plusAdvancedSlower$$$

Usage

From UI

  1. Open task
  2. Click "Run Agent"
  3. Select "GLM 4.7"
  4. Start

From CLI

friday-dev run --task 123 --agent glm

Multilingual Capabilities

Chinese + English

GLM handles both seamlessly:

## 任务 (Task)
实现用户登录功能

## 要求 (Requirements)
- 支持邮箱密码登录
- 添加验证码验证
- 使用 JWT token
- 包含中文错误提示

## 参考文件 (Reference Files)
- src/auth/login.ts
- src/utils/i18n.ts

Example Output

/**
* 用户登录服务
* User login service
*/
export class LoginService {
async login(email: string, password: string): Promise<LoginResult> {
// 验证邮箱格式 - Validate email format
if (!this.isValidEmail(email)) {
throw new AuthError('邮箱格式不正确', 'INVALID_EMAIL');
}

// 查找用户 - Find user
const user = await this.userRepo.findByEmail(email);
if (!user) {
throw new AuthError('用户不存在', 'USER_NOT_FOUND');
}

// 验证密码 - Verify password
const isValid = await this.verifyPassword(password, user.passwordHash);
if (!isValid) {
throw new AuthError('密码错误', 'INVALID_PASSWORD');
}

// 生成 token - Generate token
const token = this.generateJWT(user);

return {
user: this.sanitizeUser(user),
token,
message: '登录成功', // Login successful
};
}
}

Best Practices

Task Descriptions

GLM works well with structured tasks:

## 功能描述
添加文件上传功能

## 技术要求
- 使用 multer 处理上传
- 支持图片和 PDF
- 最大 10MB
- 存储到 S3

## 代码规范
- 使用 TypeScript
- 添加类型定义
- 包含错误处理

Code Comments

Request bilingual comments:

请在代码中添加中英文双语注释
(Please add bilingual Chinese/English comments)

Coding Strengths

Algorithm Implementation

GLM excels at algorithms:

## Task
实现快速排序算法,要求:
- 原地排序
- 时间复杂度 O(n log n)
- 添加详细注释

API Development

## Task
创建 RESTful API:
- GET /users - 获取用户列表
- POST /users - 创建用户
- PUT /users/:id - 更新用户
- DELETE /users/:id - 删除用户

使用 Express + TypeScript

Comparison

FeatureGLM 4.7ClaudeGemini
Coding⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Chinese⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Speed⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Cost$$$$$Free/$

Pricing

GLM offers competitive pricing:

  • Per-token pricing
  • Volume discounts available
  • Check open.bigmodel.cn for details

Troubleshooting

API Connection

Error: Connection to GLM API failed

Solutions:

  1. Check API key validity
  2. Verify network access to China servers
  3. Try using a VPN if blocked
  4. Check account status

Language Issues

If responses are in unexpected language:

  1. Specify language in task
  2. Set locale in configuration
  3. Add language preference explicitly

Quality Issues

If output quality is low:

  1. Add more context
  2. Use structured prompts
  3. Try GLM-4-Plus for complex tasks

Integration with Droid

GLM 4.7 integrates via the Droid executor:

{
"GLM_4_7": {
"DROID": {
"autonomy": "workspace-write",
"model": "glm-4.7"
}
}
}

This allows using GLM with Friday Dev's tool ecosystem.

Next Steps