Claude Code is Anthropic’s official command-line interface for Claude, providing direct AI assistance from your terminal for software development, code analysis, and programming tasks.

LLM Model

We are using the GLM-5.2 model (by Z.AI) with a 1M context window — the latest generation. The API is served through our own gateway at https://claude.matsci.dev via Sub2API.

Installation

System Requirements

  • OS: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows 10+ (with WSL/Git for Windows)
  • Hardware: 4GB+ RAM
  • Software: Node.js 18+ (for NPM installation)
  • Network: Internet connection required

Standard Installation

macOS Installation

Homebrew (Recommended):

brew install --cask claude-code

curl Script:

curl -fsSL https://claude.ai/install.sh | bash

NPM Install (All Platforms)

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

Getting Your API Key

Info

We’ve migrated our AI gateway to Sub2API, which is more robust and secure. Follow these steps to get set up:

  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, and click Create.
  3. Get setup instructions: On the same page, go to Actions → Use Key for configuration details.
  4. Change your password (recommended): In the left panel, go to MY ACCOUNT → Profile, scroll to the bottom, and change your password.

Environment Variables

Add the following to your ~/.bashrc or ~/.zshrc:

# Claude Code Configuration
export ANTHROPIC_BASE_URL="https://claude.matsci.dev"
export ANTHROPIC_AUTH_TOKEN="API-KEY"
 
# Model selection (optional — see table below)
export ANTHROPIC_DEFAULT_HAIKU_MODEL=MODEL_NAME
export ANTHROPIC_DEFAULT_SONNET_MODEL=MODEL_NAME
export ANTHROPIC_DEFAULT_OPUS_MODEL=MODEL_NAME

Alternatively, you can set models in ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]",
    "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. If Claude Code says the model doesn’t exist, upgrade to the latest version.

Warning

Replace API-KEY with the actual API key you created above.

Available models (you must set at least one, or you will get an error):

ModelContextSpeedNotes
glm-5.21MStandard✅ Recommended — latest GLM, unlimited usage (coding plan)
glm-4.7200KStandardPrevious generation, unlimited usage
glm-4.5-air128KFastLighter GLM model
glm-5.1200KStandardPrevious GLM generation
glm-5-turbo200KFastFaster GLM variant
deepseek-v4-flash—Very fast (~5×)Quick tasks, speed matters most — cheap
deepseek-v4-pro—ModerateHeavy tasks — best quality + speed — cheap

Choosing a model

  • GLM-5.2 is the latest model with a 1M context window — use it for large codebases and long documents. To enable 1M context in Claude Code, use the [1m] suffix: glm-5.2[1m].
  • 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.
  • You can set different models for Haiku/Sonnet/Opus slots and switch between them in Claude Code.

SSH Reverse Proxy Tunnel for HPC Servers

Some machines (e.g., Fornax, Orion) cannot directly reach https://claude.matsci.dev due to network restrictions (firewall, no external access, etc.). In that case, you need to set up an SSH reverse proxy tunnel through a machine that has access.

Setup

From the HPC server, create a tunnel to a bastion machine that can reach claude.matsci.dev:

# Run this on the HPC server (e.g., Fornax, Orion)
# This forwards local port 13000 → bastion → claude.matsci.dev:443
ssh -R 13000:claude.matsci.dev:443 <user>@<bastion-host> -N -f

Then set the environment variable to use localhost:

# Claude Code Configuration for HPC Servers (via tunnel)
export ANTHROPIC_BASE_URL="http://localhost:13000"
export ANTHROPIC_AUTH_TOKEN="API-KEY"

Making the Tunnel Persistent

To keep the tunnel alive across disconnects, add to your ~/.bashrc or use autossh:

# Using autossh (install it first if needed)
autossh -M 0 -f -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" \
  -R 13000:claude.matsci.dev:443 <user>@<bastion-host>

Tip

Contact the computer officer for the bastion host details and your SSH key setup.

Apply Changes

After adding the environment variables, restart your terminal or run:

# For bash
source ~/.bashrc
 
# For zsh
source ~/.zshrc

Verification

Verify your installation:

claude --version

Updates

  • Auto updates are enabled by default
  • Manual update: claude update

Basic Usage

# Start in your project directory
cd /path/to/your/project
claude

Best Practices

Project Setup

  • Create CLAUDE.md files for project context and instructions
  • Be specific in your requests and provide relevant context
  • Use /clear to manage conversation context when needed

Effective Workflows

  • Explore, plan, code, commit: Research first, then plan before implementing
  • Use screenshots for visual feedback and UI development
  • Iterative development: Start simple and refine gradually

Advanced Features

  • Git integration: Automatic commit messages and PR assistance
  • Multi-file operations: Work across your entire codebase
  • Custom commands: Create slash commands in .claude/commands/

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
  • Always review AI-generated code before committing

References

Next Steps

Ready for Advanced Features?

Once you’re comfortable with basic Claude Code usage, extend its capabilities with MCP (Model Context Protocol) tools:

  • Claude Code with MCP Tools - Add email, calendar, and document processing capabilities
  • Complete research automation workflows can be documented here later if the group develops a stable process.

Common Research Applications

  • Code debugging and optimization for Python scripts
  • Job script generation for HPC clusters
  • Container setup for Docker reproducible research
  • Automated testing and code review workflows
  • Git and Github - Version control integration
  • Conda - Python environment management
  • Docker - Container-based development
  • HPC - HPC job optimization