OpenAI-compatible proxy for CodeBuddy and Kiro (Amazon Q Developer) β access Claude Opus 4.7, Sonnet 4.5, GLM-5, Qwen3, and more via a single local API.
- π Kiro Gateway β Use
ksk_API keys from Kiro IDE to access Claude models via AWS - π€ 10+ AI Models β Claude Opus 4.7, Opus 4.5, Sonnet 4.5, Haiku 4.5, GLM-5, Qwen3, Minimax, and more
- π Key Rotation β Automatic round-robin across multiple API keys
- π‘ OpenAI-Compatible β Works with OpenCode, Cursor, Continue, and any OpenAI-compatible client
- π Streaming Support β Real-time SSE streaming responses
- π‘οΈ Error Recovery β Auto-retry with key rotation on 403/429 errors
- Python 3.10+
- Kiro IDE account (free) β to get your
ksk_API key - Git
git clone https://github.com/nopperabbo/codebuddy2api.git
cd codebuddy2apipython3 -m venv venv
source venv/bin/activate # macOS/Linux
# or: venv\Scripts\activate # Windowspip install -r requirements.txtcp .env.example .envEdit .env and set your password:
CODEBUDDY_PASSWORD=your_secret_password_hereCreate kiro_keys.json in the project root:
[
{"api_key": "ksk_YOUR_FIRST_KEY_HERE"},
{"api_key": "ksk_YOUR_SECOND_KEY_HERE"}
]π‘ How to get your
ksk_key: Open Kiro IDE, sign in, then find your API key in Settings β API Keys. It starts withksk_.
bash start.shThe server will start on http://localhost:8003.
| Model ID | Description | Status |
|---|---|---|
claude-opus-4.7 |
Claude Opus 4.7 β Latest & most capable | β |
claude-opus-4.5 |
Claude Opus 4.5 | β |
claude-sonnet-4.5 |
Claude Sonnet 4.5 | β |
claude-haiku-4.5 |
Claude Haiku 4.5 β Fast & light | β |
claude-sonnet-4 |
Claude Sonnet 4 | β |
glm-5 |
GLM-5 (via Kiro) | β |
qwen3-coder-next |
Qwen3 Coder Next (via Kiro) | β |
minimax-m2.5 |
Minimax M2.5 (via Kiro) | β |
minimax-m2.1 |
Minimax M2.1 (via Kiro) | β |
auto |
Let Kiro pick the best model | β |
| Method | Endpoint | Description |
|---|---|---|
GET |
/kiro/v1/models |
List available Kiro models |
POST |
/kiro/v1/chat/completions |
Chat completions (OpenAI-compatible) |
GET |
/kiro/v1/keys |
List configured API keys (masked) |
POST |
/kiro/v1/keys |
Add a new API key |
| Method | Endpoint | Description |
|---|---|---|
GET |
/codebuddy/v1/models |
List CodeBuddy models |
POST |
/codebuddy/v1/chat/completions |
Chat completions |
GET |
/codebuddy/v1/credentials |
List credentials |
# List models
curl -s -H "Authorization: Bearer YOUR_PASSWORD" \
http://localhost:8003/kiro/v1/models | python3 -m json.tool
# Chat with Opus 4.7
curl -s -X POST http://localhost:8003/kiro/v1/chat/completions \
-H "Authorization: Bearer YOUR_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4.7",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'
# Streaming
curl -N -X POST http://localhost:8003/kiro/v1/chat/completions \
-H "Authorization: Bearer YOUR_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4.7",
"messages": [{"role": "user", "content": "Write a haiku about coding"}],
"stream": true
}'Add this to your ~/.config/opencode/opencode.json under the "provider" section:
"kiro": {
"models": {
"claude-opus-4.7": {
"limit": { "context": 200000, "output": 64000 },
"name": "Claude Opus 4.7 (Kiro/AWS)",
"modalities": {
"input": ["text", "image", "pdf"],
"output": ["text"]
},
"variants": {
"low": { "thinkingConfig": { "thinkingBudget": 16384 } },
"medium": { "thinkingConfig": { "thinkingBudget": 32768 } },
"high": { "thinkingConfig": { "thinkingBudget": 65536 } },
"max": { "thinkingConfig": { "thinkingBudget": 128000 } }
}
},
"claude-opus-4.5": {
"limit": { "context": 200000, "output": 64000 },
"name": "Claude Opus 4.5 (Kiro/AWS)",
"modalities": {
"input": ["text", "image", "pdf"],
"output": ["text"]
},
"variants": {
"low": { "thinkingConfig": { "thinkingBudget": 16384 } },
"medium": { "thinkingConfig": { "thinkingBudget": 32768 } },
"high": { "thinkingConfig": { "thinkingBudget": 65536 } },
"max": { "thinkingConfig": { "thinkingBudget": 128000 } }
}
},
"claude-sonnet-4": {
"limit": { "context": 200000, "output": 64000 },
"name": "Claude Sonnet 4 (Kiro/AWS)",
"modalities": {
"input": ["text", "image", "pdf"],
"output": ["text"]
},
"variants": {
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
"medium": { "thinkingConfig": { "thinkingBudget": 16384 } },
"high": { "thinkingConfig": { "thinkingBudget": 24576 } },
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
}
},
"auto": {
"limit": { "context": 200000, "output": 64000 },
"name": "Auto (Kiro/AWS Best Pick)",
"modalities": {
"input": ["text", "image", "pdf"],
"output": ["text"]
},
"variants": {
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
"medium": { "thinkingConfig": { "thinkingBudget": 16384 } },
"high": { "thinkingConfig": { "thinkingBudget": 24576 } },
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
}
}
},
"name": "Kiro (Amazon Q)",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "YOUR_PASSWORD",
"baseURL": "http://127.0.0.1:8003/kiro/v1"
}
}Then select kiro/claude-opus-4.7 as your model in OpenCode.
Use these settings in any OpenAI-compatible client:
| Setting | Value |
|---|---|
| Base URL | http://localhost:8003/kiro/v1 |
| API Key | Your CODEBUDDY_PASSWORD from .env |
| Model | claude-opus-4.7 (or any from the list above) |
codebuddy2api/
βββ src/
β βββ __init__.py
β βββ auth.py # Authentication middleware
β βββ codebuddy_router.py # CodeBuddy proxy router
β βββ kiro_api_client.py # Kiro API client & model mapping
β βββ kiro_router.py # Kiro gateway router
β βββ ...
βββ kiro_keys.json # Your ksk_ API keys (gitignored)
βββ .env # Environment config (gitignored)
βββ .env.example # Example environment file
βββ requirements.txt # Python dependencies
βββ start.sh # Startup script
βββ web.py # Main application entry point
- Keep your
ksk_keys safe β they provide direct access to the Kiro API kiro_keys.jsonis gitignored β your keys will never be accidentally committed- The server runs on port
8003by default - All requests require the
Authorization: Bearer YOUR_PASSWORDheader - Multiple
ksk_keys are supported β the server rotates through them automatically
- kiro-gateway β Reference implementation for Kiro API integration
- Amazon Q Developer β The underlying AI service
MIT