Skip to content

refactor(ai-gateway): derive model variants from catalog - #5032

Merged
chrarnoldus merged 1 commit into
mainfrom
refactor/ai-gateway-model-variants
Aug 5, 2026
Merged

refactor(ai-gateway): derive model variants from catalog#5032
chrarnoldus merged 1 commit into
mainfrom
refactor/ai-gateway-model-variants

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • Derive OpenRouter model reasoning variants from the persisted model catalog when supported efforts are available.
  • Preserve the existing model-name fallback rules for direct BYOK, models.dev synchronization, code-review variant lists, and catalog misses.
  • Make catalog-aware OpenCode settings asynchronous and apply the resolved variants to OpenRouter model metadata and auto-routing decisions.

Verification

  • No manual UI verification required; this is server-side model metadata and routing behavior.

Visual Changes

N/A

Reviewer Notes

  • Review the mandatory versus optional reasoning handling, including the synthesized none variant and Anthropic verbosity mapping.
  • The fallback model-name variants are intentionally kept separate from catalog-derived variants so direct BYOK and code-review consumers remain synchronous.

Comment thread apps/web/src/lib/ai-gateway/auto-model/resolution.ts
Comment thread apps/web/src/lib/ai-gateway/providers/model-settings.ts
@kilo-code-bot

kilo-code-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The catalog-derived variant refactor drops a still-required OpenRouterReasoningConfig cast in auto-model resolution and breaks the existing resolution.test.ts suite via an incomplete gateway-models-cache jest mock.

Overview

Severity Count
CRITICAL 2
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/web/src/lib/ai-gateway/auto-model/resolution.ts 253 Removed as OpenRouterReasoningConfig cast; catalog ReasoningEffort ('max') still exceeds ChatCompletionReasoningEffort at the same pinned openai@6.49.0, so typecheck fails
apps/web/src/lib/ai-gateway/providers/model-settings.ts 15 New getOpenRouterModelsMetadataFromDatabase import is undefined under resolution.test.ts's partial gateway-models-cache mock — all variant-branch tests fail with TypeError
Files Reviewed (10 files)
  • apps/web/src/lib/ai-gateway/auto-model/resolution.ts - 1 issue
  • apps/web/src/lib/ai-gateway/providers/direct-byok/byteplus-coding.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/direct-byok/index.test.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/direct-byok/index.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/direct-byok/sync-direct-byok.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/model-settings.ts - 1 issue
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/openrouter/types.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/variants.ts - 0 issues
  • apps/web/src/lib/code-reviews/core/model-variants.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 136.5K · Output: 40.8K · Cached: 3.5M

Review guidance: REVIEW.md from base branch main

@chrarnoldus chrarnoldus self-assigned this Aug 5, 2026
@chrarnoldus
chrarnoldus merged commit 836aaec into main Aug 5, 2026
16 checks passed
@chrarnoldus
chrarnoldus deleted the refactor/ai-gateway-model-variants branch August 5, 2026 14:24
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.

2 participants