Skip to content

feat: add local Ollama provider support with prefix stripping - #561

Open
niko4244 wants to merge 1 commit into
tashfeenahmed:mainfrom
niko4244:feat/local-ollama-provider
Open

feat: add local Ollama provider support with prefix stripping#561
niko4244 wants to merge 1 commit into
tashfeenahmed:mainfrom
niko4244:feat/local-ollama-provider

Conversation

@niko4244

Copy link
Copy Markdown

Summary

Two changes to enable using a local Ollama instance (http://127.0.0.1:11434) instead of the Ollama Cloud API:

1. Local Ollama base URL (providers/index.ts)

Changes the Ollama provider baseUrl from https://ollama.com/v1 to http://127.0.0.1:11434/v1, and renames from 'Ollama Cloud' to 'Local Ollama'.

2. Prefix stripping (providers/openai-compat.ts)

Strips the ollama/ prefix from model IDs before sending requests to Ollama's API. FreeLLMAPI stores model IDs as ollama/<name> but the local Ollama API expects bare model names (e.g., qwen3.5:4b, not ollama/qwen3.5:4b).

This is a generic fix — any FreeLLMAPI user running a local Ollama instance will hit this prefix mismatch.

Backwards Compatibility

  • The prefix stripping is a no-op when no ollama/ prefix exists
  • The base URL can be overridden via provider config for users who still want the cloud endpoint

Testing

Tested end-to-end with 19 local Ollama models (qwen3.5, qwythos, gemma3, qwen3-coder, etc.) — all route correctly through the local instance. Also tested cloud providers (nvidia, minimax, mistral) to confirm the change doesn't affect non-Ollama routing.

Two changes to enable using a local Ollama instance (127.0.0.1:11434)
instead of the Ollama Cloud API:

1. providers/index.ts: Change Ollama baseUrl from https://ollama.com/v1
   to http://127.0.0.1:11434/v1, and rename from 'Ollama Cloud' to
   'Local Ollama'.

2. providers/openai-compat.ts: Strip the 'ollama/' prefix from model
   IDs before sending to Ollama's API. FreeLLMAPI stores model IDs as
   'ollama/<name>' but the local Ollama API expects bare model names
   (e.g., 'qwen3.5:4b' not 'ollama/qwen3.5:4b').

Both changes are backwards-compatible — the prefix stripping is a
no-op when no prefix exists, and the base URL can be overridden via
provider config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant