Claude Code integration guide
Developer toolCLI toolUpdated: 2025-11-26Introduction
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?
| Advantage | Description |
|---|---|
| 💰 Flexible billing | Pay as you go, no subscription required |
| ⚡ High performance | Low latency, fast responses |
| 🔒 Data security | Code is not stored, protecting your privacy |
| 🆓 New user credit | New accounts receive free credit |
Supported models
SeaWhale AI supports the Claude family through an Anthropic-compatible endpoint:
Model list
| Family | Model name | Strengths | Best for |
|---|---|---|---|
| Claude Sonnet | claude-sonnet-4-6 | • Strong at code • Accurate reasoning • 200K context | Complex projects, refactoring |
| Claude Opus | claude-opus-4-7 | • Highest capability • Deep reasoning • 200K context | Architecture, complex algorithms |
| Claude Haiku | claude-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
- Open the SeaWhale AI console
- Sign up and log in
- Generate an API key on the API management page
- 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
| Requirement | Details |
|---|---|
| Operating system | macOS 10.15+, Windows 10+, Linux |
| Node.js | v16.0+ |
| npm | v7.0+ |
| Terminal | A modern terminal with color support |
Installation
1. Install Claude Code
# Install globally with npm
npm install -g @anthropic-ai/claude-code
# Verify the installation
claude --version# Install globally with npm
npm install -g @anthropic-ai/claude-code
# Verify the installation
claude --versionInstallation 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.
Recommended: configuration file (all platforms)
Create ~/.claude/settings.json in your home directory:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.seawhaleai.com",
"ANTHROPIC_AUTH_TOKEN": "sk-******",
"DISABLE_TELEMETRY": "1"
}
}What each setting does
ANTHROPIC_BASE_URL: the SeaWhale AI compatible endpointANTHROPIC_AUTH_TOKEN: your SeaWhale AI API keyDISABLE_TELEMETRY: disables telemetry (optional)
Notes
- Set either
ANTHROPIC_API_KEYorANTHROPIC_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
# Change into your project directory
cd my-project
# Start Claude Code
claude2. Common commands
| Command | What it does | Example |
|---|---|---|
/model <model> | Switch model | /model claude-opus-4-7 |
/clear | Clear conversation history | /clear |
/compact | Compact conversation history | /compact |
/help | Show help | /help |
/exit | Quit | /exit |
Worked examples
Example 1: code generation
👤 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
👤 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
👤 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 structureSaving 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
.gitignoreto exclude unnecessary files - ✅ Delete or move large binary files
- ✅ Avoid starting in your home directory or a folder containing many projects
Example .gitignore
# Exclude dependency directories
node_modules/
venv/
__pycache__/
# Exclude build output
dist/
build/
*.pyc
# Exclude large files
*.pdf
*.zip
*.tar.gz2. Manage conversation history
Claude Code keeps prior conversation as context and compacts it automatically when it grows too long.
| Command | When to use | Effect |
|---|---|---|
/compact | The conversation is long | Summarizes the conversation, shrinking context |
/clear | Before a new task | Clears all history and resets the context |
| Auto-compact | At 95% of context | Claude Code triggers it for you |
Note
/cleardiscards all conversation history/compactkeeps 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 middleware5. Token usage comparison
| Task | Estimated tokens | Suggestion |
|---|---|---|
| Simple code generation | 500–1000 | Use claude-haiku |
| Complex algorithm | 2000–5000 | Use claude-sonnet |
| Whole-project refactor | 10000+ | Break it into stages |
| Code explanation | 1000–3000 | Name 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 status | Error code | Meaning | How to fix |
|---|---|---|---|
| 400 | invalid_request_error | Malformed request | • Check the model name • Verify parameter formats • Check the request body is complete |
| 401 | authentication_error | API key auth failed | • Check the API key • Confirm the environment variable is set • Regenerate the key |
| 403 | permission_error | Insufficient permission | • Check API key permissions • Confirm model access • Contact an administrator |
| 404 | not_found_error | Resource not found | • Check the BASE_URL spelling • Confirm the model name • Verify the endpoint |
| 413 | request_too_large | Request too large | • Reduce the input • Use /compact to shrink history • Process large files in batches |
| 429 | rate_limit_error | Rate limited | • Slow down requests • Wait and retry • Increase your account quota |
| 500 | api_error | Server error | • Retry later • Check service status • Contact support |
| 529 | overloaded_error | Server 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?
| Tool | Type | Strengths | Best for |
|---|---|---|---|
| Claude Code | CLI tool | Conversational, strong context understanding | Complex projects, deep work |
| GitHub Copilot | IDE plugin | Completion, inline suggestions | Live coding, quick completion |
| Cursor | IDE | Integrated editor, visual | Full development environment |
| ChatGPT | Web / app | General chat, zero setup | Learning, 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 type | Estimated volume |
|---|---|
| Simple code generation | 200–500 requests |
| Medium project work | 50–100 sessions |
| Complex architecture work | 10–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.md2. 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 thing3. Code review workflow
Using Claude Code to assist with review:
# 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?