Skip to content

[Feature]: Support OpenRouter provider pinning (provider.only / provider.order) in OpenClaw model config #10869

@RLst

Description

@RLst

Problem

I’m using OpenClaw with OpenRouter (e.g. model openrouter/zai/glm-4.7). OpenRouter can route the same model across multiple inference providers, but I need to restrict routing to a specific subset of providers for consistency.

Example: for openrouter/zai/glm-4.7, I want to restrict routing to only:

  • DeepInfra
  • Inceptron
  • Nebius

Right now, OpenClaw lets me choose the OpenRouter model id, but I don’t see a way to set OpenRouter’s provider routing preferences (the provider object in the request body), so OpenRouter can still pick other inference providers.

OpenRouter reference

OpenRouter supports provider routing fields in the request body under provider, e.g. only, order, ignore, allow_fallbacks, etc:
https://openrouter.ai/docs/guides/routing/provider-selection

Requested feature

Add a way in OpenClaw to pass OpenRouter provider routing preferences for OpenRouter models, ideally per-model entry.

This should allow restricting to a provider allowlist and optionally specifying ordering and fallback behavior (e.g. allow_fallbacks: false).

Proposed config shape (one possible approach)

Expose something like an “extra request body” passthrough for OpenAI-compatible providers, or an OpenRouter-specific block, e.g.:

{
  agents: {
    defaults: {
      models: {
"openrouter/zai/glm-4.7": {
          // example only — schema can differ
          openrouter: {
            provider: {
              only: ["deepinfra", "inceptron", "nebius"],
              // optionally:
              // order: ["deepinfra", "inceptron", "nebius"],
              // allow_fallbacks: false
            }
          }
        }
      }
    }
  }
}

(Provider identifiers should match OpenRouter’s provider slugs for the provider object.)

Expected behavior / acceptance criteria

  • When using an OpenRouter model with this config set, OpenClaw includes the configured provider object in the OpenRouter request body.
  • OpenRouter routing is restricted accordingly (no other inference providers are used when only is set; ordering respected when order is set).
  • Works for normal runs and streaming.
  • Ideally surfaced in /model status or logs so it’s easy to confirm it’s active.

Why this matters

Without provider pinning, behavior/cost/latency can vary between providers for the same model. The workaround is running a proxy layer that injects OpenRouter routing params, but it’d be much simpler if OpenClaw supported this natively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions