Login
Back to Blog
01|Quick Start: Connecting Claude Code to Crazyrouter

01|Quick Start: Connecting Claude Code to Crazyrouter

C
Crazyrouter Team
June 10, 2026
1 viewsEnglishClaude Code
Share:

01|Claude Code with Crazyrouter: Quick Start and Configuration#

This is Part 01 of the Crazyrouter Claude Code series. This article focuses on “Claude Code with Crazyrouter: Quick Start and Configuration,” with an emphasis on getting started with Claude Code and setting it up correctly.

Unified access pattern: use ANTHROPIC_BASE_URL=https://cn.crazyrouter.com for Claude Code / Anthropic native clients; use base_url=https://cn.crazyrouter.com/v1 for OpenAI-compatible SDKs, HTTP requests, and frontend/backend applications.

What This Article Covers#

  • Who this is for: developers who are using Claude Code, preparing to connect to domestic models, or want to standardize team calls through Crazyrouter.
  • What you’ll learn: how to configure environment variables according to the Crazyrouter documentation, organize your workflow, and avoid the /v1/v1/... issue caused by an incorrect Base URL.
  • Recommended preparation: first create a dedicated API Token in the Crazyrouter console, then follow the Claude Code integration documentation to complete the basic setup.

Claude Code Quick Start and Configuration#

Install Claude Code#

Your system must meet the following minimum requirements:

Operating system: Linux (Ubuntu 18.04+, CentOS 7+), macOS 10.15+, Windows 10+

Network connection: a stable internet connection

Storage: at least 500 MB of available disk space

Install Node.js#

Before you begin the installation, check your Node.js and npm versions:

bash
node --version
npm --version

If Node.js is not installed on your machine, we recommend installing Node.js 18 LTS or later:

Install Git#

Before you begin the installation, check your Git version:

bash
git --version

If Git is not installed on your machine, choose the installation method for your system:

Install on Linux / macOS#

text
# Install Claude Code globally
sudo npm install -g @anthropic-ai/claude-code

# Verify the installation
claude --version

Install on Windows#

text
# Open PowerShell or Command Prompt as an administrator

# Install globally
npm install -g @anthropic-ai/claude-code

# Verify the installation
claude --version

Configure the Crazyrouter API Key#

When connecting Claude Code to Crazyrouter, configure ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY first. In most cases, there is no need to include an empty proxy address in the article.

Windows PowerShell:

powershell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://cn.crazyrouter.com", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "YOUR_CRAZYROUTER_API_KEY", "User")

macOS / Linux:

bash
export ANTHROPIC_BASE_URL=https://cn.crazyrouter.com
export ANTHROPIC_API_KEY=YOUR_CRAZYROUTER_API_KEY

If you want a script to automatically check Git, Node.js, and Claude Code, you can use the Crazyrouter Claude Code one-click configuration script.

Start Claude Code from the Console#

Enter claude in the terminal. You will then need to log in to Claude and authenticate with your Crazyrouter Token.

1. Basics: Commands and Configuration Are the Starting Point#

Master the Help Command to Unlock Everything#

Want to get started quickly? Begin with claude --help. This command lists all available options and commands, such as -p for non-interactive output, -c to continue the most recent conversation, and --model to specify a model. Memorizing common options can double your efficiency—for example, use claude -r to restore a previous session, or --output-format json to export structured results.

CommandDescriptionUse Case
/clearClear contextUse this when you need to start over or feel that the AI can no longer solve the problem
/compactCompact the conversationStart a new conversation without losing previous memory
/costCostCheck the current session’s usage; recommended to cross-check with logs in the Crazyrouter console
/logout /loginLog out / log inSwitch accounts and similar operations
/modelSwitch modelSwitch available models based on Token permissions and the model whitelist
/statusStatusView the current status of CC
/doctorDiagnosticsCheck the installation status of CC

Seamlessly Connect with Your IDE and Code Without Switching Windows#

Use Claude Code in IDEs such as VS Code and Cursor in just two steps:#

  • Install the plugin: search for “Claude Code,” choose the official Anthropic version, and click Install.

  • Quick launch: use the Cmd+Escape shortcut (customizable) to wake it up, or click the Claude Code icon in the IDE UI. The workspace will appear directly on the right. It supports automatically passing selected code into context, comparing code changes with diff, and even using Alt+Cmd+K to push selected content into the prompt box with one action.

