Usage object
OpenAI usage shape plus one field: cached_prompt_tokens.Every response includes a
usage object matching OpenAI’s shape, extended with one Malibu-specific field.
Shape
cached_prompt_tokens
Reports how many of the prompt tokens were served from the sticky provider’s warm KV-cache. Always present; 0 when there was no cache reuse.
When you’ll see non-zero values:
- You sent
X-Malibu-Conversationand the request routed to the same provider as a recent turn on the same tag. - The shared prefix between the two turns exceeds the provider’s cache-miss threshold (typically a few hundred tokens).
- No
X-Malibu-Conversationheader on the request. - The sticky provider was unavailable and the request fell through to normal routing.
- The provider serving the request is legacy (pre prefix-cache billing) — safe to consume unconditionally.
Billing implication
Cached tokens are billed at the per-modelprompt_cache_hit_rate_per_mtok rate instead of the full promptRate. See Network overview → Metering & billing for the formula and Sticky conversations for how to opt in.
Reading from the SDK
getattr fallback handles cases where you’re using an older openai-python version that doesn’t expose the field on the typed object — the raw JSON still contains it.
Aggregated usage
For per-day / per-model buyer aggregates use the/v1/usage endpoint: