BerriAI/litellm · error · OCIError
kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDI
Error message
kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDICATED'
What it means
Error "kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDICATED'" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/transformation.py:541
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(
servingType="DEDICATED",
endpointId=optional_params.get("oci_endpoint_id", model),
)
else:
serving_mode = OCIServingMode(servingType="ON_DEMAND", modelId=model)
if vendor == OCIVendors.COHERE:
user_messages: Final = [m for m in messages if m.get("role") == "user"]
if not user_messages:
raise OCIError(
status_code=400,
message="No user message found — Cohere models require at least one user message",View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set oci_serving_mode to 'ON_DEMAND' or 'DEDICATED'.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/transformation.py:541 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/7e2ded0194e4b218.
Report an issue: GitHub.