BerriAI/litellm · error · ValueError
api_base is required in generic_prompt_config
Error message
api_base is required in generic_prompt_config
What it means
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.
Source
Thrown at litellm/integrations/generic_prompt_management/__init__.py:43
- api_base: Base URL for the API
- api_key: Optional API key for authentication
- timeout: Request timeout in seconds (default: 30)
"""
import litellm
litellm.global_generic_prompt_config = config
def prompt_initializer(litellm_params: "PromptLiteLLMParams", prompt_spec: "PromptSpec") -> "CustomPromptManagement":
"""
Initialize a prompt from a generic prompt management API.
"""
prompt_id: Final = getattr(litellm_params, "prompt_id", None)
api_base: Final = litellm_params.api_base
api_key: Final = litellm_params.api_key
if not api_base:
raise ValueError("api_base is required in generic_prompt_config")
provider_specific_query_params: Final = litellm_params.provider_specific_query_params
try:
generic_prompt_manager: Final = GenericPromptManager(
api_base=api_base,
api_key=api_key,
prompt_id=prompt_id,
additional_provider_specific_query_params=provider_specific_query_params,
**litellm_params.model_dump(
exclude_none=True,
exclude={
"prompt_id",
"api_key",
"provider_specific_query_params",
"api_base",
},
),View on GitHub (pinned to 6c2dcb801b)
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.
Example fix
# before (config.yaml model_list entry) model_name: my-prompt litellm_params: model: openai/gpt-4o prompt_integration: generic_api prompt_id: my-prompt-id # api_base missing -> ValueError # after model_name: my-prompt litellm_params: model: openai/gpt-4o prompt_integration: generic_api prompt_id: my-prompt-id api_base: https://your-litellm-proxy.example.com
Defensive patterns
Strategy: validation
Validate before calling
def validate_generic_prompt_params(litellm_params) -> None:
if not getattr(litellm_params, "api_base", None):
raise ValueError(
"Prompt integration 'generic_api' requires litellm_params.api_base "
"(root URL of the prompt management API)"
)
validate_generic_prompt_params(model.litellm_params) Type guard
def has_api_base(litellm_params) -> bool:
return bool(getattr(litellm_params, "api_base", None)) Prevention
- 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.
When it happens
Trigger: 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'.
Common situations: 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.
Related errors
- gitlab_config is required for gitlab prompt integration
- prompt_id is required for Arize Phoenix prompt manager
- Event hook {hook} is not in the supported event hooks {suppo
- Event hook {event_hook} is not in the supported event hooks
- Invalid environment: {environment}. Please use one of the fo
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/80126977ac105c3c.
Report an issue: GitHub.