BerriAI/litellm · error · Exception
Only POST requests are supported
Error message
Only POST requests are supported
What it means
litellm's vendored DeepEval/Confident-AI Api client implements only POST: _http_request hard-fails on any other method string before any network I/O. It exists as a guard against porting call sites from the official deepeval SDK, where GET/PUT/DELETE are supported for some endpoints.
Source
Thrown at litellm/integrations/deepeval/api.py:68
BASELINE_ATTACKS_ENDPOINT = "/generate-baseline-attacks"
class Api:
def __init__(self, api_key: str, base_url=None):
self.api_key = api_key
self._headers = {
"Content-Type": "application/json",
# "User-Agent": "Python/Requests",
"CONFIDENT_API_KEY": api_key,
}
# using the global non-eu variable for base url
self.base_api_url = base_url or API_BASE_URL
self.sync_http_handler = HTTPHandler()
self.async_http_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)
def _http_request(self, method: str, url: str, headers=None, json=None, params=None):
if method != "POST":
raise Exception("Only POST requests are supported")
try:
self.sync_http_handler.post(
url=url,
headers=headers,
json=json,
params=params,
)
except httpx.HTTPStatusError as e:
raise Exception(f"DeepEval logging error: {e.response.text}")
except Exception as e:
raise e
def send_request(self, method: HttpMethods, endpoint: Endpoints, body=None, params=None):
url: Final = f"{self.base_api_url}{endpoint.value}"
res: Final = self._http_request(
method=method.value,
url=url,
headers=self._headers,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use HttpMethods.POST for every send_request call through this vendored client
- If you need GET/PUT/DELETE against Confident AI, use the official deepeval SDK (pip install deepeval) or a plain httpx client instead
Example fix
# before
api.send_request(HttpMethods.GET, Endpoints.PROMPT_ENDPOINT, params={"id": p}) # Exception
# after (official SDK for reads)
from deepeval.confident_api import ... # or plain httpx GET
# vendored client stays POST-only:
api.send_request(HttpMethods.POST, Endpoints.TRACING_ENDPOINT, body=trace) Defensive patterns
Strategy: type-guard
Validate before calling
from litellm.integrations.deepeval.api import HttpMethods
def assert_post(method: HttpMethods) -> None:
if method is not HttpMethods.POST:
raise ValueError(f"vendored DeepEval client is POST-only, got {method}") Type guard
from litellm.integrations.deepeval.api import HttpMethods
from typing import Any
def is_supported_method(method: Any) -> bool:
"""Narrow to the only verb the vendored client implements."""
return method is HttpMethods.POST Prevention
- Keep a project lint/enum whitelist: only HttpMethods.POST may reach send_request
- Route read/delete flows to the official deepeval SDK, not this vendored client
- Add a unit test asserting new call sites never pass non-POST verbs
When it happens
Trigger: Calling api.send_request(HttpMethods.GET, Endpoints.PROMPT_ENDPOINT, ...) or any non-POST verb; code migrated from the official confident-ai/deepeval client that fetches or deletes resources.
Common situations: Developers assuming the vendored client mirrors deepeval's full REST surface; automated call-site refactors switching the HttpMethods enum value.
Related errors
- DeepEval logging error: {e.response.text}
- res.json().get("error", res.text)
- Please set 'CONFIDENT_API_KEY=<>' in your environment variab
- Invalid environment: {environment}. Please use one of the fo
- BedrockFilesConfig does not support file retrieval
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9c58c95286d5a55a.
Report an issue: GitHub.