BerriAI/litellm · error · HTTPException

Only admins can create orgs. Your role is = {user_api_key_di

Error message

Only admins can create orgs. Your role is = {user_api_key_dict.user_role}

What it means

Authorization guard in the organization creation endpoint (/organization/new). LiteLLM reserves org creation for PROXY_ADMIN users; the request's key/user metadata resolved to a role that is missing or not admin, so the endpoint rejects it with 401 before touching the DB. This is expected for self-serve or internal users attempting to create organizations; an admin key must be used, or the user's role must be elevated.

Source

Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:396

        "budget_id": "428eeaa8-f3ac-4e85-a8fb-7dc8d7aa8689"
    }'
    ```
    """

    from litellm.proxy.proxy_server import (
        litellm_proxy_admin_name,
        llm_router,
        prisma_client,
    )

    if prisma_client is None:
        raise HTTPException(
            status_code=500,
            detail={"error": CommonProxyErrors.db_not_connected_error.value},
        )

    if user_api_key_dict.user_role is None or user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
        raise HTTPException(
            status_code=401,
            detail={"error": f"Only admins can create orgs. Your role is = {user_api_key_dict.user_role}"},
        )

    if llm_router is None:
        raise HTTPException(status_code=500, detail={"error": CommonProxyErrors.no_llm_router.value})

    # Validate budget values are not negative
    if data.max_budget is not None and (not math.isfinite(data.max_budget) or data.max_budget < 0):
        raise HTTPException(
            status_code=400,
            detail={"error": f"max_budget must be a non-negative finite number. Received: {data.max_budget}"},
        )
    if data.soft_budget is not None and (not math.isfinite(data.soft_budget) or data.soft_budget < 0):
        raise HTTPException(
            status_code=400,
            detail={"error": f"soft_budget must be a non-negative finite number. Received: {data.soft_budget}"},
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a PROXY_ADMIN API key to create organizations.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:396 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e78533b7c51259a0. Report an issue: GitHub.