Allow API key for Ollama connections#7173
Open
shimmyshimmer wants to merge 1 commit into
Open
Conversation
The Connections form hid the API key field for the Ollama preset, which blocked Ollama cloud (it requires a key). Show the optional field for Ollama; the backend already sends Authorization: Bearer when a key is set and omits the header when empty, so local keyless servers are unaffected. Fixes #7163
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the Ollama provider configuration to support an optional API key, which is required for Ollama cloud deployments. The frontend has been updated to display the API key field for Ollama (making it optional for local servers and required for cloud), whereas previously it was hidden. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
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.
Fixes #7163
Problem
The Connections form (Settings > Connections) hid the API key field for the Ollama preset.
customPresetSkipsApiKeyFieldinexternal-providers.tsreturned true for bothollamaandllama_cpp, so there was no way to enter a key. Ollama cloud requires one, so cloud endpoints could only be used through a Custom connection workaround.Fix
Everything downstream was already key capable: the provider registry defines
Authorization: Bearerauth forollama, and model listing, connection tests, and chat requests all forward a stored key. The only blocker was the hidden input.external-providers.ts: removeollamafromcustomPresetSkipsApiKeyField, onlyllama_cppstill hides the fieldchat-providers-dialog.tsx: update the stale comment at theshowApiKeyFieldcomputationproviders.py: update the ollama registry note from "no API key" to "API key optional (required by Ollama cloud)"Since Ollama is a custom provider type, the existing form logic already labels the field as optional, stores the key locally per connection, and removes a stored key when the field is saved empty.
Behavior
https://ollama.com/v1and paste a key, requests sendAuthorization: Bearer <key>Testing
tsc -bpassesAuthorization: Bearer <key>; with an empty key no auth header is present