{"record":{"id":"80126977ac105c3c","repo":"BerriAI/litellm","slug":"api-base-is-required-in-generic-prompt-config","errorCode":null,"errorMessage":"api_base is required in generic_prompt_config","messagePattern":"api_base is required in generic_prompt_config","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/generic_prompt_management/__init__.py","lineNumber":43,"sourceCode":"                - api_base: Base URL for the API\n                - api_key: Optional API key for authentication\n                - timeout: Request timeout in seconds (default: 30)\n    \"\"\"\n    import litellm\n\n    litellm.global_generic_prompt_config = config\n\n\ndef prompt_initializer(litellm_params: \"PromptLiteLLMParams\", prompt_spec: \"PromptSpec\") -> \"CustomPromptManagement\":\n    \"\"\"\n    Initialize a prompt from a generic prompt management API.\n    \"\"\"\n    prompt_id: Final = getattr(litellm_params, \"prompt_id\", None)\n\n    api_base: Final = litellm_params.api_base\n    api_key: Final = litellm_params.api_key\n    if not api_base:\n        raise ValueError(\"api_base is required in generic_prompt_config\")\n\n    provider_specific_query_params: Final = litellm_params.provider_specific_query_params\n\n    try:\n        generic_prompt_manager: Final = GenericPromptManager(\n            api_base=api_base,\n            api_key=api_key,\n            prompt_id=prompt_id,\n            additional_provider_specific_query_params=provider_specific_query_params,\n            **litellm_params.model_dump(\n                exclude_none=True,\n                exclude={\n                    \"prompt_id\",\n                    \"api_key\",\n                    \"provider_specific_query_params\",\n                    \"api_base\",\n                },\n            ),","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/generic_prompt_management/__init__.py#L25-L61","documentation":"Raised by prompt_initializer() in the generic prompt management integration when litellm_params.api_base is falsy. The generic prompt manager must call a LiteLLM-compatible prompt management API, and api_base is the URL of that API; without it there is nothing to fetch the prompt from.","triggerScenarios":"Calling litellm.router.completion with a model whose model_info declares prompt_integration='generic_api' (or setting litellm.global_generic_prompt_config) but omitting api_base in the model's litellm_params; passing api_base=None or an empty string; typo like 'apiUrl' or 'base_url' instead of 'api_base'.","commonSituations":"Defining a prompt-management model in the config.yaml of the proxy without an api_base entry; assuming the prompt manager reads a base URL from an environment variable (it does not); renaming the key when migrating config from the LiteLLM proxy UI where the field is labeled differently.","solutions":["Add api_base (the root URL of your prompt management API, e.g. https://api.litellm.ai or a self-hosted proxy) to the litellm_params of the model that uses the generic prompt integration.","If set via litellm.global_generic_prompt_config, verify that dict includes 'api_base' alongside api_key.","Check for typos: the attribute read is exactly litellm_params.api_base — 'base_url', 'api_url', or 'url' are silently ignored and leave api_base falsy."],"exampleFix":"# before (config.yaml model_list entry)\nmodel_name: my-prompt\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: generic_api\n  prompt_id: my-prompt-id\n  # api_base missing -> ValueError\n\n# after\nmodel_name: my-prompt\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: generic_api\n  prompt_id: my-prompt-id\n  api_base: https://your-litellm-proxy.example.com","handlingStrategy":"validation","validationCode":"def validate_generic_prompt_params(litellm_params) -> None:\n    if not getattr(litellm_params, \"api_base\", None):\n        raise ValueError(\n            \"Prompt integration 'generic_api' requires litellm_params.api_base \"\n            \"(root URL of the prompt management API)\"\n        )\n\nvalidate_generic_prompt_params(model.litellm_params)","typeGuard":"def has_api_base(litellm_params) -> bool:\n    return bool(getattr(litellm_params, \"api_base\", None))","tryCatchPattern":null,"preventionTips":["Write a startup validator that walks model_list and asserts api_base for every prompt_integration model.","Keep a documented example entry for the generic prompt integration and diff new configs against it.","Watch for the exact key name api_base — aliases are silently ignored."],"tags":["config","prompt-management","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}