Skip to content

feat: allow specifying presets for openrouter provider by id - #243

Merged
antonbabenko merged 2 commits into
masterfrom
feat/openrouter-presets
Oct 11, 2026
Merged

antonbabenko merged 2 commits into
masterfrom
feat/openrouter-presets

Conversation

@antonbabenko

Copy link
Copy Markdown
Owner

Summary

Allows specifying OpenRouter presets by ID/slug (e.g. cheapest-first or @preset/cheapest-first) for the OpenRouter provider across configuration and tool calls:

  • Provider level: providers.openrouter.preset or providers.openrouter.defaults.preset
  • Per-model alias: models.<id>.preset (supports specifying preset alone, or combined with an explicit model)
  • Per-call override: preset argument on ask-openrouter, ask-one, and consensus

Motivation & Benefits

  • Cost Reduction: Presets allow specifying provider routing policies like sorting available hosts by price ("sort": { "by": "price" }) with automatic failover ("allow_fallbacks": true), dramatically reducing inference costs without manual endpoint tracking.
  • Data Compliance: Enforces upstream data policies such as "data_collection": "deny".
  • Centralized Parameter Management: System prompts, parameters, and provider preferences can be configured once in the OpenRouter dashboard and reused by identifier.

Pre-PR Cross-Model Consensus Review

A consensus code review was run across Gemini (arbiter), Grok 4.7, and OpenRouter GLM-5.3-flash with the code-reviewer persona:

  • Dismissed/Addressed Issues:
    • Preset-only aliases falling back to defaultModel: Fixed in core/registry.js and core/providers/openai-compatible.js so preset-only models pass empty string models and do not inherit defaultModel.
    • Allowlist bypass with raw presets when allowRawModel: false: Fixed in server/openrouter/index.js resolveDelegate by checking against configured presets.
    • Scope creep in server/openrouter/config.js: Reverted unmotivated makeConfigReader changes and export expansions back to master baseline.
    • Missing config.default.json: Added cheapest-preset to config/config.default.json.
    • Documentation coverage: Added preset documentation to README.md, SETUP.md, TECHNICAL.md, and docs/tool-guide.md, followed by npm run sync.

Verification

  • npm run sync:check passes
  • npm run test:contracts passes (19/19)
  • npm run typecheck passes (0 errors)
  • npm test passes (1192/1192)

@antonbabenko
antonbabenko enabled auto-merge (squash) October 11, 2026 17:00
@antonbabenko
antonbabenko disabled auto-merge October 11, 2026 17:02
@antonbabenko
antonbabenko merged commit e776868 into master Oct 11, 2026
1 check passed
@antonbabenko
antonbabenko deleted the feat/openrouter-presets branch October 11, 2026 17:02
@github-actions

Copy link
Copy Markdown
Contributor

This PR is included in v3.30.0 🎉

Claude Code

/plugin marketplace update antonbabenko
/reload-plugins

If the update still shows the old version, the marketplace re-pin is a few minutes behind; run it again shortly.

Codex, Kiro, Cursor, OpenCode plugins: update deliberation from your host's plugin manager.

MCP server (any host): @antonbabenko/deliberation-mcp@3.30.0 is published. Restart your host to pick it up.

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.

1 participant