{"record":{"id":"fd31b5b362781ac8","repo":"BerriAI/litellm","slug":"api-base-is-required-fd31b5","errorCode":null,"errorMessage":"api_base is required","messagePattern":"api_base is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/interactions/transformation.py","lineNumber":118,"sourceCode":"        stream: bool | None = None,\n    ) -> str:\n        \"\"\"\n        Get the complete URL for the interaction request.\n\n        Per OpenAPI spec: POST /{api_version}/interactions\n\n        Args:\n            api_base: Base URL for the API\n            model: The model name (for model interactions)\n            agent: The agent name (for agent interactions)\n            litellm_params: LiteLLM parameters\n            stream: Whether this is a streaming request\n\n        Returns:\n            The complete URL for the request\n        \"\"\"\n        if api_base is None:\n            raise ValueError(\"api_base is required\")\n        return api_base\n\n    @abstractmethod\n    def transform_request(\n        self,\n        model: str | None,\n        agent: str | None,\n        input: InteractionInput | None,\n        optional_params: InteractionsAPIOptionalRequestParams,\n        litellm_params: GenericLiteLLMParams,\n        headers: dict,\n    ) -> dict:\n        \"\"\"\n        Transform the input request into the provider's expected format.\n\n        Per OpenAPI spec, the request body should be either:\n        - CreateModelInteractionParams (with model)\n        - CreateAgentInteractionParams (with agent)","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/interactions/transformation.py#L100-L136","documentation":"The base InteractionsAPIConfig get_complete_url raises ValueError when api_base is None. Interactions (OpenAI Responses-style agent/model interaction endpoints) require a concrete base URL; the default implementation just returns api_base, so a None value is rejected before the HTTP client would produce a nonsense request.","triggerScenarios":"Calling the interactions API (litellm.interactions / proxy /v1/interactions routes) for a provider whose params contain no api_base: missing <PROVIDER>_API_BASE env, custom provider registered without a default base URL, or proxy model entry lacking api_base.","commonSituations":"Self-hosted OpenAI-compatible servers used for interactions without base URL configuration; new provider configs that only set transform_request; environment differences between local (env set) and CI/deploy (env missing).","solutions":["Pass api_base with the request (litellm_params={'api_base': ...}).","Set the matching provider env var (e.g. OPENAI_API_BASE).","Add api_base to the proxy model config used by interactions routes.","Provider authors: override get_complete_url in the InteractionsAPIConfig subclass with a sane default."],"exampleFix":"# before\nlitellm.interactions(model='my-provider/agent-1', input='hi')  # api_base None\n\n# after\nlitellm.interactions(model='my-provider/agent-1', input='hi', api_base='https://host/v1')","handlingStrategy":"validation","validationCode":"def validate_interactions_call(api_base: str | None) -> None:\n    if api_base is None and not os.environ.get('OPENAI_API_BASE'):\n        raise ConfigError('interactions API requires api_base')","typeGuard":null,"tryCatchPattern":"try:\n    litellm.interactions(...)\nexcept ValueError as e:\n    if 'api_base is required' in str(e):\n        raise ConfigError('set api_base or OPENAI_API_BASE for interactions') from e\n    raise","preventionTips":["Centralize provider base URLs in a typed settings object loaded at startup.","Validate required params per API surface (interactions, responses, evals) before dispatch.","Log resolved api_base (not secrets) once at client init to catch env issues early."],"tags":["interactions","api-base","configuration","url-construction"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}