GRGlobalRouter Docs
Console

Docs / Start

Strategy

A strategy determines which provider relations and credentials a request prefers for the same model. Set a default on an API key, or override it for one request in the request body.

Supported strategies

StrategyCurrent behavior
priceFor price-sensitive workloads, automatically selects healthy low-price channels.
qualityFor workloads that require high stability, automatically selects healthy quality channels.

There are two ways to set a strategy: request parameters and API Key configuration. Request parameters take precedence over the API Key setting.

A strategy affects provider relations and credentials for the same model. It does not switch to another model, and it does not mean an upstream failure will trigger a retry with another strategy.

When unconfigured

When neither the request body nor the API key sets a strategy, current primary APIs do not add a strategy restriction and select by available relation priority, using health fallback when no normal candidate is available. Compatibility paths that do not support an empty strategy continue to use price.

API key configuration

When creating or editing an API key in the console's API key management page, choose:

SettingMeaning
UnconfiguredThe key supplies no strategy. The request body or unconfigured behavior applies.
Low priceEquivalent to price.
QualityEquivalent to quality.

The API key strategy is the default for every request made with that key. A valid request-body strategy overrides the API key setting.

Request parameters

The canonical field is router_metadata.routing_strategy. It is platform routing metadata and is not sent to an upstream provider.

Code examples
{
  "model": "qwen3-32b",
  "messages": [
    {
      "role": "user",
      "content": "Summarize this product note."
    }
  ],
  "router_metadata": {
    "routing_strategy": "quality"
  }
}

The following nested fields exist only for older request compatibility. They are checked in order and all rank below the canonical field:

  • router_metadata.routing.routing_strategy: accepts the same strategy values as the canonical field.
  • router_metadata.routing.credential_strategy: accepts the same strategy values as the canonical field.
  • router_metadata.routing.strategy: supports only the legacy balanced and lowest_cost values. An empty string is ignored; other unsupported values return ROUTER_INVALID_ROUTING_METADATA.

Some generation and task APIs also expose a top-level routing object. Its routing_strategy, credential_strategy, or strategy value is parsed as a compatibility field.

When router_metadata.routing_strategy or either of its two same-value compatibility fields is missing or null, resolution continues with later sources. An explicit empty string, unknown value, or wrong type on those fields returns 400 ROUTER_INVALID_ROUTING_STRATEGY.

Priority

When setting a strategy, request parameters take precedence over API Key configuration:

PriorityMethodDescription
1Request parametersSets the strategy for the current request.
2API Key configurationProvides the default strategy for all requests made with that key.

Request parameters apply only to the current request. If the request has no valid strategy, the API Key default is used.