Documentation Index
Fetch the complete documentation index at: https://docs.laozhang.ai/llms.txt
Use this file to discover all available pages before exploring further.
Model Overview
Claude is a series of AI assistants developed by Anthropic, known for their safety, accuracy, and powerful reasoning capabilities. From the flagship Claude Sonnet 4.6 to the fast Claude Haiku 4.5, Claude models excel in code generation, long document analysis, complex reasoning, and more.Dual Compatibility: Supports both OpenAI format and Claude native format, choose according to your preference.
Model Classification
Claude 4.7 / 4.6 Series
Claude Sonnet 4.6
Claude Sonnet 4.6
Balanced current model for coding, analysis, and long text
-
Core Features:
- 1M context window
- Outstanding code generation capabilities
- Strong reasoning and analysis abilities
- Excellent long document processing
- Supports image understanding
-
Pricing:
- Check the console for real-time pricing
-
Suitable Scenarios:
- Complex code generation
- Technical document analysis
- Legal contract review
- Academic research
- Multi-turn complex conversations
Claude Haiku 4.5
Claude Haiku 4.5
Fast model, best cost-performance in Claude series
-
Core Features:
- 200K context window
- Fastest response speed
- Excellent cost-performance ratio
- Stable and reliable
-
Pricing:
- Check the console for real-time pricing
-
Suitable Scenarios:
- Daily conversations
- Quick queries
- Batch processing
- Customer service bots
Claude Opus / Legacy Series
Claude Opus 4.7
Claude Opus 4.7
Strongest reasoning capabilities, suitable for most complex tasks
-
Core Features:
- 1M context window
- Top-tier reasoning ability
- Strong multimodal understanding
- Excels at complex problem-solving
-
Pricing:
- Check the console for real-time pricing
-
Suitable Scenarios:
- Advanced research
- Complex decision analysis
- Professional consulting
- Critical business scenarios
Claude Sonnet 4.6
Claude Sonnet 4.6
Balanced model with excellent overall performance
-
Core Features:
- 1M context window
- Balanced performance and cost
- Strong reasoning ability
- Good image understanding
-
Pricing:
- Check the console for real-time pricing
-
Suitable Scenarios:
- Daily business applications
- Document analysis
- Content generation
- Technical support
Claude Haiku 4.5
Claude Haiku 4.5
Fast and economical, suitable for high-frequency calls
-
Core Features:
- 200K context window
- Extremely fast response
- Ultra-low price
- Stable quality
-
Pricing:
- Input: $0.25/1M tokens
- Output: $1.25/1M tokens
-
Suitable Scenarios:
- Real-time conversations
- Quick queries
- Mass text processing
- Low-budget projects
Usage Methods
Method 1: OpenAI Format (Recommended)
Use the familiar OpenAI SDK, fully compatible:Method 2: Claude Native Format
Use Anthropic’s official SDK for more native experience:Application Scenarios
1. Code Generation and Review
Claude Sonnet 4.6 excels at code-related tasks:2. Long Document Analysis
Leverage Claude’s 200K context window to process long documents:3. Complex Data Analysis
4. Creative Writing
5. Image Understanding
Current Claude 4 models support image understanding:Claude’s Unique Advantages
1. Built-in Safety
Claude models have strong content safety filtering built-in, effectively reducing risks of generating inappropriate content
- Automatically identifies and refuses harmful requests
- Reduces risk of generating biased content
- Suitable for scenarios with high safety requirements
2. Precise Instruction Following
Claude excels at understanding and executing complex, multi-step instructions:3. Deep Reasoning Ability
Claude excels at handling problems requiring complex reasoning:- Mathematical proof
- Logical reasoning
- Ethical dilemma analysis
- Strategy planning
4. Excellent Multilingual Ability
Claude has excellent language capabilities beyond English:Usage Tips
1. Choose the Right Model
| Scenario | Recommended Model | Reason |
|---|---|---|
| Code generation | Claude Sonnet 4.6 | Strongest code capabilities |
| Long documents | Claude Sonnet 4.6 | 200K context |
| Daily conversations | Claude Haiku 4.5 | Cost-effective, fast |
| Complex reasoning | Claude Opus 4.7 | Strongest reasoning |
| Batch processing | Claude Haiku 4.5 | Fastest speed, lowest price |
| Professional consulting | Claude Sonnet 4.6 | Accurate and reliable |
2. Optimize Prompts
Structured Instructions
Structured Instructions
Use numbered lists or step-by-step descriptions:
Provide Context
Provide Context
Give sufficient background information:
Specify Output Format
Specify Output Format
Clearly state the desired output format:
3. Parameter Tuning
Control output randomness:
0-0.3: Very deterministic (code, analysis, facts)0.7: Balanced (general conversation)1.0-1.5: More creative (creative writing, brainstorming)
Control output length:
- Code generation: 1000-2000
- Article writing: 2000-4000
- Detailed analysis: 4000-8000
Alternative to temperature:
0.9: Balanced0.95: More diverse- Generally use either temperature or top_p, not both
Cost Optimization
1. Model Selection Strategy
Development Phase
Use Claude Haiku 4.5
- Fast testing iteration
- Low cost
- Quick feedback
Production Phase
Choose based on needs:
- Simple tasks → Claude Haiku 4.5
- Complex tasks → Claude Sonnet 4.6
- Critical tasks → Claude Opus 4.7
2. Context Management
3. Caching Strategy
For repeated queries, consider caching results:Error Handling
Common Errors and Solutions
429: Rate Limit
429: Rate Limit
Solution: Implement exponential backoff retry
400: Invalid Request
400: Invalid Request
Common Causes:
- Incorrect model name
- Message format error
- Parameter out of range
500/502: Server Error
500/502: Server Error
Solution: Implement retry with delay
Best Practices
1. System Prompt Best Practices
2. Multi-turn Conversation Management
3. Streaming Response
For long responses, use streaming for better user experience:Compare with GPT-4
| Dimension | Claude Sonnet 4.6 | GPT-4o |
|---|---|---|
| Price | $3/1M (input) | $2.5/1M (input) |
| Context | 200K tokens | 128K tokens |
| Code Generation | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Reasoning Ability | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Safety | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Multilingual | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Response Speed | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Instruction Following | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
Related Resources
- Chat Completions API - Complete API documentation
- OpenAI Models - GPT series models guide
- Gemini Models - Google Gemini models guide
- Pricing - Detailed model pricing information