[GH-ISSUE #1031] [Issue]: OpenRouter model context metadata is discarded #503

Closed
opened 2026-10-20 17:29:34 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @cha1latte on GitHub (May 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1031

Originally assigned to: @cha1latte on GitHub.

Summary

OpenRouter model metadata such as context_length and top_provider.max_completion_tokens is discarded, so models like google/gemini-3.5-flash can fall back to 128k context even when OpenRouter reports about 1M context.

Source Discord thread: https://discord.com/channels/1417099416812392641/1480379733173731458/threads/1506579703404953670

Reporter: 로도

Expected behavior

When remote model metadata includes context and output limits, Marinara should preserve those values and expose/use them in the connection model picker and generation settings.

Actual behavior

The reporter says OpenRouter returns context_length: 1048576 and top_provider.max_completion_tokens: 65536, but Marinara normalizes remote models down to { id, name } and maps client models as { id, name, context: 0, maxOutput: 0 }. The affected chat can save/use 128k instead of the model's larger context. Manually setting the connection to 1000000 is only a workaround, and preset parameters can still clamp generation.

Steps to reproduce

  1. Use OpenRouter with google/gemini-3.5-flash.
  2. Fetch/select remote models through the OpenAI-compatible/OpenRouter connection flow.
  3. Observe that model capability metadata from /api/v1/models is not preserved in the picker/settings.
  4. Generate with a preset that has lower maxContext parameters and observe generation clamped below the model's real context.

Marinara Engine version

1.60

Install type

Other

OS + version

Windows 11

Browser or app shell

Not specified.

Screenshots or video

Not a visual/UI issue.

Logs

Reporter-provided metadata:

OpenRouter /api/v1/models:
id: google/gemini-3.5-flash
context_length: 1048576
top_provider.max_completion_tokens: 65536

Additional context

Reporter notes possible affected areas:

  • Preserve context_length or top_provider.context_length as context.
  • Preserve top_provider.max_completion_tokens as max output.
  • Update client model types and picker to use remote context.
  • Add or restore Preset Parameters UI for maxContext and useMaxContext.
  • Consider warning when prompt preset/chat parameters clamp below connection context.

Template check

  • I provided the required summary, behavior, reproduction, and environment details.
  • If this is a visual/UI bug, blank screen, layout issue, mobile/responsive issue, incorrect image or sprite, broken animation, or unexpected error state, I attached screenshots or video.
Originally created by @cha1latte on GitHub (May 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1031 Originally assigned to: @cha1latte on GitHub. ## Summary OpenRouter model metadata such as `context_length` and `top_provider.max_completion_tokens` is discarded, so models like `google/gemini-3.5-flash` can fall back to 128k context even when OpenRouter reports about 1M context. Source Discord thread: https://discord.com/channels/1417099416812392641/1480379733173731458/threads/1506579703404953670 Reporter: 로도 ## Expected behavior When remote model metadata includes context and output limits, Marinara should preserve those values and expose/use them in the connection model picker and generation settings. ## Actual behavior The reporter says OpenRouter returns `context_length: 1048576` and `top_provider.max_completion_tokens: 65536`, but Marinara normalizes remote models down to `{ id, name }` and maps client models as `{ id, name, context: 0, maxOutput: 0 }`. The affected chat can save/use 128k instead of the model's larger context. Manually setting the connection to `1000000` is only a workaround, and preset parameters can still clamp generation. ## Steps to reproduce 1. Use OpenRouter with `google/gemini-3.5-flash`. 2. Fetch/select remote models through the OpenAI-compatible/OpenRouter connection flow. 3. Observe that model capability metadata from `/api/v1/models` is not preserved in the picker/settings. 4. Generate with a preset that has lower `maxContext` parameters and observe generation clamped below the model's real context. ## Marinara Engine version 1.60 ## Install type Other ## OS + version Windows 11 ## Browser or app shell Not specified. ## Screenshots or video Not a visual/UI issue. ## Logs Reporter-provided metadata: ```text OpenRouter /api/v1/models: id: google/gemini-3.5-flash context_length: 1048576 top_provider.max_completion_tokens: 65536 ``` ## Additional context Reporter notes possible affected areas: - Preserve `context_length` or `top_provider.context_length` as context. - Preserve `top_provider.max_completion_tokens` as max output. - Update client model types and picker to use remote context. - Add or restore Preset Parameters UI for `maxContext` and `useMaxContext`. - Consider warning when prompt preset/chat parameters clamp below connection context. ## Template check - [ ] I provided the required summary, behavior, reproduction, and environment details. - [ ] If this is a visual/UI bug, blank screen, layout issue, mobile/responsive issue, incorrect image or sprite, broken animation, or unexpected error state, I attached screenshots or video.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#503
No description provided.