Install and Configure Claude Code in Three Commands

Install Claude Code with three commands and configure DeepSeek API for affordable AI coding.
This guide walks through installing Claude Code in under a minute using just three npm commands, then configuring third-party model APIs like DeepSeek to dramatically reduce usage costs. It covers environment setup, configuration file settings, environment variables, and demonstrates practical usage for AI-assisted programming in the terminal.
Introduction
Claude Code is a command-line AI programming assistant from Anthropic that interacts directly with code in the terminal, enabling code generation, debugging, and refactoring. Unlike completion-based tools embedded in IDEs like GitHub Copilot, Claude Code is an Agent-type programming tool — it can proactively read project file structures, understand code context, and execute complex multi-step tasks. It runs in a terminal environment, receiving natural language instructions through a REPL (Read-Eval-Print Loop) interactive mode, then calls a large language model for reasoning, and finally applies results directly to the project in the form of code modifications, file creation, and more.
However, many developers get discouraged at the installation and configuration stage — when in reality, the entire process is far less complex than imagined. Bilibili creator A-Long shared a minimalist installation approach: with just three commands, you can complete the Claude Code installation in one minute, and by pairing it with third-party model APIs like DeepSeek, you can use this powerful AI programming tool at a fraction of the cost.
Install Claude Code in Three Commands
The entire installation process requires executing just three commands sequentially in the terminal — no complex environment dependencies or configuration steps needed.
Step 1: Install Claude Code Globally via npm
Enter the following command in your terminal:
npm install -g @anthropic-ai/claude-code
This command installs Claude Code globally via npm. npm (Node Package Manager) is the default package manager for Node.js, where the -g flag indicates global installation — meaning the tool is installed to a system-level directory rather than the current project directory, allowing you to invoke the claude command from any path. Globally installed packages are typically located in /usr/local/lib/node_modules (macOS/Linux) or %AppData%/npm/node_modules (Windows).
The prerequisite is that your system already has Node.js and npm installed. If not, you can download and install the latest LTS (Long Term Support) version from the Node.js official website. The LTS version is more stable than the Current version and is better suited for production environments and toolchains.
Step 2: Verify the Installation
After installation, enter the following command to verify success:
claude --version
If the terminal returns a version number, Claude Code has been successfully installed.

Step 3: Launch Claude Code
Navigate to your project directory and simply enter:
claude
This launches Claude Code and starts conversational programming with AI. Upon startup, Claude Code automatically scans the current directory's file structure, builds an initial understanding of the project, and all subsequent conversations are based on this context.
Configure DeepSeek and Other Third-Party Models to Reduce Costs
The default Claude Code uses Anthropic's Claude model, which requires an Anthropic API Key and comes with relatively high costs. A more economical approach is to connect to Chinese LLMs like DeepSeek, significantly reducing usage costs.
About the DeepSeek Model
DeepSeek is a large language model series from DeepSeek AI, with DeepSeek-V3 and DeepSeek-Coder performing exceptionally well on code generation tasks. DeepSeek uses a MoE (Mixture of Experts) architecture, which activates only a subset of parameters during each inference, maintaining high performance while dramatically reducing inference costs. Its API pricing is typically one-tenth or even less than Claude's, allowing developers to use it frequently in daily programming without worrying about costs.
Obtain a DeepSeek API Key
First, open the DeepSeek platform (platform.deepseek.com) and create a new key on the API Key management page.

Modify the Claude Code Configuration File
The key to connecting Claude Code with third-party models lies in the OpenAI-compatible API protocol. Currently, most Chinese LLMs (including DeepSeek, Qwen, Moonshot, etc.) provide interface endpoints compatible with the OpenAI API format — you only need to modify the base_url and API Key to seamlessly switch the underlying model. This protocol compatibility has become a de facto industry standard, greatly reducing the cost of tool migration and model switching.
Locate the Claude Code settings.json configuration file in your user directory and add the following information:
- Model service address: DeepSeek's API endpoint (typically
https://api.deepseek.com) - API Key: The key you just created
- Available models: You can configure multiple models for switching
As demonstrated in the video, the configuration can include multiple model options simultaneously, including Claude's Haiku, Opus, and Sonnet series as well as other third-party models, allowing flexible switching based on different task scenarios. For example, simple code completion tasks can use lower-cost smaller models, while complex architecture design and refactoring tasks can switch to more capable larger models.

