BerriAI/litellm · error · Exception
Request did not return a 200 status code: {response.status_c
Error message
Request did not return a 200 status code: {response.status_code}, {response.text} What it means
Raised in async_audio_speech when the awaited POST to the Vertex AI speech endpoint returns non-200; status and body are embedded. Same failure class as the sync path: bad request payload, auth, or quota.
Source
Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:188
async def async_audio_speech(
self,
logging_obj,
url: str,
headers: dict,
request: VertexTextToSpeechRequest,
) -> HttpxBinaryResponseContent:
import base64
async_handler: Final = get_async_httpx_client(llm_provider=litellm.LlmProviders.VERTEX_AI)
response = await async_handler.post(
url=url,
headers=headers,
json=request,
)
if response.status_code != 200:
raise Exception(f"Request did not return a 200 status code: {response.status_code}, {response.text}")
_json_response: Final = response.json()
response_content: Final = _json_response["audioContent"]
# Decode base64 to get binary content
binary_data: Final = base64.b64decode(response_content)
# Create an httpx.Response object
response = httpx.Response(
status_code=200,
content=binary_data,
)
# Initialize the HttpxBinaryResponseContent instance
http_binary_response: Final = HttpxBinaryResponseContent(response)
return http_binary_response
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Read the status code and response text in the error to identify the upstream failure (permissions, billing, invalid input).
- Confirm the Vertex AI Text-to-Speech API is enabled on the project and the credentials have the required IAM roles.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:188 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/84a1d98c407f3c22.
Report an issue: GitHub.