LLM client force-appends /v1 to base_url, breaking providers with other versioned paths (e.g. Volcano Ark /api/v3)
Summary
The memory LLM client force-appends /v1 to [memory.llm].base_url when it does not end with /v1. This breaks any OpenAI-compatible provider whose API version path is not v1 — for example Volcano Engine Ark, whose endpoint is https://ark.cn-beijing.volces.com/api/v3/chat/completions.
Environment
- memorix 1.7.2 (npm global install, latest at time of writing)
- Windows 10, Node v24.14.1
Reproduction
~/.memorix/config.toml:
[memory.llm]
provider = "openai"
model = "deepseek-v4-flash-ga-260731"
base_url = "https://ark.cn-beijing.volces.com/api/v3"
API key via MEMORIX_LLM_API_KEY. Then:
$ echo "hello" | memorix ask
Error: LLM tool-call API error (404):
The same endpoint works fine when called directly (both plain chat and tools function calling):
$ curl https://ark.cn-beijing.volces.com/api/v3/chat/completions ... # 200
Root cause
Four call sites append /v1 unconditionally when the base URL does not already end with it:
src/llm/provider.ts:264(callOpenAICompatible, comment: "Auto-fix: append /v1 if baseUrl doesn't end with it (common user mistake)")src/llm/provider.ts:391(callLLMWithTools)src/llm/provider.ts:607(callLLMWithToolsStream)src/multimodal/image-loader.ts:59(callVisionLLM)
With the Ark base URL the request goes to .../api/v3/v1/chat/completions, which does not exist.
For contrast, the embedding lane (src/embedding/api-provider.ts) builds ${config.baseUrl}/embeddings directly with no /v1 coercion, which is why [embedding].base_url works with /api/v3-style endpoints while [memory.llm].base_url does not.
Suggested fix
Treat any trailing version segment as final so the existing convenience (auto-/v1 for bare hosts like http://localhost:11434) is preserved:
if (!/\/v\d+$/.test(base)) base += '/v1';
Workaround
I patched the four sites in the installed bundle locally (/v1–/v4 suffixes are left untouched); memorix ask then works against Ark. Happy to send a PR if the suggested fix looks right.
Thanks for the detailed report and the Ark reproduction. You were right: Memorix was appending /v1 even when the configured OpenAI-compatible base URL already contained an explicit version path such as /api/v3.
This is fixed and released in [email protected]:
npm install -g [email protected]
The fix preserves explicit paths such as /api/v3, /v2, /v4, and /v1beta, while keeping the /v1 convenience for bare local hosts. It is covered for ordinary chat, tool calling, streaming, and vision requests. The release passed the Ubuntu, Windows, macOS, Docker, typecheck, and full test gates.
Thanks again for catching this and for providing a working direct curl comparison.