[PR #831] [CLOSED] fix: replace hardcoded API key placeholders in llm_router_app #7051

Closed
opened 2026-05-31 14:44:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Shubhamsaboo/awesome-llm-apps/pull/831
Author: @Alexi5000
Created: 5/21/2026
Status: Closed

Base: mainHead: pr/fix-hardcoded-api-keys


📝 Commits (1)

  • f8354a3 fix: replace hardcoded API key placeholders with sidebar input

📊 Changes

2 files changed (+17 additions, -8 deletions)

View changed files

advanced_llm_apps/cursor_ai_experiments/llm_router_app/.env.example (+2 -0)
📝 advanced_llm_apps/cursor_ai_experiments/llm_router_app/llm_router.py (+15 -8)

📄 Description

Summary

Replaces hardcoded API key placeholder strings in advanced_llm_apps/cursor_ai_experiments/llm_router_app/llm_router.py with Streamlit sidebar text input, consistent with the rest of the repo.

Problem

The file had literal strings as API key values:

os.environ[OPENAI_API_KEY] = your_openai_api_key
os.environ[TOGETHERAI_API_KEY] = your_togetherai_api_key

This pattern:

  1. Fails silently at runtime - the app starts but API calls fail with auth errors
  2. Risk of credential leaks - users may edit the strings in-place and accidentally commit real keys
  3. Inconsistent with repo conventions - most other templates use st.sidebar.text_input for key collection

Changes

  • Replaced hardcoded strings with st.sidebar.text_input (password-masked)
  • Added st.stop() guard when keys are not provided
  • Added .env.example documenting required keys
  • Moved import os below Streamlit setup (only needed after keys are collected)

Test plan

  • Verify the app starts and shows the sidebar key inputs
  • Verify st.stop() fires when keys are empty
  • Verify the app works end-to-end when valid keys are provided

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Shubhamsaboo/awesome-llm-apps/pull/831 **Author:** [@Alexi5000](https://github.com/Alexi5000) **Created:** 5/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/fix-hardcoded-api-keys` --- ### 📝 Commits (1) - [`f8354a3`](https://github.com/Shubhamsaboo/awesome-llm-apps/commit/f8354a3ada3c9b8b21cb4cffb04eb95f803e7e55) fix: replace hardcoded API key placeholders with sidebar input ### 📊 Changes **2 files changed** (+17 additions, -8 deletions) <details> <summary>View changed files</summary> ➕ `advanced_llm_apps/cursor_ai_experiments/llm_router_app/.env.example` (+2 -0) 📝 `advanced_llm_apps/cursor_ai_experiments/llm_router_app/llm_router.py` (+15 -8) </details> ### 📄 Description ## Summary Replaces hardcoded API key placeholder strings in `advanced_llm_apps/cursor_ai_experiments/llm_router_app/llm_router.py` with Streamlit sidebar text input, consistent with the rest of the repo. ## Problem The file had literal strings as API key values: ```python os.environ[OPENAI_API_KEY] = your_openai_api_key os.environ[TOGETHERAI_API_KEY] = your_togetherai_api_key ``` This pattern: 1. **Fails silently at runtime** - the app starts but API calls fail with auth errors 2. **Risk of credential leaks** - users may edit the strings in-place and accidentally commit real keys 3. **Inconsistent with repo conventions** - most other templates use `st.sidebar.text_input` for key collection ## Changes - Replaced hardcoded strings with `st.sidebar.text_input` (password-masked) - Added `st.stop()` guard when keys are not provided - Added `.env.example` documenting required keys - Moved `import os` below Streamlit setup (only needed after keys are collected) ## Test plan - [ ] Verify the app starts and shows the sidebar key inputs - [ ] Verify `st.stop()` fires when keys are empty - [ ] Verify the app works end-to-end when valid keys are provided --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-31 14:44:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-llm-apps#7051