Skip to main content

Dimensions

Dimensions let you tag requests with metadata for cost attribution and reporting. They are sent in the X-ASO-Dims header.

Format

Simple format (recommended):

-H "X-ASO-Dims: team=search,app=product-search,env=prod"

JSON format:

-H 'X-ASO-Dims: {"team":"search","app":"product-search","env":"prod"}'

Full example

curl https://proxy.aispendops.com/v1/openai/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-H "X-ASO-API-Key: aso_k_yourkey.secret" \
-H "X-ASO-Dims: team=search,app=product-search,env=prod" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4.1","messages":[{"role":"user","content":"Hello"}]}'

Dimension rules

Your API key has a dimensions policy configured by your administrator:

RuleDefaultDescription
MandatoryNoWhether X-ASO-Dims is required on every request
Allowed keysteam, env, appOnly these dimension keys are accepted
Max pairs8Maximum number of key-value pairs per request
Max key length32 charactersMaximum length of a dimension key
Max value length64 charactersMaximum length of a dimension value

Validation errors

Dimension validation errors return HTTP 400:

{"error": "AISpendOps: Dimension key \"department\" not allowed"}
{"error": "AISpendOps: Too many dimension pairs (max 8)"}
{"error": "AISpendOps: Dimensions are required (X-ASO-Dims header)"}

Mandatory dimensions

Your administrator can require dimensions on every request. When enabled, any request without X-ASO-Dims will be rejected with a 400 error. This ensures all usage is properly attributed to a team, app, or environment.