> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yelinai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code Setup Guide

> Claude Code API setup tutorial: Configure Claude Code with third-party API provider. Works without Anthropic account, settings.json configuration. 20% cheaper than official, with all Claude models supported.

## Overview

Claude Code is Anthropic’s official command-line programming assistant. By configuring LaoZhang API, you can:

## 🚀 Stable Connection

Direct access, no proxy needed

## 💰 Cost Effective

No \$200/month Claude Max subscription

## ⚡ High Concurrency

Unlimited parallel requests

## 🔧 Simple Setup

Complete configuration in minutes

## Quick Start

**Simplified Setup**: If you don’t want to register a Claude account, check the [Project Configuration](#3-configure-claude-code-recommended) section below. Using `.claude.json` file can completely bypass official verification.

### 1. Install Claude Code

Run the following command to install globally:

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

Requires Node.js 18 or higher. If not installed, download from [nodejs.org](https://nodejs.org).

### 2. Get API Key

1. Visit [LaoZhang API Console](https://api.yelinai.com/token)
2. Create a new token, **select “Claude Code” group**
3. Copy the key for later use (format: `sk-...`)

**Important**: You must select the “Claude Code” group when creating the token, otherwise it may not work properly.

### 3. Configure Claude Code (Recommended)

Edit `~/.claude/settings.json` file:

```
vim ~/.claude/settings.json
```

Add the following content:

```
{
    "env": {
      "ANTHROPIC_BASE_URL": "https://api.yelinai.com",
      "ANTHROPIC_AUTH_TOKEN": "sk-your-laozhang-api-key",
      "ANTHROPIC_MODEL": "claude-opus-4-5-20251101"
    }
}
```

**Configuration Notes**:

* `ANTHROPIC_BASE_URL`: Points to LaoZhang API proxy
* `ANTHROPIC_AUTH_TOKEN`: Your API key (from console)
* `ANTHROPIC_MODEL`: Default model to use (optional)

Save and you’re ready to go. No need to restart terminal.

### 4. Launch Claude Code

Navigate to your project directory and start:

```
cd ~/Desktop/my-project
claude
```

First launch will show API configuration info. Confirm and start using.

## Model Selection

Models supported in Claude Code group:

| Model                        | Model ID                            | Features                            |
| ---------------------------- | ----------------------------------- | ----------------------------------- |
| **Claude Opus 4.5**          | `claude-opus-4-5-20251101`          | Latest & most powerful, recommended |
| **Claude Opus 4.5 Thinking** | `claude-opus-4-5-20251101-thinking` | Chain of thought reasoning          |
| **Claude Sonnet 4.5**        | `claude-sonnet-4-5-20250929`        | Balance of performance & cost       |
| **Claude Opus 4.1**          | `claude-opus-4-1-20250805`          | Enhanced reasoning                  |
| **Claude Sonnet 4**          | `claude-sonnet-4-20250514`          | Excellent coding capability         |
| **Claude 3.7 Sonnet**        | `claude-3-7-sonnet-20250219`        | Stable & reliable                   |
| **Claude Haiku 4.5**         | `claude-haiku-4-5-20251001`         | Fast response, low cost             |
| **Claude 3.5 Sonnet**        | `claude-3-5-sonnet-20241022`        | Classic stable version              |
| **Claude 3.5 Haiku**         | `claude-3-5-haiku-20241022`         | Lightweight & fast                  |

Models with `-thinking` suffix support chain-of-thought reasoning, ideal for complex problem analysis.

## Usage Guide

### Basic Commands

```
claude
# Shows API Key and Base URL
# Confirm configuration and continue
```

### Workflow

1. **Start**: Run `claude` in project directory
2. **Describe**: Input your programming needs
3. **Interact**: Claude understands context and provides suggestions
4. **Apply**: Claude can directly modify files

### Supported Features

* ✅ Code generation and optimization
* ✅ Bug fixing and debugging
* ✅ Code refactoring
* ✅ Documentation writing
* ✅ Test case generation
* ✅ Technical Q\&A
* ✅ Multi-file editing (Agent mode)

## Troubleshooting

Unable to Connect to Anthropic Services

Check the following:

1. Environment variables are correctly set
2. API key is valid
3. Network connection is stable

```
echo $ANTHROPIC_API_KEY
echo $ANTHROPIC_BASE_URL
```

Requires Claude Account Authorization

Create `.claude.json` with `hasCompletedOnboarding: true`:

```
{
  "apiKey": "sk-your-laozhang-api-key",
  "apiBaseUrl": "https://api.yelinai.com",
  "hasCompletedOnboarding": true
}
```

Invalid API Key

Ensure you’re using a LaoZhang API key. Check at [LaoZhang API Console](https://api.yelinai.com/token).

How to Update Claude Code

```
npm update -g @anthropic-ai/claude-code
```

## Best Practices

### Effective Prompts

```
Good prompts:
"Refactor this Python function for efficiency and add type annotations"
"This code has a memory leak, find and fix it"
"Write unit tests for this React component"

Avoid vague prompts:
"Improve my code"  # Too vague
```

### Performance Tips

1. **Use project config**: `.claude.json` avoids verification, faster startup
2. **Keep conversations coherent**: Handle related tasks in one session
3. **Be specific**: Clear descriptions reduce round trips

## Related Resources

## Official Docs

Claude Code Official Documentation

## API Console

Manage API Keys

## Model Info

Learn about Claude models

## Cline Setup

VS Code AI Agent

Need help? Visit [LaoZhang API](https://api.yelinai.com) for support.
