[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70540":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":45,"readmeContent":46,"aiSummary":47,"trendingCount":16,"starSnapshotCount":16,"syncStatus":48,"lastSyncTime":49,"discoverSource":50},70540,"kiro-gateway","jwadow\u002Fkiro-gateway","jwadow","👻 Proxy API gateway for Kiro IDE & CLI (Amazon Q Developer \u002F AWS CodeWhisperer). Use free Claude models with any client.",null,"https:\u002F\u002Fgithub.com\u002Fjwadow\u002Fkiro-gateway","Python",1942,433,10,19,0,42,98,608,126,20.91,false,"main",[25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"ai","anthropic","api-gateway","aws","claude","codewhisperer","fastapi","kiro","llm","openai","opus","proxy","python","sonnet","streaming","free","opencode","sso","kiro-cli","openclaw","2026-06-12 02:02:34","\u003Cdiv align=\"center\">\n\n# 👻 Kiro Gateway\n\n**Proxy gateway for Kiro API (Amazon Q Developer \u002F AWS CodeWhisperer)**\n\n🇬🇧 English • [🇷🇺 Русский](docs\u002Fru\u002FREADME.md) • [🇨🇳 中文](docs\u002Fzh\u002FREADME.md) • [🇪🇸 Español](docs\u002Fes\u002FREADME.md) • [🇮🇩 Indonesia](docs\u002Fid\u002FREADME.md) • [🇧🇷 Português](docs\u002Fpt\u002FREADME.md) • [🇯🇵 日本語](docs\u002Fja\u002FREADME.md) • [🇰🇷 한국어](docs\u002Fko\u002FREADME.md)\n\nMade with ❤️ by [@Jwadow](https:\u002F\u002Fgithub.com\u002Fjwadow)\n\n[![License: AGPL v3](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-AGPL%20v3-blue.svg)](https:\u002F\u002Fwww.gnu.org\u002Flicenses\u002Fagpl-3.0)\n[![Python 3.10+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10+-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![FastAPI](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFastAPI-0.100+-green.svg)](https:\u002F\u002Ffastapi.tiangolo.com\u002F)\n[![Sponsor](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F💖_Sponsor-Support_Development-ff69b4)](#-support-the-project)\n\n*Use Claude models from Kiro with Claude Code, OpenCode, OpenClaw, Claw Code, Codex app, Cursor, Cline, Roo Code, Kilo Code, Obsidian, OpenAI SDK, LangChain, Continue and other OpenAI or Anthropic compatible tools*\n\n[Models](#-supported-models) • [Features](#-features) • [Quick Start](#-quick-start) • [Configuration](#%EF%B8%8F-configuration) • [💖 Sponsor](#-support-the-project)\n\n\u003C\u002Fdiv>\n\n---\n\n## 🤖 Available Models (Free List)\n\n> ⚠️ **Important:** Model availability depends on your Kiro tier (free\u002Fpaid). The gateway provides access to whatever models are available in your IDE or CLI based on your subscription. The list below shows models commonly available on the **free tier**.\n\n> 🔒 **Claude Opus 4.5** was removed from the free tier on January 17, 2026. It may be available on paid tiers — check your IDE\u002FCLI model list.\n\n🚀 **Claude Sonnet 4.5** — Balanced performance. Great for coding, writing, and general-purpose tasks.\n\n⚡ **Claude Haiku 4.5** — Lightning fast. Perfect for quick responses, simple tasks, and chat.\n\n📦 **Claude Sonnet 4** — Previous generation. Still powerful and reliable for most use cases.\n\n💤 **GLM-5** — Open MoE model (744B params, 40B active). Advanced model for complex systems engineering and long-horizon agentic tasks.\n\n🐋 **DeepSeek-V3.2** — Open MoE model (685B params, 37B active). Balanced performance for coding, reasoning, and general tasks.\n\n🧩 **MiniMax M2.5** — Open MoE model (230B params, 10B active). Enhanced version with improved reasoning and task handling.\n\n🧩 **MiniMax M2.1** — Open MoE model (230B params, 10B active). Great for complex tasks, planning, and multi-step workflows.\n\n🤖 **Qwen3-Coder-Next** — Open MoE model (80B params, 3B active). Coding-focused. Excellent for development and large projects.\n\n> 💡 **Smart Model Resolution:** Use any model name format — `claude-sonnet-4-5`, `claude-sonnet-4.5`, or even versioned names like `claude-sonnet-4-5-20250929`. The gateway normalizes them automatically.\n\n---\n\n## ✨ Features\n\n| Feature | Description |\n|---------|-------------|\n| 🔌 **OpenAI-compatible API** | Works with any OpenAI-compatible tool |\n| 🔌 **Anthropic-compatible API** | Native `\u002Fv1\u002Fmessages` endpoint |\n| 🔀 **Multi-Account Support** | Intelligent failover between multiple accounts |\n| 🌐 **VPN\u002FProxy Support** | HTTP\u002FSOCKS5 proxy for restricted networks |\n| 🧠 **Extended Thinking** | Reasoning is exclusive to our project |\n| 👁️ **Vision Support** | Send images to model |\n| 🔍 **Web Search** | Search the web for current information |\n| 🛠️ **Tool Calling** | Supports function calling |\n| 💬 **Full message history** | Passes complete conversation context |\n| 📡 **Streaming** | Full SSE streaming support |\n| 🔄 **Retry Logic** | Automatic retries on errors (403, 429, 5xx) |\n| 📋 **Extended model list** | Including versioned models |\n| 🔐 **Smart token management** | Automatic refresh before expiration |\n\n---\n\n## 🚀 Quick Start\n\n**Choose your deployment method:**\n- 🐍 **Native Python** - Full control, easy debugging\n- 🐳 **Docker** - Isolated environment, easy deployment → [jump to Docker](#-docker-deployment)\n\n### Prerequisites\n\n- Python 3.10+\n- One of the following:\n  - [Kiro IDE](https:\u002F\u002Fkiro.dev\u002F) with logged in account, OR\n  - [Kiro CLI](https:\u002F\u002Fkiro.dev\u002Fcli\u002F) with AWS SSO (AWS IAM Identity Center, OIDC) - free Builder ID or corporate account\n\n### Installation\n\n```bash\n# Clone the repository (requires Git)\ngit clone https:\u002F\u002Fgithub.com\u002FJwadow\u002Fkiro-gateway.git\ncd kiro-gateway\n\n# Or download ZIP: Code → Download ZIP → extract → open kiro-gateway folder\n\n# Install dependencies\npip install -r requirements.txt\n\n# Configure (see Configuration section)\ncp .env.example .env\n# Copy and edit .env with your credentials\n\n# Start the server\npython main.py\n\n# Or with custom port (if 8000 is busy)\npython main.py --port 9000\n```\n\nThe server will be available at `http:\u002F\u002Flocalhost:8000`\n\n---\n\n## ⚙️ Configuration\n\n> 💡 **Advanced users:** Looking for multi-account support? See [Account System](#-account-system-advanced) below.\n\n### Option 1: JSON Credentials File (Kiro IDE \u002F Enterprise)\n\nSpecify the path to the credentials file:\n\nWorks with:\n- **Kiro IDE** (standard) - for personal accounts\n- **Enterprise** - for corporate accounts with SSO\n\n```env\nKIRO_CREDS_FILE=\"~\u002F.aws\u002Fsso\u002Fcache\u002Fkiro-auth-token.json\"\n\n# Password to protect YOUR proxy server (make up any secure string)\n# You'll use this as api_key when connecting to your gateway\nPROXY_API_KEY=\"my-super-secret-password-123\"\n```\n\n\u003Cdetails>\n\u003Csummary>📄 JSON file format\u003C\u002Fsummary>\n\n```json\n{\n  \"accessToken\": \"eyJ...\",\n  \"refreshToken\": \"eyJ...\",\n  \"expiresAt\": \"2025-01-12T23:00:00.000Z\",\n  \"profileArn\": \"arn:aws:codewhisperer:us-east-1:...\",\n  \"region\": \"us-east-1\",\n  \"clientIdHash\": \"abc123...\"  \u002F\u002F Optional: for corporate SSO setups\n}\n```\n\n> **Note:** If you have two JSON files in `~\u002F.aws\u002Fsso\u002Fcache\u002F` (e.g., `kiro-auth-token.json` and a file with a hash name), use `kiro-auth-token.json` in `KIRO_CREDS_FILE`. The gateway will automatically load the other file.\n\n\u003C\u002Fdetails>\n\n### Option 2: Environment Variables (.env file)\n\nCreate a `.env` file in the project root:\n\n```env\n# Required\nREFRESH_TOKEN=\"your_kiro_refresh_token\"\n\n# Password to protect YOUR proxy server (make up any secure string)\nPROXY_API_KEY=\"my-super-secret-password-123\"\n\n# Optional\nPROFILE_ARN=\"arn:aws:codewhisperer:us-east-1:...\"\nKIRO_REGION=\"us-east-1\"\n```\n\n### Option 3: AWS SSO Credentials (kiro-cli \u002F Enterprise)\n\nIf you use `kiro-cli` or Kiro IDE with AWS SSO (AWS IAM Identity Center), the gateway will automatically detect and use the appropriate authentication.\n\nWorks with both free Builder ID accounts and corporate accounts.\n\n```env\nKIRO_CREDS_FILE=\"~\u002F.aws\u002Fsso\u002Fcache\u002Fyour-sso-cache-file.json\"\n\n# Password to protect YOUR proxy server\nPROXY_API_KEY=\"my-super-secret-password-123\"\n\n# Note: PROFILE_ARN is NOT needed for AWS SSO (Builder ID and corporate accounts)\n# The gateway will work without it\n```\n\n\u003Cdetails>\n\u003Csummary>📄 AWS SSO JSON file format\u003C\u002Fsummary>\n\nAWS SSO credentials files (from `~\u002F.aws\u002Fsso\u002Fcache\u002F`) contain:\n\n```json\n{\n  \"accessToken\": \"eyJ...\",\n  \"refreshToken\": \"eyJ...\",\n  \"expiresAt\": \"2025-01-12T23:00:00.000Z\",\n  \"region\": \"us-east-1\",\n  \"clientId\": \"...\",\n  \"clientSecret\": \"...\"\n}\n```\n\n**Note:** AWS SSO (Builder ID and corporate accounts) users do NOT need `profileArn`. The gateway will work without it (if specified, it will be ignored).\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🔍 How it works\u003C\u002Fsummary>\n\nThe gateway automatically detects the authentication type based on the credentials file:\n\n- **Kiro Desktop Auth** (default): Used when `clientId` and `clientSecret` are NOT present\n  - Endpoint: `https:\u002F\u002Fprod.{region}.auth.desktop.kiro.dev\u002FrefreshToken`\n  \n- **AWS SSO (OIDC)**: Used when `clientId` and `clientSecret` ARE present\n  - Endpoint: `https:\u002F\u002Foidc.{region}.amazonaws.com\u002Ftoken`\n\nNo additional configuration is needed — just point to your credentials file!\n\n\u003C\u002Fdetails>\n\n### Option 4: kiro-cli SQLite Database\n\nIf you use `kiro-cli` and prefer to use its SQLite database directly:\n\n```env\nKIRO_CLI_DB_FILE=\"~\u002F.local\u002Fshare\u002Fkiro-cli\u002Fdata.sqlite3\"\n\n# Password to protect YOUR proxy server\nPROXY_API_KEY=\"my-super-secret-password-123\"\n\n# Note: PROFILE_ARN is NOT needed for AWS SSO (Builder ID and corporate accounts)\n# The gateway will work without it\n```\n\n\u003Cdetails>\n\u003Csummary>📄 Database locations\u003C\u002Fsummary>\n\n| CLI Tool | Database Path |\n|----------|---------------|\n| kiro-cli | `~\u002F.local\u002Fshare\u002Fkiro-cli\u002Fdata.sqlite3` |\n| amazon-q-developer-cli | `~\u002F.local\u002Fshare\u002Famazon-q\u002Fdata.sqlite3` |\n\nThe gateway reads credentials from the `auth_kv` table which stores:\n- `kirocli:odic:token` or `codewhisperer:odic:token` — access token, refresh token, expiration\n- `kirocli:odic:device-registration` or `codewhisperer:odic:device-registration` — client ID and secret\n\nBoth key formats are supported for compatibility with different kiro-cli versions.\n\n\u003C\u002Fdetails>\n\n### Getting Credentials\n\n**For Kiro IDE users:**\n- Log in to Kiro IDE and use Option 1 above (JSON credentials file)\n- The credentials file is created automatically after login\n\n**For Kiro CLI users:**\n- Log in with `kiro-cli login` and use Option 3 or Option 4 above\n- No manual token extraction needed!\n\n\u003Cdetails>\n\u003Csummary>🔧 Advanced: Manual token extraction\u003C\u002Fsummary>\n\nIf you need to manually extract the refresh token (e.g., for debugging), you can intercept Kiro IDE traffic:\n- Look for requests to: `prod.us-east-1.auth.desktop.kiro.dev\u002FrefreshToken`\n\n\u003C\u002Fdetails>\n\n---\n\n## 🔀 Account System (Advanced)\n\nAccount System is a way to manage multiple Kiro accounts with automatic failover. In the future, this system will replace `.env` file for credential configuration, but currently it's optional and intended for those who want to use multiple accounts.\n\n### Why You Need This\n\nIf you have multiple Kiro accounts, the gateway can automatically switch between them when account is temporarily unavailable.\n\nThe system works with a single account too — just without switching.\n\n### How to Enable\n\nAdd to your `.env`:\n\n```env\nACCOUNT_SYSTEM=true\n```\n\n**What happens:**\n- On first startup, your credentials from `.env` are automatically migrated to `credentials.json` (one-time)\n- After that, all account and region settings from `.env` are ignored\n- Account management only through `credentials.json`\n\n\u003Cdetails>\n\u003Csummary>📄 Configuration Examples\u003C\u002Fsummary>\n\n**Single account:**\n```json\n[\n  {\n    \"type\": \"json\",\n    \"path\": \"~\u002F.aws\u002Fsso\u002Fcache\u002Fkiro-auth-token.json\"\n  }\n]\n```\n\n**Multiple accounts:**\n```json\n[\n  {\n    \"type\": \"json\",\n    \"path\": \"~\u002F.aws\u002Fsso\u002Fcache\u002Fkiro-auth-token.json\"\n  },\n  {\n    \"type\": \"sqlite\",\n    \"path\": \"~\u002F.local\u002Fshare\u002Fkiro-cli\u002Fdata.sqlite3\"\n  },\n  {\n    \"type\": \"refresh_token\",\n    \"refresh_token\": \"eyJhbGc...\",\n    \"profile_arn\": \"arn:aws:codewhisperer:us-east-1:...\"\n  }\n]\n```\n\n**Folder with files:**\n```json\n[\n  {\n    \"type\": \"json\",\n    \"path\": \"C:\\\\MyAccs\\\\kiro67\"\n  }\n]\n```\n\nThe gateway will scan all files in the folder and add them as separate accounts.\n\n\u003C\u002Fdetails>\n\n### How Failover Works\n\nWhen one account returns an error (429 rate limit, 402 quota exceeded), the gateway automatically tries the next account from the list. If an account fails several times in a row, the gateway temporarily stops using it and periodically checks if it has recovered.\n\nFor a single account, failover doesn't work — you get the original error from Kiro API.\n\nFor complete configuration examples (including per-account region settings), see [`credentials.json.example`](credentials.json.example).\n\n---\n\n## 🐳 Docker Deployment\n\n> **Docker-based deployment.** Prefer native Python? See [Quick Start](#-quick-start) above.\n\n### Quick Start\n\n```bash\n# 1. Clone and configure\ngit clone https:\u002F\u002Fgithub.com\u002FJwadow\u002Fkiro-gateway.git\ncd kiro-gateway\ncp .env.example .env\n# Edit .env with your credentials\n\n# 2. Run with docker-compose\ndocker-compose up -d\n\n# 3. Check status\ndocker-compose logs -f\ncurl http:\u002F\u002Flocalhost:8000\u002Fhealth\n```\n\n### Docker Run (Without Compose)\n\n\u003Cdetails>\n\u003Csummary>🔹 Using Environment Variables\u003C\u002Fsummary>\n\n```bash\ndocker run -d \\\n  -p 8000:8000 \\\n  -e PROXY_API_KEY=\"my-super-secret-password-123\" \\\n  -e REFRESH_TOKEN=\"your_refresh_token\" \\\n  --name kiro-gateway \\\n  ghcr.io\u002Fjwadow\u002Fkiro-gateway:latest\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🔹 Using Credentials File\u003C\u002Fsummary>\n\n**Linux\u002FmacOS:**\n```bash\ndocker run -d \\\n  -p 8000:8000 \\\n  -v ~\u002F.aws\u002Fsso\u002Fcache:\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache:ro \\\n  -e KIRO_CREDS_FILE=\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache\u002Fkiro-auth-token.json \\\n  -e PROXY_API_KEY=\"my-super-secret-password-123\" \\\n  --name kiro-gateway \\\n  ghcr.io\u002Fjwadow\u002Fkiro-gateway:latest\n```\n\n**Windows (PowerShell):**\n```powershell\ndocker run -d `\n  -p 8000:8000 `\n  -v ${HOME}\u002F.aws\u002Fsso\u002Fcache:\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache:ro `\n  -e KIRO_CREDS_FILE=\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache\u002Fkiro-auth-token.json `\n  -e PROXY_API_KEY=\"my-super-secret-password-123\" `\n  --name kiro-gateway `\n  ghcr.io\u002Fjwadow\u002Fkiro-gateway:latest\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🔹 Using .env File\u003C\u002Fsummary>\n\n```bash\ndocker run -d -p 8000:8000 --env-file .env --name kiro-gateway ghcr.io\u002Fjwadow\u002Fkiro-gateway:latest\n```\n\n\u003C\u002Fdetails>\n\n### Docker Compose Configuration\n\nEdit `docker-compose.yml` and uncomment volume mounts for your OS:\n\n```yaml\nvolumes:\n  # Kiro IDE credentials (choose your OS)\n  - ~\u002F.aws\u002Fsso\u002Fcache:\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache:ro              # Linux\u002FmacOS\n  # - ${USERPROFILE}\u002F.aws\u002Fsso\u002Fcache:\u002Fhome\u002Fkiro\u002F.aws\u002Fsso\u002Fcache:ro  # Windows\n  \n  # kiro-cli database (choose your OS)\n  - ~\u002F.local\u002Fshare\u002Fkiro-cli:\u002Fhome\u002Fkiro\u002F.local\u002Fshare\u002Fkiro-cli  # Linux\u002FmacOS\n  # - ${USERPROFILE}\u002F.local\u002Fshare\u002Fkiro-cli:\u002Fhome\u002Fkiro\u002F.local\u002Fshare\u002Fkiro-cli  # Windows\n  \n  # Debug logs (optional)\n  - .\u002Fdebug_logs:\u002Fapp\u002Fdebug_logs\n```\n\n### Management Commands\n\n```bash\ndocker-compose logs -f      # View logs\ndocker-compose restart      # Restart\ndocker-compose down         # Stop\ndocker-compose pull && docker-compose up -d  # Update\n```\n\n\u003Cdetails>\n\u003Csummary>🔧 Building from Source\u003C\u002Fsummary>\n\n```bash\ndocker build -t kiro-gateway .\ndocker run -d -p 8000:8000 --env-file .env kiro-gateway\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## 🌐 VPN\u002FProxy Support\n\n**For users in China, corporate networks, or regions with connectivity issues to AWS services.**\n\nThe gateway supports routing all Kiro API requests through a VPN or proxy server. This is essential if you experience connection problems to AWS endpoints or need to use a corporate proxy.\n\n### Configuration\n\nAdd to your `.env` file:\n\n```env\n# HTTP proxy\nVPN_PROXY_URL=http:\u002F\u002F127.0.0.1:7890\n\n# SOCKS5 proxy\nVPN_PROXY_URL=socks5:\u002F\u002F127.0.0.1:1080\n\n# With authentication (corporate proxies)\nVPN_PROXY_URL=http:\u002F\u002Fusername:password@proxy.company.com:8080\n\n# Without protocol (defaults to http:\u002F\u002F)\nVPN_PROXY_URL=192.168.1.100:8080\n```\n\n### Supported Protocols\n\n- ✅ **HTTP** — Standard proxy protocol\n- ✅ **HTTPS** — Secure proxy connections\n- ✅ **SOCKS5** — Advanced proxy protocol (common in VPN software)\n- ✅ **Authentication** — Username\u002Fpassword embedded in URL\n\n### When You Need This\n\n| Situation | Solution |\n|-----------|----------|\n| Connection timeouts to AWS | Use VPN\u002Fproxy to route traffic |\n| Corporate network restrictions | Configure your company's proxy |\n| Regional connectivity issues | Use a VPN service with proxy support |\n| Privacy requirements | Route through your own proxy server |\n\n### Popular VPN Software with Proxy Support\n\nMost VPN clients provide a local proxy server you can use:\n- **Sing-box** — Modern VPN client with HTTP\u002FSOCKS5 proxy\n- **Clash** — Usually runs on `http:\u002F\u002F127.0.0.1:7890`\n- **V2Ray** — Configurable SOCKS5\u002FHTTP proxy\n- **Shadowsocks** — SOCKS5 proxy support\n- **Corporate VPN** — Check your IT department for proxy settings\n\nLeave `VPN_PROXY_URL` empty (default) if you don't need proxy support.\n\n---\n\n## 📡 API Reference\n\n### Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `\u002F` | GET | Health check |\n| `\u002Fhealth` | GET | Detailed health check |\n| `\u002Fv1\u002Fmodels` | GET | List available models |\n| `\u002Fv1\u002Fchat\u002Fcompletions` | POST | OpenAI Chat Completions API |\n| `\u002Fv1\u002Fmessages` | POST | Anthropic Messages API |\n\n---\n\n## 💡 Usage Examples\n\n### OpenAI API\n\n\u003Cdetails>\n\u003Csummary>🔹 Simple cURL Request\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer my-super-secret-password-123\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}],\n    \"stream\": true\n  }'\n```\n\n> **Note:** Replace `my-super-secret-password-123` with the `PROXY_API_KEY` you set in your `.env` file.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🔹 Streaming Request\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer my-super-secret-password-123\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"messages\": [\n      {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n      {\"role\": \"user\", \"content\": \"What is 2+2?\"}\n    ],\n    \"stream\": true\n  }'\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🛠️ With Tool Calling\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer my-super-secret-password-123\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"What is the weather in London?\"}],\n    \"tools\": [{\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"get_weather\",\n        \"description\": \"Get weather for a location\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"location\": {\"type\": \"string\", \"description\": \"City name\"}\n          },\n          \"required\": [\"location\"]\n        }\n      }\n    }]\n  }'\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🐍 Python OpenAI SDK\u003C\u002Fsummary>\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8000\u002Fv1\",\n    api_key=\"my-super-secret-password-123\"  # Your PROXY_API_KEY from .env\n)\n\nresponse = client.chat.completions.create(\n    model=\"claude-sonnet-4-5\",\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Hello!\"}\n    ],\n    stream=True\n)\n\nfor chunk in response:\n    if chunk.choices[0].delta.content:\n        print(chunk.choices[0].delta.content, end=\"\")\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🦜 LangChain\u003C\u002Fsummary>\n\n```python\nfrom langchain_openai import ChatOpenAI\n\nllm = ChatOpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8000\u002Fv1\",\n    api_key=\"my-super-secret-password-123\",  # Your PROXY_API_KEY from .env\n    model=\"claude-sonnet-4-5\"\n)\n\nresponse = llm.invoke(\"Hello, how are you?\")\nprint(response.content)\n```\n\n\u003C\u002Fdetails>\n\n### Anthropic API\n\n\u003Cdetails>\n\u003Csummary>🔹 Simple cURL Request\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fmessages \\\n  -H \"x-api-key: my-super-secret-password-123\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"max_tokens\": 1024,\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n  }'\n```\n\n> **Note:** Anthropic API uses `x-api-key` header instead of `Authorization: Bearer`. Both are supported.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🔹 With System Prompt\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fmessages \\\n  -H \"x-api-key: my-super-secret-password-123\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"max_tokens\": 1024,\n    \"system\": \"You are a helpful assistant.\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n  }'\n```\n\n> **Note:** In Anthropic API, `system` is a separate field, not a message.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>📡 Streaming\u003C\u002Fsummary>\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fv1\u002Fmessages \\\n  -H \"x-api-key: my-super-secret-password-123\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-5\",\n    \"max_tokens\": 1024,\n    \"stream\": true,\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n  }'\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>🐍 Python Anthropic SDK\u003C\u002Fsummary>\n\n```python\nimport anthropic\n\nclient = anthropic.Anthropic(\n    api_key=\"my-super-secret-password-123\",  # Your PROXY_API_KEY from .env\n    base_url=\"http:\u002F\u002Flocalhost:8000\"\n)\n\n# Non-streaming\nresponse = client.messages.create(\n    model=\"claude-sonnet-4-5\",\n    max_tokens=1024,\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\nprint(response.content[0].text)\n\n# Streaming\nwith client.messages.stream(\n    model=\"claude-sonnet-4-5\",\n    max_tokens=1024,\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n) as stream:\n    for text in stream.text_stream:\n        print(text, end=\"\", flush=True)\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## 🔧 Debugging\n\nDebug logging is **disabled by default**. To enable, add to your `.env`:\n\n```env\n# Debug logging mode:\n# - off: disabled (default)\n# - errors: save logs only for failed requests (4xx, 5xx) - recommended for troubleshooting\n# - all: save logs for every request (overwrites on each request)\nDEBUG_MODE=errors\n```\n\n### Debug Modes\n\n| Mode | Description | Use Case |\n|------|-------------|----------|\n| `off` | Disabled (default) | Production |\n| `errors` | Save logs only for failed requests (4xx, 5xx) | **Recommended for troubleshooting** |\n| `all` | Save logs for every request | Development\u002Fdebugging |\n\n### Debug Files\n\nWhen enabled, requests are logged to the `debug_logs\u002F` folder:\n\n| File | Description |\n|------|-------------|\n| `request_body.json` | Incoming request from client (OpenAI format) |\n| `kiro_request_body.json` | Request sent to Kiro API |\n| `response_stream_raw.txt` | Raw stream from Kiro |\n| `response_stream_modified.txt` | Transformed stream (OpenAI format) |\n| `app_logs.txt` | Application logs for the request |\n| `error_info.json` | Error details (only on errors) |\n\n---\n\n## 🔧 Troubleshooting\n\n### Connection Issues\n\n**Error: \"Name or service not known\" or DNS resolution failed**\n\nThe Q API endpoint may not be publicly resolvable in your region. Use a VPN or proxy:\n\n```env\nVPN_PROXY_URL=http:\u002F\u002F127.0.0.1:7890\n```\n\nSee [VPN\u002FProxy Support](#-vpnproxy-support) for details.\n\n---\n\n**Error: \"503 Service Unavailable\" through proxy**\n\nThe Q API endpoint exists in specific regions only. Try a different region:\n\n```env\nKIRO_API_REGION=\"eu-central-1\"  # or us-east-1\n```\n\nCommonly reachable regions: `us-east-1`, `eu-central-1`\n\n---\n\n**OIDC works but Q API fails**\n\nYour SSO region may differ from the Q API region. The gateway auto-detects this from credentials, but you can override:\n\n```env\nKIRO_API_REGION=\"eu-central-1\"\n```\n\n---\n\n## 📜 License\n\nThis project is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.\n\nThis means:\n- ✅ You can use, modify, and distribute this software\n- ✅ You can use it for commercial purposes\n- ⚠️ **You must disclose source code** when you distribute the software\n- ⚠️ **Network use is distribution** — if you run a modified version on a server and let others interact with it, you must make the source code available to them\n- ⚠️ Modifications must be released under the same license\n\nSee the [LICENSE](LICENSE) file for the full license text.\n\n### Why AGPL-3.0?\n\nAGPL-3.0 ensures that improvements to this software benefit the entire community. If you modify this gateway and deploy it as a service, you must share your improvements with your users.\n\n### Contributor License Agreement (CLA)\n\nBy submitting a contribution to this project, you agree to the terms of our [Contributor License Agreement (CLA)](CLA.md). This ensures that:\n- You have the right to submit the contribution\n- You grant the maintainer rights to use and relicense your contribution\n- The project remains legally protected\n\n---\n\n## 💖 Support the Project\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002FTarikul-Islam-Anik\u002FAnimated-Fluent-Emojis\u002Fmaster\u002FEmojis\u002FSmilies\u002FSmiling%20Face%20with%20Hearts.png\" alt=\"Love\" width=\"80\" \u002F>\n\n**If this project saved you time or money, consider supporting it!**\n\nEvery contribution helps keep this project alive and growing\n\n\u003Cbr>\n\n### 🤑 Donate\n\n[**☕ One-time Support**](https:\u002F\u002Fapp.lava.top\u002Fproducts\u002Fb4e34d12-3b6b-49b7-be50-50b6a20ed262\u002Ff3ea941f-de73-4ad1-bbb6-f82042ef8132)\n\n\u003Cbr>\n\n### 🪙 Or send crypto\n\n| Currency | Network | Address |\n|:--------:|:-------:|:--------|\n| **USDT** | TRC20 | `TSVtgRc9pkC1UgcbVeijBHjFmpkYHDRu26` |\n| **BTC** | Bitcoin | `12GZqxqpcBsqJ4Vf1YreLqwoMGvzBPgJq6` |\n| **ETH** | Ethereum | `0xc86eab3bba3bbaf4eb5b5fff8586f1460f1fd395` |\n| **SOL** | Solana | `9amykF7KibZmdaw66a1oqYJyi75fRqgdsqnG66AK3jvh` |\n| **TON** | TON | `UQBVh8T1H3GI7gd7b-_PPNnxHYYxptrcCVf3qQk5v41h3QTM` |\n\n\u003C\u002Fdiv>\n\n---\n\n## ⚠️ Disclaimer\n\nThis project is not affiliated with, endorsed by, or sponsored by Amazon Web Services (AWS), Anthropic, or Kiro IDE. Use at your own risk and in compliance with the terms of service of the underlying APIs.\n\n---\n\n\u003Cdiv align=\"center\">\n\n**[⬆ Back to Top](#-kiro-gateway)**\n\n\u003C\u002Fdiv>\n","Kiro Gateway 是一个为 Kiro IDE 和 CLI（Amazon Q Developer \u002F AWS CodeWhisperer）设计的代理 API 网关，允许用户通过任何客户端免费使用 Claude 模型。该项目基于 Python 3.10+ 开发，并采用了 FastAPI 框架以提供高性能的 Web 服务。其核心功能包括支持多种 Claude 模型及其他开源模型，以及智能模型名称解析能力，确保了不同格式下的模型名称都能被正确识别和使用。此外，它还兼容 OpenAI 和 Anthropic 的 API 标准，使得该网关能够无缝集成到现有的开发工具链中。Kiro Gateway 特别适合需要利用先进 AI 模型进行代码编写、文本生成或其他通用任务处理的开发者或团队使用。",2,"2026-06-11 03:32:42","trending"]