BerriAI/litellm · error · OCIError

oci_compartment_id is required for OCI chat requests. Pass i

Error message

oci_compartment_id is required for OCI chat requests. Pass it as optional_params or set the OCI_COMPARTMENT_ID env var.

What it means

Error "oci_compartment_id is required for OCI chat requests. Pass it as optional_params or set the OCI_COMPARTMENT_ID env var." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/oci/chat/transformation.py:529

        # OCI rejects both the OpenAI string and the nested OpenAI dict shape.
        _normalize_tool_choice(selected_params)

        _normalize_response_format(selected_params, vendor)

        return selected_params

    def transform_request(
        self,
        model: str,
        messages: list[AllMessageValues],
        optional_params: dict,
        litellm_params: dict,
        headers: dict,
    ) -> dict:
        creds: Final = resolve_oci_credentials(optional_params)
        oci_compartment_id: Final = creds["oci_compartment_id"]
        if not oci_compartment_id:
            raise OCIError(
                status_code=400,
                message=(
                    "oci_compartment_id is required for OCI chat requests. "
                    "Pass it as optional_params or set the OCI_COMPARTMENT_ID env var."
                ),
            )

        vendor: Final = get_vendor_from_model(model)

        oci_serving_mode: Final = optional_params.get("oci_serving_mode", "ON_DEMAND")
        if oci_serving_mode not in ["ON_DEMAND", "DEDICATED"]:
            raise OCIError(
                status_code=400,
                message="kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDICATED'",
            )

        if oci_serving_mode == "DEDICATED":
            serving_mode = OCIServingMode(

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass oci_compartment_id or set OCI_COMPARTMENT_ID.

When it happens

Trigger: Thrown at litellm/llms/oci/chat/transformation.py:529 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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