BerriAI/litellm · error · AlephAlphaError
json.dumps(completion_response)
Error message
json.dumps(completion_response)
What it means
Raised while normalizing the Aleph Alpha completion response when completions data is malformed or absent (missing/mis-shaped completion_response["completions"]), so the raw JSON is dumped into the error for diagnosis.
Solutions
- The Aleph Alpha response contained an 'error' field; read it for the provider's reason.
- Note this provider is deprecated in litellm; migrate to a supported provider.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/deprecated_providers/aleph_alpha.py:273 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/5264fa1fc0cbd81a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/deprecated_providers/aleph_alpha.py:273
status_code=response.status_code,
)
else:
try:
choices_list: Final = []
for idx, item in enumerate(completion_response["completions"]):
if len(item["completion"]) > 0:
message_obj = Message(content=item["completion"])
else:
message_obj = Message(content=None)
choice_obj = Choices(
finish_reason=item["finish_reason"],
index=idx + 1,
message=message_obj,
)
choices_list.append(choice_obj)
model_response.choices = choices_list
except Exception:
raise AlephAlphaError(
message=json.dumps(completion_response),
status_code=response.status_code,
)
## CALCULATING USAGE - baseten charges on time, not tokens - have some mapping of cost here.
prompt_tokens: Final = len(encoding.encode(prompt))
completion_tokens: Final = len(
encoding.encode(
model_response["choices"][0]["message"]["content"],
disallowed_special=(),
)
)
model_response.created = int(time.time())
model_response.model = model
usage: Final = Usage(
prompt_tokens=prompt_tokens,
completion_tokens=completion_tokens,View on GitHub (pinned to 77b7c6c40c)