{"record":{"id":"a2fc581dfda2c64f","repo":"BerriAI/litellm","slug":"oci-serving-mode-must-be-on-demand-or-dedicated","errorCode":null,"errorMessage":"oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'.","messagePattern":"oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'\\.","errorType":"exception","errorClass":"OCIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/oci/embed/transformation.py","lineNumber":222,"sourceCode":"                            \"Convert token lists to strings before calling embedding().\"\n                        ),\n                    )\n                texts.append(item if isinstance(item, str) else str(item))\n        else:\n            texts = [str(input)]\n\n        if len(texts) > OCI_EMBED_BATCH_LIMIT:\n            raise OCIError(\n                status_code=400,\n                message=(\n                    f\"OCI embedText accepts at most {OCI_EMBED_BATCH_LIMIT} inputs per request \"\n                    f\"(got {len(texts)}). Batch your requests.\"\n                ),\n            )\n\n        serving_mode_type: Final = optional_params.get(\"oci_serving_mode\", \"ON_DEMAND\").upper()\n        if serving_mode_type not in {\"ON_DEMAND\", \"DEDICATED\"}:\n            raise OCIError(\n                status_code=400,\n                message=\"oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'.\",\n            )\n\n        if serving_mode_type == \"DEDICATED\":\n            endpoint_id: Final = optional_params.get(\"oci_endpoint_id\", model)\n            serving_mode = OCIServingMode(servingType=\"DEDICATED\", endpointId=endpoint_id)\n        else:\n            serving_mode = OCIServingMode(servingType=\"ON_DEMAND\", modelId=model)\n\n        # Map input_type from OpenAI convention to OCI/Cohere convention\n        input_type = optional_params.get(\"input_type\")\n        if input_type:\n            input_type = _INPUT_TYPE_MAP.get(input_type.lower(), input_type.upper())\n\n        request: Final = OCIEmbedRequest(\n            compartmentId=compartment_id,\n            servingMode=serving_mode,","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oci/embed/transformation.py#L204-L240","documentation":"OCI generative-ai embedding models can be served two ways: ON_DEMAND (shared, identified by modelId) or DEDICATED (a dedicated cluster, identified by endpointId). The adapter reads `optional_params['oci_serving_mode']` (default 'ON_DEMAND'), uppercases it, and rejects anything outside {'ON_DEMAND', 'DEDICATED'} with this 400 error.","triggerScenarios":"Passing `oci_serving_mode='dedicated-cluster'`, `'batch'`, or a typo like `'ONDEMAND'` (no underscore) as an extra kwarg to litellm.embedding with an oci/ model. Any value that does not equal ON_DEMAND or DEDICATED after .upper() triggers it.","commonSituations":"Copy-pasting serving mode names from the OCI console or SDK docs that use different casing/labels, or mistakenly passing the OCI SDK enum object instead of its string value. Users switching from dedicated endpoints to on-demand and editing the param by hand.","solutions":["Set the parameter to exactly 'ON_DEMAND' or 'DEDICATED' (case-insensitive): `litellm.embedding(..., oci_serving_mode='DEDICATED')`.","If using DEDICATED, also pass `oci_endpoint_id` so the request targets your endpoint (it defaults to the model string otherwise).","Remove the parameter entirely if you want the default on-demand serving."],"exampleFix":"# before\nresp = litellm.embedding(model=\"oci/cohere.embed-v3\", input=[\"hi\"], oci_serving_mode=\"DEDICATED_CLUSTER\")\n\n# after\nresp = litellm.embedding(model=\"oci/cohere.embed-v3\", input=[\"hi\"], oci_serving_mode=\"DEDICATED\", oci_endpoint_id=\"ocid1.generativeaiendpoint.oc1...\")","handlingStrategy":"validation","validationCode":"SERVING_MODES = {\"ON_DEMAND\", \"DEDICATED\"}\nmode = (oci_serving_mode or \"ON_DEMAND\").upper()\nif mode not in SERVING_MODES:\n    raise ValueError(f\"oci_serving_mode must be one of {SERVING_MODES}, got {oci_serving_mode!r}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize serving-mode config in one constant","Validate config at app startup, not at request time","When using DEDICATED always pair it with oci_endpoint_id"],"tags":["oci","embedding","configuration","serving-mode"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}