Anthropic’s Claude 4 series is opening new possibilities for AI assistants. Claude Opus 4.5 in particular has achieved significant evolution in coding ability and reasoning power. This article provides a detailed explanation of new features and usage methods that are especially important for developers.
Claude 4 Series Overview
Model Lineup
| Model | Features | Main Uses |
|---|---|---|
| Claude Opus 4.5 | Highest performance, Extended Thinking | Complex analysis, advanced coding |
| Claude Sonnet 4 | Balanced, fast | General development tasks |
| Claude Haiku | Fastest, low cost | Real-time processing, bulk processing |
Key Evolution Points
flowchart TB
subgraph Claude4["Claude 4 Series Major Evolutions"]
subgraph Thinking["Extended Thinking"]
T1["Deep reasoning for complex problems"]
T2["Visualization of step-by-step thinking process"]
end
subgraph Coding["Coding Ability Improvement"]
C1["Industry-leading score on SWE-bench"]
C2["Understanding changes across multiple files"]
end
subgraph Tools["Enhanced Tool Usage"]
TO1["Computer Use (GUI operation)"]
TO2["MCP (Model Context Protocol)"]
end
Context["Context Window: 200K tokens (approx. 150,000 words)"]
end
Claude Code - AI-Native Development Tool
What is Claude Code
Claude Code is an AI coding assistant that runs in the terminal. It understands the entire codebase and can make actual code changes.
# Installation
npm install -g @anthropic-ai/claude-code
# Launch
claude
# Or in a specific directory
claude /path/to/project
Main Features
// Claude Code feature examples
// 1. Code understanding and explanation
// > Explain what this function does
// Claude: This function...
// 2. Bug fixing
// > Identify the cause of the failing test and fix it
// Claude: [Analyze file] → [Identify cause] → [Suggest fix] → [Implement]
// 3. Refactoring
// > Refactor this class to be more maintainable
// Claude: [Code analysis] → [Design proposal] → [Incremental changes]
// 4. New feature implementation
// > Add user authentication feature
// Claude: [Confirm requirements] → [Design] → [Implement] → [Test]
Workflow
Claude Code Workflow:
1. Input question/task
↓
2. Codebase analysis
├── Understand file structure
├── Grasp dependencies
└── Learn existing patterns
↓
3. Present plan
├── Explain changes
├── Identify impact scope
└── Evaluate risks
↓
4. User approval
↓
5. Execute changes
├── Edit files
├── Run commands
└── Run tests
↓
6. Confirm results
Configuration File
// .claude/settings.json
{
"model": "claude-opus-4-5-20251101",
"permissions": {
"allowFileEdit": true,
"allowBashExec": true,
"allowWebSearch": false
},
"context": {
"includePatterns": ["src/**/*", "tests/**/*"],
"excludePatterns": ["node_modules", "dist", ".git"]
},
"hooks": {
"preCommit": "npm run lint && npm test",
"postEdit": "npm run format"
}
}
Extended Thinking
Handling Complex Problems
Extended Thinking is a feature available in Claude Opus 4.5 that performs deeper reasoning for complex problems.
# Using Extended Thinking with Python SDK
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-5-20251101",
max_tokens=16000,
thinking={
"type": "enabled",
"budget_tokens": 10000 # Tokens used for thinking
},
messages=[{
"role": "user",
"content": "Analyze the time complexity of this algorithm and suggest optimizations"
}]
)
# Display thinking process and answer
for block in response.content:
if block.type == "thinking":
print("[Thinking Process]")
print(block.thinking)
elif block.type == "text":
print("[Answer]")
print(block.text)
Visualizing the Thinking Process
Extended Thinking Example:
User: Optimize this merge sort implementation
[Thinking Process]
First, I need to analyze the current implementation...
- Recursion depth: O(log n)
- Merge at each level: O(n)
- Overall time complexity: O(n log n)
Considering optimization possibilities...
1. In-place merge → Memory reduction but increased complexity
2. Switch to insertion sort for small arrays → Constant factor improvement
3. Utilize natural runs → Timsort-like approach
Predicting benchmark results...
- Option 2 is easiest to implement and most effective
- Threshold is typically 32-64 elements
[Answer]
I suggest the following optimizations...
Computer Use
GUI Operation Automation
The Claude 4 series experimentally supports the ability to directly operate computer GUIs.
# Computer Use example
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
tools=[{
"type": "computer_20241022",
"name": "computer",
"display_width_px": 1920,
"display_height_px": 1080
}],
messages=[{
"role": "user",
"content": "Open the browser and create a new repository on GitHub"
}]
)
Supported Actions
| Action | Description |
|---|---|
| screenshot | Take screenshot of screen |
| click | Mouse click |
| type | Text input |
| key | Keyboard operation |
| scroll | Scrolling |
| mouse_move | Mouse movement |
MCP (Model Context Protocol)
What is MCP
MCP is a standard protocol for Claude to integrate with external systems and data sources.
flowchart TB
Claude["Claude"]
Protocol["MCP Protocol"]
GitHub["GitHub Server"]
Slack["Slack Server"]
Database["Database Server"]
Claude --> Protocol
Protocol --> GitHub
Protocol --> Slack
Protocol --> Database
MCP Server Configuration
// claude_desktop_config.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-github"],
"env": {
"GITHUB_TOKEN": "your-token"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-filesystem"],
"env": {
"ALLOWED_DIRECTORIES": "/Users/you/projects"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-postgres"],
"env": {
"DATABASE_URL": "postgres://localhost/mydb"
}
}
}
}
Creating Custom MCP Server
// my-mcp-server.ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server(
{
name: "my-custom-server",
version: "1.0.0",
},
{
capabilities: {
tools: {},
resources: {},
},
}
);
// Tool definition
server.setRequestHandler("tools/list", async () => ({
tools: [
{
name: "get_weather",
description: "Get weather for specified city",
inputSchema: {
type: "object",
properties: {
city: { type: "string", description: "City name" }
},
required: ["city"]
}
}
]
}));
// Tool execution
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "get_weather") {
const city = request.params.arguments.city;
const weather = await fetchWeather(city);
return { content: [{ type: "text", text: JSON.stringify(weather) }] };
}
});
// Start server
const transport = new StdioServerTransport();
await server.connect(transport);
API Usage
Python SDK
import anthropic
client = anthropic.Anthropic()
# Basic message
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{"role": "user", "content": "Implement quicksort in Python"}
]
)
print(message.content[0].text)
# Streaming
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Please give a long explanation"}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
# Tool usage
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=[{
"name": "get_stock_price",
"description": "Get stock price",
"input_schema": {
"type": "object",
"properties": {
"symbol": {"type": "string"}
},
"required": ["symbol"]
}
}],
messages=[{"role": "user", "content": "Tell me Apple's stock price"}]
)
TypeScript SDK
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
// Basic message
const message = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [
{ role: 'user', content: 'Create an API client in TypeScript' }
]
});
console.log(message.content[0].text);
// Streaming
const stream = await client.messages.stream({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Write code' }]
});
for await (const event of stream) {
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
process.stdout.write(event.delta.text);
}
}
Pricing
Token Pricing (as of January 2025)
| Model | Input | Output |
|---|---|---|
| Claude Opus 4.5 | $15 / 1M tokens | $75 / 1M tokens |
| Claude Sonnet 4 | $3 / 1M tokens | $15 / 1M tokens |
| Claude Haiku | $0.25 / 1M tokens | $1.25 / 1M tokens |
Cost Optimization Tips
// 1. Appropriate model selection
const model = taskComplexity === 'high'
? 'claude-opus-4-5-20251101' // Complex tasks
: 'claude-haiku-20250314'; // Simple tasks
// 2. Utilizing prompt caching
const response = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
system: [{
type: 'text',
text: longSystemPrompt,
cache_control: { type: 'ephemeral' } // Enable caching
}],
messages: [{ role: 'user', content: userMessage }]
});
// 3. Batch processing
const batch = await client.batches.create({
requests: messages.map((msg, i) => ({
custom_id: `request-${i}`,
params: {
model: 'claude-haiku-20250314',
max_tokens: 1024,
messages: [{ role: 'user', content: msg }]
}
}))
});
Summary
The Claude 4 series becomes a powerful tool for developers.
Key Features
- Extended Thinking: Deep reasoning for complex problems
- Claude Code: AI-native development environment
- Computer Use: GUI operation automation
- MCP: Integration with external systems
Usage Points
- Complex coding tasks → Claude Opus 4.5
- Daily development work → Claude Sonnet 4
- Bulk processing / Real-time → Claude Haiku
By utilizing the Claude 4 series, significant efficiency improvements in the development process can be expected.