Skip to main content

Overview

Claude Code is Anthropic’s official command-line programming assistant, allowing you to use Claude’s powerful programming capabilities directly in the terminal. By configuring APIYI service, you can get:

🚀 Stable Connection

Direct connection without proxy, no network instability

💰 Cost-Effective

No need for Claude Max $200 subscription

⚡ High Concurrency

Unlimited access powered by APIYI

🔧 Simple Setup

Complete setup in minutes

Quick Start

Simplified Configuration Tip: If you don’t want to register for a Claude official account, we recommend checking the Advanced Configuration section below to use .claude.json file configuration, which completely bypasses official verification.

1. Install Claude Code

Run the following command in terminal to install globally:
npm install -g @anthropic-ai/claude-code
Requires Node.js 18 or higher. If not installed, please visit nodejs.org to download and install.

2. Configure API Key

Get API Key

  1. Visit APIYI Console
  2. Generate a new key in the [Token] section
  3. Copy the key for later use

Set Environment Variables

Add APIYI configuration to your system environment variables.
  • macOS/Linux
  • Windows
Edit ~/.zshrc or ~/.bashrc file:
# APIYI Configuration
export ANTHROPIC_API_KEY="sk-your-APIYI-key"
export ANTHROPIC_API_BASE="https://api.apiyi.com"
Mac User Tip: Press ⌘ + ⇧ + . in your user directory to show hidden files, then use a text editor to open the .zshrc file.

3. Apply Configuration

  • macOS/Linux
  • Windows
source ~/.zshrc
# or
source ~/.bashrc

4. Launch Claude Code

Enter your project directory and launch:
# Enter project directory
cd ~/Desktop/my-project

# Launch Claude Code
claude

Advanced Configuration

Create .claude.json file in project root directory to bypass Claude official verification:
{
  "apiKey": "sk-your-APIYI-key",
  "apiBaseUrl": "https://api.apiyi.com",
  "hasCompletedOnboarding": true
}
Important Note: Adding "hasCompletedOnboarding": true completely bypasses Claude official account verification, allowing direct use of APIYI service. This means you don’t need to:
  • Register for Claude official account (difficult registration, requires overseas phone number)
  • Worry about Claude official account being banned
  • Perform any additional authorization steps
Security Reminder: .claude.json file contains sensitive information, please ensure:
  1. Add to .gitignore to avoid committing to version control
  2. Don’t share project archives containing this file
If you don’t configure hasCompletedOnboarding: true, authorization page will appear on first use:
  1. Need to redirect to Claude official website for confirmation
  2. Requires Claude official account (difficult registration and easily banned)
  3. Return to terminal after successful authorization
Recommendation: Strongly recommend using the .claude.json configuration method above to avoid various limitations of Claude official accounts.

User Guide

Basic Commands

After launching, Claude Code will display current configuration information:
claude
# Displays API Key and API Base URL
# Confirm configuration is correct and select Yes to continue

Workflow

  1. Launch Assistant: Run claude in project directory
  2. Describe Requirements: Enter your programming needs or questions
  3. Interactive Dialogue: Claude understands context and provides code suggestions
  4. Apply Changes: After confirmation, Claude can directly modify files

Supported Features

  • ✅ Code generation and optimization
  • ✅ Bug fixing and debugging
  • ✅ Code refactoring suggestions
  • ✅ Documentation writing
  • ✅ Test case generation
  • ✅ Technical Q&A

Model Selection

Claude Code uses the latest Claude models by default. Through APIYI, you can access:
ModelFeaturesRecommended Scenarios
Claude 4 SonnetStrongest programmingComplex code tasks
Claude Opus 4.1Performance upgradeHigh-demand programming
Claude 4 Sonnet ThinkingChain-of-thought modeComplex reasoning

Troubleshooting

Common Issues

This is usually a network configuration issue. Please check:
  1. Environment variables are set correctly
  2. API key is valid
  3. Network connection is normal
Run the following commands to verify configuration:
echo $ANTHROPIC_API_KEY
echo $ANTHROPIC_API_BASE
This is because hasCompletedOnboarding is not configured. Create .claude.json file in project directory and add:
{
  "apiKey": "sk-your-APIYI-key",
  "apiBaseUrl": "https://api.apiyi.com",
  "hasCompletedOnboarding": true
}
This bypasses official account verification.
Make sure you’re using APIYI’s key, not Claude official website’s key. Generate new key at APIYI Console.
Run the following command to update to latest version:
npm update -g @anthropic-ai/claude-code
Claude Code supports all mainstream programming languages, including but not limited to:
  • Python, JavaScript/TypeScript, Java, C++, C#
  • Go, Rust, Swift, Kotlin
  • HTML/CSS, SQL, Shell Scripts
  • And more…

Best Practices

Effective Prompts

Good prompts:
"Help me refactor this Python function to make it more efficient and add type annotations"
"This code has a memory leak, please help me find and fix it"
"Write unit tests for this React component"

Avoid being too broad:
"Improve my code"  # Too vague

Project Structure Recommendations

  • Keep codebase clean and organized
  • Use clear file naming
  • Add appropriate comments
  • Provide project README

Performance Optimization

Improve Response Speed

  1. Use Project Configuration: .claude.json configuration avoids verification each time, especially faster startup after setting hasCompletedOnboarding: true
  2. Maintain Conversation Coherence: Handle related tasks in same session
  3. Clear Requirements: Clear descriptions reduce round-trip interactions

Cost Control

  • Claude Code charges based on Token usage
  • Enjoy preferential prices through APIYI
  • Check Pricing Page for details

Summary

Claude Code combined with APIYI service provides developers with a powerful, stable, and economical AI programming assistant solution. Enjoy top-tier AI programming experience without expensive subscription fees.
Tip: For more AI tools in programming scenarios, check out OpenAI Codex CLI and other options.