概述
Claude Code 是 Anthropic 官方推出的 CLI 编程助手。通过 Ling.AI,您可以使用 Claude Code 访问 Claude 全系模型。
配置步骤
1. 安装 Claude Code
bash
npm install -g @anthropic-ai/claude-code
2. 配置 Ling.AI API
bash
# 设置 Ling.AI API Key export ANTHROPIC_API_KEY="sk-xxxxxxxx" # 设置 Base URL export ANTHROPIC_BASE_URL="https://api.lingyuncx.com/anthropic"
3. 开始使用
bash
# 启动 Claude Code claude # 或指定模型 claude --model claude-sonnet-4-6
支持模型
| 模型 | 适用场景 |
|---|---|
claude-sonnet-4-6 | 日常编程、代码生成 |
claude-opus-4-6 | 复杂任务、架构设计 |
claude-3-5-sonnet | 快速迭代、代码审查 |
使用示例
bash
# 代码生成 claude "帮我写一个 Python 函数,计算斐波那契数列" # 代码审查 claude "审查这个文件的安全问题" src/main.py # 代码重构 claude "将这个函数改写为异步版本" src/utils.py
💡 提示
Claude Code 默认使用 Anthropic 协议,Ling.AI 已完整兼容,无需额外配置。