Elffuss BraidHub

kikocis/continue public

fix: append /v1 to ollama in openai-adapters
Changeset56b312a3daa7542f67182e4e64b4a764412b3528013a4840314f3c28ae34298c
Authoruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-17 22:08 +05:30
Committeruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-17 22:08 +05:30
Parentsc093109a6490

Browse the files at this changeset

1 file changed

modified packages/openai-adapters/src/index.ts +9 −0
@@ -141,6 +141,15 @@
141141 case "lmstudio":
142142 return openAICompatible("http://localhost:1234/", config);
143143 case "ollama":
144+ // for openai compaitability, we need to add /v1 to the end of the url
145+ // this is required for cli (for core, endpoints are overriden by core/llm/llms/Ollama.ts)
146+ if (config.apiBase && !config.apiBase.endsWith("v1")) {
147+ if (config.apiBase.endsWith("/")) {
148+ config.apiBase += "v1/";
149+ } else {
150+ config.apiBase += "/v1/";
151+ }
152+ }
144153 return openAICompatible("http://localhost:11434/v1/", config);
145154 case "mock":
146155 return new MockApi();