<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>claude-mem归档 - Liao&#039;s blog</title>
	<atom:link href="https://www.laobaiblog.top/tag/claude-mem/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.laobaiblog.top/tag/claude-mem/</link>
	<description>路漫漫其修远兮，吾将上下而求索</description>
	<lastBuildDate>Tue, 28 Apr 2026 05:23:06 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.laobaiblog.top/wp-content/uploads/2022/01/cropped-tyuu-32x32.png</url>
	<title>claude-mem归档 - Liao&#039;s blog</title>
	<link>https://www.laobaiblog.top/tag/claude-mem/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>用 DeepSeek 模型驱动 Claude Code + 安装 claude-mem 持久记忆插件</title>
		<link>https://www.laobaiblog.top/2026/04/28/deepseekapi_claude/</link>
		
		<dc:creator><![CDATA[大白]]></dc:creator>
		<pubDate>Tue, 28 Apr 2026 04:38:59 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[分享]]></category>
		<category><![CDATA[ai]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[cc]]></category>
		<category><![CDATA[claude]]></category>
		<category><![CDATA[claude-mem]]></category>
		<category><![CDATA[deepseek]]></category>
		<guid isPermaLink="false">https://www.laobaiblog.top/?p=624</guid>

					<description><![CDATA[<p>本文由Claude code+DeepSeek-V4-Flash编写 为什么这么做？ 1. Clau &#8230;</p>
<p><a href="https://www.laobaiblog.top/2026/04/28/deepseekapi_claude/">用 DeepSeek 模型驱动 Claude Code + 安装 claude-mem 持久记忆插件</a>最先出现在<a href="https://www.laobaiblog.top">Liao&#039;s blog</a>。</p>
]]></description>
										<content:encoded><![CDATA[<blockquote><p>
  本文由Claude code+DeepSeek-V4-Flash编写
</p></blockquote>
<h3>为什么这么做？</h3>
<h4>1. Claude 账号风险太高</h4>
<p>Claude 官方对账号的风控比较严格，尤其是国内用户，经常遇到莫名其妙的封号、IP 限制、支付卡被拒等问题。与其提心吊胆地养号，不如直接用国内大模型做底层引擎。DeepSeek 注册门槛低、无封号焦虑，用起来踏实。</p>
<h4>2. API 费用极其便宜</h4>
<p>DeepSeek V4 的 API 定价比 Claude 官方 API 便宜一到两个数量级。配合 Claude Code 的本地编辑模式，日常开发场景下 token 消耗可控，成本几乎可以忽略不计。不用再盯着用量生怕超支。</p>
<h4>3. claude-mem 插件的优势：上下文管理，省 token</h4>
<p>Claude Code 本身每次会话都是一次性的，切到新会话后之前的上下文就丢了。claude-mem 解决了这个痛点：</p>
<ul>
<li><strong>跨会话记忆</strong>：上次聊到哪、改过什么文件、做过什么决策，下次打开都能 recall</li>
<li><strong>节省 token</strong>：不需要每次手动粘贴背景信息，claude-mem 自动注入最相关的上下文，减少了冗余 prompt 的 token 消耗</li>
<li><strong>渐进式召回</strong>：按需检索，不会一股脑把全部历史塞进上下文，精确控制 token 开销</li>
</ul>
<p>三层加起来的效果就是：<strong>低风险 + 低成本 + 有记忆</strong>，日常编码体验比纯原版 Claude Code 还舒服。</p>
<hr />
<p>DeepSeek 也提供了 Anthropic 兼容 API，可以直接把 Claude Code 的底层模型换成 DeepSeek V4，同时再装上 claude-mem 插件让 Claude 拥有跨会话的持久记忆。整个过程很简单，记录一下。</p>
<hr />
<h3>一、获取 DeepSeek API Key</h3>
<p>首先去 <a class="wp-editor-md-post-content-link" href="https://platform.deepseek.com">DeepSeek 开放平台</a> 注册账号。</p>
<p><a class="wp-editor-md-post-content-link" href="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_8454c0cb591fb76d9ee447127db5f5fd.jpg"><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_8454c0cb591fb76d9ee447127db5f5fd.jpg" alt="" /></a></p>
<p>注册后在左侧导航栏找到 <strong>API Keys</strong>，点击 <strong>Create new secret key</strong>，给 Key 取个名字，创建后复制并保存好（弹窗关了就看不到了）。</p>
<p>API 模型价格如下（限时优惠）</p>
<p><a class="wp-editor-md-post-content-link" href="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_e1e8c1101ef5998f04dbdbc3e04fc6b3.jpg"><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_e1e8c1101ef5998f04dbdbc3e04fc6b3.jpg" alt="" /></a></p>
<p>API Key 的使用地址（Anthropic 兼容模式）：</p>
<pre><code class="line-numbers">https://api.deepseek.com/anthropic
</code></pre>
<p>参考官方文档：https://api-docs.deepseek.com/zh-cn/</p>
<hr />
<h3>二、 更新 Claude Code</h3>
<p>如果你是 Windows 环境，可以直接用 <code>winget</code> 更新：</p>
<pre><code class="language-powershell line-numbers">winget upgrade Anthropic.ClaudeCode
或
winget install Anthropic.ClaudeCode
</code></pre>
<p>更新过程如下：</p>
<p><a class="wp-editor-md-post-content-link" href="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_228a73b26ddb24e18a718115e620278f.jpg"><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_228a73b26ddb24e18a718115e620278f.jpg" alt="" /></a></p>
<p>更新完成后，建议先确认一下版本：</p>
<pre><code class="language-powershell line-numbers">claude --version
</code></pre>
<p>我这边更新后的版本如下：</p>
<p><a class="wp-editor-md-post-content-link" href="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_fa49022c8c9c899e5c5eeb317db60bc1.jpg"><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_fa49022c8c9c899e5c5eeb317db60bc1.jpg" alt="" /></a></p>
<h3>三、配置 Claude Code 的 settings.json</h3>
<p>Claude Code 的配置文件位置一般在：</p>
<p><a class="wp-editor-md-post-content-link" href="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_03ba161d22ba443d031eb3fae982fc63.jpg"><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_03ba161d22ba443d031eb3fae982fc63.jpg" alt="" /></a></p>
<pre><code class="language-text line-numbers">C:\Users\你的用户名\.claude\settings.json
</code></pre>
<p>找到 Claude Code 的配置文件 <code>settings.json</code>，填入以下内容：</p>
<pre><code class="language-json line-numbers">{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "&lt;你的 DeepSeek API Key&gt;",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash[1m]",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_EFFORT_LEVEL": "max"
  },
  "model": "opus"
}
</code></pre>
<p>关键点说明：</p>
<table>
<thead>
<tr>
<th>配置项</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ANTHROPIC_BASE_URL</code></td>
<td>指向 DeepSeek 的 Anthropic 兼容接口</td>
</tr>
<tr>
<td><code>ANTHROPIC_AUTH_TOKEN</code></td>
<td>替换成刚才复制的 API Key</td>
</tr>
<tr>
<td><code>ANTHROPIC_DEFAULT_OPUS_MODEL</code></td>
<td>设为 <code>deepseek-v4-pro</code>（最强推理）</td>
</tr>
<tr>
<td><code>ANTHROPIC_DEFAULT_SONNET_MODEL</code></td>
<td>同样可用 <code>deepseek-v4-pro</code></td>
</tr>
<tr>
<td><code>ANTHROPIC_DEFAULT_HAIKU_MODEL</code></td>
<td>设为 <code>deepseek-v4-flash</code>（快速响应）</td>
</tr>
<tr>
<td><code>CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC</code></td>
<td>设为 <code>1</code> 禁用非必要流量</td>
</tr>
<tr>
<td><code>CLAUDE_CODE_EFFORT_LEVEL</code></td>
<td>设为 <code>max</code> 获得最佳效果</td>
</tr>
</tbody>
</table>
<p>保存后重启 Claude Code，模型就切换完成了。</p>
<blockquote><p>
  <strong>注意：</strong> <code>[1m]</code> 后缀是模型标识的一部分，不要去掉。模型 <code>deepseek-chat</code> 和 <code>deepseek-reasoner</code> 将在 2026 年 7 月 24 日弃用，推荐直接使用 V4 系列。
</p></blockquote>
<hr />
<h3>三、安装 claude-mem 持久记忆插件</h3>
<p><a class="wp-editor-md-post-content-link" href="https://github.com/thedotmack/claude-mem">claude-mem</a> 是一款让 Claude Code 拥有跨会话持久记忆的开源插件，它会自动记录你的操作并生成语义摘要，在后续会话中注入相关上下文。</p>
<h4>安装方式一：通过 Claude Code 插件市场</h4>
<p>在 Claude Code 会话中依次执行：</p>
<pre><code class="language-json line-numbers">/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
/reload-plugins
</code></pre>
<h4>安装方式二：一行命令安装（推荐）</h4>
<pre><code class="language-bash line-numbers">npx claude-mem install
</code></pre>
<h3>安装后的检查</h3>
<p>确认插件正常工作：</p>
<pre><code class="language-bash line-numbers"># 查看记忆数据库中的记录数
sqlite3 ~/.claude-mem/claude-mem.db "SELECT count(*) FROM observations;"

# 健康检查
curl http://localhost:37777/health
</code></pre>
<p>如果记录数 > 0，说明已经在工作了。</p>
<h4>常见踩坑</h4>
<ol>
<li><strong>安装范围选&#8221;为本用户安装&#8221;</strong>，不要选 project 或 local</li>
<li><strong>Worker 起不来？</strong> 检查 Bun 是否正常安装，可以手动装一下</li>
<li><strong>默认模型不对？</strong> 修改 <code>~/.claude-mem/settings.json</code>：</li>
</ol>
<pre><code class="language-json line-numbers">{
  "CLAUDE_MEM_MODEL": "sonnet",
  "CLAUDE_MEM_MODE": "code--zh"
}
</code></pre>
<ol start="4">
<li><strong>修改配置后重启 worker：</strong></li>
</ol>
<pre><code class="language-bash line-numbers">cd ~/.claude/plugins/marketplaces/thedotmack
npm run worker:restart
</code></pre>
<hr />
<h3>四、最终效果</h3>
<p>配置完成后，你的 Claude Code 变成了：</p>
<ul>
<li><strong>引擎：</strong> DeepSeek V4 模型（Pro 负责推理、Flash 负责快速响应）</li>
<li><strong>记忆：</strong> claude-mem 提供跨会话上下文（打开 Web UI <code>http://localhost:37777</code> 可以实时查看记忆流）</li>
<li><strong>成本：</strong> DeepSeek API 价格远低于原版 Claude API</li>
</ul>
<p><img decoding="async" src="https://www.laobaiblog.top/wp-content/uploads/2026/04/wp_editor_md_e0b9f7daba4484d885feac440225716e.jpg" alt="" /></p>
<h3>参考资料</h3>
<ul>
<li><a class="wp-editor-md-post-content-link" href="https://api-docs.deepseek.com/zh-cn/">DeepSeek API 官方文档</a></li>
<li><a class="wp-editor-md-post-content-link" href="https://platform.deepseek.com">DeepSeek 开放平台</a></li>
<li><a class="wp-editor-md-post-content-link" href="https://github.com/thedotmack/claude-mem">claude-mem GitHub</a></li>
<li><a class="wp-editor-md-post-content-link" href="https://github.com/thedotmack/claude-mem/blob/main/docs/i18n/README.zh.md">claude-mem 中文安装指南</a></li>
</ul>
<p><a href="https://www.laobaiblog.top/2026/04/28/deepseekapi_claude/">用 DeepSeek 模型驱动 Claude Code + 安装 claude-mem 持久记忆插件</a>最先出现在<a href="https://www.laobaiblog.top">Liao&#039;s blog</a>。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