2. Core Modes: Switch by Scenario for Maximum Efficiency#

Auto-Edit Mode: Batch Operations Without Confirmation#

This is suitable for file creation and modification scenarios where you do not need to confirm each step. Press Shift+Tab once to enable it. Claude will then automatically perform edit operations without manual confirmation. For example, if you prompt it with “create a cool todolist app,” it will directly generate and modify files, saving the time spent on repeated confirmations.

Plan Mode: A Powerful Tool for Upfront Planning#

When setting up a project or handling a complex problem, press Shift+Tab twice to enable Plan Mode. It will first outline the solution structure. For example, if you want to build “a pixel-style mobile todolist,” it will automatically plan the tech stack, page structure, adaptation strategy, and more before implementation. If you are not satisfied, you can simply say “replan” until it meets your expectations.

Yolo Mode: Full Permissions, Hands Off#

When refactoring code, starting a new project, or fixing a complex bug, use claude --dangerously-skip-permissions to enter Yolo Mode. In this mode, Claude has higher permissions and can directly perform more operations. Be mindful of security and use it in a sandbox environment when possible. After entering this mode, you can still use Shift+Tab to adjust modes and flexibly switch the permission level.

text
claude --dangerously-skip-permissions

3. CLAUDE.md: The Core of Global Memory#

When talking to a chatbot, we know the “system prompt” matters because it continuously affects the AI’s behavior. In CC, CLAUDE.md plays a similar role. A typical workflow looks like this:

Create an initial CLAUDE.md → keep chatting until the context is close to overflowing, then run /compact to extend the session → when you reach a milestone, ask CC to update CLAUDE.md based on the progress → repeat until finished

As you can see, CLAUDE.md acts like a global variable that keeps taking effect throughout the session. And when CC writes to it, it usually summarizes aggressively enough to keep the file very readable.

Notes on CLAUDE.md

  • Keep the file from getting too long, since CC reads it by default.
  • During a session, for convenience, CC can also understand it if you say claude.md.
  • The file is a good place for reminders, such as “Require CC to include a link to evidence files every time it announces success” and “The proxy service port is 9890.” During a session, you can then ask CC to “check the relevant part of claude.md.”
  • According to GPT, the official feature that uses “#” to add content to the document has an unstable bug.

4. Session management: stay in control and keep moving efficiently#

Pause and roll back anytime#

  • Press Esc while working to pause the current operation. For example, if you notice Claude is stuck installing dependencies or going down the wrong path, interrupting it early can reduce wasted work.
  • Press Esc twice to roll back to a previous point in the conversation history. Note that there is no redo feature, so confirm before rolling back.
  • Not happy with the code? Just say “roll back to the previous code,” and Claude will automatically restore the earlier version.

Handling history overflow#

When the session shows “Context left until auto-compact: 3%,” it means the conversation history is almost full. Auto-compaction will be triggered at that point, which takes about 150 seconds. You can also manually run the /compact command to extend the session and avoid interruptions.#

Resume and view history#

  • Use claude -c to jump directly back into the previous conversation.
  • Use claude -r to choose and restore a historical session, which is useful when you exit midway and want to continue working later.

5. Resource monitoring and batch tasks: control the pace and avoid waste#

Monitor token usage in real time#

Want to know how many resources you consume per day or per hour? Run npx ccusage@latest to view daily usage, or npx ccusage blocks --live to monitor consumption speed in real time. If usage is growing too quickly, you can handle token-heavy operations such as git commits manually to avoid going over the limit.

text
npx ccusage@latest

Handle batch tasks efficiently#

If you need to run dozens of repetitive tasks, such as generating documentation chapters in batches, use a script-style workflow:

  1. Write the tasks line by line into TASK.md, with one task per line.
  2. Run the command:
text
cat TASK.md | while IFS= read -r line; do echo $line; claude -p "$line" --debug; done

You can add timeout to prevent a single task from hanging, and use --allowedTools "Edit" to limit permissions and avoid accidental operations. Be careful not to run tasks concurrently, or you may trigger rate-limit bans.

6. Pitfalls and advanced tips: make Claude more “obedient”#

