OpenAI 兼容提供方¶
Claude-mem 可以对任何支持 OpenAI /chat/completions 形状的端点运行观察提取。将 CLAUDE_MEM_PROVIDER 设为 openai-compatible,选择一个预设(或提供 base URL),记忆功能就会完全脱离你的 Claude 套餐运行。
Note
claude-mem observer:在 npx claude-mem install 期间选择 claude-mem observer,即可在无需任何配置的情况下让记忆功能脱离套餐运行。本页介绍的是自带端点和密钥的方式。
为什么这独立于 OpenRouter 提供方¶
CLAUDE_MEM_OPENROUTER_BASE_URL 已经允许 OpenRouter 客户端与任何 OpenAI 兼容端点通信,而且它仍然可用——那条路径上的任何东西都没有改变。但它携带了三样专属于 openrouter.ai 的东西:
- 归属标头。
HTTP-Referer和X-Title会被发送到 base URL 所指的任何主机,因此将其指向 NVIDIA 时,等于向 NVIDIA 宣告 claude-mem 的 OpenRouter 身份。 usage: { include: true },仅当 URL 中包含openrouter.ai时才启用。- cmem.ai 网关的凭据固定规则,这些规则决定持久化的 base URL 何时固定持久化的密钥。这些规则的存在是为了确保账户下发的网关凭据绝不会被发送到别处——这是正确的做法,但与你自行配置的端点无关;不过你仍然与 OpenRouter 共用相同的三个设置键。
该提供方拥有自己的设置键。请求体默认为 model、messages、temperature、max_tokens 和 reasoning: { enabled: false },这样推理模型就不会把输出上限耗在思考上,然后返回空的观察结果。将 CLAUDE_MEM_OPENAI_COMPAT_REASONING 设为 on,即可把推理交给端点处理。如果严格的服务器(尤其是 vLLM)不接受 reasoning 字段,claude-mem 会去掉该字段后重发一次请求。max_tokens 的值来自 CLAUDE_MEM_OBSERVER_MAX_OUTPUT_TOKENS(默认为 4096);如果模型只接受 max_completion_tokens,则会改用该字段重发请求。
claude-mem observer 的密钥(cm_pro_…)绝不会发送到这些端点。请使用端点签发的密钥。
快速开始:NVIDIA NIM¶
1. 获取密钥
登录 build.nvidia.com 并创建 API 密钥。该密钥以 nvapi- 开头。NVIDIA 托管的模型初期免费,非常适合观察提取:它量大、结构化,而且不需要前沿模型。
2. 让 claude-mem 指向它
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "nvidia-nim",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "nvapi-..."
}
或者不把密钥写进 settings.json,而是放进 ~/.claude-mem/.env:
3. 选择模型(可选)
该预设默认使用一个由 NVIDIA 提供的小型快速模型。build.nvidia.com 上的任何模型 id 都可以使用,并按原样传递:
4. 重启 Worker Service
预设¶
预设只提供默认的 base URL 和默认模型。预设设置的任何内容都会被对应的设置覆盖,因此切换预设绝不会改动你自己固定的端点或模型。
| 预设 | Base URL | 是否需要密钥 |
|---|---|---|
nvidia-nim |
https://integrate.api.nvidia.com/v1 |
是 |
orcarouter |
https://api.orcarouter.ai/v1 |
是 |
api-route |
https://global.api-route.com/v1 |
是 |
opper |
https://api.opper.ai/v3/compat |
是 |
atlascloud |
https://api.atlascloud.ai/v1 |
是 |
runcrate |
https://api.runcrate.ai/v1 |
是 |
deepseek |
https://api.deepseek.com/v1 |
是 |
opencode-go |
https://opencode.ai/zen/go/v1 |
是 |
opencode-zen |
https://opencode.ai/zen/v1 |
是 |
groq |
https://api.groq.com/openai/v1 |
是 |
together |
https://api.together.xyz/v1 |
是 |
minimax |
https://api.minimax.io/v1 |
是 |
minimax-cn |
https://api.minimaxi.com/v1 |
是 |
iflytek |
https://maas-api.cn-huabei-1.xf-yun.com/v2 |
是 |
ollama |
http://localhost:11434/v1 |
否 |
lmstudio |
http://localhost:1234/v1 |
否 |
vllm |
http://localhost:8000/v1 |
否 |
custom |
——自行设置 | 否 |
Note
本地预设需要模型 id——claude-mem 无法猜测你加载了哪个模型。请将 CLAUDE_MEM_OPENAI_COMPAT_MODEL 设置为 ollama list(或你的服务器)报告的模型;否则该提供方会报告自身未配置,调度将回退到 Claude。
OpenCode Go 与 Zen¶
此处的 OpenCode Go 订阅或 Zen 密钥均可使用。opencode-go 默认使用 kimi-k3;opencode-zen 不带默认模型,因此也需要设置模型。可从 https://opencode.ai/zen/go/v1/models 或 https://opencode.ai/zen/v1/models 选择 id。只有通过 /chat/completions 提供的模型才可用。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "opencode-zen",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your OpenCode key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "deepseek-v4-flash"
}
设置¶
| 设置 | 默认值 | 描述 |
|---|---|---|
CLAUDE_MEM_PROVIDER |
claude |
设置为 openai-compatible 以选择该提供方 |
CLAUDE_MEM_OPENAI_COMPAT_PRESET |
''(= custom) |
上表中的命名端点预设 |
CLAUDE_MEM_OPENAI_COMPAT_BASE_URL |
预设的 | OpenAI 兼容 base URL。若缺少 /chat/completions,会自动追加 |
CLAUDE_MEM_OPENAI_COMPAT_MODEL |
预设的 | 模型 id,按原样传递 |
CLAUDE_MEM_OPENAI_COMPAT_REASONING |
''(= off) |
off 在每次请求中发送 reasoning: { enabled: false }。on 将推理交给端点 |
CLAUDE_MEM_OPENAI_COMPAT_API_KEY |
'' |
API 密钥。也会从 ~/.claude-mem/.env 中的 OPENAI_COMPAT_API_KEY 读取 |
CLAUDE_MEM_OPENAI_COMPAT_API_KEYS |
'' |
用于轮换的额外密钥——参见多密钥轮换 |
未知的预设 id 会降级为 custom,而不会报错,因为设置是在状态轮询期间读取的,拼写错误不应导致一次轮询崩溃。
`block. claude-mem removes a leading block like that on every preset (it also covers DeepSeek R1 or Qwen3 on Ollama and vLLM), so the reasoning is never stored or re-sent with the next request."
Translation: "M2 系列等推理模型可能会以 <think>…</think> 块开头回复。claude-mem 会在所有预设上移除此类开头的块(这也涵盖 Ollama 和 vLLM 上的 DeepSeek R1 或 Qwen3),因此推理内容绝不会被存储或随下一次请求重新发送。"
iFlytek Spark:¶
"iflytek points at iFlytek's Astron MaaS platform and defaults to spark-x2.5. Keys come from the MaaS console. The preset's base URL is the pay-as-you-go endpoint; a Token Plan key is only accepted on the Token Plan endpoint, so set the base URL as well:"
Translation: "iflytek 指向 iFlytek 的 Astron MaaS 平台,默认使用 spark-x2.5。密钥来自 MaaS 控制台。该预设的基础 URL 是按量付费端点;Token Plan 密钥仅在 Token Plan 端点上被接受,因此请一并设置基础 URL:"
"A key used on the other endpoint is rejected with a 403 (11200). spark-x2.5 returns its reasoning in a separate reasoning_content field, which claude-mem ignores, so only the answer is stored."
Translation: "在其他端点上使用密钥会被拒绝,返回 403(11200)。spark-x2.5 在单独的 reasoning_content 字段中返回其推理内容,claude-mem 会忽略该字段,因此只存储答案。"
Any other endpoint:¶
Code block stays.
When a key is required:¶
"Setting CLAUDE_MEM_OPENAI_COMPAT_BASE_URL replaces the preset's endpoint, so whether a key is needed is decided by the endpoint you pointed at, not by the preset name you started from:"
Translation: "设置 CLAUDE_MEM_OPENAI_COMPAT_BASE_URL 会替换预设的端点,因此是否需要密钥取决于您指向的端点,而非您所依据的预设名称:"
Table:
| Endpoint | Key required |
|---|---|
localhost, 127.0.0.1, [::1], *.local |
No |
A private network address (10.x, 192.168.x, 172.16–31.x) |
No |
| Anything else | Yes |
Translate the prose in table cells:
- "Key required" -> "是否需要密钥"
- "No" -> "否"
- "A private network address (10.x, 192.168.x, 172.16–31.x)" -> "私有网络地址(10.x、192.168.x、172.16–31.x)"
- "Anything else" -> "其他任何地址"
- "Yes" -> "是"
"Without an override, the preset decides — the hosted presets need a key, the local ones do not."
Translation: "未设置覆盖时,由预设决定——托管预设需要密钥,本地预设则不需要。"
"A remote endpoint that genuinely needs no authentication still works: set CLAUDE_MEM_OPENAI_COMPAT_API_KEY to any non-empty value. The default errs toward asking for a key because the alternative is a provider that reports itself ready and then fails every observation with a 401."
Translation: "对于真正无需认证的远程端点,仍然可以正常工作:将 CLAUDE_MEM_OPENAI_COMPAT_API_KEY 设置为任意非空值即可。默认行为倾向于要求密钥,因为另一种情况是提供商报告自身就绪,随后每次观察都因 401 而失败。"
OrcaRouter:¶
"OrcaRouter serves provider-scoped model ids, such as openai/gpt-4o-mini (the preset's default) or anthropic/claude-haiku-4.5, behind one sk-orca- key. Its model list is public at https://api.orcarouter.ai/v1/models."
Translation: "OrcaRouter 在一个 sk-orca- 密钥后面提供带提供商前缀的模型 ID,例如 openai/gpt-4o-mini(该预设的默认值)或 anthropic/claude-haiku-4.5。其模型列表公开于 https://api.orcarouter.ai/v1/models。"
API Route:¶
"API Route uses the api-route preset with an API Route key. It has no default model: set CLAUDE_MEM_OPENAI_COMPAT_MODEL to an exact model id available to your account on https://global.api-route.com/v1/models. Choose a model served on /chat/completions; the id is passed verbatim."
Translation: "API Route 使用 api-route 预设和 API Route 密钥。它没有默认模型:请将 CLAUDE_MEM_OPENAI_COMPAT_MODEL 设置为您的账户在 https://global.api-route.com/v1/models 上可用的确切模型 ID。选择在 /chat/completions 上提供的模型;该 ID 会被原样传递。"
"Alternatively, store the key as OPENAI_COMPAT_API_KEY in ~/.claude-mem/.env. Restart the worker after changing the configuration. Without a model or key, this provider is unconfigured and dispatch falls through to Claude."
Translation: "或者,将密钥以 OPENAI_COMPAT_API_KEY 的形式存储在 ~/.claude-mem/.env 中。更改配置后请重启工作进程(worker)。如果没有模型或密钥,此提供商将处于未配置状态,调度会回退到 Claude。"
Wait - "worker" - should I translate it? It's mentioned as "Restart the worker". The domain term list includes "Worker Service" which should be kept. "worker" itself is a generic word here. I could keep it in English or translate as "工作进程". Given "Worker Service" is a domain term, maybe keep "worker" in English to be consistent. Let me write "重启 worker" using English term in code-ish? Actually "worker" isn't in the code formatting. Hmm. The term list says "Worker Service" exactly. But here it's just "worker". I think keeping "worker" is safer. I'll write "重启 worker" or "重启工作进程". Let me think... The rule says don't translate API names, etc. "worker" is somewhat generic. In Chinese technical docs, "worker" often is kept as-is. I'll keep it as "worker" to avoid confusion.
Actually, let me reconsider. The phrase "Restart the worker" - claude-mem has a worker process. I'll translate as "重启 worker(工作进程)" or just "重启 Worker". Hmm, I'd rather keep it simple: "更改配置后重启 worker。"
Opper:¶
"Opper is an EU-hosted gateway with one OpenAI-compatible API and one key for 700+ models. Model ids are pooled names such as gpt-5.4-mini (the preset's default) or claude-haiku-4-5, and Opper picks the route per request. A provider/model id such as aws/claude-haiku-4-5-eu pins one provider and region. The catalogue is public at https://api.opper.ai/v3/models, and keys come from platform.opper.ai."
Translation: "Opper 是一个欧盟托管网关,提供一个 OpenAI 兼容 API 和一个适用于 700+ 模型的密钥。模型 ID 是池化名称,例如 gpt-5.4-mini(该预设的默认值)或 claude-haiku-4-5,Opper 会按请求选择路由。类似 aws/claude-haiku-4-5-eu 的 provider/model ID 会将提供商标识和地区固定下来。其目录公开于 https://api.opper.ai/v3/models,密钥来自 platform.opper.ai。"
Atlas Cloud:¶
"Atlas Cloud serves models from DeepSeek, Z.ai, Moonshot, Qwen and other vendors behind one OpenAI-compatible API key. Model ids are vendor-prefixed, such as deepseek-ai/deepseek-v4-flash (the preset's default) or zai-org/glm-5.3, and are passed verbatim. The model list is public at https://api.atlascloud.ai/v1/models, and keys come from console.atlascloud.ai."
Translation: "Atlas Cloud 在一个 OpenAI 兼容 API 密钥后面提供来自 DeepSeek、Z.ai、Moonshot、Qwen 等厂商的模型。模型 ID 带有厂商前缀,例如 deepseek-ai/deepseek-v4-flash(该预设的默认值)或 zai-org/glm-5.3,并且会被原样传递。模型列表公开于 https://api.atlascloud.ai/v1/models,密钥来自 console.atlascloud.ai。"
Runcrate:¶
"Runcrate is a GPU cloud that also serves open models such as DeepSeek V4.1 Flash, GLM-5.3, Qwen3.8 Flash and gpt-oss 120B behind one OpenAI-compatible API key. Model ids are vendor-prefixed, such as deepseek-ai/DeepSeek-V4.1-Flash (the preset's default) or zai-org/GLM-5.3, and are passed verbatim. The model list is public at https://api.runcrate.ai/v1/models, and keys come from the Runcrate dashboard."
Translation: "Runcrate 是一个 GPU 云平台,还提供一个 OpenAI 兼容 API 密钥来服务 DeepSeek V4.1 Flash、GLM-5.3、Qwen3.8 Flash 和 gpt-oss 120B 等开放模型。模型 ID 带有厂商前缀,例如 deepseek-ai/DeepSeek-V4.1-Flash(该预设的默认值)或 zai-org/GLM-5.3,并且会被原样传递。模型列表公开于 https://api.runcrate.ai/v1/models,密钥来自 Runcrate 仪表盘。"
Hmm, "the Runcrate dashboard" - should I translate the link text? It's prose. "仪表盘" is a good translation for dashboard. I'll use "Runcrate 仪表盘".
Now, let me also double-check punctuation. In Chinese, I should use full-width punctuation like 。,:; etc. But I need to keep the Markdown structure.
One thing: the em-dash "—" is used. In Chinese, I can keep "—" or use "——". I'll use "——" for the em-dash cases.
Let me also verify the code blocks are preserved exactly. Yes, I must copy them verbatim.
Let me also think about terms like "preset" - should it be "预设"? Yes, that's fine. "base URL" - "基础 URL". "endpoint" - "端点". "model id" - "模型 ID". "API key" - "API 密钥". "provider" - "提供商". "reasoning" - "推理". "observation" - "观察". These are reasonable translations.
Actually wait - in the intro, it says "The viewer's Settings → Advanced panel edits the provider, preset, base URL and model." This is a domain-specific UI. "查看器的设置 → 高级面板" works. "provider" could also be "提供商" or "提供方". I'll use "提供商". "preset" - "预设". OK.
Now let me consider the bold formatting. "Settings → Advanced" - the bold is on English text. I could translate but keep bold. "设置 → 高级". The arrow → is unicode, fine to keep.
Let me review punctuation in each translated part. Also, I notice "claude-mem" is the product name - keep as is. "Ollama" and "vLLM" are brand names - keep.
Let me assemble the full translation now. I need to output only the translated Markdown, no preamble, no code fence.
Let me check heading anchors again: - "## MiniMax" -> "## MiniMax {#minimax}" - "## iFlytek Spark" -> "## iFlytek Spark {#iflytek-spark}" - "## Any other endpoint" -> "## 其他端点 {#any-other-endpoint}" - "### When a key is required" -> "### 何时需要密钥 {#when-a-key-is-required}" - "## OrcaRouter" -> "## OrcaRouter {#orcarouter}" - "## API Route" -> "## API Route {#api-route}" - "## Opper" -> "## Opper {#opper}" - "## Atlas Cloud" -> "## Atlas Cloud {#atlas-cloud}" - "## Runcrate" -> "## Runcrate {#runcrate}"
These look right.
Now let me finalize the translation text.
Intro:
查看器的设置 → 高级面板可编辑提供商、预设、基础 URL 和模型。API 密钥仅通过 ~/.claude-mem/settings.json 或 ~/.claude-mem/.env 设置,绝不通过查看器设置。
MiniMax¶
minimax 是 MiniMax 的全球端点,minimax-cn 是中国大陆端点;请使用与您的账户所在地区匹配的预设。两者默认使用 MiniMax-M3。MiniMax 提供的任何模型 ID 都会原样传递,包括 MiniMax-M2.7 等旧版 ID。
若要改用 M3.1 Flash,请显式设置其模型 ID。观察器默认发送 reasoning: { enabled: false },因此 Flash 不会在每次观察时以 max 强度运行其自适应思考。将 CLAUDE_MEM_OPENAI_COMPAT_REASONING 设为 on 即可将思考交由 MiniMax 处理。Flash 可能还需要 MiniMax Token Plan 而非按量付费。请参阅 MiniMax OpenAI API 参考文档。
M2 系列等推理模型可能会以 <think>…</think> 块开头回复。claude-mem 会在所有预设上移除此类开头的块(这也涵盖 Ollama 和 vLLM 上的 DeepSeek R1 或 Qwen3),因此推理内容绝不会被存储或随下一次请求重新发送。
iFlytek Spark¶
iflytek 指向 iFlytek 的 Astron MaaS 平台,默认使用 spark-x2.5。密钥来自 MaaS 控制台。该预设的基础 URL 是按量付费端点;Token Plan 密钥仅在 Token Plan 端点上被接受,因此请一并设置基础 URL:
[code block]
在其他端点上使用密钥会被拒绝,返回 403(11200)。spark-x2.5 在单独的 reasoning_content 字段中返回其推理内容,claude-mem 会忽略该字段,因此只存储答案。
其他端点¶
[code block]
何时需要密钥¶
设置 CLAUDE_MEM_OPENAI_COMPAT_BASE_URL 会替换预设的端点,因此是否需要密钥取决于您指向的端点,而非您所依据的预设名称:
| 端点 | 是否需要密钥 |
|---|---|
localhost、127.0.0.1、[::1]、*.local |
否 |
私有网络地址(10.x、192.168.x、172.16–31.x) |
否 |
| 其他任何地址 | 是 |
未设置覆盖时,由预设决定——托管预设需要密钥,本地预设则不需要。
对于真正无需认证的远程端点,仍然可以正常工作:将 CLAUDE_MEM_OPENAI_COMPAT_API_KEY 设置为任意非空值即可。默认行为倾向于要求密钥,因为另一种情况是提供商报告自身就绪,随后每次观察都因 401 而失败。
OrcaRouter¶
OrcaRouter 在一个 sk-orca- 密钥后面提供带提供商前缀的模型 ID,例如 openai/gpt-4o-mini(该预设的默认值)或 anthropic/claude-haiku-4.5。其模型列表公开于 https://api.orcarouter.ai/v1/models。
[code block]
API Route¶
API Route 使用 api-route 预设和 API Route 密钥。它没有默认模型:请将 CLAUDE_MEM_OPENAI_COMPAT_MODEL 设置为您的账户在 https://global.api-route.com/v1/models 上可用的确切模型 ID。选择在 /chat/completions 上提供的模型;该 ID 会被原样传递。
[code block]
或者,将密钥以 OPENAI_COMPAT_API_KEY 的形式存储在 ~/.claude-mem/.env 中。更改配置后请重启 worker。如果没有模型或密钥,此提供商将处于未配置状态,调度会回退到 Claude。
Opper¶
Opper 是一个欧盟托管的网关,提供一个 OpenAI 兼容 API 和一个适用于 700+ 模型的密钥。模型 ID 是池化名称,例如 gpt-5.4-mini(该预设的默认值)或 claude-haiku-4-5,Opper 会按请求选择路由。类似 aws/claude-haiku-4-5-eu 的 provider/model ID 会固定提供商和地区。其目录公开于 https://api.opper.ai/v3/models,密钥来自 platform.opper.ai。
[code block]
Atlas Cloud¶
Atlas Cloud 在一个 OpenAI 兼容 API 密钥后面提供来自 DeepSeek、Z.ai、Moonshot、Qwen 等厂商的模型。模型 ID 带有厂商前缀,例如 deepseek-ai/deepseek-v4-flash(该预设的默认值)或 zai-org/glm-5.3,并且会被原样传递。模型列表公开于 https://api.atlascloud.ai/v1/models,密钥来自 console.atlascloud.ai。
[code block]
Runcrate¶
Runcrate 是一个 GPU 云平台,还提供服务 DeepSeek V4.1 Flash、GLM-5.3、Qwen3.8 Flash 和 gpt-oss 120B 等开放模型的 OpenAI 兼容 API 密钥。模型 ID 带有厂商前缀,例如 deepseek-ai/DeepSeek-V4.1-Flash(该预设的默认值)或 zai-org/GLM-5.3,并且会被原样传递。模型列表公开于 https://api.runcrate.ai/v1/models,密钥来自 Runcrate 仪表盘。
[code block]
Wait, for the table row with localhost, I changed the vertical bars pattern. Actually the original table is:
| Endpoint | Key required |
|---|---|
localhost, 127.0.0.1, [::1], *.local |
No |
A private network address (10.x, 192.168.x, 172.16–31.x) |
No |
| Anything else | Yes |
The code in the first row is localhost, 127.0.0.1, [::1], *.local. I need to keep the inline code intact. The comma between them is prose, I can render as localhost、127.0.0.1、[::1]、*.local with Chinese enumeration comma. That's fine.
In the second row, 10.x, 192.168.x, 172.16–31.x inside parentheses - I'll use Chinese parentheses( )and Chinese enumeration commas.
Now, double check: the 172.16–31.x contains an en dash "–". I should keep it as is since it's code.
One concern: "MaaS 控制台" - MaaS is kept because it's a brand acronym. "控制台" translates "console". Good.
"Astron MaaS platform" - "Astron MaaS 平台". Good.
Another thought on "worker": maybe "工作进程" is clearer. But given the domain terms list has "Worker Service" untranslated, and "worker" likely refers to the claude-mem worker service. I think keeping "worker" is fine. Let me use "Worker" capitalized? The original has lowercase "worker". I'll keep "worker" lowercase.
Hmm, but in Chinese text, English words often get wrapped in spaces. "重启 worker" and "调度会回退到 Claude" - "回退到 Claude" is fine, though "fall through to Claude" might better be "回退到 Claude" or "落到 Claude". I'll use "回退到 Claude".
Let me check "pooled names" - "池化名称" is a good technical translation.
"pins one provider and region" - "固定提供商和地区" or "锁定一个提供商和地区". I'll use "锁定".
Actually, let me reconsider: "A provider/model id such as aws/claude-haiku-4-5-eu pins one provider and region." -> "类似 aws/claude-haiku-4-5-eu 这样的 provider/model ID 会锁定一个提供商和地区。" That's better.
Regarding "pooled names" - "池化名称" works. Or "聚合名称"? "池化" is used in ML contexts (pooling). Hmm, "pooled names" here means shared/pooled model names that route to different providers. I'll go with "池化名称" - it's understandable. Actually "共享名称" might be clearer. Let me keep "池化名称" as it matches the pool concept.
Also, "an OpenAI-compatible API" - domain term "OpenAI" and "API" kept. "OpenAI 兼容 API" good.
"EU-hosted gateway" - "欧盟托管的网关". Good.
Let me also reconsider "观察器" for "observer". The claude-mem observer is a component that observes sessions. "观察器" is fine. Alternatively "observer" could be kept. But I'll translate.
"adaptive thinking at max effort" - "以 max 强度运行其自适应思考". Good.
"Token Plan" is a MiniMax product term - keep as is.
"pay-as-you-go" - "按量付费". Good.
Now the heading "Any other endpoint" - I translated to "其他端点". The anchor is {#any-other-endpoint}. Good.
Let me verify the code blocks exactly match the original. I need to copy them verbatim:
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "minimax",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<key from platform.minimax.io>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "MiniMax-M3.1-Flash"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "iflytek",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your MaaS key>",
"CLAUDE_MEM_OPENAI_COMPAT_BASE_URL": "https://maas-token-api.cn-huabei-1.xf-yun.com/v2"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_BASE_URL": "https://my-gateway.example.com/v1",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "my-model-id",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "..."
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "orcarouter",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "sk-orca-...",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "anthropic/claude-haiku-4.5"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "api-route",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your API Route key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "<your chat-completions model id>"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "opper",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Opper key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "claude-haiku-4-5"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "atlascloud",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Atlas Cloud key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "deepseek-ai/deepseek-v4-flash"
}
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "runcrate",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Runcrate key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "deepseek-ai/DeepSeek-V4.1-Flash"
}
Wait, the Runcrate section in the prompt doesn't show a code block! Let me re-read the original:
"## Runcrate
Runcrate is a GPU cloud that also serves open models such as DeepSeek V4.1 Flash, GLM-5.3, Qwen3.8 Flash and gpt-oss 120B behind one OpenAI-compatible API key. Model ids are vendor-prefixed, such as deepseek-ai/DeepSeek-V4.1-Flash (the preset's default) or zai-org/GLM-5.3, and are passed verbatim. The model list is public at https://api.runcrate.ai/v1/models, and keys come from the Runcrate dashboard."
End of document. There is no JSON code block for Runcrate. OK, so I should not add one. I'll just translate the prose.
Good catch. Let me make sure I don't add a code block for Runcrate.
Now, let me also double-check the "Any other endpoint" section. The original:
"## Any other endpoint
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_BASE_URL": "https://my-gateway.example.com/v1",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "my-model-id",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "..."
}
When a key is required"¶
So the code block is between H2 and H3. I'll preserve that.
Also check the "API Route" section: "## API Route
API Route uses the api-route preset with an API Route key. ..."
Then the JSON block, then "Alternatively, store the key..."
OK.
Now, let me finalize the entire translated document and make sure it's well-formatted.
One more consideration: the intro paragraph uses "The viewer's Settings → Advanced panel". "viewer" here is claude-mem's viewer app. I translated as "查看器". That's fine.
Another: "edits the provider, preset, base URL and model" - "可编辑提供商、预设、基础 URL 和模型". Good.
Also: "The API key is set in ... only, never through the viewer." - "API 密钥仅通过 ... 设置,绝不通过查看器设置。" Good.
Let me check all domain terms from the list appear correctly in my output: API ✓, Claude Code (not used), MCP (no), SDK (no), OpenRouter (no), HTTP (no), SessionStart (no), CLI (no), ID ✓, URL ✓, LiteLLM (no), PATH (no), FTS5 (no), AI (no), POST (no), PM2 (no), GET (no), OpenAI ✓, CMEM (no), UI (no), CMEM Pro (no), JSON (in code blocks, not translated) ✓, Grok Bot (no), PostToolUse (no), Agent SDK (no), Claude Agent (no), Claude Agent SDK (no), HTTP API (no), UserPromptSubmit (no), OpenClaw (no), SSE (no), Worker Service (no), Antigravity CLI (no), Smart Explore (no), Claude Desktop (no), macOS (no), IDE (no), PID (no), T3 (no), PreToolUse (no).
Now let me also verify the anchor for the "### When a key is required" heading is correct. The original English heading is "When a key is required" -> slug "when-a-key-is-required". Yes.
Now produce the final output. I'll be careful with the Markdown structure, preserving blank lines between sections and code blocks.
Actually, let me reconsider one thing about "MaaS 控制台" — in the link MaaS console, translating "console" to "控制台" is fine. But since "MaaS" is a generic acronym for "Model as a Service" and it's iFlytek's platform, keeping "MaaS" is fine.
Regarding "claude-mem removes a leading block like that on every preset" - "claude-mem 会在所有预设上移除此类开头的块". Good.
"so the reasoning is never stored or re-sent with the next request." - "因此推理内容绝不会被存储或随下一次请求重新发送。" Good.
Let me also reconsider the phrase "serves provider-scoped model ids" - "提供带提供商前缀的模型 ID". "provider-scoped" = scoped by provider. Good.
"pooled names" - maybe "统一名称池" or "池化名称". I'll stick with "池化名称".
"Opper picks the route per request" - "Opper 会按请求选择路由" or "按请求自动选路". I'll use "Opper 会为每个请求选择路由".
"A provider/model id such as aws/claude-haiku-4-5-eu pins one provider and region." - "类似 aws/claude-haiku-4-5-eu 的 provider/model ID 会锁定一个提供商和地区。"
OK, one small nuance: "an EU-hosted gateway with one OpenAI-compatible API and one key for 700+ models" - "一个欧盟托管的网关,提供一个 OpenAI 兼容 API 和一个适用于 700+ 模型的密钥". Good.
"Model ids are pooled names such as gpt-5.4-mini (the preset's default) or claude-haiku-4-5" - "模型 ID 是池化名称,例如 gpt-5.4-mini(该预设的默认值)或 claude-haiku-4-5". Good.
Now assemble final output.查看器的设置 → 高级面板可编辑提供商、预设、基础 URL 和模型。API 密钥仅通过 ~/.claude-mem/settings.json 或 ~/.claude-mem/.env 设置,绝不通过查看器设置。
MiniMax¶
minimax 是 MiniMax 的全球端点,minimax-cn 是中国大陆端点;请使用与您的账户所在地区匹配的预设。两者默认使用 MiniMax-M3。MiniMax 提供的任何模型 ID 都会原样传递,包括 MiniMax-M2.7 等旧版 ID。
若要改用 M3.1 Flash,请显式设置其模型 ID。观察器默认发送 reasoning: { enabled: false },因此 Flash 不会在每次观察时以 max 强度运行其自适应思考。将 CLAUDE_MEM_OPENAI_COMPAT_REASONING 设为 on 即可将思考交由 MiniMax 处理。Flash 可能还需要 MiniMax Token Plan 而非按量付费。请参阅 MiniMax OpenAI API 参考文档。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "minimax",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<key from platform.minimax.io>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "MiniMax-M3.1-Flash"
}
M2 系列等推理模型可能会以 <think>…</think> 块开头回复。claude-mem 会在所有预设上移除此类开头的块(这也涵盖 Ollama 和 vLLM 上的 DeepSeek R1 或 Qwen3),因此推理内容绝不会被存储或随下一次请求重新发送。
iFlytek Spark¶
iflytek 指向 iFlytek 的 Astron MaaS 平台,默认使用 spark-x2.5。密钥来自 MaaS 控制台。该预设的基础 URL 是按量付费端点;Token Plan 密钥仅在 Token Plan 端点上被接受,因此请一并设置基础 URL:
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "iflytek",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your MaaS key>",
"CLAUDE_MEM_OPENAI_COMPAT_BASE_URL": "https://maas-token-api.cn-huabei-1.xf-yun.com/v2"
}
在其他端点上使用密钥会被拒绝,返回 403(11200)。spark-x2.5 在单独的 reasoning_content 字段中返回其推理内容,claude-mem 会忽略该字段,因此只存储答案。
其他端点¶
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_BASE_URL": "https://my-gateway.example.com/v1",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "my-model-id",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "..."
}
何时需要密钥¶
设置 CLAUDE_MEM_OPENAI_COMPAT_BASE_URL 会替换预设的端点,因此是否需要密钥取决于您指向的端点,而非您所依据的预设名称:
| 端点 | 是否需要密钥 |
|---|---|
localhost、127.0.0.1、[::1]、*.local |
否 |
私有网络地址(10.x、192.168.x、172.16–31.x) |
否 |
| 其他任何地址 | 是 |
未设置覆盖时,由预设决定——托管预设需要密钥,本地预设则不需要。
对于真正无需认证的远程端点,仍然可以正常工作:将 CLAUDE_MEM_OPENAI_COMPAT_API_KEY 设置为任意非空值即可。默认行为倾向于要求密钥,因为另一种情况是提供商报告自身就绪,随后每次观察都因 401 而失败。
OrcaRouter¶
OrcaRouter 在一个 sk-orca- 密钥后面提供带提供商前缀的模型 ID,例如 openai/gpt-4o-mini(该预设的默认值)或 anthropic/claude-haiku-4.5。其模型列表公开于 https://api.orcarouter.ai/v1/models。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "orcarouter",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "sk-orca-...",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "anthropic/claude-haiku-4.5"
}
API Route¶
API Route 使用 api-route 预设和 API Route 密钥。它没有默认模型:请将 CLAUDE_MEM_OPENAI_COMPAT_MODEL 设置为您的账户在 https://global.api-route.com/v1/models 上可用的确切模型 ID。选择在 /chat/completions 上提供的模型;该 ID 会被原样传递。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "api-route",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your API Route key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "<your chat-completions model id>"
}
或者,将密钥以 OPENAI_COMPAT_API_KEY 的形式存储在 ~/.claude-mem/.env 中。更改配置后请重启 worker。如果没有模型或密钥,此提供商将处于未配置状态,调度会回退到 Claude。
Opper¶
Opper 是一个欧盟托管的网关,提供一个 OpenAI 兼容 API 和一个适用于 700+ 模型的密钥。模型 ID 是池化名称,例如 gpt-5.4-mini(该预设的默认值)或 claude-haiku-4-5,Opper 会为每个请求选择路由。类似 aws/claude-haiku-4-5-eu 的 provider/model ID 会锁定一个提供商和地区。其目录公开于 https://api.opper.ai/v3/models,密钥来自 platform.opper.ai。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "opper",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Opper key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "claude-haiku-4-5"
}
Atlas Cloud¶
Atlas Cloud 在一个 OpenAI 兼容 API 密钥后面提供来自 DeepSeek、Z.ai、Moonshot、Qwen 等厂商的模型。模型 ID 带有厂商前缀,例如 deepseek-ai/deepseek-v4-flash(该预设的默认值)或 zai-org/glm-5.3,并且会被原样传递。模型列表公开于 https://api.atlascloud.ai/v1/models,密钥来自 console.atlascloud.ai。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "atlascloud",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Atlas Cloud key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "deepseek-ai/deepseek-v4-flash"
}
Runcrate¶
Runcrate 是一个 GPU 云平台,还提供一个 OpenAI 兼容 API 密钥来服务 DeepSeek V4.1 Flash、GLM-5.3、Qwen3.8 Flash 和 gpt-oss 120B 等开放模型。模型 ID 带有厂商前缀,例如 deepseek-ai/DeepSeek-V4.1-Flash(该预设的默认值)或 zai-org/GLM-5.3,并且会被原样传递。模型列表公开于 https://api.runcrate.ai/v1/models,密钥来自 Runcrate 仪表盘。
{
"CLAUDE_MEM_PROVIDER": "openai-compatible",
"CLAUDE_MEM_OPENAI_COMPAT_PRESET": "runcrate",
"CLAUDE_MEM_OPENAI_COMPAT_API_KEY": "<your Runcrate key>",
"CLAUDE_MEM_OPENAI_COMPAT_MODEL": "deepseek-ai/DeepSeek-V4.1-Flash"
}
故障排查¶
记忆功能会静默地改为使用 Claude 运行。 当提供方已被选定但未完全配置时,调度会回退到 Claude——缺少 base URL、缺少模型,或预置项需要密钥但缺少密钥时,都会触发此回退。这种回退是刻意为之:配置不完整的端点不应让每条观察都失败。运行 npx claude-mem doctor 进行检查。
端点返回 404。 几乎总是 base URL 错误,或端点不提供该模型;错误信息会同时指出这两个设置项。请注意,某些网关对模型 ID 添加前缀的方式可能与厂商官方文档有所不同。
反复超时。 请求是流式传输的,因此只有在端点连续 90 秒未返回任何 token 且未发送 keep-alive 时,或累计 300 秒后,才会放弃请求。自托管端点在负载均衡器后面排队请求时,排队等待期间是静默的,因此这段时间会被视为空闲;请将 CLAUDE_MEM_LLM_STREAM_IDLE_TIMEOUT_MS 调大到超过该等待时间。CLAUDE_MEM_LLM_TIMEOUT_MS 不适用于流式请求;它仅作为拒绝流式传输(返回 400 并指明 stream 或 stream_options)的端点的截止时间,之后 claude-mem 在工作进程的剩余生命周期内将以非流式方式调用该端点。如果请求持续超时,请优先选择一个小而快的模型:观察提取是高吞吐量的结构化任务,而不是推理基准测试。
观察结果为空或被截断。 如果模型不能严格遵循输出模式,就无法产出任何可用的结果。小型指令微调模型通常比推理模型表现更好,因为后者的思考输出往往会挤掉结构化回复。当日志显示回复在输出 token 上限处被截断时,请调大 CLAUDE_MEM_OBSERVER_MAX_OUTPUT_TOKENS。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/claude-mem