[GH-ISSUE #9642] Feature Request: API Key Authentication Support #6292

Closed
opened 2026-04-12 17:43:57 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ZimaBlueee on GitHub (Mar 11, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9642

Currently, there is no API key verification mechanism in place for authenticating requests. It is proposed to add API key authentication with the following approach:

  1. Allow the configuration of an API key through an environment variable;
  2. Require that all requests include the predefined API key in the request header;
  3. On receiving a request, validate that the API key in the header matches the one stored in the environment variable—proceed if they match, otherwise reject the request.

Implementing this feature will enhance the security of the API by preventing unauthorized access, and it lays the groundwork for addressing future security requirements.

Originally created by @ZimaBlueee on GitHub (Mar 11, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9642 Currently, there is no API key verification mechanism in place for authenticating requests. It is proposed to add API key authentication with the following approach: 1. Allow the configuration of an API key through an environment variable; 2. Require that all requests include the predefined API key in the request header; 3. On receiving a request, validate that the API key in the header matches the one stored in the environment variable—proceed if they match, otherwise reject the request. Implementing this feature will enhance the security of the API by preventing unauthorized access, and it lays the groundwork for addressing future security requirements.
GiteaMirror added the feature request label 2026-04-12 17:43:57 -05:00
Author
Owner
<!-- gh-comment-id:2713111306 --> @rick-github commented on GitHub (Mar 11, 2025): https://github.com/ollama/ollama/issues/1053#issuecomment-2558705136 https://github.com/ollama/ollama/issues/9488#issuecomment-2701659171 https://github.com/ollama/ollama/pull/9131
Author
Owner

@ZimaBlueee commented on GitHub (Mar 11, 2025):

thanks!

<!-- gh-comment-id:2713119848 --> @ZimaBlueee commented on GitHub (Mar 11, 2025): thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6292