{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/litellm_proxy/responses/transformation.py#L20-L51","documentation":"The Responses-API transformation for the litellm_proxy provider routes requests to the upstream proxy's {api_base}/responses endpoint. api_base is taken from the call parameter or the LITELLM_PROXY_API_BASE secret/env var; if neither is present it raises ValueError (note this variant also disables native WebSocket support).","triggerScenarios":"Calling litellm.responses(model=\"litellm_proxy/gpt-4o\", input=...) or a proxy route that forwards to a litellm_proxy responses deployment with no api_base configured and no LITELLM_PROXY_API_BASE set.","commonSituations":"Adopting the newer Responses API on a chained-proxy setup that only configured chat credentials; missing env var in the new service that uses responses.","solutions":["Set LITELLM_PROXY_API_BASE to the upstream proxy root (the code appends /responses)","Or pass api_base explicitly on the litellm.responses call / deployment entry","Ensure the upstream proxy version supports the /responses endpoint","Restart the calling process after setting the variable"],"exampleFix":"# before\nlitellm.responses(model=\"litellm_proxy/gpt-4o\", input=\"hello\")  # ValueError\n\n# after\nos.environ[\"LITELLM_PROXY_API_BASE\"] = \"http://proxy-b:4000\"\nos.environ[\"LITELLM_PROXY_API_KEY\"] = \"sk-...\"\nlitellm.responses(model=\"litellm_proxy/gpt-4o\", input=\"hello\")","handlingStrategy":"validation","validationCode":"import os\n\nif not os.getenv(\"LITELLM_PROXY_API_BASE\"):\n    raise SystemExit(\"Set LITELLM_PROXY_API_BASE to use litellm_proxy responses API\")","typeGuard":null,"tryCatchPattern":"try:\n    litellm.responses(model=\"litellm_proxy/gpt-4o\", input=\"hi\")\nexcept ValueError as e:\n    if \"api_base not set\" in str(e):\n        raise ConfigError(\"Set LITELLM_PROXY_API_BASE for the responses API\") from e\n    raise","preventionTips":["When adopting the Responses API on chained proxies, reuse the same LITELLM_PROXY_API_BASE/KEY setup as chat","Confirm the upstream proxy version serves /responses before routing traffic","Validate chaining env vars at startup for every API surface you enable"],"tags":["litellm-proxy","responses-api","api-base","env-var"],"backgroundTag":"missing-api-base-url","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}