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:
| Rule | Default | Description |
|---|---|---|
| Mandatory | No | Whether X-ASO-Dims is required on every request |
| Allowed keys | team, env, app | Only these dimension keys are accepted |
| Max pairs | 8 | Maximum number of key-value pairs per request |
| Max key length | 32 characters | Maximum length of a dimension key |
| Max value length | 64 characters | Maximum 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.