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
Entitlement Snapshot Assertions for OpenAI-Compatible SDKs (September 2026)
#80
An OpenAI-compatible SDK usually treats authentication as a simple preflight: do I have a key, and did the request return a valid response? For a multi-provider gateway, that is not enough. The SDK also needs a way to prove which entitlement context the request accepted before it crossed the network boundary.
By entitlement context, I mean the small set of control-plane facts that decide whether a request is allowed and how its cost row will be interpreted later: account group, token group, allowed route group, requested model, resolved model, pricing version, catalog version, and ledger policy version. If those fields drift, a successful API call can still leave the developer with a support problem.
I checked the live pricing sources for this discussion on September 6, 2026. AIWave's public /api/pricing endpoint returned success=true, 63 route records, pricing version a42d372ccf0b5dd13ecf71203521f9d2, auto_groups=["default"], and group ratios of default=3 and vip=1. Selected route rows from that snapshot were:
Model
model_ratio
completion_ratio
cache_ratio
Enabled groups
deepseek-v4-flash
0.319
3
0.0318
default, vip, svip
deepseek-v4-pro
0.957
3
0.0333
default, vip, svip
glm-5.1
1.05
3.142857
0.32381
default, vip, svip
kimi-k3
2.25
5
0.2
default, vip, svip
qwen3-max
0.7810988945590882
4
absent
vip, svip, default
I also rechecked direct provider pricing pages the same day. DeepSeek publishes token-price rows with separate cache-hit input, cache-miss input, and output prices plus peak and off-peak windows. Z.AI publishes GLM promotional and standard rows by model family. Alibaba Cloud Model Studio documents token billing by model, with Batch API and tool add-on pricing documented separately. Those pages are useful external references, but an SDK should not merge them into one undifferentiated number. It should record which source owned each fact.
For aiwave-sdk-python, I would make entitlement snapshots an optional assertion helper around the normal client:
The helper should not expose private identifiers by default. It can hash token IDs, omit customer emails, and never store prompts or completions. The point is not to make billing data public. The point is to give the developer a receipt that says: this request was accepted under this route policy, with this dated catalog and this pricing version.
The failure behavior matters. If the token group is missing, the account group does not match the token group, the route is not enabled for the effective group, or the pricing version is unknown, the assertion should fail closed before the workload runs. If an advisory field such as cache metadata is absent for a model that does not promise cache accounting, the helper can warn instead of blocking.
This belongs in three places: CI fixtures before a route-policy change, rollout checks before a new worker starts serving traffic, and support diagnostics after a customer asks why two similar requests behaved differently.
The SDK boundary stays narrow. The gateway remains the source of truth for live account state, route policy, and final ledger rows. The SDK provides a typed way to ask for those facts, assert the subset the application depends on, and attach the resulting snapshot to a test report or incident note.
Open question: should entitlement snapshot assertions live as a first-class aiwave-sdk-python helper, or should the repository publish them first as a reference CI pattern that teams can adapt?
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.
An OpenAI-compatible SDK usually treats authentication as a simple preflight: do I have a key, and did the request return a valid response? For a multi-provider gateway, that is not enough. The SDK also needs a way to prove which entitlement context the request accepted before it crossed the network boundary.
By entitlement context, I mean the small set of control-plane facts that decide whether a request is allowed and how its cost row will be interpreted later: account group, token group, allowed route group, requested model, resolved model, pricing version, catalog version, and ledger policy version. If those fields drift, a successful API call can still leave the developer with a support problem.
I checked the live pricing sources for this discussion on September 6, 2026. AIWave's public
/api/pricingendpoint returnedsuccess=true, 63 route records, pricing versiona42d372ccf0b5dd13ecf71203521f9d2,auto_groups=["default"], and group ratios ofdefault=3andvip=1. Selected route rows from that snapshot were:model_ratiocompletion_ratiocache_ratiodeepseek-v4-flash0.31930.0318default,vip,svipdeepseek-v4-pro0.95730.0333default,vip,svipglm-5.11.053.1428570.32381default,vip,svipkimi-k32.2550.2default,vip,svipqwen3-max0.78109889455908824vip,svip,defaultI also rechecked direct provider pricing pages the same day. DeepSeek publishes token-price rows with separate cache-hit input, cache-miss input, and output prices plus peak and off-peak windows. Z.AI publishes GLM promotional and standard rows by model family. Alibaba Cloud Model Studio documents token billing by model, with Batch API and tool add-on pricing documented separately. Those pages are useful external references, but an SDK should not merge them into one undifferentiated number. It should record which source owned each fact.
For
aiwave-sdk-python, I would make entitlement snapshots an optional assertion helper around the normal client:The helper should not expose private identifiers by default. It can hash token IDs, omit customer emails, and never store prompts or completions. The point is not to make billing data public. The point is to give the developer a receipt that says: this request was accepted under this route policy, with this dated catalog and this pricing version.
The failure behavior matters. If the token group is missing, the account group does not match the token group, the route is not enabled for the effective group, or the pricing version is unknown, the assertion should fail closed before the workload runs. If an advisory field such as cache metadata is absent for a model that does not promise cache accounting, the helper can warn instead of blocking.
A compact JSON artifact could look like this:
{ "checked_at": "2026-09-06T00:00:00Z", "requested_model": "deepseek-v4-pro", "resolved_model": "deepseek-v4-pro", "account_group": "vip", "token_group": "vip", "route_group": "vip", "pricing_version": "a42d372ccf0b5dd13ecf71203521f9d2", "catalog_version": "catalog_2026_09_06", "ledger_policy_version": "ledger_v1" }This belongs in three places: CI fixtures before a route-policy change, rollout checks before a new worker starts serving traffic, and support diagnostics after a customer asks why two similar requests behaved differently.
The SDK boundary stays narrow. The gateway remains the source of truth for live account state, route policy, and final ledger rows. The SDK provides a typed way to ask for those facts, assert the subset the application depends on, and attach the resulting snapshot to a test report or incident note.
Open question: should entitlement snapshot assertions live as a first-class
aiwave-sdk-pythonhelper, or should the repository publish them first as a reference CI pattern that teams can adapt?All reactions