Skip to content

Providers & Routing ​

Every model on the platform may be backed by multiple providers. You can configure a routing strategy on your token, or override it for individual requests using headers.

What Is a Provider ​

A provider is a service node organized by source and cost—each provider has its own rate multiplier and range of available models. When you send a request, the system automatically selects an available provider based on your token configuration. If a provider fails or times out, the system automatically retries on another node. The entire process is completely transparent to your code.

Available Providers ​

IDNameDescription
officialOfficial DirectA provider group aggregating direct connections to major official platforms such as OpenAI, Anthropic, and Google—the highest stability
official_cheapOfficial (Discounted)A cost-optimized version of official channels—lower prices while maintaining high stability
mixMixed ChannelsChannels from multiple sources—the lowest prices and broadest model coverage

About official ​

official is a provider group that bundles nodes from major official platforms such as OpenAI, Anthropic, Google, and DeepSeek. When you select official, the system intelligently routes and fails over across all official nodes—no need to specify vendors one by one.

How to Choose ​

Your NeedsRecommended Configuration
Maximum stability, price-insensitiveofficial
A balance of stability and valueofficial_cheap
Lowest cost, tolerant of minor fluctuationmix
Prefer discounted official, fall back to mixedofficial_cheap,mix

Configuring Providers on a Token ​

When creating or editing a token, you can set its default routing behavior.

Provider List ​

Specify which providers this token is allowed to use.

  • Empty (recommended): Automatically routes across all available providers—best availability
  • Single provider: e.g. official—routes only through official nodes
  • Multiple providers: comma-separated, e.g. official_cheap,mix—tried in order or according to the sort strategy

Provider-Only Mode ​

  • Off (default): Prefer the specified providers; if all of them fail, fall back to other providers
  • On: Strictly limited to the specified providers; if all fail, an error is returned with no fallback

Sort Strategy ​

When multiple providers are specified, this controls the order in which they're tried:

  • Manual (default): Try in the order you entered
  • Latency: Prefer the fastest-responding provider
  • Price: Prefer the lowest-cost provider
  • Throughput: Prefer the provider with the highest throughput

Overriding Providers per Request ​

You can also use headers to temporarily override your token settings for a single request—no need to modify the token.

HeaderPurpose
X-Provider-OrderThe providers and order to use for this request
X-Provider-Only"true" enables strict mode—no fallback
X-Provider-SortOverrides the sort strategy (latency / price / throughput)
X-Provider-IgnoreProviders to skip for this request, applied on top of the token configuration

Providers specified via headers are still subject to your account permissions.

Examples ​

Prefer discounted official, fall back to mixed channels

bash
curl https://api.calgine.com.cn/v1/chat/completions \
  -H "Authorization: Bearer sk-your-token" \
  -H "X-Provider-Order: official_cheap,mix" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'

Strictly official only, no fallback

bash
curl https://api.calgine.com.cn/v1/chat/completions \
  -H "Authorization: Bearer sk-your-token" \
  -H "X-Provider-Order: official" \
  -H "X-Provider-Only: true" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-opus-4-5-20251101", "messages": [{"role": "user", "content": "Hello"}]}'

Set default headers in an SDK client

python
import openai

client = openai.OpenAI(
    api_key="sk-your-token",
    base_url="https://api.calgine.com.cn/v1",
    default_headers={
        "X-Provider-Order": "official_cheap,mix",
    }
)
js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-your-token",
  baseURL: "https://api.calgine.com.cn/v1",
  defaultHeaders: {
    "X-Provider-Order": "official_cheap,mix",
  }
});