Provider Pricing API
Hvoy 1.0/1.1 compatible pricing feed for NewAPI, Sub2API, and custom relay sites.
XTokenChecker first fetches the Hvoy-compatible pricing API submitted by the site owner. If the field is empty, we try /api/provider/pricing under the site domain, then fall back to price-page parsing.
Publishing this structured endpoint is strongly recommended. It is more stable than scraping an HTML pricing page and maps naturally to NewAPI / Sub2API model groups, channel groups, and final user-facing prices.
Endpoint
GET /api/provider/pricing
Content-Type: application/json; charset=utf-8Return final CNY prices. XTokenChecker matches each channel by the stable compound key model_name + group_name.
Minimal Response
{
"schema_version": "1.1",
"success": true,
"message": "",
"data": {
"currency": "CNY",
"price_unit": "per_1m_tokens",
"site_name": "example",
"site_domain": "example.com",
"updated_at": "2026-07-15T00:00:00Z",
"models": [
{
"model_name": "claude-sonnet-4-6",
"group_name": "cc",
"input_price": 7.5,
"output_price": 37.5,
"cache_input_price": 0.75,
"cache_create_price": 9.375,
"cache_create_price_1h": 15,
"enabled": true,
"note": ""
},
{
"model_name": "gpt-image-2",
"group_name": "image",
"price_unit": "per_call",
"unit_price": 0.2,
"enabled": true,
"note": "per call"
}
]
}
}Field Rules
| Field | Rule |
|---|---|
schema_version | Required. Use 1.1; 1.0 is still accepted. |
success | Required. Whether the feed was generated successfully. |
data.currency | Required. Must be CNY. |
data.price_unit | Required. Supports per_1m_tokens and per_call. |
data.updated_at | Required. ISO 8601 datetime with timezone; UTC is recommended. |
data.models | Required. One item per model and group combination. |
model_name | Required. Stable model ID, such as gpt-5.4 or claude-sonnet-4-6. |
group_name | Required. Stable channel or group ID, such as official, cc, or vip. Do not rename it frequently after publishing. |
input_price | Required for token pricing. CNY / 1M input tokens. |
output_price | Recommended for token pricing. CNY / 1M output tokens. Use null if unknown. |
cache_input_price | Optional cache-read price. |
cache_create_price | Optional cache-write price; for Claude this usually maps to 5-minute cache writes. |
cache_create_price_1h | Optional Claude 1-hour cache-write price; usually null for other providers. |
unit_price | Required when price_unit is per_call. CNY / call. |
enabled | Optional, defaults to true. Return false for known temporarily unavailable combinations. |
note | Optional display or debugging note; not used in calculations. |
Prices must be JSON numbers, not numeric strings. Missing model_name + group_name combinations are treated as unmatched, not as explicitly disabled.
Optional Signature
If you do not want the pricing feed to be fully public, enable the Hvoy-compatible signature.
X-Hvoy-Ts: 1747886400
X-Hvoy-Sign: 9f0f4d7f6a5a648242cc0d2e4c2cfc0d4d79cf50615a5c1304f8cbea57c478c4Signature formula:
sign = hex(HMAC-SHA256(auth_secret, X-Hvoy-Ts))Accept timestamps within a 60-second window. The public tester uses this fixed test secret:
hvoy_provider_pricing_test_secret_v1_20260522NewAPI Sites
Many relay sites are based on NewAPI or a fork. Add a read-only public endpoint in your own backend and convert internal pricing settings to the Provider Pricing API response.
Recommended sources:
- Model availability: NewAPI model list, channel configuration, or public
/v1/models. - Channel groups: channel group, model ratio group, user group price, or custom group mapped to stable
group_name. - Token pricing: convert model ratio, completion ratio, and group ratio into final CNY / 1M token prices.
- Image or per-call models: return
price_unit: "per_call"andunit_price.
Avoid requiring the crawler to log into your admin dashboard. Admin tables and field names vary across forks; a JSON feed is much more reliable.
Sub2API Sites
Sub2API sites usually have model mappings, groups, and subscription or package multipliers. Export the final effective user price as Provider Pricing API.
Suggested flow:
- Load currently sellable models and groups.
- Normalize display names or aliases into stable
model_nameIDs. - Convert package, model, and channel ratios into final CNY prices.
- Keep temporarily unavailable combinations in the feed with
enabled: false.
If your site only has an HTML pricing page, XTokenChecker can try rule-based parsing, but structured JSON is the preferred path.
Self-Test
- Deploy
GET /api/provider/pricing. - Open the fetch tester.
- Enter a full HTTPS URL, for example
https://example.com/api/provider/pricing. - If signature validation is enabled, first test with the public test secret, then submit the production secret in the site-owner dashboard.
- The response should include at least one
models[]entry that matches the models you submitted.
Common Mistakes
- Returning numeric strings such as
"7.5"instead of numbers. - Returning
updated_atwithout timezone. - Using display names instead of stable model IDs.
- Frequently renaming
group_name, which breaks price history. - Mixing token pricing and per-call pricing without setting
price_unit. - Returning official provider list prices instead of the final user-facing relay-site prices.