- Each model is available only in a fixed set of groups. For example,
claude-opus-4-8is available only in Claude groups; thedefaultgroup cannot run Claude. - Your API key has its own set of available groups. That set must intersect the target model’s available groups for the request to succeed.
- You cannot extrapolate the cost of the same prompt linearly across models or groups. Billing uses “official price × model multiplier × group multiplier,” and combinations may differ by dozens of times.
Do not hardcode multipliers. Groups and prices may change at any time. Treat the GET /api/pricing response as the runtime source of truth.
Authoritative endpoint
Field definitions
| Field | Meaning |
|---|---|
group_ratio | Multiplier map for all current groups; the sole authoritative source |
usable_group | Public descriptions for groups, suitable for documentation or UI display |
auto_groups | The server’s allowlist for automatic groups; only groups listed here may be resolved to a specific model through automatic selection |
data[].enable_groups | Groups supported by the model; the request must match at least one |
data[].model_ratio | Input-token multiplier relative to the official baseline |
data[].completion_ratio | Output-token multiplier, applied as a multiple of model_ratio |
data[].cache_ratio | Multiplier for cache-hit input; null means the model does not distinguish cached input |
data[].quota_type | 0 for token-based billing; 1 for per-request billing |
data[].model_price | Price per request when quota_type=1 |
pricing_version | Billing snapshot version, used as a client cache key; retrieve fresh data when it changes |
How callers select a group
There are two ways to select a group in a request:- Omit
group(recommended): The server calculates “API key groups ∩ modelenable_groups,” then selects one usingauto_groupsand internal priority. This default workflow is sufficient for most callers. - Pass
groupexplicitly: Add a value such as"group": "claude 特价"to the request body. The group must belong to both the API key’s available groups and the model’senable_groups; otherwise, the API returns403 model_not_allowed.
group only when one API key has multiple eligible target groups and your application must consistently use one of them.
Billing formulas
For token-billed models (quota_type = 0):
quota_type = 1):
n is the number of images or videos actually produced by the task. For image endpoints, it is the n field in the request body.
Cost examples
claude-opus-4-8 in the claude 特价 group, with 1K input tokens and 500 output tokens:
model_ratio = 2.5,completion_ratio = 5,group_ratio = 0.3input = 1000 × 2.5 × 0.3 = 750output = 500 × 2.5 × 5 × 0.3 = 1875total ≈ 2625in internal system quota, converted to display currency using the account’squota_per_unit
gpt-5.5 in the default and open ai 特价 groups:
default:group_ratio = 1; the fullmodel_ratio 2.5×completion_ratio 6calculation applies.open ai 特价:group_ratio = 0.5; the final cost is half the cost in thedefaultgroup.
gpt-image-2:
- The 2K tier has
model_price = 0.15;group_ratiois eithergpt-image-2 = 1ordefault = 1, so the request costs0.15. Read the separateresolution_optionsvalues for the 1K and 4K tiers instead of applying the 2K price.
Engineering recommendations
- Retrieve
GET /api/pricingat startup and build amodel_name → { enable_groups, model_ratio, completion_ratio, cache_ratio, quota_type, model_price }index. Usepricing_versionas the cache key. - When showing available groups for a model in the UI, read
data[].enable_groupsand theusable_groupdescriptions directly instead of maintaining a separate hardcoded map. - Cost estimates must account for all four values:
model_ratio,completion_ratio,cache_ratio, andgroup_ratio. Omitting any of them produces an inaccurate estimate. - When you see
403 model_not_allowed, first check whether the API key’s available groups cover the target model’senable_groups. As a temporary workaround, setgroupexplicitly to a group the current key actually has.