Skip to Content
APIHaoAI OpenAPIReal-Time Pricing

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/pricing

Note: 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:

ModeRequest headersResponse caching
Signed mode (default)X-Hvoy-Ts and X-Hvoy-Sign requiredCache-Control: no-store
Public modeNo headers requiredCache-Control: public, max-age=60

Signature algorithm

In signed mode, the request must carry these two headers:

HeaderDescription
X-Hvoy-TsUnix timestamp (integer seconds). Must be within 60 seconds of server time
X-Hvoy-SignHMAC-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

Terminal
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

FieldTypeDescription
schema_versionstringResponse schema version, currently "1.0"
successbooleanWhether the request succeeded
messagestringEmpty string on success, error message on failure
dataobjectPricing data, only present on success

data Fields

FieldTypeDescription
currencystringCurrency, fixed to "CNY" (Chinese Yuan)
price_unitstringPrice unit, fixed to "per_1m_tokens" (per 1 million tokens)
site_namestringSite name, e.g. "HaoAI" (may be omitted)
site_domainstringSite domain, e.g. "hao.ai" (may be omitted)
updated_atstringSnapshot generation time, UTC, RFC 3339 format
modelsarrayModel price list, sorted by group_name, then model_name

models[] Fields

FieldTypeDescription
model_namestringModel ID (requested-side name), e.g. openai/gpt-4o
group_namestringChannel group name, stable per channel, e.g. channel-1
input_pricenumberInput token price
output_pricenumber | nullOutput token price, null if the model has no such price
cache_input_pricenumber | nullCache read price
cache_create_pricenumber | nullCache write (5-minute) price
cache_create_price_1hnumber | nullCache write (1-hour) price
enabledbooleanAvailability. Only currently schedulable models are exported, so always true
notestringNote, 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" }
Statusmessage valueDescription
401missing hvoy signatureX-Hvoy-Ts or X-Hvoy-Sign missing in signed mode
401invalid hvoy timestampTimestamp is not a valid positive integer
401expired hvoy signatureTimestamp differs from server time by more than 60 seconds
401invalid hvoy signatureSignature verification failed
503provider pricing disabledPrice export is not enabled on this site
503provider pricing signature secret unavailableSigning secret not configured on the server
503service temporarily unavailableInternal error, please retry later