feat: add modern Claude model mappings + BIND_HOST/DISABLE_AUTH for gateway deployments#39
Open
vahnxu wants to merge 3 commits into
Open
Conversation
Go 1.26.x build fails with sonic v1.14.1 due to missing GoMapIterator type. Upgrading to v1.15.0 restores build compatibility on modern Go toolchains. Same fix as PR caidaoli#37 (isabst). Verified with go 1.26.1 darwin/arm64 and linux/amd64.
Kiro Pro subscription already supports these models (verified via 'kiro-cli chat --list-models'), but kiro2api's ModelMap was missing the entries, causing 'model not found' errors for modern Claude models. Changes: - Add claude-opus-4.5, claude-opus-4.5-20251101 → claude-opus-4.5 - Add claude-opus-4.6, claude-opus-4.6-20260205 → claude-opus-4.6 - Add claude-sonnet-4.6, claude-sonnet-4.6-20260205 → claude-sonnet-4.6 - Upgrade claude-haiku-4.5-20251001 from 'auto' to exact mapping - Add claude-haiku-4.5 short alias Value format follows kiro-cli's short ID (e.g. 'claude-opus-4.6'), which CodeWhisperer accepts alongside the legacy CLAUDE_XXX_V1_0 format. Relaxed test format validator to allow all three formats. Validated end-to-end with real Kiro Pro account: - Non-streaming opus-4.6: PASS - Streaming sonnet-4.6: PASS (full Anthropic SSE event chain) - Non-streaming haiku-4.5: PASS
When kiro2api runs behind an upstream LLM gateway (Sub2API, OneAPI, LiteLLM,
etc.), two deployment conveniences are common needs:
1. BIND_HOST — restrict the listening address. Default is all interfaces
(':<port>'). Set 'BIND_HOST=127.0.0.1' to only accept connections
from the same host (production hardening when behind a gateway).
2. DISABLE_AUTH — skip kiro2api's own API-key middleware on /v1/*. Useful
when the upstream gateway already authenticates callers and transparently
forwards their api-key header (which won't match KIRO_CLIENT_TOKEN).
Emits a warning at startup so operators don't accidentally expose the
server without auth.
Both features default to the previous behavior (listen on all interfaces,
require KIRO_CLIENT_TOKEN) so existing deployments are unaffected.
Example gateway-behind deployment .env:
BIND_HOST=127.0.0.1
PORT=8081
DISABLE_AUTH=true
KIRO_AUTH_TOKEN='[{"auth":"IdC","refreshToken":"...","clientId":"...","clientSecret":"..."}]'
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
Three related improvements to make kiro2api usable with modern Claude models (Opus 4.5/4.6, Sonnet 4.6, Haiku 4.5) and easier to deploy behind upstream LLM gateways.
Kiro Pro already supports all current Claude models — verified via
kiro-cli chat --list-models:but kiro2api's
ModelMapinconfig/config.golists only Sonnet-4/4.5, 3.7-sonnet, 3.5-haiku plus a partialautofallback for Haiku 4.5. Requests for Opus 4.6 etc. currently return "model not found".Commits
chore(deps): upgrade sonic to v1.15.0 for Go 1.26 compatibility
Same fix as upgrade sonic to v1.15.0 for go1.26 build #37 (isabst) —
sonic v1.14.1fails to build on Go 1.26.x due to missingGoMapIterator. Included here to keep the branch self-contained (CI on Go 1.26 fails otherwise). Happy to drop if upgrade sonic to v1.15.0 for go1.26 build #37 lands first.feat(models): add Opus 4.5/4.6, Sonnet 4.6, Haiku 4.5 mappings
Map the new aliases + date-suffixed variants to the kiro-cli model IDs that CodeWhisperer already accepts (e.g.
claude-opus-4.6).TestModelMap_MappingsAreCorrectFormatrelaxed to accept three value formats:CLAUDE_XXX_V1_0,claude-xxx-N.M, andauto. Added dedicated tests for the new aliases.feat(server): add BIND_HOST and DISABLE_AUTH for gateway deployments
Two deployment conveniences when kiro2api runs behind an upstream gateway (Sub2API / OneAPI / LiteLLM / etc.):
BIND_HOST— restrict listen address (default: all interfaces; set127.0.0.1for gateway-behind hardening).DISABLE_AUTH— skip kiro2api's own /v1 auth middleware (useful when the upstream gateway authenticates callers and transparently forwards their api-key, which won't matchKIRO_CLIENT_TOKEN). Prints a warning at startup so operators don't accidentally expose the server without auth.Both default to existing behavior — existing deployments unaffected.
Validation
End-to-end with a real Kiro Pro (IdC) account on macOS + Linux VPS:
claude-opus-4-6: PASS (Anthropic response schema correct,usagetokens populated)claude-sonnet-4-6: PASS (full Anthropic SSE event chain:message_start→ping→content_block_start→content_block_delta× N →content_block_stop→message_delta→message_stop)claude-haiku-4-5: PASSgo test ./...all green on Go 1.26.1Test plan
go test ./config/...covers new ModelMap entries and format validatorgo test ./server/...exercises middleware pathscurl -X POST $BASE/v1/messages -d '{"model":"claude-opus-4-6",...}'with a real IdC account🤖 Generated with Claude Code