A browser displaying VS Code in GitHub Codespaces, showcasing a terminal with Claude Code and GLM-4.6 generating Python code in a sleek, dark-themed interface with cloud motifs.

Complete Guide: Setting Up Claude Code with GLM-4.6 on GitHub Codespaces

October 24, 20259 min read

Resources:

  1. >> Download the blog post as a markdown-file this keeps codeblocks intact and is much easier to read in something like vscode. just rename the .txt to .md and you are good to go

  2. >> Your z.ai Invitation ( yes ofc its my affiliate link )

  3. >> Blog post about: Same setup - but on a local server or vps

    ===========================================

INTRODUCTION

In the fast-paced world of software development, integrating AI-assisted coding tools can significantly boost productivity. This comprehensive guide details how to configure Anthropic's Claude Code—a powerful command-line interface (CLI) coding assistant—with Zhipu AI's GLM-4.6 model within GitHub Codespaces.

GLM-4.6, released in September 2025, offers a 200K token context window, 30% token efficiency over its predecessors, and performance rivaling Claude Sonnet 4 in coding tasks. Paired with GitHub Codespaces, a cloud-hosted Visual Studio Code (VS Code) environment, this setup enables seamless, device-agnostic development with zero local setup.

This beginner-friendly guide, achievable in 10-15 minutes, leverages GitHub's free tier (120 core-hours/month) and GLM-4.6's cost-effective API ($0.001-$0.003 per 1K tokens). Our team has validated all steps against the latest Anthropic, Zhipu AI, and GitHub documentation as of October 2025, ensuring accuracy and relevance.

===========================================

WHAT YOU'LL GAIN FROM THIS SETUP

✓ Cloud-Based VS Code Environment: Full-featured editor in your browser with auto-cloned repositories and persistent storage.

✓ Pre-Configured Claude Code: CLI assistant for code generation, debugging, and Git integration, powered by GLM-4.6.

✓ Cost-Effective AI: GLM-4.6 reduces costs by up to 70% compared to Anthropic's API while matching performance.

✓ Device Flexibility: Code from any browser-enabled device.

✓ No Local Dependencies: Fully cloud-based, with automatic setup for new Codespaces.

✓ Free Tier Viability: 120 core-hours (60 hours on 2-core machines) monthly, ideal for personal projects.

===========================================

PREREQUISITES

GitHub Account

• Free tier suffices

• Sign up at github.com

Zhipu AI (Z.AI) API Key

• Register at z.ai

• Navigate to Dashboard → API Keys

• Create a key (starts with sk_...)

• Opt for the $3/month GLM Coding Plan for higher limits

Internet Connection

• Required for cloud-based Codespaces and API calls

Note: No container or CLI experience needed.

===========================================

UNDERSTANDING GITHUB CODESPACES

GitHub Codespaces provides isolated Ubuntu Linux containers with VS Code, pre-installed tools (Node.js, Git), and your repo cloned automatically.

KEY FEATURES

• Scalable Compute: 2-core (free) to 32-core machines

• Persistence: Work saves across sessions; auto-timeout conserves quotas

• Collaboration: Share via links for pair programming

FREE TIER DETAILS (OCTOBER 2025)

Core-Hours: 120/month

• 60 hours on 2-core machines

• Scales inversely (e.g., 30 hours on 4-core)

Storage: 15 GB/month

• Excess at $0.07/GB

Idle Timeout: 30 minutes default

• Adjustable to 10 minutes

Example: 2 hours daily on 2-core = 4 core-hours/day. Over 20 days, 80 core-hours fits within limits.

===========================================

STEP-BY-STEP SETUP

STEP 1: CREATE OR SELECT A REPOSITORY

Codespaces require a GitHub repo.

Option A: New Repo

1. Visit github.com/new

2. Name your repo (e.g., claude-glm-codespace)

3. Initialize with a README.md (public/private)

Option B: Existing Repo

• Use any current project

---

STEP 2: SECURELY STORE YOUR Z.AI API KEY

Never hardcode keys. Use GitHub Secrets:

1. Go to github.com/settings/codespaces

2. Under "Codespaces secrets," click "New secret"

3. Set:

• Name: ZAI_API_KEY

• Value: Your sk_... key

• Repository access: "All repositories" or specific ones

4. Click "Add secret"

---

STEP 3: CONFIGURE THE DEV CONTAINER

The .devcontainer folder automates setup.

DIRECTORY STRUCTURE

your-repo/

└── .devcontainer/

├── devcontainer.json

└── setup-claude.sh

---

CREATE devcontainer.json

