Errors
enroute raises typed errors so callers can retry the right failures.
All package errors inherit EnrouteError. Use is_retryable for RateLimitError, TimeoutError, and ProviderUnavailable.
from enroute import (
AuthenticationError,
BudgetExceededError,
EnrouteError,
RateLimitError,
is_retryable,
)
try:
client.chat(model="openai/gpt-5.6-luna", messages=[...])
except BudgetExceededError:
print("raise max_cost_usd or buy credits")
except EnrouteError as exc:
if is_retryable(exc):
print("retry", type(exc).__name__)Other types: AuthenticationError, InvalidRequestError, NotFoundError, ContextLengthError, ContentFilterError, and ConfigurationError. The hosted gateway maps missing keys to 401 and an empty workspace wallet to 402.