How jwadow/kiro-gateway works
Kiro Gateway is a FastAPI proxy that lets OpenAI- and Anthropic-compatible clients use Kiro models. Requests enter through the server and protocol-specific routes, which prepare provider requests and return converted or streamed responses; account selection and authentication support the upstream call. The README also documents model discovery, web search, token counting, retries, multi-account failover, and VPN/proxy access. Edges are limited to relationships visible in excerpts, the source index, or README; unsampled subsystems are represented without asserting unverified internal calls.
Main entry points: routes_openai.py OpenAI Routes · routes_anthropic.py Anthropic Routes · main.py Server Lifecycle · http_client.py Kiro HTTP Client
Components 24
Gateway API
- Server Lifecycle
main.py - OpenAI Routes
kiro/routes_openai.py - Anthropic Routes
kiro/routes_anthropic.py
Accounts and Models
- Account Manager
kiro/account_manager.py - Kiro Authentication
kiro/auth.py - Model Resolution
kiro/model_resolver.py - Model Metadata Cache
kiro/cache.py
Protocol Handling
- OpenAI Conversion
kiro/converters_openai.py - Anthropic Conversion
kiro/converters_anthropic.py - Shared Conversion
kiro/converters_core.py - OpenAI Streaming
kiro/streaming_openai.py - Anthropic Streaming
kiro/streaming_anthropic.py - Stream Processing
kiro/streaming_core.py - Event Parsing
kiro/parsers.py
Upstream Runtime
- Kiro HTTP Client
kiro/http_client.py - Web Search Tools
kiro/mcp_tools.py - Truncation Recovery
kiro/truncation_recovery.py - Truncation State
kiro/truncation_state.py
Gateway Services
- Gateway Configuration
kiro/config.py - Debug Logging
kiro/debug_logger.py
Other components
- API Clients
- Kiro API
- Kiro MCP API
- VPN or Proxy
Connections 32
- API Clients → Server Lifecycle: send requests
README.md - Server Lifecycle → OpenAI Routes: registers routes
main.py - Server Lifecycle → Anthropic Routes: registers routes
main.py - Server Lifecycle → Account Manager: initializes
main.py - Server Lifecycle → Gateway Configuration: loads settings
main.py - Server Lifecycle → Debug Logging: installs middleware
main.py - OpenAI Routes → OpenAI Conversion: converts requests
kiro/routes_openai.py - OpenAI Routes → OpenAI Streaming: streams responses
kiro/routes_openai.py - Anthropic Routes → Anthropic Conversion: converts requests
kiro/routes_anthropic.py - Anthropic Routes → Anthropic Streaming: streams responses
kiro/routes_anthropic.py - OpenAI Conversion → Shared Conversion: uses shared conversion
kiro/converters_openai.py - Anthropic Conversion → Shared Conversion: uses shared conversion
kiro/converters_anthropic.py - OpenAI Streaming → Stream Processing: uses stream helpers
kiro/streaming_openai.py - Anthropic Streaming → Stream Processing: uses stream helpers
kiro/streaming_anthropic.py - OpenAI Streaming → Event Parsing: parses events
kiro/streaming_openai.py - Anthropic Streaming → Event Parsing: parses events
kiro/streaming_anthropic.py - OpenAI Routes → Model Resolution: resolves model
kiro/routes_openai.py - Model Resolution → Model Metadata Cache: checks metadata
kiro/model_resolver.py - Account Manager → Kiro Authentication: manages authentication
kiro/account_manager.py - OpenAI Routes → Kiro HTTP Client: sends upstream requests
kiro/routes_openai.py - Anthropic Routes → Kiro HTTP Client: sends upstream requests
kiro/routes_anthropic.py - Kiro HTTP Client → Kiro Authentication: gets access tokens
kiro/http_client.py - Kiro HTTP Client → Kiro API: calls Kiro
README.md - Anthropic Streaming → Web Search Tools: intercepts search calls
kiro/streaming_anthropic.py - Web Search Tools → Kiro MCP API: calls search API
kiro/mcp_tools.py - OpenAI Routes → Truncation State: reads and updates
kiro/routes_openai.py - Anthropic Routes → Truncation State: reads and updates
kiro/routes_anthropic.py - OpenAI Routes → Truncation Recovery: uses recovery
kiro/routes_openai.py - Anthropic Routes → Truncation Recovery: uses recovery
kiro/routes_anthropic.py - Kiro HTTP Client → VPN or Proxy: routes through proxy
README.md - OpenAI Routes → Debug Logging: records request activity
kiro/routes_openai.py - Anthropic Routes → Debug Logging: records request activity
kiro/routes_anthropic.py