Create a file at: .devcontainer/devcontainer.json

Copy this configuration:

{

"name": "Claude Code with GLM-4.6",

"image": "mcr.microsoft.com/devcontainers/javascript-node:20",

"features": {

"ghcr.io/devcontainers/features/common-utils:2": {

"installZsh": true,

"installOhMyZsh": true,

"upgradePackages": true

}

},

"postCreateCommand": "bash .devcontainer/setup-claude.sh",

"containerEnv": {

"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",

"ANTHROPIC_AUTH_TOKEN": "${localEnv:ZAI_API_KEY}",

"API_TIMEOUT_MS": "3000000",

"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6",

"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",

"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",

"ENABLE_THINKING": "true",

"ENABLE_STREAMING": "true",

"ANTHROPIC_SAFE_MODE": "false"

},

"customizations": {

"vscode": {

"extensions": [

"anthropic.claude-code"

],

"settings": {

"terminal.integrated.defaultProfile.linux": "bash",

"editor.formatOnSave": true

}

}

},

"remoteUser": "node"

}

---

CREATE setup-claude.sh

Create a file at: .devcontainer/setup-claude.sh

Copy this script:

#!/bin/bash

echo "🚀 Setting up Claude Code with GLM-4.6..."

# Install Claude Code globally

npm install -g @anthropic-ai/claude-code

# Create Claude settings directory

mkdir -p ~/.claude

# Create settings.json with environment variables

cat > ~/.claude/settings.json <<EOF

{

"env": {

"ANTHROPIC_BASE_URL": "${ANTHROPIC_BASE_URL}",

"ANTHROPIC_AUTH_TOKEN": "${ANTHROPIC_AUTH_TOKEN}",

"API_TIMEOUT_MS": "${API_TIMEOUT_MS}",

"ANTHROPIC_DEFAULT_OPUS_MODEL": "${ANTHROPIC_DEFAULT_OPUS_MODEL}",

"ANTHROPIC_DEFAULT_SONNET_MODEL": "${ANTHROPIC_DEFAULT_SONNET_MODEL}",

"ANTHROPIC_DEFAULT_HAIKU_MODEL": "${ANTHROPIC_DEFAULT_HAIKU_MODEL}",

"ENABLE_THINKING": "${ENABLE_THINKING}",

"ENABLE_STREAMING": "${ENABLE_STREAMING}",

"ANTHROPIC_SAFE_MODE": "${ANTHROPIC_SAFE_MODE}"

}

}

EOF

echo "✅ Claude Code setup complete!"

echo "📝 Run 'claude --version' to verify installation"

IMPORTANT NOTES:

• Node.js 20 base image supports npm for Claude Code

• Environment variables route to Z.AI's Anthropic-compatible endpoint

• ENABLE_THINKING shows GLM-4.6's reasoning

• ENABLE_STREAMING enables real-time output

---

STEP 4: COMMIT AND PUSH

Run these commands:

git add .devcontainer/

git commit -m "Add Claude Code dev container with GLM-4.6"

git push

Or use GitHub's web editor.

---

STEP 5: LAUNCH YOUR CODESPACE

Method 1: From Repo

1. Click "Code" button

2. Select "Codespaces" tab

3. Click "Create codespace on main"

Method 2: From Dashboard

1. Visit github.com/codespaces

2. Click "New codespace"

3. Select repo/branch

4. Choose 2-core machine

5. Click "Create"

Setup takes 1-3 minutes: container spins up, repo clones, script runs, VS Code opens.

---

STEP 6: VERIFY SETUP

