Real-Time Pricing
Returns a real-time billing price snapshot of all available models, including input, output, and cache prices, grouped by channel. The response shape is compatible with hvoy.ai and similar third-party price aggregation platforms.
This endpoint is part of the HaoAI OpenAPI and is protocol-agnostic (independent of OpenAI / Anthropic / Gemini). Prices are generated live from the platform’s billing price tables and match actual billing exactly.
Endpoint
GET https://hao.ai/api/provider/pricingNote: this endpoint is mounted on the site domain hao.ai, not the API gateway domain api.hao.ai.
Authentication
This endpoint does not use HaoAI API keys. Depending on site configuration, there are two access modes:
| Mode | Request headers | Response caching |
|---|---|---|
| Signed mode (default) | X-Hvoy-Ts and X-Hvoy-Sign required | Cache-Control: no-store |
| Public mode | No headers required | Cache-Control: public, max-age=60 |
Signature algorithm
In signed mode, the request must carry these two headers:
| Header | Description |
|---|---|
X-Hvoy-Ts | Unix timestamp (integer seconds). Must be within 60 seconds of server time |
X-Hvoy-Sign | HMAC-SHA256 over the timestamp string, keyed by the shared secret, as lowercase hex: hex(HMAC-SHA256(secret, ts)) |
The signature covers only the timestamp itself — not the request path or any other content. The shared secret is distributed by HaoAI to partner platforms; contact support@hao.ai to get access.
Request Example
cURL
ts=$(date +%s)
sign=$(printf '%s' "$ts" | openssl dgst -sha256 -hmac "$HVOY_PRICING_SECRET" -r | cut -d' ' -f1)
curl https://hao.ai/api/provider/pricing \
-H "X-Hvoy-Ts: $ts" \
-H "X-Hvoy-Sign: $sign"In public mode, simply omit the two signature headers — everything else is identical.
Response Format
Successful response 200 OK:
{
"schema_version": "1.0",
"success": true,
"message": "",
"data": {
"currency": "CNY",
"price_unit": "per_1m_tokens",
"site_name": "HaoAI",
"site_domain": "hao.ai",
"updated_at": "2026-06-07T12:00:00Z",
"models": [
{
"model_name": "openai/gpt-4o",
"group_name": "channel-1",
"input_price": 18.75,
"output_price": 75,
"cache_input_price": 1.875,
"cache_create_price": null,
"cache_create_price_1h": null,
"enabled": true,
"note": ""
}
]
}
}Top-Level Fields
| Field | Type | Description |
|---|---|---|
schema_version | string | Response schema version, currently "1.0" |
success | boolean | Whether the request succeeded |
message | string | Empty string on success, error message on failure |
data | object | Pricing data, only present on success |
data Fields
| Field | Type | Description |
|---|---|---|
currency | string | Currency, fixed to "CNY" (Chinese Yuan) |
price_unit | string | Price unit, fixed to "per_1m_tokens" (per 1 million tokens) |
site_name | string | Site name, e.g. "HaoAI" (may be omitted) |
site_domain | string | Site domain, e.g. "hao.ai" (may be omitted) |
updated_at | string | Snapshot generation time, UTC, RFC 3339 format |
models | array | Model price list, sorted by group_name, then model_name |
models[] Fields
| Field | Type | Description |
|---|---|---|
model_name | string | Model ID (requested-side name), e.g. openai/gpt-4o |
group_name | string | Channel group name, stable per channel, e.g. channel-1 |
input_price | number | Input token price |
output_price | number | null | Output token price, null if the model has no such price |
cache_input_price | number | null | Cache read price |
cache_create_price | number | null | Cache write (5-minute) price |
cache_create_price_1h | number | null | Cache write (1-hour) price |
enabled | boolean | Availability. Only currently schedulable models are exported, so always true |
note | string | Note, currently always an empty string |
All prices are in CNY per 1 million tokens, already include the plan rate multiplier, and are rounded to 6 decimal places. Only token-billed models with a currently available upstream are exported; each model appears at most once per group.
Error Responses
On failure, the same envelope is returned with success set to false and no data:
{
"schema_version": "1.0",
"success": false,
"message": "service temporarily unavailable"
}| Status | message value | Description |
|---|---|---|
| 401 | missing hvoy signature | X-Hvoy-Ts or X-Hvoy-Sign missing in signed mode |
| 401 | invalid hvoy timestamp | Timestamp is not a valid positive integer |
| 401 | expired hvoy signature | Timestamp differs from server time by more than 60 seconds |
| 401 | invalid hvoy signature | Signature verification failed |
| 503 | provider pricing disabled | Price export is not enabled on this site |
| 503 | provider pricing signature secret unavailable | Signing secret not configured on the server |
| 503 | service temporarily unavailable | Internal error, please retry later |