Backtestslitellmrun-20261018-182052#41834
[Bug]: Databricks service_tier is dropped in request translation, streaming, and pricing
Our patch was judged better than the merged fix.
In this judgment, Patch A = our agent, Patch B = the merged fix.
Both patches add service_tier to the Databricks supported-params list, read the tier from responses_api_request in the Responses-to-Chat bridge, and stamp the provider-returned tier in DatabricksConfig.transform_response. Patch B stops there: it does nothing for streaming, so the issue's explicit 'tier on terminal usage-only chunk' case remains broken. The independent tests confirm this: B fails all three streaming tests (stream_chunk_builder aggregation and the logged complete streaming response with and without include_usage), while A passes every one of the ten tests. Patch A fixes the streaming gap at the point where CustomStreamWrapper handles the usage-only chunk, widens the existing _stamp_served_service_tier helper to accept any BaseModel, and also propagates the served tier into the Responses API response without manufacturing one from the request, matching the issue's expected behavior. A's added validation that rejects non-Databricks tiers like 'flex' unless drop_params is set goes somewhat beyond the ask, but it is small, consistent with litellm's UnsupportedParamsError convention, and low risk. A's tests are broader and exercise the real end-to-end paths (chunk_parser, CustomStreamWrapper, stream_chunk_builder, pricing with returned-default override); B's tests cover only params, non-stream parsing, and the request bridge. A fully covers the issue's four symptom rows and B covers only three, so A is the better fix.
Four judges ruled on this ticket in parallel, and the verdict comes from counting their votes. Each saw the issue and the two patches, labelled A and B in random order (two of them saw ours as A), with issue links and version numbers removed. Where tests could check the fix, they also saw the results of tests a separate agent wrote for the issue, run on both patches. None was told which patch was ours. The reasoning above is one judge's, shown verbatim.
Solve
1h 10m
Wall-clock time in the container
Full test suite
Not run
The harness did not reach the test stage
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
335vs 56 merged
Changed lines, ours vs merged
The issue
View on GitHubSummary
In LiteLLM 1.100.0, Databricks service_tier="priority" can be dropped during request translation and parameter filtering. Databricks cost calculation also ignores the resolved tier, so configured priority input/output/cache-read rates are not used. Returned tiers are lost in response conversion and streaming aggregation.
These defects need to be handled together: fixing pricing alone can apply requested priority rates even when Databricks reports service_tier="default" after fallback.
Reproduction and environment
Reproduced with a clean installation of litellm[proxy]==1.100.0 on Python 3.11 in an isolated virtual environment. The portable pytest file will be attached in a follow-up comment. It uses synthetic model prices and response objects; no API credentials, provider calls, proxy, or downstream repository files are required.
Save the attached file as test_databricks_service_tier_upstream.py, outside any existing checkout, and run:
python3 -m venv /tmp/databricks-tier-repro
/tmp/databricks-tier-repro/bin/pip install 'litellm[proxy]==1.100.0' pytest
LITELLM_LOCAL_MODEL_COST_MAP=True /tmp/databricks-tier-repro/bin/python -m pytest -q test_databricks_service_tier_upstream.py
Observed results: 6 failed, 7 passed.
| Case | Expected | Actual on 1.100.0 |
|---|---|---|
| Priority pricing from explicit argument, request params, or response | $0.000568 | $0.000284 in all three cases |
| Responses-to-Chat request translation | service_tier="priority" preserved | Field absent (KeyError) |
Databricks parameter mapping with drop_params=True | service_tier="priority" preserved | Field absent (KeyError) |
| Stream with tier on terminal usage-only chunk | Aggregated response has service_tier="default" | None |
The synthetic pricing case has 100 input tokens (20 cached) and 50 output tokens. Standard rates are $1/$4 per million input/output tokens and $0.20 per million cached input tokens; priority rates are twice those values.
Default pricing, legacy Databricks model resolution, and returned-default fallback controls pass on stock 1.100.0. The fallback controls pass because stock Databricks pricing always uses standard rates; they must continue to pass after priority pricing is enabled. All 13 tests pass with a local fix.
Root cause
Source locations refer to LiteLLM 1.100.0:
litellm/llms/databricks/chat/transformation.py,DatabricksConfig.get_supported_openai_params(~line 259):service_tieris absent from the supported parameter list.litellm/responses/litellm_completion_transformation/transformation.py,transform_responses_api_request_to_chat_completion_request(~line 340): readskwargs.get("service_tier"), but the tier is inresponses_api_request. Adding only the Databricks allowlist entry does not repair this earlier loss.litellm/cost_calculator.py(~line 623) andlitellm/llms/databricks/cost_calculator.py(~line 34): the Databricks dispatch/helper do not passservice_tierthrough togeneric_cost_per_token.litellm/litellm_core_utils/streaming_chunk_builder_utils.py: stream aggregation does not carry the returned tier, including when it arrives only on the final usage chunk. Databricks response parsing, stream-wrapper reconstruction, and Chat/Responses/Messages conversion also need to preserve it for end-to-end accounting.completion_costcurrently gives a requested tier precedence over a returned tier. For Databricks, a concrete returneddefaulttier should override requested priority.
Additional Router/HTTP-interception tests exposed a related Messages-stream accounting issue: litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py calls stream_chunk_builder without its existing request logging object. Standalone cost calculation can then miss Router pricing and cache a zero cost. Passing the logging object preserves the configured pricing context. This path is covered by the broader local regression suite, not the 13-test portable file.
Expected behavior
- Forward supported Databricks
default/prioritytiers through Chat, Responses, and Messages bridges, including streaming. - Preserve provider-returned tiers through response parsing, adapters, stream reconstruction/aggregation, and accounting.
- Apply configured tier-specific input, output, and cache-read prices.
- Use a concrete returned Databricks tier over the requested tier; retain standard pricing and legacy model-name resolution.
- If the provider omits a returned tier, do not manufacture one. Requested-tier pricing is an estimate, not evidence of the tier delivered or invoiced.
Databricks documents priority fallback and model/region availability here: https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/priority-mode
I searched open and closed issues for Databricks priority/service-tier symptoms and the affected function names and found no matching report. PR #35674 concerns cache pricing and does not address these tier-propagation gaps.
The two patches
litellm/litellm_core_utils/streaming_handler.pyindex a78e6f17cc..f2261b8391 100644@@ -74,7 +74,7 @@ def _next_sync_or_exhausted(it: Iterator[object]) -> object: return _SYNC_ITER_EXHAUSTED -def _stamp_served_service_tier(response: ModelResponseStream, complete_streaming_response: ModelResponse) -> None:+def _stamp_served_service_tier(response: ModelResponseStream, complete_streaming_response: BaseModel) -> None: served_tier: Final = complete_streaming_response.model_dump().get("service_tier") if isinstance(served_tier, str) and served_tier: setattr(response, "service_tier", served_tier) # noqa: B010 # pydantic extra, not a declared field@@ -1508,6 +1508,9 @@ class CustomStreamWrapper: except Exception: model_response.choices[0].delta = Delta() else:+ # Providers such as Databricks report the served tier only on the terminal usage-only chunk+ if isinstance(original_chunk, BaseModel):+ _stamp_served_service_tier(model_response, original_chunk) if self.send_stream_usage is True: model_response.choices = [] return model_responselitellm/llms/databricks/chat/transformation.pyindex 50d3b82a98..cec954c6a6 100644@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Any, Final, Literal, cast, overload import httpx from pydantic import BaseModel, TypeAdapter +import litellm from litellm.constants import RESPONSE_FORMAT_TOOL_NAME from litellm.litellm_core_utils.llm_response_utils.convert_dict_to_response import ( handle_invalid_parallel_tool_calls,@@ -164,6 +165,9 @@ else: LiteLLMLoggingObj = Any +DATABRICKS_SERVICE_TIERS: Final[frozenset[str]] = frozenset({"default", "priority"})++ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): """ Reference: https://docs.databricks.com/en/machine-learning/foundation-models/api-reference.html#chat-request@@ -285,8 +289,25 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): "tool_choice", "reasoning_effort", "thinking",+ "service_tier", ] + @staticmethod+ def _resolve_service_tier(value: object, model: str, drop_params: bool) -> str | None:+ """Accept the Databricks-supported tiers; drop (None) or reject anything else (e.g. OpenAI's "auto"/"flex")."""+ if isinstance(value, str) and value.lower() in DATABRICKS_SERVICE_TIERS:+ return value.lower()+ if not (litellm.drop_params or drop_params):+ raise litellm.utils.UnsupportedParamsError(+ message=(+ f"databricks/{model} does not support service_tier={value!r}. "+ f"Supported values: {sorted(DATABRICKS_SERVICE_TIERS)}. "+ "To drop unsupported params, set `litellm.drop_params = True`."+ ),+ status_code=400,+ )+ return None+ @staticmethod def _uses_anthropic_thinking_param(model: str) -> bool: from litellm.utils import supports_anthropic_thinking_payload@@ -368,6 +389,12 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): ) -> dict: is_thinking_enabled: Final = self.is_thinking_enabled(non_default_params) mapped_params: Final = super().map_openai_params(non_default_params, optional_params, model, drop_params)+ if "service_tier" in non_default_params:+ service_tier: Final = self._resolve_service_tier(non_default_params["service_tier"], model, drop_params)+ if service_tier is None:+ mapped_params.pop("service_tier", None)+ else:+ mapped_params["service_tier"] = service_tier if "claude" in model: AnthropicConfig.translate_legacy_thinking_for_adaptive_model( model=model, optional_params=mapped_params, custom_llm_provider="databricks"@@ -697,6 +724,9 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): model_response.id = completion_response["id"] model_response.created = completion_response["created"] setattr(model_response, "usage", Usage(**completion_response["usage"]))+ served_tier: Final = completion_response.get("service_tier")+ if isinstance(served_tier, str) and served_tier:+ setattr(model_response, "service_tier", served_tier) # noqa: B010 # pydantic extra, not a declared field model_response.choices = self._transform_dbrx_choices( choices=completion_response["choices"],litellm/responses/litellm_completion_transformation/transformation.pyindex 4f99c57055..3054f8859d 100644@@ -500,7 +500,7 @@ class LiteLLMCompletionResponsesConfig: "max_tokens": responses_api_request.get("max_output_tokens"), "stream": stream, "metadata": kwargs.get("metadata"),- "service_tier": kwargs.get("service_tier"),+ "service_tier": responses_api_request.get("service_tier") or kwargs.get("service_tier"), "safety_identifier": responses_api_request.get("safety_identifier"), "web_search_options": web_search_options, "response_format": response_format,@@ -2504,6 +2504,10 @@ class LiteLLMCompletionResponsesConfig: user=echoed.get("user"), store=echoed.get("store"), )+ # Only the provider-reported tier is surfaced; the requested tier is not evidence of what was served+ served_tier: Final = getattr(chat_completion_response, "service_tier", None)+ if isinstance(served_tier, str) and served_tier:+ setattr(responses_api_response, "service_tier", served_tier) # noqa: B010 # pydantic extra, not a declared field chat_completion_hidden_params: Final = get_hidden_params_storage(chat_completion_response) set_hidden_params( responses_api_response,litellm/types/llms/databricks.pyindex a9c027bd2d..8695782726 100644@@ -2,6 +2,7 @@ from typing import Any, Literal from pydantic import BaseModel from typing_extensions import (+ NotRequired, ReadOnly, Required, TypedDict,@@ -82,3 +83,4 @@ class DatabricksResponse(TypedDict): model: str choices: list[DatabricksChoice] usage: ChatCompletionUsageBlock+ service_tier: ReadOnly[NotRequired[str | None]]tests/unit/llms/databricks/test_databricks_service_tier.pynew file mode 100644index 0000000000..0b8db5fc94@@ -0,0 +1,292 @@+"""Databricks service_tier propagation: request translation, response parsing, streaming, and pricing."""++import time+from typing import Final++import httpx+import pytest++import litellm+from litellm.cost_calculator import completion_cost+from litellm.litellm_core_utils.streaming_chunk_builder_utils import ChunkProcessor+from litellm.llms.databricks.chat.transformation import DatabricksChatResponseIterator, DatabricksConfig+from litellm.main import stream_chunk_builder+from litellm.responses.litellm_completion_transformation.transformation import LiteLLMCompletionResponsesConfig+from litellm.types.utils import ModelResponse, Usage+from litellm.utils import get_optional_params++MODEL: Final = "databricks-tier-test-model"+STANDARD_COST: Final = 0.000284+PRIORITY_COST: Final = 0.000568+++@pytest.fixture+def tier_priced_model(monkeypatch: pytest.MonkeyPatch) -> str:+ monkeypatch.setattr(+ litellm,+ "model_cost",+ {+ **litellm.model_cost,+ f"databricks/{MODEL}": {+ "litellm_provider": "databricks",+ "mode": "chat",+ "input_cost_per_token": 1e-6,+ "output_cost_per_token": 4e-6,+ "cache_read_input_token_cost": 2e-7,+ "input_cost_per_token_priority": 2e-6,+ "output_cost_per_token_priority": 8e-6,+ "cache_read_input_token_cost_priority": 4e-7,+ },+ },+ )+ return f"databricks/{MODEL}"+++def _usage() -> Usage:+ return Usage(+ prompt_tokens=100,+ completion_tokens=50,+ total_tokens=150,+ prompt_tokens_details={"cached_tokens": 20},+ )+++def _response(service_tier: str | None = None) -> ModelResponse:+ response: Final = ModelResponse(+ model=MODEL,+ choices=[{"index": 0, "message": {"role": "assistant", "content": "hi"}, "finish_reason": "stop"}],+ usage=_usage(),+ **({"service_tier": service_tier} if service_tier is not None else {}),+ )+ response._hidden_params["custom_llm_provider"] = "databricks"+ return response+++def test_standard_pricing_without_tier(tier_priced_model: str) -> None:+ assert completion_cost(completion_response=_response(), model=tier_priced_model) == pytest.approx(STANDARD_COST)+++def test_priority_pricing_from_explicit_tier(tier_priced_model: str) -> None:+ cost: Final = completion_cost(completion_response=_response(), model=tier_priced_model, service_tier="priority")+ assert cost == pytest.approx(PRIORITY_COST)+++def test_priority_pricing_from_requested_tier(tier_priced_model: str) -> None:+ cost: Final = completion_cost(+ completion_response=_response(),+ model=tier_priced_model,+ optional_params={"service_tier": "priority"},+ )+ assert cost == pytest.approx(PRIORITY_COST)+++def test_priority_pricing_from_returned_tier(tier_priced_model: str) -> None:+ cost: Final = completion_cost(completion_response=_response("priority"), model=tier_priced_model)+ assert cost == pytest.approx(PRIORITY_COST)+++def test_returned_default_tier_overrides_requested_priority(tier_priced_model: str) -> None:+ cost: Final = completion_cost(+ completion_response=_response("default"),+ model=tier_priced_model,+ optional_params={"service_tier": "priority"},+ )+ assert cost == pytest.approx(STANDARD_COST)+++def test_supported_params_include_service_tier() -> None:+ assert "service_tier" in DatabricksConfig().get_supported_openai_params(model=MODEL)+++def test_service_tier_survives_drop_params_mapping() -> None:+ optional_params: Final = get_optional_params(+ model=MODEL,+ custom_llm_provider="databricks",+ service_tier="priority",+ drop_params=True,+ )+ assert optional_params["service_tier"] == "priority"+++def test_responses_to_chat_request_keeps_service_tier() -> None:+ request: Final = LiteLLMCompletionResponsesConfig.transform_responses_api_request_to_chat_completion_request(+ model=f"databricks/{MODEL}",+ input="hello",+ responses_api_request={"service_tier": "priority"},+ custom_llm_provider="databricks",+ )+ assert request["service_tier"] == "priority"+++def test_non_stream_response_keeps_returned_tier() -> None:+ body: Final = {+ "id": "chatcmpl-1",+ "object": "chat.completion",+ "created": int(time.time()),+ "model": MODEL,+ "service_tier": "default",+ "choices": [{"index": 0, "message": {"role": "assistant", "content": "hi"}, "finish_reason": "stop"}],+ "usage": {"prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15},+ }+ logging_obj: Final = litellm.Logging(+ model=MODEL,+ messages=[{"role": "user", "content": "hi"}],+ stream=False,+ call_type="completion",+ start_time=time.time(),+ litellm_call_id="tier-test",+ function_id="tier-test",+ )+ response: Final = DatabricksConfig().transform_response(+ model=MODEL,+ raw_response=httpx.Response(200, json=body),+ model_response=ModelResponse(),+ logging_obj=logging_obj,+ request_data={},+ messages=[{"role": "user", "content": "hi"}],+ optional_params={},+ litellm_params={},+ encoding=None,+ )+ assert response.model_dump()["service_tier"] == "default"+++def _chunk(+ content: str | None, *, finish_reason: str | None = None+) -> dict: # mutable-ok: chunk_parser takes the raw SSE dict+ return {+ "id": "chatcmpl-stream",+ "object": "chat.completion.chunk",+ "created": 1700000000,+ "model": MODEL,+ "choices": [{"index": 0, "delta": {"role": "assistant", "content": content}, "finish_reason": finish_reason}],+ }+++def _usage_only_chunk(service_tier: str) -> dict: # mutable-ok: chunk_parser takes the raw SSE dict+ return {+ "id": "chatcmpl-stream",+ "object": "chat.completion.chunk",+ "created": 1700000000,+ "model": MODEL,+ "choices": [],+ "usage": {"prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150},+ "service_tier": service_tier,+ }+++def test_stream_chunk_builder_keeps_tier_from_usage_only_chunk() -> None:+ iterator: Final = DatabricksChatResponseIterator(streaming_response=None, sync_stream=True)+ chunks: Final = [+ iterator.chunk_parser(_chunk("he")),+ iterator.chunk_parser(_chunk("llo", finish_reason="stop")),+ iterator.chunk_parser(_usage_only_chunk("default")),+ ]+ rebuilt: Final = stream_chunk_builder(chunks=chunks)+ assert rebuilt is not None+ assert rebuilt.model_dump()["service_tier"] == "default"+ assert ChunkProcessor._get_service_tier_from_chunks([c.model_dump() for c in chunks]) == "default"+++def test_stream_wrapper_keeps_tier_from_usage_only_chunk() -> None:+ iterator: Final = DatabricksChatResponseIterator(streaming_response=None, sync_stream=True)+ raw_chunks: Final = [+ iterator.chunk_parser(_chunk("he")),+ iterator.chunk_parser(_chunk("llo", finish_reason="stop")),+ iterator.chunk_parser(_usage_only_chunk("default")),+ ]+ logging_obj: Final = litellm.Logging(+ model=MODEL,+ messages=[{"role": "user", "content": "hi"}],+ stream=True,+ call_type="completion",+ start_time=time.time(),+ litellm_call_id="tier-stream-test",+ function_id="tier-stream-test",+ )+ logging_obj.update_environment_variables(+ model=MODEL,+ user="",+ optional_params={"stream_options": {"include_usage": True}},+ litellm_params={"litellm_call_id": "tier-stream-test"},+ custom_llm_provider="databricks",+ )+ wrapper: Final = litellm.CustomStreamWrapper(+ completion_stream=iter(raw_chunks),+ model=MODEL,+ custom_llm_provider="databricks",+ logging_obj=logging_obj,+ stream_options={"include_usage": True},+ )+ received: Final = list(wrapper)+ rebuilt: Final = stream_chunk_builder(chunks=received)+ assert rebuilt is not None+ assert rebuilt.model_dump()["service_tier"] == "default"+++def test_unsupported_tier_is_dropped_with_drop_params() -> None:+ optional_params: Final = get_optional_params(+ model=MODEL,+ custom_llm_provider="databricks",+ service_tier="flex",+ drop_params=True,+ )+ assert "service_tier" not in optional_params+++def test_unsupported_tier_is_rejected_without_drop_params() -> None:+ with pytest.raises(litellm.UnsupportedParamsError):+ get_optional_params(model=MODEL, custom_llm_provider="databricks", service_tier="flex")+++def test_chat_to_responses_response_keeps_returned_tier() -> None:+ converted: Final = LiteLLMCompletionResponsesConfig.transform_chat_completion_response_to_responses_api_response(+ request_input="hello",+ responses_api_request={"service_tier": "priority"},+ chat_completion_response=_response("default"),+ )+ assert converted.model_dump()["service_tier"] == "default"+++def test_chat_to_responses_response_does_not_manufacture_tier() -> None:+ converted: Final = LiteLLMCompletionResponsesConfig.transform_chat_completion_response_to_responses_api_response(+ request_input="hello",+ responses_api_request={"service_tier": "priority"},+ chat_completion_response=_response(),+ )+ assert converted.model_dump().get("service_tier") is None+++def test_stream_wrapper_without_include_usage_logs_returned_tier() -> None:+ iterator: Final = DatabricksChatResponseIterator(streaming_response=None, sync_stream=True)+ raw_chunks: Final = [+ iterator.chunk_parser(_chunk("he")),+ iterator.chunk_parser(_chunk("llo", finish_reason="stop")),+ iterator.chunk_parser(_usage_only_chunk("default")),+ ]+ logging_obj: Final = litellm.Logging(+ model=MODEL,+ messages=[{"role": "user", "content": "hi"}],+ stream=True,+ call_type="completion",+ start_time=time.time(),+ litellm_call_id="tier-stream-no-usage",+ function_id="tier-stream-no-usage",+ )+ logging_obj.update_environment_variables(+ model=MODEL,+ user="",+ optional_params={},+ litellm_params={"litellm_call_id": "tier-stream-no-usage"},+ custom_llm_provider="databricks",+ )+ wrapper: Final = litellm.CustomStreamWrapper(+ completion_stream=iter(raw_chunks),+ model=MODEL,+ custom_llm_provider="databricks",+ logging_obj=logging_obj,+ )+ list(wrapper)+ rebuilt: Final = stream_chunk_builder(chunks=wrapper.chunks)+ assert rebuilt is not None+ assert rebuilt.model_dump()["service_tier"] == "default"
litellm/llms/databricks/chat/transformation.pyindex 50d3b82a989..dceec658824 100644@@ -285,6 +285,7 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): "tool_choice", "reasoning_effort", "thinking",+ "service_tier", ] @staticmethod@@ -697,6 +698,9 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig): model_response.id = completion_response["id"] model_response.created = completion_response["created"] setattr(model_response, "usage", Usage(**completion_response["usage"]))+ served_tier: Final = completion_response.get("service_tier")+ if isinstance(served_tier, str) and served_tier:+ setattr(model_response, "service_tier", served_tier) # noqa: B010 # no declared field model_response.choices = self._transform_dbrx_choices( choices=completion_response["choices"],litellm/responses/litellm_completion_transformation/transformation.pyindex 4f99c570551..c2cc876970c 100644@@ -500,7 +500,7 @@ class LiteLLMCompletionResponsesConfig: "max_tokens": responses_api_request.get("max_output_tokens"), "stream": stream, "metadata": kwargs.get("metadata"),- "service_tier": kwargs.get("service_tier"),+ "service_tier": responses_api_request.get("service_tier"), "safety_identifier": responses_api_request.get("safety_identifier"), "web_search_options": web_search_options, "response_format": response_format,tests/unit/llms/databricks/chat/test_databricks_chat_transformation.pyindex c6e0ecd2b41..fe76a667f3e 100644@@ -2216,3 +2216,42 @@ def test_completion_with_prompt_caching_anthropic_model( assert response.usage.total_tokens == 1666 assert response.usage.cache_read_input_tokens == 0 assert response.usage.cache_creation_input_tokens == 1545+++def test_get_optional_params_keeps_service_tier_for_databricks() -> None:+ optional_params: Final = litellm.utils.get_optional_params(+ model="databricks-claude-opus-5",+ custom_llm_provider="databricks",+ service_tier="priority",+ drop_params=True,+ )++ assert optional_params["service_tier"] == "priority"+++@pytest.mark.parametrize("served_tier", ["priority", "default", None])+def test_transform_response_carries_served_service_tier(served_tier: str | None) -> None:+ raw_response: Final = MagicMock()+ raw_response.json.return_value = {+ "id": "chatcmpl-1",+ "object": "chat.completion",+ "created": 0,+ "model": "dbrx",+ **({"service_tier": served_tier} if served_tier is not None else {}),+ "choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],+ "usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2},+ }++ result: Final = DatabricksConfig().transform_response(+ model="databricks/dbrx",+ raw_response=raw_response,+ model_response=litellm.ModelResponse(),+ logging_obj=MagicMock(),+ request_data={},+ messages=[{"role": "user", "content": "hi"}],+ optional_params={},+ litellm_params={},+ encoding=None,+ )++ assert result.to_dict().get("service_tier") == served_tiertests/unit/responses/litellm_completion_transformation/test_litellm_completion_responses.pyindex c7f20a1d959..7006feb22b2 100644@@ -5180,3 +5180,14 @@ def test_convert_response_function_tool_call_keeps_the_index_it_is_given(index: ) assert tool_call["index"] == index+++def test_transform_request_reads_service_tier_from_responses_api_request() -> None:+ result: Final = LiteLLMCompletionResponsesConfig.transform_responses_api_request_to_chat_completion_request(+ model="databricks/dbrx",+ input="hello",+ responses_api_request={"service_tier": "priority"},+ custom_llm_provider="databricks",+ )++ assert result["service_tier"] == "priority"