Skip to content

fix(image-gen): honor image_gen.model for Nous/OpenRouter provider - #55672

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/55655-image-gen-top-level-model
Jun 30, 2026
Merged

fix(image-gen): honor image_gen.model for Nous/OpenRouter provider#55672
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/55655-image-gen-top-level-model

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

The OpenRouter/Nous image-gen provider now honors the model you actually selected — both the top-level image_gen.model config key (written by hermes tools) and an explicit model kwarg — instead of silently ignoring them and always running the quality-first default chain (gpt-5.4-image-2gemini-3-pro-image).

Root cause: _resolve_model_chain() only read the scoped image_gen.<provider>.model key, while hermes tools writes the user's pick to top-level image_gen.model and the image_generate dispatch passes it as a model kwarg — 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-level image_gen.model).

Changes

  • plugins/image_gen/openrouter/__init__.py: _resolve_model{,_chain} accept an explicit override (the model kwarg) and resolve top-level image_gen.model, matching the established sibling precedence: explicit kwarg → *_IMAGE_MODEL env → scoped image_gen.<provider>.model → top-level image_gen.model → default chain.
  • Docstrings aligned to the new precedence (follow-up commit).
  • Tests: top-level config override, Nous honoring top-level, explicit-kwarg-wins, and generate(model=...) end-to-end.

Validation

Config Before (main) After
image_gen.model: openai/gpt-image-2 [gpt-5.4-image-2, gemini-3-pro-image] (ignored) [openai/gpt-image-2]
explicit model kwarg dropped wins over config
no config default chain default chain (unchanged)
  • tests/plugins/image_gen/ — 167 passed.
  • E2E with real 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).
  • ruff + ty: clean.

Credit

Based on #55655 by @xxxigm. Cherry-picked to preserve authorship; docstring alignment added on top.

Closes #55655

xxxigm and others added 3 commits June 30, 2026 19:02
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.
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