Dashboard › Code › Session 1OYc5yYoFmDK
1OYc5yYoFmDKU4clotry now
Jun 05 13:26:48 labs opencode[3530660]: [lore] upstream: https://api.anthropic.com (provider=none, providerURL=none, modelRoute=https://api.anthropic.com, headerUpstream=no, protocol=anthropic, auth=api-key:sk-ant-a…) Jun 05 13:27:05 labs opencode[3530660]: [lore] upstream: https://api.anthropic.com (provider=none, providerURL=none, modelRoute=https://api.anthropic.com, headerUpstream=no, protocol=anthropic, auth=api-key:sk-ant-a…) Jun 05 13:27:21 labs opencode[3530660]: [lore] upstream: https://api.anthropic.com (provider=none, providerURL=none, modelRoute=https://api.anthropic.com, headerUpstream=no, protocol=anthropic, auth=api-key:sk-ant-a…) Jun 05 13:27:37 labs opencode[3530660]: [lore] upstream: https://api.anthropic.com (provider=none, providerURL=none, modelRoute=https://api.anthropic.com, headerUpstream=no, protocol=anthropic, auth=api-key:sk-ant-a…) Jun 05 13:27:40 labs opencode[3530660]: [lore] upstream: https://api.anthropic.com (provider=none, providerURL=none, ...
Excellent! The debug log reveals everything:
[lore] chat.headers provider: {"keys":["id","name","env","options","source","models","key"],"id":"anthropic"}
The provider ID is at input.provider.id, NOT input.provider.info.id! The plugin was looking at the wrong path. And the provider still shows provider=none in the gateway because the header wasn't sent — the old code checks input.provider?.info?.id which is undefined.
Now trigger a minimax request so we can see what its provider object looks like. But first, the fix is clear — change input.provider?.info?.id to input.provider?.id:
Edit applied successfully.
Now also need to capture the original baseURL correctly from the provider object at config time. The provider has options in it — let me check if the config hook accesses it correctly. Looking at the config hook:
entry.options ??= {};
if (entry.options.baseURL) {
originalBaseURLs.set(providerID, entry.options.baseURL);
}
This should work if cfg.provider["minimax"].options.baseURL is set by OpenCode Zen before the config hook runs. But we know minimax isn't in cfg.provider at config-hook time — it comes from WELL_KNOWN_PROVIDERS with p["minimax"] ??= {}.
But the chat.headers hook now has access to input.provider which has options — we can read the current baseURL from there! If the baseURL is the gateway URL, we look it up in originalBaseURLs. If it's something else (i.e., it was never overwritten because OpenCode set it after our config hook), we can use it directly.
Wait, let me think again. The chat.headers hook fires per-request. input.provider.options might have the current baseURL (which we overwrote to gateway). But we need the original. Let me check if we can read it from input.provider.options:
Edit applied successfully.
Now rebuild gateway (for the removed minimax prefix) and restart to test:
dist/embedding-worker.js — embedding worker ESM (Bun) dist/bin.cjs — CLI wrapper dist/index.d.cts — type declarations
Ready. After restart, please trigger both a claude-opus and a minimax request. We should see:
id: "anthropic" with baseURL showing the gateway URL (since we overwrote it)id: "minimax" (or whatever OpenCode calls it) with its baseURLPlus, the fix from input.provider?.info?.id → input.provider?.id should now inject x-lore-provider correctly, so the gateway logs should show provider=anthropic instead of provider=none.