Add Ollama Cloud support with Bearer token auth#610
Merged
mehmetozguldev merged 2 commits intomasterfrom Apr 16, 2026
Merged
Conversation
Ollama previously only worked against local servers with no authentication. This extends the provider so the same integration can point at Ollama Cloud (https://ollama.com) by sending the user's API key as a Bearer token. - Refactor OllamaProvider to hold an optional API key and include an Authorization header on streaming requests, model discovery, and connection checks. - Add isOllamaCloudUrl helper plus OLLAMA_CLOUD_BASE_URL / DEFAULT_ OLLAMA_BASE_URL exports for reuse across settings and chat service. - Surface Local/Cloud preset buttons and a password-style API key input in AI Settings, wired through the existing secure-token service (store / retrieve / remove). - Sync the stored key into the provider singleton at startup via settings-effects so getModels and connection checks work immediately after reload. - Guard chat streams: if the endpoint is cloud but no key is stored, surface a clear error pointing back to settings. - Improve getModels output to include parameter size when the server reports it, and rename provider label from "Ollama (Local)" to "Ollama" now that it supports both modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the Ollama provider so it works against both local Ollama servers and Ollama Cloud. Previously the provider hardcoded a no-auth local endpoint, so pointing it at
https://ollama.comsilently failed.OllamaProviderto hold an optional API key and attachAuthorization: Bearer …to streaming requests, model discovery (/api/tags), and connection checks.isOllamaCloudUrl/OLLAMA_CLOUD_BASE_URLhelpers; reuse them acrossai-settings,ai-chat-service, and the provider itself.storeProviderApiToken/getProviderApiToken/removeProviderApiToken).settings-effectssogetModelsand the connection indicator work on first load.getModelsnow appends the parameter size (e.g.llama3 (8B)) when the server reports it.Docs referenced: https://docs.ollama.com/api/introduction, https://docs.ollama.com/cloud.
Test plan
/api/tags, chat streams.https://ollama.com, warning shows until a key is entered.Fixes #372