Claude Code Guide

Overview

Claude Code is a command-line AI programming assistant launched by Anthropic that runs directly in your terminal. By configuring shallowseek's API endpoint, you can use Claude Code to access the platform's rich model resources.

Install Claude Code

Method 1: npm Global Install (Recommended)

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

Method 2: One-Click Install Script

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

# Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex

Verify Installation

claude --version

If a version number is displayed, the installation was successful.

Configure shallowseek API

After installation, connect Claude Code to the shallowseek platform by setting environment variables for the custom API endpoint:

Linux / macOS

# Add to ~/.bashrc or ~/.zshrc
export ANTHROPIC_BASE_URL="https://api.shallowseek.top/"
export ANTHROPIC_API_KEY="sk-your-api-key-here"

Windows (PowerShell)

# Add to PowerShell profile
$env:ANTHROPIC_BASE_URL="https://api.shallowseek.top/"
$env:ANTHROPIC_API_KEY="sk-your-api-key-here"
Environment Variable Reference
  • ANTHROPIC_BASE_URL — The API address provided by shallowseek (must include the /v1 suffix)
  • ANTHROPIC_API_KEY — The API Key created in the shallowseek console (starts with sk-)

Basic Usage

Start Interactive Mode

cd /path/to/your/project
claude

Run claude in your project directory — Claude Code automatically detects the project structure and enters interactive programming assistant mode.

Single Query Mode

# Ask a question directly (without entering interactive mode)
claude -p "Explain what this function does"

# Pipe output as input
cat error.log | claude -p "Analyze this error log and suggest solutions"

Common Commands

CommandDescription
claudeStart interactive mode in the current directory
claude -p "question"Single query and output the result
claude --model model-nameSpecify which model to use
claude configView and modify configuration
claude --helpView full help information

Model Selection

Use the --model parameter to specify different models:

# Use Claude Sonnet
claude --model claude-sonnet-4-20250514

# Use Claude Opus
claude --model claude-opus-4-20250514

# Use GPT models
claude --model gpt-4o
Model Selection Tips
  • Daily development — Sonnet models, fast and cost-effective
  • Complex refactoring — Opus models, stronger reasoning capabilities
  • Large project analysis — Choose models with larger context windows (e.g., 128K window models)

Tips & Tricks

  • Start in the project root directory — Allows Claude Code to fully perceive the project structure and files
  • Use clear instructions — Clearly state what to do and which files are involved
  • Use @ references — Use @filename to reference specific files for more precise context
  • Execute step by step — Break complex tasks into smaller interactive steps, verifying results at each step
  • Commit code regularly — Claude Code modifies files directly; it's recommended to git commit before use
  • Check Token usage — Large projects may consume significant Tokens; keep an eye on credit consumption

FAQ

How do I confirm Claude Code is connected to shallowseek?

Run claude config to view the current configuration and confirm ANTHROPIC_BASE_URL points to shallowseek's API address. You can also verify the connection with a simple chat test.

What should I do if the connection fails?
  • Check if environment variables are correctly set and applied (echo $ANTHROPIC_BASE_URL)
  • Verify that the API Key is valid and not expired
  • Check if the API address is accessible in a browser
  • Ensure the network is not blocking access to the API port
Which versions of Claude Code are supported?

It is recommended to use the latest version of Claude Code. You can update to the latest version at any time with npm update -g @anthropic-ai/claude-code.