litellm - ✅(Solved) Fix [Bug]: `service_tier` parameter not forwarded to Anthropic API [3 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23398Fetched 2026-04-08 00:36:59
View on GitHub
Comments
1
Participants
2
Timeline
18
Reactions
0
Author
Participants
Timeline (top)
referenced ×8cross-referenced ×5labeled ×3closed ×1

Root Cause

Because service_tier is not listed, it is never passed into map_openai_params() and never written into the Anthropic request body.

Fix Action

Fixed

PR fix notes

PR #23401: fix: forward service_tier param to Anthropic API

Description (problem / solution / changelog)

service_tier was silently dropped because it was missing from AnthropicConfig.get_supported_openai_params(). Add it to the supported params list and add a passthrough mapping in map_openai_params() so it is forwarded as-is to the request body.

Fixes #23398

Relevant issues

Fixes #23398

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

service_tier was silently dropped when passed to Anthropic models via litellm.completion().

Root cause: service_tier was missing from AnthropicConfig.get_supported_openai_params(), so LiteLLM dropped it before map_openai_params() was ever called.

Fix:

  • Added service_tier to get_supported_openai_params()
  • Added passthrough mapping in map_openai_params() to forward it as-is to the Anthropic request body

Tests added in tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py:

  • test_service_tier_forwarded_to_anthropic — parametrized for auto and standard_only
  • test_service_tier_in_supported_params — verifies the param passes the gatekeeper

Changed files

  • litellm/llms/anthropic/chat/transformation.py (modified, +6/-0)
  • litellm/types/llms/anthropic.py (modified, +1/-0)
  • tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py (modified, +53/-0)

PR #1: fix(anthropic): forward service_tier parameter to Anthropic API

Description (problem / solution / changelog)

Description

Add service_tier to the list of supported OpenAI parameters and map it to the Anthropic request body. This allows users to use Anthropic's Priority Tier feature (auto/standard_only) via litellm.completion().

Related Issue

Fixes: https://github.com/BerriAI/litellm/issues/23398

Changes Made

  1. Added "service_tier" to AnthropicConfig.get_supported_openai_params()
  2. Added passthrough mapping in AnthropicConfig.map_openai_params()

Testing

The fix follows the same pattern as other passthrough parameters like speed and cache_control.

Changed files

  • litellm/llms/anthropic/chat/transformation.py (modified, +5/-0)

PR #23436: fix(anthropic): forward service_tier parameter to Anthropic API

Description (problem / solution / changelog)

Summary

  • Add service_tier to AnthropicConfig.get_supported_openai_params()
  • Add mapping in map_openai_params() to forward the parameter

Problem

When calling Anthropic models with service_tier="auto", the parameter is silently dropped and never sent to the Anthropic API. This is because service_tier was not listed in the supported params.

Fix

  1. Add "service_tier" to the supported params list
  2. Add passthrough mapping in map_openai_params()

Valid values per Anthropic service tiers documentation:

  • "auto" — use Priority Tier capacity if available, fall back to standard
  • "standard_only" — always use standard tier capacity

Closes #23398

Changed files

  • litellm/llms/anthropic/chat/transformation.py (modified, +5/-0)

Code Example

import litellm

response = await litellm.acompletion(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
    service_tier="auto",
)

---

def get_supported_openai_params(self, model: str):
    params = [
        "stream", "stop", "temperature", "top_p", "max_tokens",
        "max_completion_tokens", "tools", "tool_choice", "extra_headers",
        "parallel_tool_calls", "response_format", "user",
        "web_search_options", "speed", "context_management", "cache_control",
        # "service_tier" is missing here
    ]

---

{
  "model": "claude-sonnet-4-6",
  "messages": [...],
  "service_tier": "auto"
}

---

elif param == "service_tier":
    optional_params["service_tier"] = value

---
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When calling an Anthropic model via litellm.completion() / acompletion() with service_tier="auto", the parameter is silently dropped and never sent to the Anthropic API.

Steps to Reproduce

import litellm

response = await litellm.acompletion(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
    service_tier="auto",
)

The request body sent to Anthropic does not include "service_tier": "auto".

service_tier is accepted as a named parameter in litellm.completion() (added for OpenAI support), but it is absent from AnthropicConfig.get_supported_openai_params() in litellm/llms/anthropic/chat/transformation.py:

def get_supported_openai_params(self, model: str):
    params = [
        "stream", "stop", "temperature", "top_p", "max_tokens",
        "max_completion_tokens", "tools", "tool_choice", "extra_headers",
        "parallel_tool_calls", "response_format", "user",
        "web_search_options", "speed", "context_management", "cache_control",
        # "service_tier" is missing here
    ]

Because service_tier is not listed, it is never passed into map_openai_params() and never written into the Anthropic request body.

Expected behaviour

service_tier should be forwarded to the Anthropic API as a top-level body field, matching the Anthropic service tiers documentation:

{
  "model": "claude-sonnet-4-6",
  "messages": [...],
  "service_tier": "auto"
}

Valid values per the Anthropic API:

  • "auto" — use Priority Tier capacity if available, fall back to standard
  • "standard_only" — always use standard tier capacity

The response usage object also returns a service_tier field ("priority" or "standard") indicating which tier was assigned.

Suggested fix

  1. Add "service_tier" to AnthropicConfig.get_supported_openai_params().
  2. Add a passthrough mapping in AnthropicConfig.map_openai_params():
elif param == "service_tier":
    optional_params["service_tier"] = value

Additional context

Anthropic's Priority Tier is supported on Claude Opus 4.6/4.5/4, Sonnet 4.6/4.5/4/3.7, and Haiku 4.5/3.5. The feature is GA and documented at the link above.

Relevant log output

What part of LiteLLM is this about?

SDK (litellm Python package)

What LiteLLM version are you on ?

1.82.1

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To fix the issue, we need to modify the AnthropicConfig class in litellm/llms/anthropic/chat/transformation.py. Here are the steps:

  • Add "service_tier" to the list of supported OpenAI parameters in get_supported_openai_params:
def get_supported_openai_params(self, model: str):
    params = [
        "stream", "stop", "temperature", "top_p", "max_tokens",
        "max_completion_tokens", "tools", "tool_choice", "extra_headers",
        "parallel_tool_calls", "response_format", "user",
        "web_search_options", "speed", "context_management", "cache_control",
        "service_tier"  # Add this line
    ]
  • Add a passthrough mapping for "service_tier" in map_openai_params:
elif param == "service_tier":
    optional_params["service_tier"] = value

Verification

To verify the fix, you can use the following code:

import litellm

response = await litellm.acompletion(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
    service_tier="auto",
)

print(response.json())  # Check if "service_tier" is present in the response

Extra Tips

Make sure to update the litellm package to the latest version after applying the fix. Additionally, you can test the fix with different service_tier values (e.g., "standard_only") to ensure it works as expected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: `service_tier` parameter not forwarded to Anthropic API [3 pull requests, 1 comments, 2 participants]