-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Request: User-Provided Azure OpenAI API Credentials
Overview
Currently, the application uses hardcoded Azure OpenAI credentials from environment variables. We want to implement a feature that allows users to provide their own Azure OpenAI API credentials through the frontend, which will be passed to the backend for LLM operations.
✨ Motivation
- Users may want to use their own Azure OpenAI keys instead of relying on shared credentials.
- This promotes transparency, flexibility, and improved access control.
- However, users must feel confident that their credentials will not be leaked or misused.
🔐 Security & Trust Requirements
- ✅ No logging or server-side storage of credentials.
- ✅ Credentials must be used only for the current session/request and discarded immediately after use.
- ✅ Frontend UI should clearly state that credentials are not stored or shared.
- ✅ Inputs should be securely handled via HTTPS and never exposed in
localStorageorsessionStorage. - ✅ Validate input formats and show helpful error messages if credentials are invalid.
Technical Requirements
Backend Changes
- Modify the
/api/chatendpoint to accept Azure OpenAI credentials in the request payload - Update the
stream_llm_responsefunction to use provided credentials instead of environment variables - Add input validation for the API credentials
@app.route('/api/chat', methods=['POST'])
async def chat():
data = request.get_json()
# New credential fields
azure_endpoint = data.get("azureEndpoint")
api_key = data.get("apiKey")
deployment = data.get("deployment")
api_version = data.get("apiVersion", "2023-05-15")
# Validate credentials
if not all([azure_endpoint, api_key, deployment]):
return jsonify({"error": "Missing required Azure OpenAI credentials"}), 400
# Rest of the existing function...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request