After configuration is complete, you need to set the corresponding environment variables to ensure Claude Code can correctly read the API address and key information.
Practical Usage Demonstration
Once configured, navigate to your project directory and enter the claude command to launch. After startup, you'll enter an interactive conversation interface where you can describe requirements in natural language, and the AI will understand your code context and provide corresponding code suggestions, modification plans, or directly generate code.

The overall experience is very smooth. Unlike using plugins like Copilot in an IDE, Claude Code is better suited for scenarios requiring large-scale code refactoring, project-level understanding, and complex task decomposition. Specifically, IDE plugins focus on line-level or function-level code completion, deeply integrated with the editor, ideal for instant assistance when writing new code. Command-line AI programming tools like Claude Code excel at project-level operations — they can read and modify multiple files simultaneously, execute shell commands, understand the entire codebase architecture, and are well-suited for refactoring, debugging, generating test cases, and other tasks requiring a global perspective. The two are complementary rather than substitutive, and developers can choose the most appropriate tool based on specific scenarios.
Notes and Common Issues
Environment requirements: Ensure Node.js version 18 or above, and keep npm up to date. Windows, macOS, and Linux systems are all supported. If you encounter permission issues during installation (especially on macOS and Linux), try using the sudo prefix or manage Node.js versions through nvm (Node Version Manager) to avoid permission conflicts.
Cost control: Using APIs from Chinese models like DeepSeek is far cheaper than using Claude's native API directly. Taking DeepSeek-V3 as an example, its input token price is approximately 1 RMB per million tokens, and output tokens are approximately 2 RMB per million tokens, while Claude 3.5 Sonnet costs about $3 per million input tokens and $15 per million output tokens — a difference of tens of times. For daily development and learning scenarios, this is a very practical alternative. However, it's worth noting that third-party models may have some gap compared to Claude's native model in code understanding and generation quality, especially when handling complex logical reasoning, long-context understanding, and multi-file coordinated modifications. It's recommended to choose the appropriate model based on actual results.
Security reminder: API Keys are sensitive information — do not commit configuration files containing keys to public code repositories. It's recommended to add configuration files to .gitignore. Additionally, consider setting API call quota limits on the DeepSeek platform to prevent unexpected charges if a key is leaked.
Conclusion
Installing and configuring Claude Code isn't as complex as you might think. Three commands to complete installation, a few more minutes to configure a third-party model's API, and you can experience the power of command-line AI programming at minimal cost. For developers who want to try AI-assisted programming without spending too much, this approach is worth a try. As LLM capabilities continue to improve and API prices continue to drop, command-line AI programming tools are becoming an increasingly important member of the developer's toolkit.
Key Takeaways
Related articles

From Chat to Agent: Automating Your Entire Business Workflow with AI Agents
Veteran AI practitioner Remy breaks down the leap from chat models to AI agents: how agents work, the three pillars of context, tools, and skills, MCP connections, and hands-on architecture to make you a 100x employee.

Understand Anything: The AI Skill That Turns Code into Interactive Knowledge Graphs
Understand Anything is a high-star open-source GitHub skill that runs static analysis on any codebase and generates interactive knowledge graphs. It supports Claude Code, Cursor, Copilot and other agents, letting engineers ask questions in natural language with path references.

Kimi K3 Released: How a 2.8 Trillion Parameter Open Model Reshapes AI Cost-Effectiveness
Moonshot AI unveils Kimi K3: a 2.8 trillion parameter, 1M context, natively multimodal open model. With KDA architecture and ultra-low cost, it rivals GPT-5.6 and Fable 5, redefining AI cost-effectiveness.