Skip to content

feat(models): sync model catalog with Kiro's current models - #289

Open
imtiyazakiwat wants to merge 1 commit into
jwadow:mainfrom
imtiyazakiwat:feat/latest-kiro-models
Open

imtiyazakiwat wants to merge 1 commit into
jwadow:mainfrom
imtiyazakiwat:feat/latest-kiro-models

Conversation

@imtiyazakiwat

Copy link
Copy Markdown

Summary

runtime.kiro.dev has no /ListAvailableModels, so FALLBACK_MODELS is the entire /v1/models catalog for every account. It had fallen behind Kiro: 9 current models were missing and one end-of-life model was still listed.

Fixes #208.

Changes

Catalog (kiro/config.py): synced with kiro-cli chat --list-models --format json (checked 2026-10-20) and the Kiro models changelog.

  • Added claude-opus-5.5, claude-sonnet-5.5, claude-opus-5, claude-sonnet-5, claude-opus-4.8, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, kimi-k3.
  • Removed claude-sonnet-4. It reached end of life in Kiro on 2026-10-14 and Kiro now rejects it with Invalid model ID. It is still passed through if a client asks for it, so Kiro returns its own error.

Context windows: every entry now carries tokenLimits.maxInputTokens (from kiro-cli context_window_tokens).

  • Prompt tokens are derived from contextUsagePercentage × maxInputTokens.
  • Without per-model limits, every model used the 200K default, so usage for 1M-context models (sonnet-4.6, opus-4.6+, all 5.x, kimi-k3) was reported about 5x too low.

Context-window lookup (kiro/streaming_core.py): calculate_tokens_from_context_usage() now normalizes the client's model name before the cache lookup.

  • Routes pass the raw request name. Without this, Claude Code style names (claude-sonnet-4-6, claude-sonnet-4-6[1m]) missed the cache and fell back to 200K.
  • One place covers OpenAI and Anthropic, streaming and non-streaming.

Normalization (kiro/model_resolver.py): the no-minor-version pattern now strips -latest the same way the minor-version pattern already does (claude-opus-5-latest → claude-opus-5).

  • Bare numbers are still read as minor versions (claude-opus-5-5 → claude-opus-5.5).

Docs: added a paid-tier model note and a Sonnet 4 end-of-life note, and removed the Sonnet 4 entry, in all 8 READMEs.

Live verification (Builder ID account, runtime.us-east-1.kiro.dev)

  • GET /v1/models: 21 entries (was 13).
  • POST /v1/chat/completions (non-streaming): HTTP 200 for every listed model. claude-sonnet-4 returns 400 Invalid model ID, which confirms the end of life.
  • New models on all four paths (OpenAI and Anthropic, streaming and non-streaming): HTTP 200 for all 9 × 4 combinations.
  • Client name formats via /v1/messages: claude-opus-5-5, claude-sonnet-5-latest, claude-sonnet-5-5[1m] and claude-opus-4-8 all return 200.

Reported prompt tokens for the same ~10.5K-token prompt:

model before after
claude-haiku-4.5 (200K, control) 16,258 16,259
claude-sonnet-4.6 (1M) 3,062 16,271
claude-sonnet-4-6 via /v1/messages n/a 16,267
claude-sonnet-4-6[1m] via /v1/messages n/a 16,270

Tests

  • Full suite: 1773 passed. Base a5292ca has 1691.
  • New tests cover:
    • The exact catalog snapshot and the end-of-life removal.
    • Unique IDs, and IDs that normalization leaves unchanged.
    • tokenLimits structure (rejects bool) and the per-model context window values.
    • New models resolving from cache in every client format.
    • Pass-through for the removed model.
    • The /v1/models list with default aliases.
    • Cache limits, and the normalized lookup in token calculation (mock cache and real cache).
    • -latest positive cases, plus negative cases (-latest-20260724, -latestx, 7- and 9-digit suffixes, trailing dash, non-Claude names).
  • With the three source files reverted and the tests kept, 56 of the new tests fail.

Known issues (not changed here)

  1. Claude Opus 5 (always) and Claude Sonnet 5.5 (sometimes) refuse fake-reasoning requests.
    • Kiro answers with a metadataEvent containing "stopReason":"CONTENT_FILTERED" and refusal category REASONING_EXTRACTION.
    • The gateway does not parse that event, so the client gets HTTP 200 with empty content.
    • reasoning_effort: "none" does not help, because the thinking system-prompt addition is still injected. FAKE_REASONING=false fixes it (Opus 5 then answers normally).
    • Surfacing the refusal and adjusting fake reasoning for these models seems better as a separate PR.
  2. The auto-kiro alias is listed but not resolved when the Kiro payload is built, so Kiro rejects it (auto works). This predates this PR and is covered by fix(model_resolver): resolve MODEL_ALIASES in get_model_id_for_kiro #184 and fix: aliases not resolved when building Kiro API payload #198.

Related

…-5.6, Kimi K3)

runtime.kiro.dev has no /ListAvailableModels, so FALLBACK_MODELS is the
whole /v1/models catalog. It had fallen behind Kiro's current model list.

- Add claude-opus-5.5, claude-sonnet-5.5, claude-opus-5, claude-sonnet-5,
  claude-opus-4.8, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna and kimi-k3
- Remove claude-sonnet-4 (end of life in Kiro on 2026-10-14, Kiro now
  rejects it). It is still passed through if a client requests it.
- Add per-model tokenLimits.maxInputTokens from Kiro's catalog
  (kiro-cli context_window_tokens). Prompt tokens are derived from
  contextUsagePercentage, so 1M-context models were reported 5x too low
  with the 200K default.
- Normalize the client model name before the context-window lookup, so
  claude-opus-4-6 and claude-opus-4-6[1m] use the claude-opus-4.6 limit
- Accept the -latest suffix for models without a minor version
  (claude-opus-5-latest -> claude-opus-5), matching minor-version names
- Docs: note paid-tier models and Sonnet 4 end of life in all READMEs
@cla-bot

cla-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

Thanks for the PR! 🎉

Before merge, we need a one-time CLA confirmation.
It confirms that you have the right to contribute this code and allow the project to use it.

Full CLA text:
https://github.com/jwadow/kiro-gateway/blob/main/CLA.md

Please reply once with:

I have read the CLA and I accept its terms

You need to write once, all further messages from me can be ignored.

@imtiyazakiwat

Copy link
Copy Markdown
Author

I have read the CLA and I accept its terms

Ericwyn added a commit to Ericwyn/kiro-gateway-next that referenced this pull request Oct 27, 2026
Adapt upstream model metadata, context accounting, normalization, tests, and docs to this fork.

Co-authored-by: Imtiyaz Akiwat <94955223+imtiyazakiwat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: models not include claude-opus-4.8

1 participant