In VS Code terminal (Ctrl + `):

1. Check Node.js:

node --version

Expected output: v20.x.x

2. Check Claude Code:

claude --version

Expected output: 2.0.x+

3. Verify Settings:

cat ~/.claude/settings.json

Confirm GLM-4.6 configuration is present

4. Test Claude:

claude

/status

/ask What model are you using?

/code Write a Python function that prints "Hello from GLM-4.6 in Codespaces!"

/exit

Success confirms GLM-4.6 integration.

===========================================

USING CLAUDE CODE IN YOUR WORKFLOW

Run claude anytime. GLM-4.6's 200K context excels in large repos.

KEY COMMANDS

/help - List all commands

Example: claude /help

/status - Check configuration

Example: claude /status

/ask <query> - General Q&A

Example: claude /ask Explain async/await

/code <task> - Generate code

Example: claude /code REST API in Express

/fix - Debug file

Example: claude /fix

/test - Generate tests

Example: claude /test

/review - Code review

Example: claude /review

/explain - Simplify code

Example: claude /explain file.py

/exit - Quit Claude

Example: claude /exit

---

EXAMPLE WORKFLOW

claude

/code Create a React TODO app with local storage

/review

/test

/exit

git add .

git commit -m "Add TODO app via GLM-4.6"

git push

GLM-4.6 uses 15% fewer tokens than GLM-4.5, excelling in 74/100 Claude Code scenarios.

===========================================

CONFIGURATION DEEP DIVE

DEVCONTAINER.JSON PROPERTIES

• name: Codespace label

• image: Node.js 20 base

• features: Adds zsh, Oh My Zsh, updates

• postCreateCommand: Runs setup-claude.sh

• containerEnv: Sets GLM-4.6 vars

• customizations.vscode: Installs Claude extension

• remoteUser: Non-root node user

---

ENVIRONMENT VARIABLES

ANTHROPIC_BASE_URL

• Value: https://api.z.ai/api/anthropic

• Role: Routes to Z.AI

ANTHROPIC_AUTH_TOKEN

• Value: ${localEnv:ZAI_API_KEY}

• Role: Secure key

API_TIMEOUT_MS

• Value: 3000000

• Role: 50-min timeout

ANTHROPIC_DEFAULT_OPUS_MODEL

• Value: glm-4.6

• Role: Complex tasks

ANTHROPIC_DEFAULT_SONNET_MODEL

• Value: glm-4.6

• Role: Balanced tasks

ANTHROPIC_DEFAULT_HAIKU_MODEL

• Value: glm-4.5-air

• Role: Lightweight tasks

ENABLE_THINKING

• Value: true

• Role: Shows reasoning

ENABLE_STREAMING

• Value: true

• Role: Real-time output

ANTHROPIC_SAFE_MODE

• Value: false

• Role: Bypasses filters

===========================================

MANAGING CODESPACES

DASHBOARD

Visit github.com/codespaces to:

• View active/stopped spaces

• Monitor storage

• Check compute usage

COMMANDS

Start:

• Dashboard → ... → "Open in browser/VS Code"

Stop:

• Inside Codespace: "Codespaces" → Stop

• Or dashboard → ... → Stop

Delete:

• Dashboard → ... → Delete

• Push changes first!

OPTIMIZATION TIPS

• Set 10-min timeout: github.com/settings/codespaces

• Monitor: github.com/settings/billing

• Multi-project: Run one space at a time (e.g., 2 hours/project = 10 core-hours/day)

===========================================

ADVANCED CONFIGURATIONS

PROJECT-SPECIFIC SETUP

For Python projects, modify devcontainer.json:

{

"name": "Python Project",

"image": "mcr.microsoft.com/devcontainers/python:3.12",

"postCreateCommand": "bash .devcontainer/setup-claude.sh && pip install -r requirements.txt",

"containerEnv": {

"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6"

}

}

---

MULTIPLE PROFILES

Create multiple configurations:

.devcontainer/

├── devcontainer.json # Node.js

├── python/

│ └── devcontainer.json

└── nodejs/

└── devcontainer.json

Choose profile on creation.

===========================================

TROUBLESHOOTING

ISSUE: Codespace Won't Start

Cause: Storage limit

Solution:

• Delete old spaces

• Check githubstatus.com

ISSUE: Claude Not Found

Cause: Install failure

Solution:

• npm install -g @anthropic-ai/claude-code

• claude --version

ISSUE: Auth Error

Cause: Invalid key

Solution:

• Regenerate at z.ai

• Rebuild: Ctrl+Shift+P → "Codespaces: Rebuild Container"

ISSUE: Settings Ignored

Cause: Cache

Solution:

• Rebuild container

ISSUE: Quota Exceeded

Cause: Overuse

Solution:

• Monitor billing

• Use 2-core

• Stop idle spaces

===========================================

BEST PRACTICES

✓ Stop Spaces: Use UI, not just browser close

✓ Commit Often: git push to save work

✓ Monitor Quotas: Check billing monthly

✓ Pre-Builds (Pro): Enable for faster startups

✓ VS Code Sync: Extensions/settings sync automatically

===========================================

CODESPACES VS. LOCAL DEVELOPMENT

SETUP

• Codespaces: Instant

• Local: 15-60 min

HARDWARE

• Codespaces: 2-32 cores

• Local: Your device

COST

• Codespaces: Free (120 core-hours)

• Local: Free (electricity)

ACCESS

• Codespaces: Browser-anywhere

• Local: Device-specific

STORAGE

• Codespaces: 15 GB

• Local: Unlimited

UPDATES

• Codespaces: Auto

• Local: Manual

COLLABORATION

• Codespaces: Link-sharing

• Local: Screen-sharing

OFFLINE

• Codespaces: Internet required

• Local: Supported

===========================================

PRICING (OCTOBER 2025)

GLM-4.6 COSTS

Input: $0.001/1K tokens

Output: $0.003/1K tokens

Example: 100 daily requests (500 in + 1K out) = ~$0.35/day ($10/month)

Coding Plan: $3/month for light use

---

CODESPACES COSTS

Free Tier:

• 120 core-hours

• 15 GB storage

Paid Tier:

• $0.18/hour (2-core)

• $0.07/GB storage

===========================================

NEXT STEPS

→ Explore: claude /help

→ Try: /code Build a Next.js CRUD app

→ Customize: Add extensions to devcontainer.json

→ Share: Repo ensures teammates get identical setups

===========================================

RESOURCES

DOCUMENTATION

• GitHub Codespaces: docs.github.com/en/codespaces

• Dev Containers: containers.dev

• Claude Code: docs.claude.com/en/docs/claude-code

• GLM-4.6: Check Z.AI documentation

Z.AI RESOURCES

• API Docs: z.ai/docs

• Claude Integration: z.ai/claude

• Pricing: z.ai/pricing

COMMUNITY

• GitHub Discussions

• Claude Developers Discord

• r/ClaudeAI

• r/github

===========================================

FAQS

Q: Multi-Account Support?

A: Yes, each account has separate quotas.

Q: Private Repos?

A: Supported on free tier.

Q: Offline Use?

A: No, requires internet.

Q: Exceeding Free Tier?

A: Pauses; add payment for $0.18/hour.

Q: Desktop VS Code?

A: Yes, via "GitHub Codespaces" extension.

Q: Update Claude?

A: npm update -g @anthropic-ai/claude-code

Q: Security?

A: Encrypted data; secure keys; isolated containers.

===========================================

CONCLUSION

This setup delivers a robust, AI-driven cloud IDE with Claude Code and GLM-4.6—accessible, affordable, and scalable. Start with the free tier and elevate your coding workflow.

Happy coding! 🚀

Built with the POWERS process for clarity and accuracy. Contact for customizations.

About Regard: Building Freedom Through Shared Knowledge

Regard launched Real & Works after grinding through the chaos of content marketing, wearing every hat in the book—writer, WordPress coder, systems architect, graphic designer, video editor, and analytics guru. The hustle was relentless, but the burnout was inevitable. Running a one-person show while competing with studios flush with staff wasn’t just tough—it was draining every ounce of time and resources he had.

Armed with a deep background in programming and systems design, Regard decided to break the cycle. He built automated content pipelines, starting with a streamlined YouTube shorts video workflow that hums along via self-hosted setups, powered by service APIs for inference, composition, and posting. It’s lean, it’s mean, and it’s entirely under his control—no subscriptions, no middlemen, just pure, efficient creation on his own terms.

Now, Regard’s mission isn’t about landing clients—it’s about spreading knowledge to set creators free. He builds in public, sharing every step, stumble, and success, from the code to the crashes. His goal? To show that anyone with enough grit and guidance can build their own automated systems, right on their own servers, using APIs to make it happen. Follow his journey, grab the lessons from his wins and losses, and take charge of your own creative freedom.

Regard Vermeulen

About Regard: Building Freedom Through Shared Knowledge Regard launched Real & Works after grinding through the chaos of content marketing, wearing every hat in the book—writer, WordPress coder, systems architect, graphic designer, video editor, and analytics guru. The hustle was relentless, but the burnout was inevitable. Running a one-person show while competing with studios flush with staff wasn’t just tough—it was draining every ounce of time and resources he had. Armed with a deep background in programming and systems design, Regard decided to break the cycle. He built automated content pipelines, starting with a streamlined YouTube shorts video workflow that hums along via self-hosted setups, powered by service APIs for inference, composition, and posting. It’s lean, it’s mean, and it’s entirely under his control—no subscriptions, no middlemen, just pure, efficient creation on his own terms. Now, Regard’s mission isn’t about landing clients—it’s about spreading knowledge to set creators free. He builds in public, sharing every step, stumble, and success, from the code to the crashes. His goal? To show that anyone with enough grit and guidance can build their own automated systems, right on their own servers, using APIs to make it happen. Follow his journey, grab the lessons from his wins and losses, and take charge of your own creative freedom.

LinkedIn logo icon
Back to Blog