BerriAI/litellm · warning · Exception
OpenMeter logging error: {e.response.text}
Error message
OpenMeter logging error: {e.response.text} What it means
The synchronous OpenMeter event POST returned an HTTP error status (httpx.HTTPStatusError), and the logger re-raises with the response body. Common bodies are auth errors (401 invalid key), 4xx malformed CloudEvent, or 5xx from OpenMeter's cloud.
Source
Thrown at litellm/integrations/openmeter.py:121
else:
_url += "/api/v1/events"
api_key: Final = os.getenv("OPENMETER_API_KEY")
_data: Final = self._common_logic(kwargs=kwargs, response_obj=response_obj)
_headers: Final = {
"Content-Type": "application/cloudevents+json",
"Authorization": f"Bearer {api_key}",
}
try:
self.sync_http_handler.post(
url=_url,
data=json.dumps(_data),
headers=_headers,
)
except httpx.HTTPStatusError as e:
raise Exception(f"OpenMeter logging error: {e.response.text}")
except Exception as e:
raise e
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
_url = os.getenv("OPENMETER_API_ENDPOINT", "https://openmeter.cloud")
if _url.endswith("/"):
_url += "api/v1/events"
else:
_url += "/api/v1/events"
api_key: Final = os.getenv("OPENMETER_API_KEY")
_data: Final = self._common_logic(kwargs=kwargs, response_obj=response_obj)
_headers: Final = {
"Content-Type": "application/cloudevents+json",
"Authorization": f"Bearer {api_key}",
}
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Read the response text embedded in the message: 401 -> refresh OPENMETER_API_KEY; 404 -> fix OPENMETER_API_ENDPOINT (it should be the base URL; litellm appends /api/v1/events); 400 -> inspect the event JSON (subject/type)
- Verify connectivity: curl -H 'Authorization: Bearer $OPENMETER_API_KEY' $OPENMETER_API_ENDPOINT/api/v1/events
- For 5xx or transient errors, retry or rely on callback failure handling rather than crashing the request path
- If self-hosting, confirm your endpoint speaks the CloudEvents HTTP API
Example fix
# before export OPENMETER_API_ENDPOINT=https://openmeter.mycompany.io # wrong base -> HTTPStatusError # after export OPENMETER_API_ENDPOINT=https://openmeter.mycompany.io/ # and refresh key on 401: export OPENMETER_API_KEY=om-new-key
Defensive patterns
Strategy: try-catch
Validate before calling
import os, httpx
def openmeter_reachable() -> bool:
base = os.getenv("OPENMETER_API_ENDPOINT", "https://openmeter.cloud").rstrip("/")
headers = {"Authorization": f"Bearer {os.getenv('OPENMETER_API_KEY', '')}"}
try:
r = httpx.get(f"{base}/api/v1/events", headers=headers, timeout=5)
return r.status_code < 500
except httpx.HTTPError:
return False Try / catch
try:
logger.log_success_event(kwargs, response_obj, start, end)
except Exception as e:
if "OpenMeter logging error" in str(e):
log.warning("openmeter export failed: %s", e) # never fail the LLM request over telemetry
else:
raise Prevention
- Treat telemetry failures as non-fatal: catch and alert, do not propagate
- Rotate keys via env with process restart; alert on 401 bodies
When it happens
Trigger: Expired or rotated OPENMETER_API_KEY (401); OPENMETER_API_ENDPOINT pointing to the wrong host or path handling (404); payload rejected (400) because subject is not a string or event type is invalid; OpenMeter outage (5xx).
Common situations: Long-running proxies whose OpenMeter key was rotated but not updated in the env; custom OpenMeter-compatible endpoints (e.g. self-hosted) where the URL scheme differs; transient cloud 502/503s surfacing during bursts.
Related errors
- Error from qdrant checking if /collections exist {collection
- DeepEval logging error: {e.response.text}
- Mavvrik FOCUS destination: register failed ({resp.status_cod
- Mavvrik FOCUS destination: failed to get signed URL ({resp.s
- Failed to fetch prompt '{prompt_id}' from API: {e}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/866cd10ad11ca382.
Report an issue: GitHub.