You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
model.request hook baseURL is ignored for models loaded through the AI SDK adapter #55984
event.baseURL set in a model.request session hook is ignored for models loaded through the AI SDK adapter, while header changes from the same hook apply. Providers with a native route honor it. For AI SDK models route.with returns the same route (aisdk.ts#L408), so the request keeps the original baseURL. I want to choose the endpoint per request from a plugin.
In the same directory (/tmp/probe here) run npm i @ai-sdk/openai-compatible and put this in opencode.jsonc (the file:// package forces the AI SDK path): {"plugins":["./url-probe"],"providers":{"probe":{"package":"aisdk:file:///tmp/probe/node_modules/@ai-sdk/openai-compatible/dist/index.js","settings":{"baseURL":"https://original.example.invalid/v1","apiKey":"x"},"models":{"m":{"limit":{"context":200000,"output":4096}}}}}}
Run opencode --print-logs run --standalone --model probe/m Hi. The log shows PROBE https://original.example.invalid/v1/chat/completions; I expected the replacement host.
Thanks for the precise report. I reproduced this with your url-probe plugin and the aisdk:file:// openai-compatible provider config. On 2.0.30, opencode --print-logs run --standalone --model probe/m Hi logs PROBE https://original.example.invalid/v1/chat/completions for every request, so the baseURL set in model.request is ignored. It still happens on the latest dev (37e3912d8). The script below reproduces it (set OC_DEV=<checkout> to run from source).
This matches your reading of the code: the AI SDK route's with returns the same route, so the override is dropped.
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the precise report. I reproduced this with your
url-probeplugin and theaisdk:file://openai-compatible provider config. On 2.0.30,opencode --print-logs run --standalone --model probe/m HilogsPROBE https://original.example.invalid/v1/chat/completionsfor every request, so thebaseURLset inmodel.requestis ignored. It still happens on the latestdev(37e3912d8). The script below reproduces it (setOC_DEV=<checkout>to run from source).This matches your reading of the code: the AI SDK route's
withreturns the same route, so the override is dropped.Related, but not the same problem:
http.requesthook not covering AI SDK models (closed)sdkhooks not running for providers that aren't on npmReproduction script (repro.sh)
Run it:
bash repro.sh