{"record":{"id":"963c5ed8752c2643","repo":"BerriAI/litellm","slug":"api-base-not-set-for-litellm-proxy-responses-api","errorCode":null,"errorMessage":"api_base not set for LiteLLM Proxy responses API. Set via api_base parameter or LITELLM_PROXY_API_BASE environment variable","messagePattern":"api_base not set for LiteLLM Proxy responses API\\. Set via api_base parameter or LITELLM_PROXY_API_BASE environment variable","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/litellm_proxy/responses/transformation.py","lineNumber":38,"sourceCode":"\n    @property\n    def custom_llm_provider(self) -> LlmProviders:\n        return LlmProviders.LITELLM_PROXY\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        Get the endpoint for LiteLLM Proxy responses API.\n\n        Uses LITELLM_PROXY_API_BASE environment variable if api_base is not provided.\n        \"\"\"\n        api_base = api_base or get_secret_str(\"LITELLM_PROXY_API_BASE\")\n\n        if api_base is None:\n            raise ValueError(\n                \"api_base not set for LiteLLM Proxy responses API. \"\n                \"Set via api_base parameter or LITELLM_PROXY_API_BASE environment variable\"\n            )\n\n        # Remove trailing slashes\n        api_base = api_base.rstrip(\"/\")\n\n        return f\"{api_base}/responses\"\n\n    def supports_native_websocket(self) -> bool:\n        \"\"\"LiteLLM Proxy does not support native WebSocket for Responses API\"\"\"\n        return False\n","sourceCodeStart":20,"sourceCodeEnd":51,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/litellm_proxy/responses/transformation.py#L20-L51","documentation":"The Responses API transformation for the litellm_proxy provider forwards requests to {api_base}/responses on a downstream LiteLLM Proxy. If api_base is neither passed nor available via LITELLM_PROXY_API_BASE, it raises ValueError with instructions covering both resolution routes. Note this provider reports no native WebSocket support; HTTP(S) with a base URL is mandatory.","triggerScenarios":"Calling litellm.responses(model=\"litellm_proxy/...\", ...) without api_base while LITELLM_PROXY_API_BASE is unset — e.g. pointing a client's Responses API at another LiteLLM proxy that hasn't been configured.","commonSituations":"Proxy-to-proxy Responses API routing where only the key was configured; env var scoped to the wrong deployment; local .env not loaded in the server process.","solutions":["Set api_base on the call or LITELLM_PROXY_API_BASE in the environment to the downstream proxy URL","For the LiteLLM proxy, put api_base in the model deployment's litellm_params so every responses call carries it","Restart the process after setting the env var and confirm it is visible to the process"],"exampleFix":"# before\nresp = litellm.responses(model=\"litellm_proxy/gpt-4o\", input=\"hi\")\n\n# after\nresp = litellm.responses(\n    model=\"litellm_proxy/gpt-4o\",\n    input=\"hi\",\n    api_base=\"http://downstream-proxy:4000\",\n    api_key=\"sk-upstream\",\n)","handlingStrategy":"validation","validationCode":"import os\n\ndef ensure_responses_base(api_base: str | None = None) -> str:\n    base = (api_base or os.getenv(\"LITELLM_PROXY_API_BASE\") or \"\").rstrip(\"/\")\n    if not base:\n        raise ValueError(\"Downstream proxy base required for the Responses API\")\n    return base","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.responses(model=\"litellm_proxy/gpt-4o\", input=\"hi\", api_base=ensure_responses_base())\nexcept ValueError as e:\n    if \"api_base not set for LiteLLM Proxy responses API\" in str(e):\n        raise RuntimeError(\"Responses route misconfigured: set api_base or LITELLM_PROXY_API_BASE\") from e","preventionTips":["Remember this provider never uses native WebSockets — always provision an HTTP base URL","For the LiteLLM proxy, set api_base in the model deployment so SDK callers need nothing extra","Include a responses-api smoke test in deployment checks alongside chat completion tests"],"tags":["litellm-proxy","responses-api","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}