Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 10, 2026

Related GitHub Issue

Closes: #11325

Description

This PR attempts to address Issue #11325. Feedback and guidance are welcome.

When using OpenRouter with CJK languages (Korean, Chinese, Japanese), low-bit quantization providers (FP4/FP6/Int4) can produce broken Unicode escape sequences instead of readable text. This adds an opt-in checkbox to filter out those providers.

Implementation details:

  1. Schema (packages/types/src/provider-settings.ts): Added openRouterExcludeLowQuantization: z.boolean().optional() to the openRouterSchema.

  2. Handler (src/api/providers/openrouter.ts): Extracted provider options logic into a buildProviderOptions() method that combines both specific provider routing and quantization filtering. When the setting is enabled, provider.quantizations is set to ["fp16", "bf16", "fp8", "int8"], restricting to higher-precision providers. This is applied to both createMessage() and completePrompt().

  3. UI (webview-ui/src/components/settings/providers/OpenRouter.tsx): Added a checkbox labeled "Exclude low-bit quantization (FP4/FP6/Int4)" with a description explaining the CJK encoding fix.

  4. i18n (webview-ui/src/i18n/locales/en/settings.json): Added English translations for the new UI labels.

Test Procedure

  • Added 4 new tests in src/api/providers/__tests__/openrouter.spec.ts:
    • Verifies quantizations are included in providerOptions when enabled
    • Verifies quantizations are NOT included when disabled
    • Verifies quantizations combine correctly with specific provider routing
    • Verifies quantizations work in completePrompt() as well
  • All 45 tests pass: cd src && npx vitest run api/providers/__tests__/openrouter.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The setting defaults to off, preserving existing behavior. When enabled, it uses the OpenRouter documented provider.quantizations API field to restrict routing to higher-precision providers only.


Important

Adds a feature to filter out low-bit quantization providers in OpenRouter settings, with schema, handler, UI, and i18n updates.

  • Behavior:
    • Adds openRouterExcludeLowQuantization to openRouterSchema in provider-settings.ts to filter out low-bit quantization providers.
    • Updates OpenRouterHandler in openrouter.ts to include quantization filtering in buildProviderOptions().
    • Adds a checkbox in OpenRouter.tsx to enable/disable the quantization filter.
  • Tests:
    • Adds tests in openrouter.spec.ts to verify quantization filtering behavior when enabled/disabled and its combination with specific provider routing.
  • i18n:
    • Adds English translations for new UI labels in settings.json.

This description was created by Ellipsis for 0bb4567. You can customize this summary. It will automatically update as commits are pushed.

Add a checkbox in OpenRouter settings to exclude low-bit quantization
providers (FP4/FP6/Int4) that cause CJK encoding issues. When enabled,
the provider.quantizations field is set to only allow FP8/FP16/BF16/Int8.

Closes #11325
@roomote
Copy link
Contributor Author

roomote bot commented Feb 10, 2026

Rooviewer Clock   See task

Reviewed all changed files across both commits. No issues found -- the implementation is clean, well-scoped, and non-breaking. The latest commit correctly adds missing translation keys to all 17 non-English locales.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

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.

[ENHANCEMENT] UI Option to Filter OpenRouter Quantization (FP4/Int4) to Fix CJK Encoding Issues

1 participant