Error Codes
All proxy errors are returned as JSON with an error field prefixed with AISpendOps:.
Proxy errors
| Status | Error | Cause |
|---|---|---|
400 | Dimension key "{key}" not allowed | Dimension key not in the allowed list |
400 | Too many dimension pairs (max 8) | More than 8 dimension key-value pairs |
400 | Dimensions are required (X-ASO-Dims header) | Mandatory dimensions enabled but header missing |
400 | Provider not allowed by API key policy | Provider not in the key's allow-list |
400 | Model not allowed by API key policy | Model doesn't match any allowed pattern |
401 | Missing X-ASO-API-Key | X-ASO-API-Key header not present |
403 | Invalid X-ASO-API-Key | Key not recognised |
403 | API key is inactive | Key exists but has been deactivated |
404 | Unknown provider | Provider name not recognised |
502 | Upstream fetch failed | Could not reach the provider's API |
Example response
{
"error": "AISpendOps: Missing X-ASO-API-Key"
}
Provider errors
Errors from the upstream provider (e.g. 400 invalid model, 429 rate limit, 500 server error) are passed through to you unchanged with the provider's original status code and response body. These are not prefixed with AISpendOps:.
Distinguishing proxy vs provider errors
- Proxy errors always have
"error": "AISpendOps: ..."in the response body - Provider errors have the provider's native error format (varies by provider)
This makes it easy to determine whether an error came from AI SpendOps or the upstream provider.