From f8f85aea4703cb923a068061f149f029647aab1a Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Fri, 13 Mar 2026 11:59:50 -0600 Subject: [PATCH] fix: inject /v1 suffix in baseURL and skip injection when gateway is down MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Anthropic SDK appends /messages to baseURL, so the gateway baseURL must include /v1. Also removes the static baseURL from opencode.json — the plugin now injects it dynamically only when the gateway health check passes, so requests fall through directly to api.anthropic.com when Mnemosyne is not running. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- opencode-plugin/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opencode-plugin/src/index.ts b/opencode-plugin/src/index.ts index c5335e1..d762e89 100644 --- a/opencode-plugin/src/index.ts +++ b/opencode-plugin/src/index.ts @@ -275,8 +275,9 @@ const MnemosynePlugin: Plugin = async (ctx: PluginInput): Promise => { // Only set if not already overridden by user if (!inputConfig.provider.anthropic.options.baseURL) { - inputConfig.provider.anthropic.options.baseURL = gateway.url; - log.info(`Routing Anthropic through gateway at ${gateway.url}`); + // Anthropic SDK appends /messages to baseURL, so we need /v1 suffix + inputConfig.provider.anthropic.options.baseURL = `${gateway.url}/v1`; + log.info(`Routing Anthropic through gateway at ${gateway.url}/v1`); } else { log.debug( `baseURL already set to ${inputConfig.provider.anthropic.options.baseURL}, not overriding`