Skip to content

Publish accurate context windows in model listings - #6194

Open
danknasty wants to merge 1 commit into
router-for-me:devfrom
danknasty:fix/gemini-image-context-limits
Open

danknasty wants to merge 1 commit into
router-for-me:devfrom
danknasty:fix/gemini-image-context-limits

Conversation

@danknasty

Copy link
Copy Markdown

Summary

Mirror the Gemini image context corrections from router-for-me/models#74 in the embedded catalog. The current model catalog already lists gemini-3.8-flash at Google's documented 1,048,576-token window.

The registry now uses inputTokenLimit when an entry lacks context_length, and vice versa for Gemini model responses. The plain OpenAI-compatible /v1/models response now includes available context_length and max_context_length fields, so clients do not have to guess a generic window. Claude-format model responses also use the Gemini input limit when context_length is absent.

Sources

Validation

  • go test ./internal/registry ./sdk/api/handlers/openai ./sdk/api/handlers/gemini -count=1 passed.
  • go build -o <temporary output> ./cmd/server passed.
  • Parsed the embedded JSON and asserted all seven corrected entries plus Gemini 3.8 Flash.
  • git diff --check passed.

This PR targets v8 main. The locally installed VibeProxy binary is v7.3.17 and was not replaced.

@github-actions
github-actions Bot changed the base branch from main to dev September 29, 2026 07:29
@github-actions

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@danknasty
danknasty marked this pull request as ready for review September 29, 2026 07:53
Copilot AI balanced review requested due to automatic review settings September 29, 2026 07:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Home-enabled model-list routes bypass the updated handlers and still omit the new context metadata.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Corrects Gemini image context metadata and exposes context limits across model-list formats.

Changes:

  • Corrects seven embedded Gemini image context limits.
  • Adds cross-format context-limit fallbacks.
  • Exposes and tests context fields in OpenAI and Gemini responses.
File Description
internal/​registry/​models/​models.json Corrects Gemini image context metadata.
internal/​registry/​model_registry.go Adds provider-field fallbacks.
internal/​registry/​model_context_metadata_test.go Tests registry conversions.
sdk/​api/​handlers/​openai/​openai_handlers.go Exposes OpenAI context fields.
sdk/​api/​handlers/​openai/​openai_models_context_test.go Tests OpenAI output.
sdk/​api/​handlers/​gemini/​gemini_models_display_name_test.go Tests Gemini context output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1730 to +1733
resolvedInputTokenLimit := model.InputTokenLimit
if resolvedInputTokenLimit <= 0 {
resolvedInputTokenLimit = model.ContextLength
}
Comment on lines +99 to +103
if contextLength, exists := model["context_length"]; exists {
filteredModel["context_length"] = contextLength
}
if maxContextLength, exists := model["max_context_length"]; exists {
filteredModel["max_context_length"] = maxContextLength
"version": "3.1",
"description": "Gemini 3.1 Flash Image Preview",
"inputTokenLimit": 1048576,
"inputTokenLimit": 131072,
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