Quick Installation
1. Install Plugin
Search for “Cline” in VS Code extension store and install2. Configure APIYI
- Click the Cline icon on the left
- Click settings button (gear icon)
- Select OpenAI Compatible
- Configure parameters:
- Base URL:
https://api.apiyi.com/v1 - API Key: Your APIYI key
- Model Name: Enter model name
- Base URL:
Recommended Models
🎯 Programming Development First Choice
claude-sonnet-4-20250514⭐ (Claude 4 latest, extremely strong programming)o4-mini(OpenAI reasoning model, first choice for programming tasks)gemini-2.5-pro⭐ (2M context, strong multimodal)deepseek-coder(Code-specialized model, 128K context)
💡 Complex Reasoning Tasks
o3⭐ (Latest reasoning model, significantly reduced pricing)claude-sonnet-4-20250514-thinking(Claude 4 chain-of-thought mode)deepseek-r1⭐ (Latest reasoning model, 64K context)grok-3-mini(Lightweight model with reasoning)
🚀 Fast Response
gpt-3.5-turbo(Classic model, high cost-performance)gemini-2.5-flash⭐ (Fast, low cost, 1M context)claude-3-haiku(Lightweight fast version, 200K context)gpt-4o-mini(Lightweight fast version, 128K context)
💰 Super Cost-Effective
deepseek-chat(128K context, strong overall capability)qwen-turbo(Alibaba Qwen fast version)gpt-4.1-nano(Ultra-low cost version, 128K context)
Core Features
Smart Code Completion
Code Explanation
Select code snippet and use:Cline: Explain Code: Explain codeCline: Explain Error: Explain errors
Code Refactoring
- Performance Optimization: Provide optimization suggestions
- Improve Readability: Refactor complex code
- Fix Issues: Auto-fix common problems
Generate Tests
Common Commands
| Command | Shortcut | Function |
|---|---|---|
| Cline: Ask | Ctrl+Shift+L | Ask AI |
| Cline: Explain | Ctrl+Shift+E | Explain code |
| Cline: Refactor | Ctrl+Shift+R | Refactor code |
| Cline: Generate | Ctrl+Shift+G | Generate code |
Advanced Features
Multi-File Operations
Cline can understand and operate on multiple related files:Architecture Design
Generate project architecture:Code Review
Usage Tips
1. Context Management
Provide better context:2. Custom Prompts
Configure in settings:3. Project-Level Configuration
Create.cline/config.json:
Troubleshooting
Connection Failed
Check configuration:- Base URL:
https://api.apiyi.com/v1 - API key is valid
- Network connection is normal
Response Timeout
Solutions:- Use faster models
- Reduce request complexity
- Break down large tasks
Poor Generation Quality
Improvement methods:- Provide more context
- Use more powerful models
- Specify requirements clearly
Best Practices
1. Model Selection Strategy
| Task Type | Recommended Model | Cost Level | Reason |
|---|---|---|---|
| Simple Completion | gpt-3.5-turbo / gemini-2.5-flash | Very Low | Fast, low cost |
| Code Generation | claude-sonnet-4-20250514 / o4-mini | Medium | Strongest programming |
| Complex Reasoning | o3 / deepseek-r1 | Medium-Low | Strong reasoning, o3 price reduced |
| Architecture Design | deepseek-r1 + claude-4-sonnet | Low | Plan first, implement later, save cost |
| Code Review | gemini-2.5-pro / claude-4-sonnet | Medium | Long context, strong understanding |
| Batch Refactoring | deepseek-chat / qwen-turbo | Very Low | Fast and economical |
| Documentation | gpt-4.1 / qwen-max | Medium-Low | Natural expression |
| Long Text Processing | gemini-2.5-pro (2M) | Medium | Ultra-long context |
2. Prompt Optimization
3. Progressive Development
- Generate basic framework first
- Gradually add features
- Finally optimize performance
- Add error handling
4. Security Awareness
- Don’t include sensitive information in code
- Review AI-generated code
- Verify third-party dependencies
- Watch for security vulnerabilities
Integration Workflow
Git Integration
Test-Driven Development
- Write test cases first
- Cline generates implementation code
- Run tests to verify
- Iterate and optimize
CI/CD Integration
Generate configuration files:Token Optimization & Cost Control
1. Monitor Token Usage
- Real-time Monitoring: Check estimated cost in Cline sidebar
- Session Limits: Keep sessions short, avoid context accumulation
- Regular Reset: Complete long tasks in multiple sessions
2. Smart Model Switching
3. Using .clinerules Configuration
Create.clinerules file in project root:
4. Alternative Solutions to Reduce Cost
GitHub Copilot Pro Integration
- Monthly fee only $10, unlimited use
- Use through VSCode LM API
- Suitable for high-frequency scenarios
Local Models (Ollama)
Use Domestic Models to Reduce Cost
qwen-turbo(Alibaba Qwen)glm-4(Zhipu Tsinghua)ernie-4.0(Baidu Wenxin)
5. Cache Optimization
- Use services like Requesty Router
- Can save over 50% API cost
- Auto-cache repeated requests
Advanced Best Practices
1. Plan/Act Mode Usage
- Plan Mode: For design and review, read-only
- Act Mode: Direct implementation, suitable for simple tasks
- Model Memory: Cline remembers model preference for each mode
2. Context Management Skills
3. Task Management System
- Bookmark Important Conversations: Use star feature
- Export Valuable Content: Save as Markdown
- Task Sorting: Sort by cost, Token usage
- Batch Cleanup: Regularly clean low-value sessions
4. Avoid Token Explosion
5. Cost-Benefit Analysis
| Scenario | Traditional Dev Time | Cline Cost | Time Saved | ROI |
|---|---|---|---|---|
| CRUD Module | 4 hours | $5-10 | 3.5 hours | Very High |
| Complex Refactoring | 2 days | $20-50 | 1.5 days | High |
| Architecture Design | 1 week | $50-100 | 5 days | High |
6. Workflow Optimization
Performance Optimization
1. Model Switching
Choose model based on task:- Development phase: Lightweight models
- Complex tasks: Advanced models
- Production: Balance performance and cost
2. Caching Strategy
- Enable response caching
- Cache common code snippets
- Regularly clean cache
3. Request Optimization
- Batch related requests
- Use streaming responses
- Set reasonable timeouts