Skip to content

Commit c836360

Browse files
committed
Initial commit
0 parents  commit c836360

10 files changed

Lines changed: 2781 additions & 0 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Kiro Proxy Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<div align="center">
2+
<h1>Kiro Agent Proxy 🚀</h1>
3+
<p>A robust local proxy bridging OpenAI-compatible editors with the native Kiro AWS Event Stream protocol.</p>
4+
5+
<p>
6+
<a href="https://github.com/sionex-code/opencode-proxy-api/stargazers"><img src="https://img.shields.io/github/stars/sionex-code/opencode-proxy-api" alt="Stars Badge"/></a>
7+
<a href="https://github.com/sionex-code/opencode-proxy-api/network/members"><img src="https://img.shields.io/github/forks/sionex-code/opencode-proxy-api" alt="Forks Badge"/></a>
8+
<a href="https://github.com/sionex-code/opencode-proxy-api/pulls"><img src="https://img.shields.io/github/issues-pr/sionex-code/opencode-proxy-api" alt="Pull Requests Badge"/></a>
9+
<a href="https://github.com/sionex-code/opencode-proxy-api/issues"><img src="https://img.shields.io/github/issues/sionex-code/opencode-proxy-api" alt="Issues Badge"/></a>
10+
<a href="https://github.com/sionex-code/opencode-proxy-api/blob/main/LICENSE"><img src="https://img.shields.io/github/license/sionex-code/opencode-proxy-api" alt="License Badge"/></a>
11+
</p>
12+
</div>
13+
14+
---
15+
16+
## 📖 Overview
17+
18+
The **Kiro Agent Proxy** enables advanced AI IDEs (like Opencode) that expect standard OpenAI-compatible API responses to communicate seamlessly with Kiro's backend infrastructure.
19+
20+
It accomplishes this by translating standard JSON-based chat completions into AWS Binary Event Streams, injecting custom tool definitions, and converting the resulting streams back into OpenAI-compatible Server-Sent Events (SSE).
21+
22+
Additionally, it features a **Web Dashboard** for managing multiple Kiro accounts, handling OAuth PKCE flows, dynamic proxy controlling, and automatic token refreshing.
23+
24+
![Dashboard Screenshot](dashboard.jpg)
25+
26+
## ✨ Features
27+
28+
- **Multi-Account Dashboard:** Easily manage and switch between different Kiro authenticated profiles.
29+
- **Dynamic Active Switching:** The proxy automatically routes requests through whichever account is currently marked "Active" in the dashboard.
30+
- **Auto-Refreshing Tokens:** Background monitoring of token lifespans. Automatically hits the `/refreshToken` endpoint when an active token is within 5 minutes of expiring.
31+
- **Detailed Quota Tracking:** Real-time visibility into usage metrics, properly aggregating standard allocations and Free Trial limits.
32+
- **Native Tool Translation:** Transparently maps generic OpenAI tool calls into the Kiro `toolSpec` schema.
33+
- **Subprocess Management:** Start and stop the proxy server directly from the web interface without touching the terminal.
34+
35+
## 📂 Project Structure
36+
37+
```text
38+
.
39+
├── auth_capture_v2.py # Main Web Dashboard & Profile Manager (Run this!)
40+
├── proxy.py # FastAPI proxy server (Auto-managed by dashboard)
41+
├── kiro_api.py # Core AWS binary event stream parsing client
42+
├── profiles.json # Local database for OAuth tokens & limits (Auto-generated)
43+
├── tools.json # Kiro-native tool definitions
44+
├── opencode.json # Example IDE connection config
45+
├── requirements.txt # Python dependencies
46+
└── LICENSE # MIT License
47+
```
48+
49+
## 🚀 Usage Guide
50+
51+
### 1. Installation
52+
53+
Clone the repository and install the required dependencies:
54+
55+
```bash
56+
git clone https://github.com/sionex-code/opencode-proxy-api.git
57+
cd opencode-proxy-api
58+
pip install -r requirements.txt
59+
```
60+
61+
### 2. Start the Dashboard
62+
63+
Run the main management script. This acts as both your OAuth handler and your proxy controller.
64+
65+
```bash
66+
python auth_capture_v2.py
67+
```
68+
69+
### 3. Add an Account
70+
1. Open [http://localhost:3128](http://localhost:3128) in your browser.
71+
2. Click **+ Add Account**.
72+
3. Copy the provided authentication URL and open it in your preferred browser to log in via Kiro.
73+
4. Your account will appear on the dashboard with its active token, refresh token, and accurate usage limits.
74+
75+
### 4. Start the Proxy
76+
From the dashboard interface, click the green **Start Proxy** button. The proxy server will spin up on port `8000`.
77+
78+
### 5. Configure Your IDE
79+
Configure your AI editor (like Opencode) to point to the local proxy. An exact copy-paste JSON configuration is provided at the bottom of the dashboard page.
80+
81+
It will look something like this:
82+
```json
83+
{
84+
"provider": {
85+
"kiro": {
86+
"npm": "@ai-sdk/openai-compatible",
87+
"name": "Kiro Backend Proxy",
88+
"options": {
89+
"baseURL": "http://127.0.0.1:8000/v1",
90+
"apiKey": "dummy-key-not-used-by-proxy"
91+
},
92+
"models": {
93+
"claude-sonnet-4.5": {
94+
"name": "Claude Sonnet 4.5 (via Kiro)",
95+
"limit": {
96+
"context": 200000,
97+
"output": 65536
98+
}
99+
}
100+
}
101+
}
102+
}
103+
}
104+
```
105+
106+
## 📈 Star History
107+
108+
[![Star History Chart](https://api.star-history.com/svg?repos=sionex-code/opencode-proxy-api&type=Date)](https://star-history.com/#sionex-code/opencode-proxy-api&Date)
109+
110+
## 📄 License
111+
112+
This project is licensed under the [MIT License](LICENSE).

0 commit comments

Comments
 (0)