Skip to content
Sign in

Claude Code integration guide

Developer toolCLI toolUpdated: 2025-11-26

Introduction

Claude Code is Anthropic's AI coding assistant, providing intelligent code assistance through a command-line interface. Using the SeaWhale AI compatible endpoint, you can reach Claude and other powerful models for a high-quality coding experience.

Key capabilities

  • 💻 Code generation — write code from a description
  • 🐛 Debugging — locate and fix bugs quickly
  • ♻️ Refactoring — improve code structure and performance
  • 📝 Documentation — add comments and docs to your code
  • 🔍 Code explanation — make sense of complex logic
  • 🚀 Many languages — Python, JavaScript, Java, Go and more

Why SeaWhale AI?

AdvantageDescription
💰 Flexible billingPay as you go, no subscription required
High performanceLow latency, fast responses
🔒 Data securityCode is not stored, protecting your privacy
🆓 New user creditNew accounts receive free credit

Supported models

SeaWhale AI supports the Claude family through an Anthropic-compatible endpoint:

Model list

FamilyModel nameStrengthsBest for
Claude Sonnetclaude-sonnet-4-6• Strong at code
• Accurate reasoning
• 200K context
Complex projects, refactoring
Claude Opusclaude-opus-4-7• Highest capability
• Deep reasoning
• 200K context
Architecture, complex algorithms
Claude Haikuclaude-haiku-4-5-20251001• Great value
• Low latency
• Lightweight
Everyday work, code completion

Choosing a model

  • Recommended main model: claude-sonnet-4-6 (strong at code, accurate reasoning, good value)
  • Recommended fast model: claude-haiku-4-5-20251001 (great value, low latency, lightweight)
  • Hardest tasks: claude-opus-4-7 (highest capability, deep reasoning)

Notes

  • Claude Sonnet models excel at understanding and generating code, and suit most development work
  • Claude Opus models are best for complex architecture and algorithm problems
  • Claude Haiku models respond quickly and suit lightweight everyday tasks

Before you begin

1. Get a SeaWhale AI API key

  1. Open the SeaWhale AI console
  2. Sign up and log in
  3. Generate an API key on the API management page
  4. Make sure your account has enough balance or free credit
New user credit

New SeaWhale AI accounts receive free starter credit:

  • ✅ Usable across all model inference services

2. System requirements

RequirementDetails
Operating systemmacOS 10.15+, Windows 10+, Linux
Node.jsv16.0+
npmv7.0+
TerminalA modern terminal with color support

Installation

1. Install Claude Code

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

# Verify the installation
claude --version
powershell
# Install globally with npm
npm install -g @anthropic-ai/claude-code

# Verify the installation
claude --version

Installation notes

  • If you hit permission errors, you may need sudo (macOS/Linux)
  • On Windows, run PowerShell as administrator
  • To speed up npm, you can switch registries: npm config set registry https://registry.npmmirror.com

2. Configure the environment

To reach models through SeaWhale AI, we recommend the ~/.claude/settings.json configuration file.

Create ~/.claude/settings.json in your home directory:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.atalk-ai.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-******",
    "DISABLE_TELEMETRY": "1"
  }
}

What each setting does

  • ANTHROPIC_BASE_URL: the SeaWhale AI compatible endpoint
  • ANTHROPIC_AUTH_TOKEN: your SeaWhale AI API key
  • DISABLE_TELEMETRY: disables telemetry (optional)

Notes

  • Set either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN — you do not need both
  • The configuration file takes precedence over environment variables
  • Changes take effect immediately; no terminal restart needed

Usage guide

Basics

1. Start Claude Code

bash
# Change into your project directory
cd my-project

# Start Claude Code
claude

2. Common commands

CommandWhat it doesExample
/model <model>Switch model/model claude-opus-4-7
/clearClear conversation history/clear
/compactCompact conversation history/compact
/helpShow help/help
/exitQuit/exit

Worked examples

Example 1: code generation

markdown
👤 User: Write me a Python function that implements quicksort

🤖 Claude Code:
Sure — here is a quicksort implementation:

