Skip to content

Conversation

@Chesars
Copy link
Contributor

@Chesars Chesars commented Dec 17, 2025

Relevant issues

Related to #17911 and #17810

Pre-Submission checklist

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

  • I have Added testing in the tests/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

Type

🆕 New Feature

Changes

Summary

Adds OpenAI-compatible service_tier parameter support for Bedrock Converse API, translating it to Bedrock's native serviceTier format.

Currently, using the OpenAI-style service_tier parameter with Bedrock models throws UnsupportedParamsError:

# This fails with UnsupportedParamsError
litellm.completion(
    model="bedrock/converse/anthropic.claude-3-sonnet-20240229-v1:0",
    messages=[{"role": "user", "content": "Hi"}],
    service_tier="priority"
)

Solution

  1. Added service_tier to supported_params in get_supported_openai_params()
  2. Added translation in map_openai_params() that converts:
    • service_tier="priority"serviceTier={"type": "priority"}
    • service_tier="default"serviceTier={"type": "default"}
    • service_tier="flex"serviceTier={"type": "flex"}
    • service_tier="auto"serviceTier={"type": "default"} (Bedrock doesn't support "auto")

Usage

# Now works with OpenAI-style parameter
litellm.completion(
    model="bedrock/converse/anthropic.claude-3-sonnet-20240229-v1:0",
    messages=[{"role": "user", "content": "Hi"}],
    service_tier="priority"  # OpenAI format, automatically translated
)

Tests

Added 5 new tests in tests/test_litellm/llms/bedrock/chat/test_service_tier.py:

  • test_service_tier_in_supported_openai_params
  • test_map_openai_service_tier_priority
  • test_map_openai_service_tier_default
  • test_map_openai_service_tier_flex
  • test_map_openai_service_tier_auto_maps_to_default

12 tests passing:

======================== 12 passed in 0.04s ========================

Translates OpenAI's service_tier parameter (string) to Bedrock's
serviceTier format (object with type field).
@vercel
Copy link

vercel bot commented Dec 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Dec 17, 2025 11:56am

@krrishdholakia krrishdholakia added the documentation Improvements or additions to documentation label Dec 17, 2025
…tion

Document the automatic translation from OpenAI-style service_tier
parameter to Bedrock's native serviceTier format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants