Errors
ALLM uses standard HTTP status codes and problem details with stable, machine-readable error codes.
Error shape
Error responses use application/problem+json. Branch on code; use detail for diagnostics, not application logic.
JSON · 404
{
"type": "https://docs.use-allm.com/errors/deployment-not-found",
"title": "Deployment not found",
"status": 404,
"detail": "The requested deployment does not exist.",
"code": "DEPLOYMENT_NOT_FOUND"
}Status codes
| Status | Code | When it happens |
|---|---|---|
| 400 | INVALID_REQUEST | Malformed JSON, a missing field, or a value outside its allowed range. |
| 401 | UNAUTHORIZED | Missing or invalid credentials on a protected request. |
| 403 | FORBIDDEN | Valid credentials without permission for the requested resource. |
| 404 | *_NOT_FOUND | The provider, model, or deployment does not exist. |
| 422 | PRICING_UNAVAILABLE | The deployment exists, but no applicable rate card can produce a quote. |
| 429 | RATE_LIMIT_EXCEEDED | The current API quota has been exceeded. |
| 500 | INTERNAL_ERROR | An unexpected server error occurred. |
Handle errors
TypeScript
import { ALLM, ALLMError } from "@allm/sdk";
try {
await allm.pricing.calculate({
deployment: "dep_missing",
inputTokens: 1000,
outputTokens: 100,
});
} catch (error) {
if (error instanceof ALLMError) {
console.error(error.code, error.status, error.requestId);
}
}Retry policy
Retry only transport failures, 429, and transient 5xx responses. Use exponential backoff with jitter, honor Retry-After, and cap attempts. Do not retry validation errors or unavailable pricing without changing the request.