Repository navigation
Allow API key for Ollama connections - #7173
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
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.
|
@shimmyshimmer LGTM to merge as-is. |
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 unslothai#7163
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