{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/generic_prompt_management/__init__.py#L25-L61","documentation":"prompt_initializer raises ValueError when litellm_params.api_base is falsy while initializing a prompt from a generic prompt-management API. Generic prompt management fetches prompts over HTTP from a user-supplied base URL, so api_base is mandatory whenever a prompt_id/prompt_spec is used with a generic provider.","triggerScenarios":"Routing a completion with a prompt_id and a provider marked as generic prompt management while prompt_config/generic_prompt_config lacks api_base; setting api_key but not api_base in the prompt config; the api_base key nested in the wrong section of config.yaml.","commonSituations":"Wiring LiteLLM to an internal prompt-management service and forgetting the URL; copy-pasting a generic_prompt_config example that only shows api_key; config structured for a built-in prompt provider (which needs no api_base) then switching to generic without adding it.","solutions":["Add api_base to your generic_prompt_config, e.g. api_base: https://prompts.internal.example.com.","Confirm it sits at the level the code reads (litellm_params of the prompt config), not under a nested provider block.","Also set api_key if the prompt API requires auth.","Check for empty-string api_base from templated configs — falsy values fail."],"exampleFix":"# before\nlitellm.global_generic_prompt_config = {'api_key': 'sk-...'}\n\n# after\nlitellm.global_generic_prompt_config = {'api_base': 'https://prompts.internal.example.com', 'api_key': 'sk-...'}","handlingStrategy":"validation","validationCode":"if not litellm_params.api_base:\n    raise ValueError('generic_prompt_config requires api_base (the prompt API URL)')","typeGuard":"def prompt_config_has_api_base(prompt_config: dict) -> bool:\n    return bool(prompt_config.get('api_base'))","tryCatchPattern":"try:\n    prompt_initializer(litellm_params, prompt_spec)\nexcept ValueError as e:\n    if 'api_base' in str(e):\n        raise ConfigError('Add api_base to generic_prompt_config') from e\n    raise","preventionTips":["Validate generic_prompt_config keys at proxy startup, not on first request.","Include api_base and api_key in every generic_prompt_config template."],"tags":["prompt-management","generic-provider","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}