Use request labels when application code needs a stable cost dimension that is more specific than an API key or application. Labels are captured with the request audit and can be filtered in analytics without changing the model request.
Send labels
Set X-Phaseo-Metadata to a JSON object containing up to 32 unique key/value labels:
The TypeScript and Python SDKs accept custom headers, so the same header can be configured on the client. Labels are not forwarded to providers.
Slice spend
Use the analytics endpoint with both label_key and label_value:
The response uses the same grouped spend format as unfiltered analytics, but only includes requests carrying that exact label pair.
Contract
- Keys use letters, numbers,
_, ., :, or - and are limited to 64 characters.
- Values are strings limited to 256 characters.
- A request may contain up to 32 labels and the header is limited to 8 KiB.
- Duplicate keys or malformed metadata are rejected with
400 invalid_request.
- Do not put prompts, secrets, email addresses, or other personal data in labels.
Last modified on August 29, 2026