Give it enough freedom, but add safeguards#

  • Enable auto-accept edits with Shift+Tab so Claude can edit files automatically. Pair this with git version control, and accidental changes become much less risky.
  • When running Bash commands, isolate the environment with Docker, or use snapshots on a btrfs filesystem. This lets you open up permissions while still being able to roll back quickly.
  • Avoid storing sensitive information such as ssh keys in the session directory to prevent risks from cross-machine operations.

Guard against “fake progress”#

Claude may occasionally “brag,” for example by claiming success before tests are complete. Add a rule to CLAUDE.md such as: “Every time you claim success, you must include a link to evidence files.” Also ask it periodically: “Is it really done? Do you have evidence?” If you find a problem, have it fix it immediately.

Mastering these techniques turns Claude Code from a “tool” into an “efficient partner.” Whether you use it for daily coding, project management, or batch processing, it can significantly improve productivity. Remember: the key is to switch modes as needed, make good use of global memory, and add the right monitoring and safeguards. That is how you get the most value out of it.


Start integrating Crazyrouter#

If you are ready to connect Claude Code, domestic models, or your own applications to Crazyrouter through a unified setup, proceed in this order:

  1. Go to the Crazyrouter Console, create a dedicated API Token, and manage permissions separately by project or team.
  2. For Claude Code, use the root domain: https://cn.crazyrouter.com; for OpenAI-compatible SDKs, use: https://cn.crazyrouter.com/v1.
  3. When you need to automatically check the environment or quickly write configuration, use the Crazyrouter Claude Code one-click configuration script.
  4. If debugging fails, check the console logs first, then verify the API Endpoint guide, especially whether the Base URL has an extra /v1.

When you need to evaluate model costs or choose different models, first check the Crazyrouter pricing and models page, then add your commonly used models to the Token whitelist.

Implementation Guides

Related Posts

18|Claude Code on Crazyrouter, Series 18: In the AI Era, If You Can Speak, You Can CodeClaude Code

18|Claude Code on Crazyrouter, Series 18: In the AI Era, If You Can Speak, You Can Code

18|Claude Code on Crazyrouter, Series 18: In the AI era, if you can speak, you can code. This article covers Claude Code's unified integration with Crazyrouter, configuration checks, and hands-on workflows, helping readers follow the site documentation to build a reusable development workflow.

Jun 10
11|Claude Code with Crazyrouter Series 11: Chapter 8: Prompt Optimization TipsClaude Code

11|Claude Code with Crazyrouter Series 11: Chapter 8: Prompt Optimization Tips

11|Claude Code with Crazyrouter Series 11: Chapter 8: Prompt Optimization Tips. This article covers unified integration, configuration checks, and practical workflows for Claude Code and Crazyrouter, helping readers follow the site documentation to build reusable development workflows.

Jun 10
16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar ProblemsClaude Code

16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar Problems

16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar Problems. This article covers unified integration, configuration checks, and hands-on workflows for Claude Code and Crazyrouter, helping readers follow the site documentation to build reusable development workflows.

Jun 10
13|Claude Code with Crazyrouter, Part 13: Chapter 10: Solving Problems with a Programming MindsetClaude Code

13|Claude Code with Crazyrouter, Part 13: Chapter 10: Solving Problems with a Programming Mindset

13|Claude Code with Crazyrouter, Part 13: Chapter 10: Solving Problems with a Programming Mindset. This article covers unified integration, configuration checks, and hands-on workflows for Claude Code and Crazyrouter, helping readers follow the site documentation to build reusable development workflows.

Jun 10
12|Claude Code with Crazyrouter Series 12: Chapter 9: Common Keyboard ShortcutsClaude Code

12|Claude Code with Crazyrouter Series 12: Chapter 9: Common Keyboard Shortcuts

12|Claude Code with Crazyrouter Series 12: Chapter 9: Common Keyboard Shortcuts. This article walks through unified access, configuration checks, and practical workflows for Claude Code and Crazyrouter, helping readers follow the site documentation to build a reusable development workflow.

Jun 10
09|Claude Code with Crazyrouter Series 09: Chapter 6: Data Processing and AnalysisClaude Code

09|Claude Code with Crazyrouter Series 09: Chapter 6: Data Processing and Analysis

09|Claude Code with Crazyrouter Series 09: Chapter 6: Data Processing and Analysis. This article covers unified integration, configuration checks, and practical workflows for Claude Code and Crazyrouter, helping readers build reusable development workflows based on the site documentation.

Jun 10