Add Kiro CLI provider with multi-credential support#116
Open
ItzMeAyben wants to merge 3 commits intoMirrowel:mainfrom
Open
Add Kiro CLI provider with multi-credential support#116ItzMeAyben wants to merge 3 commits intoMirrowel:mainfrom
ItzMeAyben wants to merge 3 commits intoMirrowel:mainfrom
Conversation
…and documentation
Add comprehensive Kiro CLI (Amazon Q / Kiro) provider implementation with support for multiple authentication methods: - Direct refresh token via environment variables - JSON credentials from Kiro IDE (~/.aws/sso/cache/kiro-auth-token.json) - SQLite database from kiro-cli (macOS and Linux) - Auto-detection with configurable priority Features: - KiroAuthManager with AWS SSO OIDC and Kiro Desktop auth support - Token refresh with automatic expiration handling - HTTP client with retry logic (403, 429, 5xx) - OpenAI message/tool format conversion to Kiro API - AWS Event Stream parsing for streaming responses - Thinking block extraction and formatting - macOS and Linux path support Updates: - credential_manager.py: Add Kiro credential discovery - launcher_tui.py: Add Kiro credential detection in TUI - main.py: Skip JSON parsing for Kiro SQLite credentials - docker-compose.dev.yml: Add Kiro credential volume mounts - .env.example: Document all Kiro auth options - README.md: Add comprehensive Kiro setup documentation Co-authored-by: Cursor <cursoragent@cursor.com>
Add SPDX-License-Identifier and Copyright headers to all new Kiro provider files as required by CONTRIBUTING.md guidelines. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
I'm starting a comprehensive review of the new Kiro CLI provider implementation. I see a significant amount of work here, including multi-credential support and the global port transition to 7777. I'll dive into the authentication logic and streaming parser now and provide detailed feedback shortly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add Kiro CLI (Amazon Q / Kiro) provider enabling access to Claude models via AWS Bedrock using Kiro CLI authentication.
Port Note: Uses 7777 (project default) vs reference's 8000.
Features
<thinking>block extractionSupported Models
All Claude models available through Kiro API:
Architecture
Authentication Flow
sequenceDiagram participant Client as API Client participant Proxy as LLM Proxy participant Auth as KiroAuthManager participant Store as Credential Store participant OIDC as AWS SSO/Kiro Auth participant API as Kiro Bedrock API Client->>Proxy: POST /v1/chat/completions Proxy->>Auth: get_access_token() Auth->>Store: Load credentials Store-->>Auth: Token + metadata alt Token valid (> 10min remaining) Auth-->>Proxy: Valid access_token else Token expired or expiring Auth->>OIDC: Refresh token request OIDC-->>Auth: New access_token (1hr) Auth->>Store: Save refreshed token Auth-->>Proxy: New access_token end Proxy->>API: Request with Bearer token API-->>Proxy: Event Stream response Proxy-->>Client: OpenAI SSE chunksToken Management
Automatic Refresh
Token Storage Locations
~/Library/Application Support/kiro-cli/data.sqlite3~/.aws/sso/cache/kiro-auth-token.json~/.local/share/kiro-cli/data.sqlite3~/.aws/sso/cache/kiro-auth-token.jsonAuthentication Priority
KIRO_REFRESH_TOKEN/REFRESH_TOKENenvironment variableKIRO_CREDS_FILE)KIRO_CLI_DB_FILE)System Architecture
graph TB subgraph "LLM Proxy Server" A[FastAPI Router] --> B[KiroCliProvider] B --> C[Message Converters] B --> D[Stream Parser] B --> E[HTTP Client] end subgraph "Authentication Layer" F[KiroAuthManager] --> G[(JSON Files)] F --> H[(SQLite DB)] F --> I[Token Refresh] I --> J[AWS SSO OIDC] I --> K[Kiro Desktop Auth] end subgraph "External Services" L[Kiro Bedrock API] end B --> F E -->|Bearer Token| L F -->|Credentials| E L -->|AWS Event Stream| D D -->|OpenAI SSE| A C -->|Kiro Payload| EProject Structure
Testing
Verified working across multiple scenarios:
Implementation Notes
ProviderInterfacepattern fromprovider_interface.pyhas_custom_logic()for direct API handlingChecklist
ProviderInterfacepatternAcknowledgments
Implementation adapted from kiro-gateway by @Jwadow - reference for Kiro API flows, AWS Event Stream parsing, and message format conversions. Integrated into LLM-API-Key-Proxy's provider architecture with LGPL-3.0 licensing.