\```python
def quick_sort(arr):
"""
Quicksort implementation

    Args:
        arr: the array to sort

    Returns:
        the sorted array
    """
    if len(arr) <= 1:
        return arr

    pivot = arr[len(arr) // 2]
    left = [x for x in arr if x < pivot]
    middle = [x for x in arr if x == pivot]
    right = [x for x in arr if x > pivot]

    return quick_sort(left) + middle + quick_sort(right)

# Test

test_arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = quick_sort(test_arr)
print(f"Sorted: {sorted_arr}")
\```

This version uses list comprehensions, which keeps it short and readable.
Time complexity: O(n log n) average, O(n²) worst case
Space complexity: O(n)

Example 2: debugging

markdown
👤 User: Why does this code fail?
\```python
def calculate_average(numbers):
total = sum(numbers)
return total / len(numbers)

result = calculate_average([])
\```

🤖 Claude Code:
The problem is a **division by zero**. When you pass an empty list:

- `len(numbers)` returns 0
- `total / len(numbers)` raises ZeroDivisionError

The fix:

\```python
def calculate_average(numbers):
"""
Calculate the average of a list of numbers

    Args:
        numbers: list of numbers

    Returns:
        the average, or 0 when the list is empty
    """
    if not numbers:  # Guard against an empty list
        return 0

    total = sum(numbers)
    return total / len(numbers)

# Test

print(calculate_average([1, 2, 3, 4, 5])) # Prints: 3.0
print(calculate_average([])) # Prints: 0
\```

Or, if you prefer to be strict about it:

\```python
def calculate_average(numbers):
if not numbers:
raise ValueError("Cannot average an empty list")
return sum(numbers) / len(numbers)
\```

Example 3: refactoring

markdown
👤 User: Refactor this so it's clearer

\```javascript
function p(d) {
let r = [];
for(let i=0;i<d.length;i++){
if(d[i].a>18&&d[i].s=='active'){
r.push({n:d[i].n,a:d[i].a});
}
}
return r;
}
\```

🤖 Claude Code:
Here is a refactored version with better readability and maintainability:

\```javascript
/\*\*

- Filter for active adult users
- @param {Array<Object>} users - the user list
- @param {string} users[].name - user name
- @param {number} users[].age - age
- @param {string} users[].status - status
- @returns {Array<Object>} the filtered user list
  \*/
  function filterActiveAdultUsers(users) {
  const ADULT_AGE = 18;
  const ACTIVE_STATUS = 'active';

return users
.filter(user =>
user.age > ADULT_AGE &&
user.status === ACTIVE_STATUS
)
.map(user => ({
name: user.name,
age: user.age
}));
}

// Example usage
const users = [
{ name: 'Alice', age: 25, status: 'active' },
{ name: 'Bob', age: 17, status: 'active' },
{ name: 'Charlie', age: 30, status: 'inactive' }
];

const result = filterActiveAdultUsers(users);
console.log(result);
// Prints: [{ name: 'Alice', age: 25 }]
\```

**What changed**:

1. ✅ Meaningful variable names
2. ✅ Added JSDoc comments
3. ✅ Functional style (filter + map)
4. ✅ Magic numbers extracted into constants
5. ✅ Clearer overall structure

Saving tokens

Using Claude Code thoughtfully can noticeably cut token usage and cost.

1. Reduce irrelevant file scanning

Best practices

  • ✅ Start Claude Code inside the specific project directory
  • ✅ Use .gitignore to exclude unnecessary files
  • ✅ Delete or move large binary files
  • ✅ Avoid starting in your home directory or a folder containing many projects

Example .gitignore

gitignore
# Exclude dependency directories
node_modules/
venv/
__pycache__/

# Exclude build output
dist/
build/
*.pyc

# Exclude large files
*.pdf
*.zip
*.tar.gz

2. Manage conversation history

Claude Code keeps prior conversation as context and compacts it automatically when it grows too long.

CommandWhen to useEffect
/compactThe conversation is longSummarizes the conversation, shrinking context
/clearBefore a new taskClears all history and resets the context
Auto-compactAt 95% of contextClaude Code triggers it for you

Note

  • /clear discards all conversation history
  • /compact keeps the key points but may lose details
  • Best used after finishing a complete task

3. Give precise instructions

❌ Vague✅ Precise
"Optimize this code""Refactor get_user_list in user.py to use a list comprehension"
"Fix this for me""Add error handling at line 45 of index.js to catch API failures"
"Something's wrong""Fix the division-by-zero in calculate.py and add input validation"

4. Break large tasks apart

❌ Don't: ask for everything at once

Build me a complete user management system with frontend, backend and database

✅ Do: work step by step

1. First, design the user database schema
2. Then implement the user registration API
3. Next, implement sign-in
4. Finally, add authorization middleware

5. Token usage comparison

TaskEstimated tokensSuggestion
Simple code generation500–1000Use claude-haiku
Complex algorithm2000–5000Use claude-sonnet
Whole-project refactor10000+Break it into stages
Code explanation1000–3000Name the specific function

More optimization tips

See the Claude Code documentation for more ways to save tokens.


Error codes

You may encounter the following errors:

HTTP statusError codeMeaningHow to fix
400invalid_request_errorMalformed request• Check the model name
• Verify parameter formats
• Check the request body is complete
401authentication_errorAPI key auth failed• Check the API key
• Confirm the environment variable is set
• Regenerate the key
403permission_errorInsufficient permission• Check API key permissions
• Confirm model access
• Contact an administrator
404not_found_errorResource not found• Check the BASE_URL spelling
• Confirm the model name
• Verify the endpoint
413request_too_largeRequest too large• Reduce the input
• Use /compact to shrink history
• Process large files in batches
429rate_limit_errorRate limited• Slow down requests
• Wait and retry
• Increase your account quota
500api_errorServer error• Retry later
• Check service status
• Contact support
529overloaded_errorServer overloaded• Retry later
• Use a less busy model
• Shift to off-peak hours

FAQ

Q1: How does Claude Code differ from other AI coding tools?

ToolTypeStrengthsBest for
Claude CodeCLI toolConversational, strong context understandingComplex projects, deep work
GitHub CopilotIDE pluginCompletion, inline suggestionsLive coding, quick completion
CursorIDEIntegrated editor, visualFull development environment
ChatGPTWeb / appGeneral chat, zero setupLearning, quick questions

Q2: Which programming languages are supported?

Claude Code supports all mainstream programming languages:

Supported languages

Web development

  • JavaScript / TypeScript
  • HTML / CSS / SCSS
  • React / Vue / Angular
  • Node.js / Deno

Backend development

  • Python
  • Java / Kotlin
  • Go
  • Rust
  • C / C++
  • C# / .NET
  • PHP
  • Ruby

Mobile development

  • Swift (iOS)
  • Kotlin (Android)
  • Dart (Flutter)
  • React Native

Data science

  • Python (NumPy, Pandas, PyTorch)
  • R
  • Julia
  • SQL

Other

  • Shell / Bash
  • YAML / JSON / TOML
  • Markdown
  • LaTeX

Q3: Can I use it offline?

No. Claude Code needs network access to call the SeaWhale AI API.

You can still:

  • ✅ Use caching to avoid repeated requests
  • ✅ Save generated code locally
  • ✅ Review past conversation history offline

Q4: How is my code kept private?

SeaWhale AI commits to:

  • 🔒 No code storage — deleted immediately after the request is processed
  • 🔒 End-to-end encryption — encrypted throughout transit
  • 🔒 No training use — your code is never used to train models
  • 🔒 Compliance — meets GDPR and equivalent standards

Security recommendations

  • Do not include secrets (passwords, keys) in your code
  • For extremely sensitive projects, consider a local model
  • Review API key usage regularly

Q5: Is the free credit enough?

New-user credit typically covers roughly:

Task typeEstimated volume
Simple code generation200–500 requests
Medium project work50–100 sessions
Complex architecture work10–20 in-depth discussions

Best practices

1. Suggested project structure

my-project/
├── .claude/
│   └── settings.json      # Claude Code configuration
├── .gitignore             # Exclude irrelevant files
├── src/                   # Source code
├── tests/                 # Tests
├── docs/                  # Documentation
└── README.md

2. Asking effectively

✅ A good prompt

Implement JWT token verification middleware in src/utils/auth.js.
Requirements:
1. Check the Authorization header
2. Verify the token is valid
3. Parse user info onto req.user
4. Handle expired and invalid token errors

❌ A poor prompt

Write me an auth thing

3. Code review workflow

Using Claude Code to assist with review:

bash
# 1. Review the code
Please review src/api/user.js and check for:
- Security issues
- Performance bottlenecks
- Style violations
- Best practices

# 2. Add tests
Please write unit tests for the getUserById function

# 3. Ask about optimization
Does this function have performance problems? How would you optimize it?