Skip to content

feat: OpenRouter provider routing and reasoning control#1958

Open
chiefmojo wants to merge 2 commits into
MemTensor:dev-20260604-v2.0.19from
chiefmojo:feat/openrouter-routing
Open

feat: OpenRouter provider routing and reasoning control#1958
chiefmojo wants to merge 2 commits into
MemTensor:dev-20260604-v2.0.19from
chiefmojo:feat/openrouter-routing

Conversation

@chiefmojo

@chiefmojo chiefmojo commented Jun 21, 2026

Copy link
Copy Markdown

Problem

When using OpenRouter as the LLM provider, operators have no way to:

  1. Exclude specific upstream providers from serving requests (provider.ignore)
  2. Set a preferred provider order (provider.order)
  3. Control reasoning effort per model slot (reasoning)

All three are standard OpenRouter-specific request fields that MemOS currently passes through to the HTTP body without any config surface.

Changes

Config schema — adds providerIgnore, providerOrder, and reasoning to LlmSchema and SkillEvolverSchema:

llm:
  provider: openai_compatible
  endpoint: https://openrouter.ai/api/v1
  apiKey: sk-...
  providerIgnore:
    - together
    - deepinfra
  providerOrder:
    - anthropic
    - google
  reasoning:
    enabled: true
    max_tokens: 8000

SkillEvolverSchema:
  provider: openai_compatible
  endpoint: https://openrouter.ai/api/v1
  providerIgnore:
    - novita

Provider layeropenai.ts detects OpenRouter endpoints and injects the provider routing object; reasoning is forwarded unconditionally when set. Non-OpenRouter endpoints are unaffected.

EmbeddingproviderIgnore/providerOrder added to the embedding config schema; openai.ts embedding provider applies the same routing logic.

PipelinebootstrapMemoryCore forwards the new fields to createLlmClient for the skillEvolver slot.

Tests

  • providers.test.ts — reasoning forwarding, routing injection for non/streaming calls, non-OpenRouter passthrough
  • bootstrap-llm-config.test.ts — verifies routing fields propagate to dedicated LLM clients
  • load.test.ts — defaults to empty arrays, accepts explicit values

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