thisFasih commited on
Commit
01bf95d
·
verified ·
1 Parent(s): 780b466

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -127
README.md CHANGED
@@ -1,6 +1,3 @@
1
- # API Key Validator for OpenAI & Gemini
2
-
3
- # API Key Validator for OpenAI & Gemini
4
  ---
5
  title: API Key Validator
6
  emoji: 🔑
@@ -12,127 +9,3 @@ app_file: app.py
12
  pinned: false
13
  ---
14
 
15
- A lightweight Gradio web app that lets you quickly validate API keys for both OpenAI and Google Gemini (Generative Language API) and view the list of available models for each provider.
16
-
17
- ## Features
18
- - Validate OpenAI API key (calls `GET /v1/models`).
19
- - Validate Gemini API key (calls `GET /v1beta/models`).
20
- - Secure password-style input fields (keys never echoed in plain text).
21
- - Immediate feedback: success, failure, and raw error payload when invalid.
22
- - Displays available model IDs / names returned by each provider.
23
- - Zero persistence: keys are not stored, logged, or transmitted elsewhere.
24
-
25
- ## Tech Stack
26
- - **Python** (>=3.9 recommended)
27
- - **Gradio** for the UI
28
- - **Requests** for outbound HTTPS calls
29
-
30
- ## Getting Started
31
- ### 1. Clone / Download
32
- ```bash
33
- git clone <your-repo-url>
34
- cd api-key-tester-app
35
- ```
36
- (Replace folder name if different.)
37
-
38
- ### 2. Create Virtual Environment (Optional but Recommended)
39
- ```bash
40
- python -m venv .venv
41
- # Windows
42
- .venv\Scripts\activate
43
- # macOS / Linux
44
- source .venv/bin/activate
45
- ```
46
-
47
- ### 3. Install Dependencies
48
- ```bash
49
- pip install -r requirements.txt
50
- ```
51
-
52
- ### 4. Run the App
53
- ```bash
54
- python app.py
55
- ```
56
- Gradio will print a local URL (e.g., `http://127.0.0.1:7860`) and, if enabled, a public share URL.
57
-
58
- ## Usage
59
- 1. Enter your OpenAI API key (format typically starts with `sk-...`).
60
- 2. Enter your Gemini API key (Google AI Studio issued key).
61
- 3. Click **"Test Keys"**.
62
- 4. View validation results and model lists.
63
-
64
- If a key is invalid, the raw response body (error JSON / message) is shown in the results panel for troubleshooting.
65
-
66
- ## Security & Privacy
67
- - Inputs use `type="password"` in Gradio (no on-screen echo).
68
- - Keys are only transmitted directly to official provider endpoints.
69
- - No server-side storage, caching, or logging of keys.
70
- - Avoid sharing screenshots that contain sensitive error payloads.
71
-
72
- ## Environment Variables (Optional Enhancement)
73
- Currently keys are entered manually. You could extend the app to pre-fill from environment variables (example shown for convenience):
74
- Add to your shell:
75
- ```bash
76
- # Windows PowerShell
77
- $Env:OPENAI_API_KEY="sk-your-key"
78
- $Env:GEMINI_API_KEY="your-gemini-key"
79
- ```
80
-
81
- ## Error Handling
82
- - Network errors captured and surfaced as exception strings.
83
- - Non-200 status codes display provider error payload (`resp.text`).
84
- - Rate limits or expired keys will return provider-specific error JSON.
85
-
86
- ## Roadmap / Ideas
87
- - Add support for additional providers (Anthropic, Mistral, etc.).
88
- - Show quota usage (if endpoint available).
89
- - Dark mode toggle.
90
- - Simple caching of last successful model list.
91
- - Downloadable validation report.
92
-
93
- ## Testing
94
- There are no automated tests yet. Suggested next steps:
95
- - Unit test helper functions `test_openai_key` and `test_gemini_key` using mocked `requests.get`.
96
- - Add a smoke test ensuring the Gradio interface launches without exceptions.
97
-
98
- ## Contributing
99
- 1. Fork the repository.
100
- 2. Create a feature branch: `git checkout -b feature/<name>`.
101
- 3. Commit changes: `git commit -m "Add <feature>"`.
102
- 4. Push: `git push origin feature/<name>`.
103
- 5. Open a Pull Request.
104
-
105
- Please keep changes minimal and focused. For significant UI or provider additions, open an issue first to discuss.
106
-
107
- ## Configuration Notes
108
- | Provider | Endpoint Used | Purpose |
109
- |----------|---------------|---------|
110
- | OpenAI | `GET https://api.openai.com/v1/models` | Validates key + lists models |
111
- | Gemini | `GET https://generativelanguage.googleapis.com/v1beta/models?key=...` | Validates key + lists models |
112
-
113
- ## Limitations
114
- - Does not test key against every possible endpoint.
115
- - Model lists may differ if access is restricted or in preview.
116
- - No persistent audit trail by design.
117
-
118
- ## License
119
- Specify a license (e.g., MIT, Apache-2.0). If none provided, all rights reserved by default.
120
-
121
- ## Disclaimer
122
- This tool is for quick manual validation. Always follow provider security best practices and rotate credentials regularly.
123
-
124
- ## FAQ
125
- **Q: Are my keys stored anywhere?**
126
- A: No. They exist only in session memory for the duration of the Streamlit interaction.
127
-
128
- **Q: Why is my valid key showing limited models?**
129
- A: Some models require special access or are in restricted beta.
130
-
131
- **Q: Can I deploy this?**
132
- A: Yes—e.g., Streamlit Community Cloud can run Gradio apps too. Select your GitHub repo, branch `master`, and main file path `app.py`. Leave the App URL blank or choose a simple subdomain. Alternatively, deploy on Spaces (Hugging Face) or Render.
133
-
134
- **Q: How can I add another provider?**
135
- A: Create a new helper similar to `test_openai_key`, call its endpoint, parse model list, and extend the UI block.
136
-
137
- ---
138
- Feel free to customize sections like License or add CI badges once the project is in a public repo.
 
 
 
 
1
  ---
2
  title: API Key Validator
3
  emoji: 🔑
 
9
  pinned: false
10
  ---
11