Skip to main content

Overview

Claude Code is Anthropic’s official command-line coding assistant. It is designed for local project work such as code generation, debugging, refactoring, tests, and documentation. With LaoZhang API configured, you can use Claude models directly from the terminal without moving project work into a web UI.

Local CLI Agent

Runs inside your project directory and fits terminal-based workflows.

Claude Code Token Group

Select the Claude Code group when creating the token to avoid route mismatch.

Current Model Set

Use Sonnet 4.6 by default and switch to Opus 4.7 for harder tasks.

AWS Route Compatibility

Disables experimental beta fields to reduce Bedrock 400 validation errors.
This page only lists the recommended models for new Claude Code setups. Legacy Opus / Sonnet 4.5, 4.1, and 3.x models are no longer recommended for new configurations. Check the console for the actual selectable models.

Required: AWS Claude 400 Compatibility Setting

If Claude Code returns 400 ValidationException, Extra inputs are not permitted, or errors related to cache_control.scope on the AWS Claude official route, first disable Claude Code experimental beta request fields.
For the current terminal session, run this before starting Claude Code:
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
For persistent configuration, add it to ~/.claude/settings.json:
{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}

Quick Setup

1

Install Claude Code

Run:
npm install -g @anthropic-ai/claude-code
Node.js 18 or higher is required. If it is not installed, download it from nodejs.org.
2

Create a Claude Code Token

Open the LaoZhang API Console, create a new token, select the Claude Code group, and copy the sk-... key.
The token must be created under the Claude Code group. Other Claude groups may not work correctly with Claude Code.
3

Write settings.json

Edit ~/.claude/settings.json:
vim ~/.claude/settings.json
Recommended configuration:
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.laozhang.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-laozhang-api-key",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 disables Claude Code experimental beta request fields for better AWS Claude / Bedrock compatibility.
4

Launch Claude Code

Navigate to your project directory and start:
cd ~/Desktop/my-project
claude
On first launch, Claude Code shows the API configuration. Confirm the Base URL, token, and model before continuing.

Model Selection

For new projects, choose from the models below and avoid carrying over legacy Opus / Sonnet 4.5, 4.1, or 3.x model IDs from older configs.
Use CaseRecommended Model IDGuidance
Default daily developmentclaude-sonnet-4-6Balanced quality, speed, and cost for most coding work
Everyday reasoning-heavy workclaude-sonnet-4-6-thinkingGood for code review, bug analysis, and implementation planning
Difficult agentic codingclaude-opus-4-7Best for large refactors, cross-module design, and long coding workflows
Deep analysis and multi-step planningclaude-opus-4-7-thinkingUse for high-risk migrations, architecture choices, and complex decomposition
Fast low-cost tasksclaude-haiku-4-5Good for short questions, simple scripts, docs polish, and quick responses
Start with claude-sonnet-4-6. Switch to Opus 4.7 only when the task needs stronger planning, longer context, or complex tool use.

Usage

Basic Command

claude
# Shows API Key, Base URL, and model configuration
# Confirm the configuration and continue

Common Workflow

  1. Run claude in the project directory
  2. Describe the file, error, or goal
  3. Ask Claude Code for a plan first
  4. Let it edit files, run commands, or generate tests after confirmation

Good Fit

Code Generation and Refactoring

Generate functions, refactor modules, and adjust project structure.

Bug Fixing and Debugging

Analyze errors, locate causes, and add regression checks.

Tests and Scripts

Write tests, maintain scripts, and automate project commands.

Docs and Explanations

Produce README updates, API notes, and changelog entries.

Troubleshooting

If Claude Code returns one of the following errors, Claude Code may be sending experimental beta parameters that are not accepted by AWS Claude / Bedrock:
  • 400 ValidationException
  • Extra inputs are not permitted
  • Errors related to cache_control.scope
Recommended order:
  1. Update Claude Code to the latest version.
  2. Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1.
npm update -g @anthropic-ai/claude-code
The official Claude LLM gateway documentation notes that when using the Anthropic Messages format with Bedrock or Vertex, you may need to set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. Without it, some beta parameters or request fields may trigger gateway or Bedrock validation errors.Add this setting under env in ~/.claude/settings.json:
{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
To apply it only to the current terminal session, run:
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
To make it permanent, add it to your shell profile:
# macOS / Linux bash
echo 'export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1' >> ~/.bashrc
source ~/.bashrc

# macOS default zsh
echo 'export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1' >> ~/.zshrc
source ~/.zshrc
On Windows PowerShell, run:
[System.Environment]::SetEnvironmentVariable("CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", "1", "User")
Reopen the terminal and restart Claude Code after changing the setting. This forces Claude Code to use a more standard request shape and avoids unsupported fields such as cache_control, extended tool fields, and scope being rejected by Bedrock.If the error continues, check whether the model name is correct, whether you are sending a custom request body, and whether a non-standard SDK is involved. When contacting support, provide the error screenshot, Request ID, and model name.
This is usually a Base URL, token, model name, or network configuration issue. First check that ~/.claude/settings.json contains these fields:
  • ANTHROPIC_BASE_URL
  • ANTHROPIC_AUTH_TOKEN
  • ANTHROPIC_MODEL
If you inject configuration through terminal environment variables instead of settings.json, then use echo to check whether the current terminal can read those variables. Do not share screenshots that expose the full token.
If Claude Code still asks for official account authorization, create .claude.json in the project directory:
{
  "apiKey": "sk-your-laozhang-api-key",
  "apiBaseUrl": "https://api.laozhang.ai",
  "hasCompletedOnboarding": true
}
This is useful when a project needs fixed local configuration. Keep the main global configuration in ~/.claude/settings.json.
Make sure you are using a LaoZhang API key and that the token was created under the Claude Code group. You can regenerate the token in the LaoZhang API Console and test again.
Run:
npm update -g @anthropic-ai/claude-code
Reopen the terminal after updating, then run claude again.

Best Practices

RecommendationDetails
Use Sonnet 4.6 by defaultBalanced cost and quality for most daily development
Switch to Opus 4.7 for hard workBetter fit for architecture changes, cross-file refactors, and long workflows
Ask for a plan before large editsReview the plan before letting Claude Code modify files
Keep Git checks in the loopUse git status, git diff, and project tests before accepting changes
Check pricing in the consoleClaude Code is token-metered; current pricing is shown in the console

Official Docs

Claude Code official documentation

API Console

Manage API keys

Model Info

View current Claude models

Cline Setup

VS Code AI agent setup
Need help? Visit LaoZhang API for support.