A model may have several provider channels. Token Market first builds an eligible candidate set from model capabilities, workspace permissions, and current channel status; Smart Routing then selects a channel automatically. This page covers API routing configuration. Section 2 below explains how to view, filter, and sort provider data on the model details page.
Token Market API examples use automatic routing by default. Without a fixed provider, the gateway weighs capability, pricing, latency, throughput, and reliability across currently available channels. If a request fails, it continues through the remaining eligible candidates. Available fields and filters vary dynamically by model type, billing method, and live data.
If your workload has explicit routing requirements, open “Unified API Endpoint and code examples” at the bottom of the model details page. The page shows only controls supported by the current model, commonly including:
After you select criteria, the page updates the copyable API example. OpenAI-compatible requests place these criteria in extra_body.provider, using the structure below. An empty array leaves that criterion unrestricted:
{
"only": [],
"order": [],
"sort": null,
"input_price_range": [],
"output_price_range": [],
"input_length_range": [],
"output_length_range": [],
"throughput_range": [],
"latency_range": []
}
Page controls generate range values, and the displayed units apply. Price dimensions, length limits, and quality metrics vary by model type; do not copy one model’s complete field set into every request.
Generate an example request on the model details page and copy the final code. Do not invent unsupported routing fields.
Pricing, latency, throughput, and reliability vary by model, provider, time window, and request conditions. In production, set timeouts, bounded retries, and an appropriate fallback strategy, then verify the actual route in request logs. See Performance metrics for metric definitions.
Use the “model-string routing syntax” below when a request must specify a sorting preference quickly. It provides the same class of routing controls as extra_body.provider generated on the model details page. For production, prefer a page-generated request that you have validated.
To keep the request body unchanged, add the sort policy and filters to the model string:
Model ID:sort strategy:filter parameters
For example, this request prefers lower-latency channels and restricts candidates to the listed providers:
DeepSeek-R1:latency:only=SiliconFlow,Alibaba Cloud Bailian,latency<500
The syntax has three parts:
| Part | Example | Purpose |
|---|---|---|
| Model ID | DeepSeek-R1 | Identifies the model to call. Use an actual ID from Model Market or the model details page. |
| Sort policy | latency | Ranks eligible channels by latency, throughput, input pricing, output pricing, or supported input length. |
| Filters | only=SiliconFlow,latency<500 | Restricts providers or metric ranges. Separate multiple filters with ASCII commas. |
Common sort policies include:
latency: Prioritize lower latency for interactive requests;throughput: Prioritize throughput for concurrent or batch workloads;input_price / output_price: Prioritize input or output pricing for cost-sensitive workloads;input_length: Prioritize supported input length for long-context requests.Common filters and fallback parameters include:
| Parameter | Example | Description |
|---|---|---|
only | only=SiliconFlow,Alibaba Cloud Bailian | Select only from the listed providers. |
ignore | ignore=provider-name | Exclude the listed providers from the candidate set. |
provider | provider=SiliconFlow | Select one provider; equivalent to listing one provider under only. |
| Metric range | latency<500 | Restrict candidate channels by latency, throughput, pricing, or another metric. Use the units shown on the model details page. |
nofallback | nofallback | Do not try another channel if the specified candidates are unavailable. |
Complete request example:
curl ${base_url}/chat/completions \
-H "Authorization: Bearer $TOKEN_MARKET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "DeepSeek-R1:latency:only=SiliconFlow,Alibaba Cloud Bailian,latency<500",
"messages": [{"role": "user", "content": "Hello"}]
}'
When parsing, the final parameter section takes precedence. Colons separate the model, policy, and filter section; ASCII commas separate conditions within the filter section. Do not encode each filter as another colon-delimited section. Model names, policies, and provider names must match values supported by the current gateway. If routing options in the model string conflict with extra_body.provider, the gateway strictly gives the structured extra_body.provider object highest priority and ignores the corresponding options in the model string.
Production error behavior: If no candidate provider can satisfy every hard filter (for example,
latency<200), the gateway returns HTTP 503 with the fixed error codeno_available_provider.
At the top of the model details page, filter providers to match your requirements and select a column heading, such as “Throughput,” to sort by that metric. The table sorts by output throughput from highest to lowest by default.
tm-demo-text-128kA fictional text model for demonstrating filters and routing configuration. All values below are examples.
This example uses local mock data. Filters apply to both the provider list and request parameters.
| Provider | Maximum Input | Maximum Output | Provider Price | Throughput | Latency | Reliability |
|---|---|---|---|---|---|---|
| Demo Provider DPreferred | 32K | 4K | Input ¥0.70 · Output ¥1.40 / M | 118 TPS | 6.2 seconds | 99.41% |
| Demo Provider B | 64K | 8K | Input ¥0.90 · Output ¥1.80 / M | 132 TPS | 4.1 seconds | 99.72% |
| Demo Provider A | 128K | 16K | Input ¥1.20 · Output ¥2.40 / M | 86 TPS | 2.8 seconds | 99.95% |
| Demo Provider C | 128K | 32K | Input ¥1.50 · Output ¥3.10 / M | 64 TPS | 1.9 seconds | 99.88% |