fix: inject /v1 suffix in baseURL and skip injection when gateway is down
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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
a822c497c5
commit
f8f85aea47
1 changed files with 3 additions and 2 deletions
|
|
@ -275,8 +275,9 @@ const MnemosynePlugin: Plugin = async (ctx: PluginInput): Promise<Hooks> => {
|
|||
|
||||
// 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`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue