omnigate-ai 1.0.0 β†’ 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # OmniGate AI 🌌
2
+
3
+ ![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
4
+ ![License](https://img.shields.io/badge/license-MIT-green.svg)
5
+
6
+ **The Privacy-First LLM API Gateway for Developers & AI Agents**
7
+
8
+ OmniGate AI is a self-hosted, local proxy server designed to sit between your code editors (like VS Code, Roo Code, Cline) and your LLM providers (OpenAI, DeepSeek, Anthropic). It intercepts API requests to securely inject your real API keys, count tokens, and calculate costs in real-timeβ€”all without your secret keys ever leaving your machine.
9
+
10
+ ---
11
+
12
+ ## πŸš€ Quick Start
13
+
14
+ No complex installations required. If you have Node.js installed, simply run:
15
+
16
+ ```bash
17
+ npx omnigate-ai
18
+ ```
19
+
20
+ This will instantly download and start the proxy server on port `8080`.
21
+
22
+ ## πŸ’» The Dashboard
23
+
24
+ Once the server is running, open your web browser and navigate to:
25
+ **http://localhost:8080/dashboard**
26
+
27
+ You will be greeted by a beautiful, glassmorphic UI where you can:
28
+ 1. **Secure Your Gateway:** Create a local "Gateway Secret Key" to lock down your proxy.
29
+ 2. **Add API Keys:** Securely store your real OpenAI or DeepSeek API keys locally.
30
+ 3. **Track Usage:** Watch real-time gauges spin as your tokens are consumed, showing you exact costs and RPM (Requests Per Minute).
31
+ 4. **Audit Logs:** View a live feed of every single request your AI tools are making behind the scenes.
32
+
33
+ ## πŸ› οΈ Integrating with VS Code / AI Agents
34
+
35
+ To route your AI coding assistant through OmniGate AI:
36
+
37
+ 1. Open your AI Tool's settings (e.g., Roo Code or Continue).
38
+ 2. Set the **Provider** to `OpenAI Compatible`.
39
+ 3. Set the **Base URL** to `http://localhost:8080/v1`.
40
+ 4. Set the **API Key** to your **Gateway Secret Key** (the one you created in the dashboard, *not* your real OpenAI key).
41
+
42
+ Now, start coding! OmniGate AI will silently intercept the requests, inject your real API key, forward it to the provider, and track your tokens on the dashboard.
43
+
44
+ ## πŸ€– Routing Your Custom AI Apps (Python & Node.js)
45
+
46
+ Are you building your own AI apps? You can easily route them through OmniGate AI to track their token usage too! Just change the base URL in your official OpenAI SDK to point to your local proxy.
47
+
48
+ **Python Example:**
49
+ ```python
50
+ from openai import OpenAI
51
+
52
+ client = OpenAI(
53
+ base_url="http://localhost:8080/v1", # Point to your proxy
54
+ api_key="your-gateway-secret-key" # Use your local secret
55
+ )
56
+ ```
57
+
58
+ **Node.js Example:**
59
+ ```javascript
60
+ import OpenAI from 'openai';
61
+
62
+ const openai = new OpenAI({
63
+ baseURL: "http://localhost:8080/v1", // Point to your proxy
64
+ apiKey: "your-gateway-secret-key" // Use your local secret
65
+ });
66
+ ```
67
+
68
+ ## ✨ Features
69
+
70
+ - **πŸ”’ 100% Local Privacy:** Your real API keys are saved locally. Cloud-based AI tools never see them.
71
+ - **πŸ’Έ Token & Cost Tracking:** Accurate token counting and real-time cost estimation for OpenAI and DeepSeek models.
72
+ - **πŸ›‘οΈ Rate Limit Protection:** Monitor your RPM to prevent accidental massive API bills from rogue agents.
73
+ - **πŸ“‘ Live Audit Log:** Total transparency into what your automated agents are actually sending to the LLMs.
74
+ - **⚑ Zero Configuration:** Starts instantly with a single `npx` command.
75
+
76
+ ## 🌐 Website
77
+ Visit our [Landing Page](https://erfanhassan.github.io/Omnigate.ai) for more information.
78
+
79
+ ## πŸ“„ License
80
+ MIT License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigate-ai",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Privacy-first, self-hosted LLM API Gateway and Proxy for tracking token usage.",
5
5
  "main": "server.js",
6
6
  "type": "module",
package/public/app.js CHANGED
@@ -151,6 +151,40 @@ document.addEventListener('DOMContentLoaded', () => {
151
151
  console.error("Stream parse error:", err);
152
152
  }
153
153
  };
154
+
155
+ evtSource.addEventListener('clear_telemetry', () => {
156
+ // Reset state
157
+ totalTokens = 0;
158
+ totalInputTokens = 0;
159
+ totalOutputTokens = 0;
160
+ totalCost = 0.0;
161
+ totalRequests = 0;
162
+ requestTimestamps.length = 0;
163
+
164
+ // Clear DOM
165
+ tbody.innerHTML = '';
166
+ elTotalTokens.textContent = '0';
167
+ elInputTokens.textContent = '0';
168
+ elOutputTokens.textContent = '0';
169
+ elTotalCost.textContent = '$0.000';
170
+ elAvgCost.textContent = '$0.000';
171
+ elTotalRequests.textContent = '0';
172
+
173
+ updateGauges();
174
+ });
175
+ }
176
+
177
+ // ==========================================
178
+ // Reset Data Button
179
+ // ==========================================
180
+ const btnResetData = document.getElementById('btn-reset-data');
181
+ if (btnResetData) {
182
+ btnResetData.addEventListener('click', () => {
183
+ if (confirm('Are you sure you want to clear all telemetry history?')) {
184
+ fetch('/api/telemetry', { method: 'DELETE' })
185
+ .catch(err => console.error('Failed to clear telemetry:', err));
186
+ }
187
+ });
154
188
  }
155
189
 
156
190
  // ==========================================
package/public/index.html CHANGED
@@ -27,9 +27,14 @@
27
27
  <span style="font-size:0.7rem;color:var(--text-dim);font-weight:400;display:block;margin-top:0.1rem;">Privacy-First API Gateway &middot; Token Cost Tracker</span>
28
28
  </div>
29
29
  </div>
30
- <div class="status-indicator">
31
- <span class="pulse-dot"></span>
32
- <span>Gateway Connected</span>
30
+ <div class="header-actions" style="display: flex; gap: 1rem; align-items: center;">
31
+ <button id="btn-reset-data" class="btn-secondary" style="padding: 0.4rem 0.8rem; font-size: 0.8rem; border-color: rgba(255,8,68,0.5); color: #ffb199; background: rgba(255,8,68,0.1); border-radius: 50px;">
32
+ ⟲ Reset Data
33
+ </button>
34
+ <div class="status-indicator">
35
+ <span class="pulse-dot"></span>
36
+ <span>Gateway Connected</span>
37
+ </div>
33
38
  </div>
34
39
  </header>
35
40
 
package/server.js CHANGED
@@ -84,6 +84,12 @@ app.get('/api/telemetry', (req, res) => {
84
84
  res.json(telemetryHistory);
85
85
  });
86
86
 
87
+ app.delete('/api/telemetry', (req, res) => {
88
+ telemetryHistory.length = 0;
89
+ telemetryEmitter.emit('clear_telemetry', { status: 'cleared' });
90
+ res.json({ status: 'success', message: 'Telemetry history cleared' });
91
+ });
92
+
87
93
  app.get('/api/telemetry/stream', (req, res) => {
88
94
  res.setHeader('Content-Type', 'text/event-stream');
89
95
  res.setHeader('Cache-Control', 'no-cache');