
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
AI-powered code generation with streaming output. Generate code directly from your terminal with real-time feedback.
GLM CLI is installed globally, but Claude prompts can be installed globally or locally:
┌─────────────────────────────────────────────────────────┐
│ NPM Global Install (once) │
│ npm install -g glm-coding │
│ → glm command available system-wide │
└─────────────────────────────────────────────────────────┘
↓
┌────────────────┴────────────────┐
↓ ↓
┌──────────────────┐ ┌─────────────────────┐
│ Global Setup │ │ Local Setup │
│ glm init -g │ │ glm init │
│ │ │ │
│ ~/.glm/ │ │ {project}/.glm/ │
│ ~/.claude/ │ │ {project}/.claude/ │
└──────────────────┘ └─────────────────────┘
npm install -g glm-coding
This installs the glm command system-wide.
glm init -g
This creates:
~/.glm/config.json - Your API key and settings~/.glm/instructions/ - Code quality guidelines~/.glm/profiles/ - Specialized agent profiles~/.glm/logs/ - Usage statistics~/.claude/CLAUDE.md - Instructions for Claude CodeUse when: You want one configuration for all projects.
cd your-project
glm init
This creates:
{project}/.glm/config.json - Project-specific API key/settings{project}/.glm/instructions/ - Project-specific quality guidelines{project}/.glm/profiles/ - Project-specific profiles{project}/.claude/CLAUDE.md - Project-specific Claude instructionsUse when: Different projects need different API keys, profiles, or quality standards.
# Set up global defaults
glm init -g
# Override in specific projects
cd special-project
glm init
Local settings override global ones. Logs always go to ~/.glm/logs/.
# Basic usage
glm -q "Create a function to validate emails"
# With profile
glm -q "React user profile component" -p frontend-design
# Save to file
glm -q "REST API client for GitHub" -o client.py -p api-integration
# Pipe input
echo "Parse JSON with error handling" | glm -o parser.py
| Profile | Use Case | Example |
|---|---|---|
default | General coding | glm -q "utility function" |
frontend-design | UI/UX, React, components | glm -q "navbar component" -p frontend-design |
api-integration | REST, GraphQL, OAuth | glm -q "API client" -p api-integration |
database-ops | SQL, queries, migrations | glm -q "user schema" -p database-ops |
web-crawler | Web scraping, parsing | glm -q "scrape prices" -p web-crawler |
-q, --query <prompt> Query prompt (required if no pipe)
-o, --output <file> Save output to file
-p, --profile <name> Use specific profile
--no-quality Disable quality instructions
glm init Initialize local configuration
glm init -g Initialize global configuration
glm stats Show usage statistics (daily)
glm stats --monthly Show monthly statistics
glm version Show version
glm help Show help
Global: ~/.glm/config.json
Local: {project}/.glm/config.json
{
"apiKey": "your-glm-api-key",
"apiModel": "glm-4.6",
"apiBaseUrl": "https://api.z.ai/api/coding/paas/v4/chat/completions",
"apiPlan": "max",
"maxRetries": 5,
"timeout": 120000,
"debug": false,
"useQuality": true,
"verboseLog": true,
"enableLogging": true
}
If config.json doesn't have a value, GLM checks environment variables:
export GLM_API_KEY="your-api-key"
export GLM_API_MODEL="glm-4.6"
export GLM_DEBUG="true"
{project}/.glm/config.json~/.glm/config.jsonGLM_API_KEY, etc.GLM CLI supports three API plan tiers:
| Plan | Prompts/5h | Concurrent | Use Case |
|---|---|---|---|
| Lite | ~120 | 5 | Light/hobby use |
| Pro | ~600 | 5 | Regular development |
| Max | ~2400 | 5 | Heavy/team use (default) |
Note: Each prompt ≈ 15-20 model calls internally.
Edit ~/.glm/config.json:
{
"apiPlan": "pro"
}
Or set environment variable:
export GLM_API_PLAN="pro"
View 5-hour usage window:
glm stats
Output:
5-Hour Usage Window
────────────────────────────────────────────────────────────────────────────────
Plan: PRO
Limit: 600 prompts per 5 hours
Used: 145 prompts (24.2%)
[█████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 24.2%
When you run glm init (global or local), it automatically:
The CLAUDE.md section includes:
This helps Claude understand when to suggest using GLM for appropriate tasks.
Track API usage with detailed statistics:
# View 5-hour usage + daily stats
glm stats
# View monthly stats
glm stats --monthly
Statistics include:
Log locations:
~/.glm/usage.jsonl~/.glm/logs/chat-*.jsonl{user-home}/
├── .glm/ # Global config (if using glm init -g)
│ ├── config.json
│ ├── usage.jsonl # Token usage statistics (centralized)
│ ├── logs/
│ │ ├── chat-2025-12-01T10-30-45-123Z.jsonl
│ │ ├── chat-2025-12-01T11-15-22-456Z.jsonl
│ │ └── ... # Per-run chat logs (detailed)
│ ├── instructions/
│ │ └── quality.txt
│ └── profiles/
│ ├── default/
│ ├── frontend-design/
│ ├── api-integration/
│ ├── database-ops/
│ └── web-crawler/
└── .claude/
└── CLAUDE.md # GLM section added here
{project}/
├── .glm/ # Local config (if using glm init)
│ ├── config.json
│ ├── instructions/
│ └── profiles/
└── .claude/
└── CLAUDE.md
git clone https://github.com/your-org/glm-coding.git
cd glm-coding
npm install
npm run build # Build CLI
npm run dev # Watch mode
npm run typecheck # Type check without build
npm run clean # Clean build output
# Link package globally
npm link
# Test in a directory
cd /tmp/test
glm init
glm -q "hello world function"
# Unlink when done
npm unlink -g glm-coding
glm-coding/
├── src/
│ └── cli/ # CLI source code
│ ├── cli.ts # Entry point & router
│ ├── commands/ # Command implementations
│ │ ├── generate.ts # Code generation
│ │ ├── init.ts # Installation
│ │ ├── stats.ts # Statistics
│ │ ├── help.ts # Help
│ │ └── version.ts # Version
│ └── core/ # Core modules
│ ├── glmClient.ts # API client
│ ├── config.ts # Config loader
│ ├── instructions.ts # Quality loader
│ ├── profiles.ts # Profile loader
│ ├── usageLogger.ts # Usage logging
│ └── ...
├── templates/ # Installed to ~/.glm/ or {project}/.glm/
│ ├── instructions/
│ │ └── quality.txt
│ └── profiles/
│ ├── default/
│ ├── frontend-design/
│ ├── api-integration/
│ ├── database-ops/
│ └── web-crawler/
├── dist/ # Build output (gitignored)
├── package.json
├── tsconfig.json
└── tsconfig.cli.json
src/cli/ filesnpm run buildnpm linknpm version patch # or minor, major
npm publish
If you're migrating from the old MCP server version:
# Old MCP installation will be detected
glm init -g
# Remove old MCP server manually
rm -rf ~/.claude/mcp-servers/glm-coding
# Remove "glm-coding" from ~/.claude/mcp.json
glm -q "Python function to calculate fibonacci"
glm -q "React card component with image, title, description" \
-p frontend-design \
-o components/Card.tsx
glm -q "REST client for GitHub API with auth, pagination, error handling" \
-p api-integration \
-o github_client.py
glm -q "PostgreSQL schema for e-commerce with users, products, orders" \
-p database-ops \
-o schema.sql
MIT
For issues and questions, visit GitHub Issues.
FAQs
GLM CLI - AI Code Generator with streaming output
The npm package glm-coding receives a total of 11 weekly downloads. As such, glm-coding popularity was classified as not popular.
We found that glm-coding demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.