The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: bedrock openai-compatible imported-model should also have model arn encoded
An Tang4885b3658066
diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.pyindex ee07b71ef15..a438be17458 100644--- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.py+++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.py@@ -14,6 +14,7 @@ import httpxfrom litellm.llms.bedrock.base_aws_llm import BaseAWSLLMfrom litellm.llms.bedrock.common_utils import BedrockErrorfrom litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig+from litellm.passthrough.utils import CommonUtilsfrom litellm.types.llms.openai import AllMessageValuesif TYPE_CHECKING:@@ -94,6 +95,9 @@ class AmazonBedrockOpenAIConfig(OpenAIGPTConfig, BaseAWSLLM):aws_bedrock_runtime_endpoint=aws_bedrock_runtime_endpoint,aws_region_name=aws_region_name,)++ # Encode model ID for ARNs (e.g., :imported-model/ -> :imported-model%2F)+ model_id = CommonUtils.encode_bedrock_runtime_modelid_arn(model_id)# Build the invoke URLif stream:diff --git a/tests/llm_translation/test_bedrock_completion.py b/tests/llm_translation/test_bedrock_completion.pyindex d23033c1e46..40ef2c32831 100644--- a/tests/llm_translation/test_bedrock_completion.py+++ b/tests/llm_translation/test_bedrock_completion.py@@ -3517,7 +3517,7 @@ def test_bedrock_openai_imported_model():print(f"URL: {url}")assert "bedrock-runtime.us-east-1.amazonaws.com" in urlassert (- "arn:aws:bedrock:us-east-1:117159858402:imported-model/m4gc1mrfuddy" in url+ "arn:aws:bedrock:us-east-1:117159858402:imported-model%2Fm4gc1mrfuddy" in url)assert "/invoke" in url