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

  1. Login: Go to https://claude.matsci.dev and log in using the email and password provided by the computer officer.
  2. 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.
  3. Copy your key: Save the key securely β€” you’ll need it for configuration.
  4. Get setup instructions: On the same page, go to Actions β†’ Use Key for configuration details.
  5. 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

ModelContextSpeedNotes
glm-5.21MStandardβœ… Recommended β€” latest GLM, unlimited usage (coding plan)
glm-5.1200KStandardPrevious GLM generation, unlimited usage
glm-4.7200KStandardOlder generation, unlimited usage
glm-4.7-flash200KFastLightweight, fast
deepseek-v4-proβ€”ModerateBest 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 set CLAUDE_CODE_AUTO_COMPACT_WINDOW to 1000000.

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 -f

Then 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/.zshrc files to version control
  • If you suspect your key is compromised, contact the computer officer immediately