fix(image-gen): honor image_gen.model for Nous/OpenRouter provider - #55672
Merged
kshitijk4poor merged 3 commits intoJun 30, 2026
Merged
Conversation
hermes tools persists the selected model to image_gen.model, but the OpenRouter-compatible provider only read scoped image_gen.<provider>.model and ignored the dispatch model kwarg — so Nous users always hit the default quality-first chain and fell back to Gemini.
Assert image_gen.model, explicit model kwargs, and Nous provider wiring so the config path mismatch cannot regress.
…w precedence The cherry-picked fix added explicit-kwarg and top-level image_gen.model resolution but left _resolve_model / _resolve_model_chain docstrings stating the old 'env override -> config -> DEFAULT_MODEL' order. Document the full precedence (explicit kwarg -> env -> scoped -> top-level -> default chain) to match the sibling krea/openai providers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The OpenRouter/Nous image-gen provider now honors the model you actually selected — both the top-level
image_gen.modelconfig key (written byhermes tools) and an explicitmodelkwarg — instead of silently ignoring them and always running the quality-first default chain (gpt-5.4-image-2→gemini-3-pro-image).Root cause:
_resolve_model_chain()only read the scopedimage_gen.<provider>.modelkey, whilehermes toolswrites the user's pick to top-levelimage_gen.modeland theimage_generatedispatch passes it as amodelkwarg — both were dropped. This made OpenRouter/Nous the lone outlier among the multi-model image-gen plugins (krea/openai/openai-codex/xai already read top-levelimage_gen.model).Changes
plugins/image_gen/openrouter/__init__.py:_resolve_model{,_chain}accept anexplicitoverride (themodelkwarg) and resolve top-levelimage_gen.model, matching the established sibling precedence: explicit kwarg →*_IMAGE_MODELenv → scopedimage_gen.<provider>.model→ top-levelimage_gen.model→ default chain.generate(model=...)end-to-end.Validation
image_gen.model: openai/gpt-image-2[gpt-5.4-image-2, gemini-3-pro-image](ignored)[openai/gpt-image-2]modelkwargtests/plugins/image_gen/— 167 passed.config.yaml+ real config loader (temp HERMES_HOME): 6/6 assertions pass (both nous + openrouter honor top-level model; explicit kwarg overrides; no-config falls back correctly).Credit
Based on #55655 by @xxxigm. Cherry-picked to preserve authorship; docstring alignment added on top.
Closes #55655