fix: route mnemosyne provider instead of anthropic in opencode plugin

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Joey Yakimowich-Payne 2026-03-13 13:38:26 -06:00
commit 235e88d416

View file

@ -266,21 +266,22 @@ const MnemosynePlugin: Plugin = async (ctx: PluginInput): Promise<Hooks> => {
}
}
// Inject baseURL for the Anthropic provider
// This routes all Anthropic API calls through the Mnemosyne gateway
// Inject baseURL for the Mnemosyne provider only.
// Keep provider ID `anthropic` untouched so Claude Code OAuth and
// oh-my-opencode variants continue to work against direct Anthropic.
inputConfig.provider = inputConfig.provider ?? {};
inputConfig.provider.anthropic = inputConfig.provider.anthropic ?? {};
inputConfig.provider.anthropic.options =
inputConfig.provider.anthropic.options ?? {};
inputConfig.provider.mnemosyne = inputConfig.provider.mnemosyne ?? {};
inputConfig.provider.mnemosyne.options =
inputConfig.provider.mnemosyne.options ?? {};
// Only set if not already overridden by user
if (!inputConfig.provider.anthropic.options.baseURL) {
if (!inputConfig.provider.mnemosyne.options.baseURL) {
// 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`);
inputConfig.provider.mnemosyne.options.baseURL = `${gateway.url}/v1`;
log.info(`Routing Mnemosyne through gateway at ${gateway.url}/v1`);
} else {
log.debug(
`baseURL already set to ${inputConfig.provider.anthropic.options.baseURL}, not overriding`
`baseURL already set to ${inputConfig.provider.mnemosyne.options.baseURL}, not overriding`
);
}
},