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:
parent
5702a5a1e2
commit
235e88d416
1 changed files with 10 additions and 9 deletions
|
|
@ -266,21 +266,22 @@ const MnemosynePlugin: Plugin = async (ctx: PluginInput): Promise<Hooks> => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inject baseURL for the Anthropic provider
|
// Inject baseURL for the Mnemosyne provider only.
|
||||||
// This routes all Anthropic API calls through the Mnemosyne gateway
|
// 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 = inputConfig.provider ?? {};
|
||||||
inputConfig.provider.anthropic = inputConfig.provider.anthropic ?? {};
|
inputConfig.provider.mnemosyne = inputConfig.provider.mnemosyne ?? {};
|
||||||
inputConfig.provider.anthropic.options =
|
inputConfig.provider.mnemosyne.options =
|
||||||
inputConfig.provider.anthropic.options ?? {};
|
inputConfig.provider.mnemosyne.options ?? {};
|
||||||
|
|
||||||
// Only set if not already overridden by user
|
// 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
|
// Anthropic SDK appends /messages to baseURL, so we need /v1 suffix
|
||||||
inputConfig.provider.anthropic.options.baseURL = `${gateway.url}/v1`;
|
inputConfig.provider.mnemosyne.options.baseURL = `${gateway.url}/v1`;
|
||||||
log.info(`Routing Anthropic through gateway at ${gateway.url}/v1`);
|
log.info(`Routing Mnemosyne through gateway at ${gateway.url}/v1`);
|
||||||
} else {
|
} else {
|
||||||
log.debug(
|
log.debug(
|
||||||
`baseURL already set to ${inputConfig.provider.anthropic.options.baseURL}, not overriding`
|
`baseURL already set to ${inputConfig.provider.mnemosyne.options.baseURL}, not overriding`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue