We use our own Sub2API gateway at https://claude.matsci.dev to serve GLM models to the group. This gives us:
- Unlimited usage for GLM coding plan (glm-5.2, glm-5.1, glm-4.7)
- 1M token context window for GLM-5.2
- Secure, centralized key management
- Works for Claude Code, ZCode, and any other GLM-based tool
Getting Your API Key
- Login: Go to https://claude.matsci.dev and log in using the email and password provided by the computer officer.
- Create an API Key: In the left panel, go to MY ACCOUNT β API Keys, click Create API Key, fill in a name (e.g., βMy-Dev-Machineβ), and click Create.
- Copy your key: Save the key securely β youβll need it for configuration.
- Get setup instructions: On the same page, go to Actions β Use Key for configuration details.
- Change your password (recommended): In the left panel, go to MY ACCOUNT β Profile, scroll to the bottom, and change your password.
One Key for All Tools
The same Sub2API key works for Claude Code, ZCode, and any other tool that uses our GLM gateway.
API Configuration
All GLM-based tools use the same base URL and model format:
Base URL: https://claude.matsci.dev
API Key: YOUR-API-KEY-HERE
Available Models
| Model | Context | Speed | Notes |
|---|---|---|---|
glm-5.2 | 1M | Standard | β Recommended β latest GLM, unlimited usage (coding plan) |
glm-5.1 | 200K | Standard | Previous GLM generation, unlimited usage |
glm-4.7 | 200K | Standard | Older generation, unlimited usage |
glm-4.7-flash | 200K | Fast | Lightweight, fast |
deepseek-v4-pro | β | Moderate | Best quality + speed, very cheap |
deepseek-v4-flash | β | Very fast (~5Γ) | Quick tasks, speed matters most β cheap |
Choosing a model
- GLM-5.2 is the latest with a 1M context window β use it for large codebases and long documents.
- GLM coding plan has unlimited usage β great for everyday work.
- DeepSeek models are much faster (~5Γ) than GLM. Weβve purchased DeepSeek API tokens separately β they are very cheap to use.
- For heavy tasks that need both speed and quality (e.g., table-heavy work), use
deepseek-v4-pro.- For quick, lightweight tasks where speed matters most, use
deepseek-v4-flash.
Tool-Specific Configuration
Claude Code
See Claude Code for full setup instructions. Environment variables:
export ANTHROPIC_BASE_URL="https://claude.matsci.dev"
export ANTHROPIC_AUTH_TOKEN="API-KEY"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2[1m]"Enabling 1M Context
The
[1m]suffix activates GLM-5.2βs 1M token context window. You also need to setCLAUDE_CODE_AUTO_COMPACT_WINDOWto1000000.
ZCode
See ZCode for GLM for full setup instructions. In ZCode settings:
Base URL: https://claude.matsci.dev
API Key: YOUR-API-KEY-HERE
Model: glm-5.2
Network Issues on HPC Servers
Some machines (e.g., Fornax, Orion) cannot directly reach https://claude.matsci.dev due to network restrictions. In that case, you need an SSH reverse proxy tunnel.
Setting Up a Tunnel
From the HPC server, create a tunnel to a bastion machine that can reach claude.matsci.dev:
# Run this on the HPC server
# This forwards local port 13000 β bastion β claude.matsci.dev:443
ssh -R 13000:claude.matsci.dev:443 <user>@<bastion-host> -N -fThen update your API configuration to use localhost:
export ANTHROPIC_BASE_URL="http://localhost:13000"Persistent Tunnel
To keep the tunnel alive across disconnects, use autossh:
autossh -M 0 -f -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" \
-R 13000:claude.matsci.dev:443 <user>@<bastion-host>Info
See Reverse proxy on Fornax for more tunneling options and making it permanent.
Tip
Contact the computer officer for the bastion host details and your SSH key setup.
Security
- API credentials are provided by the computer officer for group members
- Store environment variables securely and never share them
- Do not commit credentials or
.bashrc/.zshrcfiles to version control - If you suspect your key is compromised, contact the computer officer immediately
Related Pages
- Claude Code β AI assistant for coding (uses GLM via Sub2API)
- ZCode for GLM β Agentic Development Environment (uses GLM via Sub2API)
- Reverse proxy on Fornax β SSH tunneling for restricted networks