返回文档列表Back to docs

Claude Code 平替:兼容 API 接入 DeepSeekClaude Code Alternative: Connecting to DeepSeek via a Compatible API

保留命令行 Agent 工作流,把模型切到国内兼容 API。Keep your CLI agent workflow while switching the model to a domestic compatible API.

Claude CodeDeepSeek中等Medium超过 141 天未复核,建议重新确认

关键配置(点击复制)

Base URL
https://api.deepseek.com
推理模型
deepseek-reasoner
编码模型
deepseek-coder

Claude Code 平替:兼容 API 接入 DeepSeek

适合谁

  • 已习惯命令行 Agent 工作流
  • 想保留多轮任务循环和文件级修改能力
  • 希望把模型切到国内兼容 API

准备内容

  • 本地可用的 Claude Code 类命令行环境
  • DeepSeek API Key
  • 可写入的本地环境变量配置

关键配置

  • Base URL:https://api.deepseek.com
  • 推理模型:deepseek-reasoner
  • 编码模型:deepseek-coder

配置步骤

  1. 找到命令行 Agent 读取模型配置或环境变量的位置。
  2. 将 provider 改为 OpenAI-compatible 模式。
  3. 写入 Base URL、API Key 和默认模型。
  4. 先用单文件修改任务冒烟,再测试多文件和命令执行链路。

常见问题

  • 如果工具调用能力不稳定,先缩短任务链并减少一次性上下文。
  • 如果输出太发散,拆小任务并显式指定目标文件。
  • 如果报兼容性错误,确认客户端没有强依赖某个专有字段。

成本提醒

命令行 Agent 的成本波动会比编辑器内问答更大。复杂任务场景建议提前设定预算上限。

CreditsPlan 是 AI 服务的智能选型与购买决策引擎。CreditsPlan helps you choose AI services, compare tools, plans, prices and purchase options, and find the right solution for your needs.

Find the right AI. Pick the right plan. Pay the right price.