Skip to content

feat(models): hide OpenRouter models that don't advertise tool support - #13238

Closed
teknium1 wants to merge 1 commit into
mainfrom
kilocode-port/filter-non-tool-openrouter-models
Closed

teknium1 wants to merge 1 commit into
mainfrom
kilocode-port/filter-non-tool-openrouter-models

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Hide OpenRouter models whose supported_parameters doesn't include tools from the model picker. Selecting one previously led to immediate runtime failures at the first tool call because hermes-agent's entire agent loop assumes tool calling.

Ported from Kilo-Org/kilocode#9068 by @gaganHanda-kilo — same rationale applies: agents that require tool calling shouldn't surface non-tool models in their picker.

Changes

  • hermes_cli/models.py — Added _openrouter_model_supports_tools() helper. Call it in fetch_openrouter_models() to drop curated entries whose live OpenRouter catalog entry explicitly omits tools from supported_parameters.
  • tests/hermes_cli/test_models.py — 9 new tests covering the helper and the integration point.

Behavior

supported_parameters on model Action
[..., "tools", ...] Kept
[...] without "tools" Dropped
[] (empty list) Dropped
Field absent / null / not a list Kept (permissive fallback)
Item is not a dict Kept (permissive fallback)

Why permissive on missing: Some OpenRouter-compatible gateways (Nous Portal, private mirrors, older catalog snapshots) don't populate supported_parameters at all. Hard-dropping on missing would silently empty the picker for those users. Only models that explicitly advertise capabilities without tools are hidden. Matches Kilo's same stance.

How this adapts to hermes-agent's architecture

Kilo filters in packages/kilo-gateway/src/api/models.ts (TypeScript, gateway-side). Hermes pulls the catalog directly from OpenRouter's /v1/models endpoint inside fetch_openrouter_models(), so the filter lives there — one chokepoint that feeds hermes model, the setup wizard, and the /model slash command.

No behavioral change for users whose gateway doesn't populate supported_parameters (the permissive fallback). Visible change for OpenRouter direct: image-only models like google/gemini-3-pro-image-preview (currently in the curated OPENROUTER_MODELS list) will stop appearing in pickers — which is the desired outcome for a tool-calling-first agent.

Test plan

scripts/run_tests.sh tests/hermes_cli/test_models.py -v         # 51 passed
scripts/run_tests.sh tests/hermes_cli/test_model_validation.py  # 65 passed

Part of the weekly Kilo Code PR scout port — 49 other merged PRs were reviewed this week; most were VS Code/JetBrains/UI-specific and not applicable, and the closely relevant ones (#9067 queued-prompt ordering, #9069 opus-4.7 adaptive reasoning, #9199 suggest-tool busy state) were structurally already handled in hermes-agent.

Port from Kilo-Org/kilocode#9068.

hermes-agent is tool-calling-first — every provider path assumes the
model can invoke tools. Models whose OpenRouter supported_parameters
doesn't include 'tools' (e.g. image-only or completion-only models)
cannot be driven by the agent loop and fail at the first tool call.

Filter them out of fetch_openrouter_models() so they never appear in
the model picker (`hermes model`, setup wizard, /model slash command).

Permissive when the field is missing — OpenRouter-compatible gateways
(Nous Portal, private mirrors, older snapshots) don't always populate
supported_parameters. Treat missing as 'unknown → allow' rather than
silently emptying the picker on those gateways. Only hide models
whose supported_parameters is an explicit list that omits tools.

Tests cover: tools present → kept, tools absent → dropped, field
missing → kept, malformed non-list → kept, non-dict item → kept,
empty list → dropped.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/openrouter OpenRouter aggregator labels Apr 22, 2026
@teknium1

Copy link
Copy Markdown
Collaborator Author

Redundant — the OpenRouter tool-support filter (_openrouter_model_supports_tools) landed on main via commit c697404 (squash-merged as part of PR #13468). Code is identical. Closing.

@teknium1 teknium1 closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/openrouter OpenRouter aggregator type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants