You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Billing Tier Inheritance for OpenAI-Compatible AI SDKs (August 2026)
#60
One small SDK design detail that deserves more attention is how an API key inherits account-level billing policy. Many OpenAI-compatible gateways start with a simple mental model: a token belongs to a user, the user belongs to a billing group, and requests are priced from the active group. In practice, that model can break if the token stores a copied group value at creation time and never follows later account changes.
That is not only a finance issue. It changes how developers reason about admission control, budget alerts, and route selection. If an engineering team upgrades an account from a default policy to a VIP policy, their existing keys should not require a hidden migration step before production traffic reflects the new status. The safer default is that tokens have no pinned group value and inherit the current account group at request time.
I rechecked AIWave's live pricing endpoint on August 17, 2026. The feed currently exposes a pricing_version, group_ratio values of default=3 and vip=1, and model rows enabled for default, vip, and svip. A few example OpenAI-compatible rows from the same feed:
Model
Input / 1M
Cached input / 1M
Output / 1M
glm-5.1
$1.050000
$0.340000
$3.300000
ernie-5.0
$1.232877
$0.123288
$4.657563
deepseek-v4-pro
$0.957000
$0.031868
$2.871000
kimi-k3
$2.250000
$0.450000
$11.250000
Official model pages point in the same direction: pricing logic is becoming too dynamic to hide in a static README. Z.AI's pricing docs list GLM-5.1 and GLM-5.2 at $1.40 input, $0.26 cached input, and $4.40 output per 1M tokens. QwenCloud documents context-tier billing, failed-call billing behavior, Batch API discounts, context caching, thinking-token billing, and tool fees. DeepSeek's docs now require teams to pay attention to cache-hit rows, cache-miss rows, output rows, and time-windowed price changes.
For SDK authors, this creates a simple rule: keep the key stable, but resolve the commercial policy late. The application code should not have to replace keys when an account status changes. The request path should resolve the current account group, apply the correct multiplier, and emit enough metadata for audit.
For example, a gateway could attach an internal event like:
The important field is not the exact name. It is the separation between token identity and billing policy. A token proves authorization. The account record decides current commercial treatment. The pricing snapshot explains which row was used. That separation makes admission controllers easier to test because they can evaluate current policy without mutating every token record.
I would also surface a narrower version of this in SDK observability. Normal application responses can stay OpenAI-compatible, but structured logs or OpenTelemetry spans should include the pricing version, resolved billing group, cache policy, and model route. When a customer asks why a request cost changed after an account upgrade, support and finance teams should be able to answer from one request event, not by reconstructing historical token state.
The design question is where SDKs should draw the line. Should billing tier inheritance be purely server-side, with SDKs only exposing opaque request IDs? Or should advanced clients be able to opt into response metadata that shows the resolved group and pricing version for their own ledgers?
My current preference is server-side inheritance plus optional debug metadata. That keeps standard OpenAI-compatible clients clean while still giving platform teams the evidence they need for budget governance, admission control, and reconciliation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
One small SDK design detail that deserves more attention is how an API key inherits account-level billing policy. Many OpenAI-compatible gateways start with a simple mental model: a token belongs to a user, the user belongs to a billing group, and requests are priced from the active group. In practice, that model can break if the token stores a copied group value at creation time and never follows later account changes.
That is not only a finance issue. It changes how developers reason about admission control, budget alerts, and route selection. If an engineering team upgrades an account from a default policy to a VIP policy, their existing keys should not require a hidden migration step before production traffic reflects the new status. The safer default is that tokens have no pinned group value and inherit the current account group at request time.
I rechecked AIWave's live pricing endpoint on August 17, 2026. The feed currently exposes a
pricing_version,group_ratiovalues ofdefault=3andvip=1, and model rows enabled fordefault,vip, andsvip. A few example OpenAI-compatible rows from the same feed:glm-5.1$1.050000$0.340000$3.300000ernie-5.0$1.232877$0.123288$4.657563deepseek-v4-pro$0.957000$0.031868$2.871000kimi-k3$2.250000$0.450000$11.250000Official model pages point in the same direction: pricing logic is becoming too dynamic to hide in a static README. Z.AI's pricing docs list GLM-5.1 and GLM-5.2 at
$1.40input,$0.26cached input, and$4.40output per 1M tokens. QwenCloud documents context-tier billing, failed-call billing behavior, Batch API discounts, context caching, thinking-token billing, and tool fees. DeepSeek's docs now require teams to pay attention to cache-hit rows, cache-miss rows, output rows, and time-windowed price changes.For SDK authors, this creates a simple rule: keep the key stable, but resolve the commercial policy late. The application code should not have to replace keys when an account status changes. The request path should resolve the current account group, apply the correct multiplier, and emit enough metadata for audit.
For example, a gateway could attach an internal event like:
{ "request_id": "req_20260817_01", "model": "glm-5.1", "pricing_version": "a42d372ccf0b5dd13ecf71203521f9d2", "token_group_mode": "inherit_user_group", "resolved_group": "vip", "group_ratio": 1, "input_price_per_1m": 1.05, "cached_input_price_per_1m": 0.34, "output_price_per_1m": 3.3 }The important field is not the exact name. It is the separation between token identity and billing policy. A token proves authorization. The account record decides current commercial treatment. The pricing snapshot explains which row was used. That separation makes admission controllers easier to test because they can evaluate current policy without mutating every token record.
I would also surface a narrower version of this in SDK observability. Normal application responses can stay OpenAI-compatible, but structured logs or OpenTelemetry spans should include the pricing version, resolved billing group, cache policy, and model route. When a customer asks why a request cost changed after an account upgrade, support and finance teams should be able to answer from one request event, not by reconstructing historical token state.
The design question is where SDKs should draw the line. Should billing tier inheritance be purely server-side, with SDKs only exposing opaque request IDs? Or should advanced clients be able to opt into response metadata that shows the resolved group and pricing version for their own ledgers?
My current preference is server-side inheritance plus optional debug metadata. That keeps standard OpenAI-compatible clients clean while still giving platform teams the evidence they need for budget governance, admission control, and reconciliation.
All reactions