BerriAI/litellm · error · ValueError

api_base is required

Error message

api_base is required

What it means

In the skills (agent-skills) base transformation, get_complete_url(api_base, endpoint, skill_id) builds '{api_base}/v1/{endpoint}'. If api_base is None it raises ValueError('api_base is required') before any string formatting would produce 'None/v1/skills'. The api_base normally comes from litellm_params.api_base, the provider's default, or an env var; none was found.

Source

Thrown at litellm/llms/base_llm/skills/transformation.py:73

    def get_complete_url(
        self,
        api_base: str | None,
        endpoint: str,
        skill_id: str | None = None,
    ) -> str:
        """
        Get the complete URL for the API request

        Args:
            api_base: Base API URL
            endpoint: API endpoint (e.g., 'skills', 'skills/{id}')
            skill_id: Optional skill ID for specific skill operations

        Returns:
            Complete URL
        """
        if api_base is None:
            raise ValueError("api_base is required")
        return f"{api_base}/v1/{endpoint}"

    @abstractmethod
    def transform_create_skill_request(
        self,
        create_request: CreateSkillRequest,
        litellm_params: GenericLiteLLMParams,
        headers: dict,
    ) -> dict:
        """
        Transform create skill request to provider-specific format

        Args:
            create_request: Skill creation parameters
            litellm_params: LiteLLM parameters
            headers: Request headers

        Returns:

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass api_base explicitly in the skills call / litellm_params (e.g. api_base="https://my-gateway.example").
  2. Set the provider's base env var (e.g. export MYPROVIDER_API_BASE=...) so the config can resolve it.
  3. Add a startup assertion/validation that required skills-provider config (api_base + api_key) is present before serving traffic.

Example fix

# before
litellm.acreate_skill(provider="myprov", create_request=req)  # ValueError: api_base is required

# after
litellm.acreate_skill(
    provider="myprov",
    create_request=req,
    litellm_params={"api_base": "https://skills.internal.example"},
)
Defensive patterns

Strategy: validation

Validate before calling

api_base = litellm_params.get("api_base") or os.getenv("MYPROV_API_BASE")
if not api_base:
    raise ValueError("skills provider requires api_base (param or MYPROV_API_BASE)")

Try / catch

try:
    await litellm.acreate_skill(provider="myprov", create_request=req, litellm_params=params)
except ValueError as e:
    if "api_base is required" in str(e):
        params.setdefault("api_base", os.environ["MYPROV_API_BASE"])
        await litellm.acreate_skill(provider="myprov", create_request=req, litellm_params=params)
    else:
        raise

Prevention

When it happens

Trigger: Calling the litellm skills CRUD API (create/list/get skill) for a provider without a resolvable api_base — no api_base passed, no provider default configured, and the relevant *_API_BASE env var unset.

Common situations: Using a custom/self-hosted skills gateway but forgetting to set api_base; env var name mismatch after provider rename; running in CI/deployment where the env var that exists locally was never set.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/415b42178cdccd01. Report an issue: GitHub.