BerriAI/litellm · error · BytezError
{error}
Error message
{error} What it means
After a successful HTTP response, the Bytez transform checks the JSON body for a top-level 'error' key; if present it raises BytezError with that error stringified and the HTTP status code. Bytez reports application-level failures (model errors, inference crashes, account issues) inside an otherwise 200-ish response, so this is the primary Bytez failure surface.
Source
Thrown at litellm/llms/bytez/chat/transformation.py:197
self,
model: str,
raw_response: httpx.Response,
model_response: ModelResponse,
logging_obj: LiteLLMLoggingObj,
request_data: dict,
messages: list[AllMessageValues],
optional_params: dict,
litellm_params: dict,
encoding: Any,
api_key: str | None = None,
json_mode: bool | None = None,
) -> ModelResponse:
json: Final = raw_response.json()
error: Final = json.get("error")
if error is not None:
raise BytezError(
message=str(json["error"]),
status_code=raw_response.status_code,
)
# set meta data here
model_response.created = int(time.time())
model_response.model = model
# Add the output
output: Final = json.get("output")
message: Final = model_response.choices[0].message
message.content = output["content"][0]["text"]
messages = adapt_messages_to_bytez_standard(messages=messages)
# NOTE We are approximating tokens, to get the true values we will need to update our BEView on GitHub (pinned to 6c2dcb801b)
Solutions
- Read the message — it embeds Bytez's own error text, which names the real cause (model not found, billing, inference error).
- For model issues, verify the model id matches a Bytez-supported repository path and correct it.
- For quota/billing, top up or switch accounts/keys.
- For transient inference failures, retry with backoff.
Example fix
# before litellm.completion(model="bytez/some-wrong/model-id", messages=m) # after litellm.completion(model="bytez/meta-llama/Llama-3-8b", messages=m) # valid Bytez model path
Defensive patterns
Strategy: try-catch
Try / catch
from litellm.llms.bytez.chat.transformation import BytezError
try:
resp = litellm.completion(model="bytez/...", messages=m)
except BytezError as e:
msg = str(e)
if "model" in msg.lower() and "not" in msg.lower():
fix_model_id_and_retry()
elif e.status_code in (402, 429):
handle_billing_or_rate_limit()
else:
retry_with_backoff() # transient inference failures Prevention
- Validate Bytez model ids against your account's available models before first use.
- Monitor credit balance and set low-balance alerts to avoid mid-run failures.
- Classify BytezError by message content to route to model fix, billing, or retry.
When it happens
Trigger: Non-streaming litellm.completion against a bytez/ model where the response JSON contains {"error": ...} — e.g. model failed to load, out-of-credits, invalid model path, or inference exception on Bytez's side.
Common situations: Incorrect model repository ids; Bytez account quota exhaustion; transient model cold-start or GPU failures; content the hosted model rejects internally.
Related errors
- Failed to transform Braintrust response: {str(e)}
- APIError: {exception_provider} - {error_str}
- LiteLLM: provider returned a response with no 'choices'. Raw
- {completion_response["error"]}
- Azure AI Speech transcription failed with RecognitionStatus=
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/31fb585882335b86.
Report an issue: GitHub.