From 07c633be3aa779f0330c77b25ae35f5a72d3b6f0 Mon Sep 17 00:00:00 2001 From: bhumikadangayach Date: Sun, 7 Jun 2026 18:30:36 +0530 Subject: [PATCH 1/5] feat(bedrock): add amazon.titan-embed-g1-text-02 embedding model support - Add model to provider routing allowlist in embedding.py - Add request transformation using AmazonTitanG1Config - Add response transformation using AmazonTitanG1Config - Add pricing metadata to model_prices_and_context_window.json - Add unit tests for embedding and model info Fixes missing cost tracking reported in #29786 Related to VANDRANKI/litellm PR #29790 --- litellm/llms/bedrock/embed/embedding.py | 9 +++++++++ model_prices_and_context_window.json | 9 +++++++++ tests/llm_translation/test_bedrock_embedding.py | 13 +++++++++++++ 3 files changed, 31 insertions(+) diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.py index 27dc785bf57..f78095a6d51 100644 --- a/litellm/llms/bedrock/embed/embedding.py +++ b/litellm/llms/bedrock/embed/embedding.py @@ -224,6 +224,10 @@ class BedrockEmbedding(BaseAWSLLM): returned_response = AmazonTitanV2Config()._transform_response( response_list=response_list, model=model ) + elif model == "amazon.titan-embed-g1-text-02": + returned_response = AmazonTitanG1Config()._transform_response( + response_list=response_list, model=model + ) elif provider == "twelvelabs": returned_response = ( TwelveLabsMarengoEmbeddingConfig()._transform_response( @@ -447,6 +451,7 @@ class BedrockEmbedding(BaseAWSLLM): "amazon.titan-embed-image-v1", "amazon.titan-embed-text-v1", "amazon.titan-embed-text-v2:0", + "amazon.titan-embed-g1-text-02", ]: batch_data = [] for i in input: @@ -464,6 +469,10 @@ class BedrockEmbedding(BaseAWSLLM): transformed_request = AmazonTitanV2Config()._transform_request( input=i, inference_params=inference_params ) + elif model == "amazon.titan-embed-g1-text-02": + transformed_request = AmazonTitanG1Config()._transform_request( + input=i, inference_params=inference_params + ) else: raise Exception( "Unmapped model. Received={}. Expected={}".format( diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index b2836a096b7..127b1f20e2e 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -570,6 +570,15 @@ "output_cost_per_token": 0.0, "output_vector_size": 1536 }, + "amazon.titan-embed-g1-text-02": { + "input_cost_per_token": 1e-07, + "litellm_provider": "bedrock", + "max_input_tokens": 8192, + "max_tokens": 8192, + "mode": "embedding", + "output_cost_per_token": 0.0, + "output_vector_size": 1536 + }, "amazon.titan-embed-text-v2:0": { "input_cost_per_token": 2e-07, "litellm_provider": "bedrock", diff --git a/tests/llm_translation/test_bedrock_embedding.py b/tests/llm_translation/test_bedrock_embedding.py index 92c22f582d9..feda016bd9f 100644 --- a/tests/llm_translation/test_bedrock_embedding.py +++ b/tests/llm_translation/test_bedrock_embedding.py @@ -34,6 +34,11 @@ img_base_64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIh "text", titan_embedding_response, ), # V2 text model + ( + "bedrock/amazon.titan-embed-g1-text-02", + "text", + titan_embedding_response, + ), # G1 text model ( "bedrock/amazon.titan-embed-image-v1", "image", @@ -459,3 +464,11 @@ def test_bedrock_embedding_region_bug_reproduction(): os.environ["AWS_REGION_NAME"] = original_region_name else: os.environ.pop("AWS_REGION_NAME", None) +def test_bedrock_titan_g1_text_02_model_info(): + """Test that amazon.titan-embed-g1-text-02 has correct pricing metadata""" + model_info = litellm.get_model_info("amazon.titan-embed-g1-text-02") + assert model_info is not None, "Model info should not be None" + assert model_info["litellm_provider"] == "bedrock" + assert model_info["mode"] == "embedding" + assert model_info["input_cost_per_token"] == 1e-07 + assert model_info["max_input_tokens"] == 8192 \ No newline at end of file From 91b06f23e1bf9917df6ea1b44f156f993970f5e0 Mon Sep 17 00:00:00 2001 From: bhumikadangayach Date: Sun, 7 Jun 2026 19:40:21 +0530 Subject: [PATCH 2/5] style: fix syntax error, trailing whitespace and missing newline --- tests/llm_translation/test_bedrock_embedding.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/llm_translation/test_bedrock_embedding.py b/tests/llm_translation/test_bedrock_embedding.py index feda016bd9f..d0e89d4b430 100644 --- a/tests/llm_translation/test_bedrock_embedding.py +++ b/tests/llm_translation/test_bedrock_embedding.py @@ -464,6 +464,8 @@ def test_bedrock_embedding_region_bug_reproduction(): os.environ["AWS_REGION_NAME"] = original_region_name else: os.environ.pop("AWS_REGION_NAME", None) + + def test_bedrock_titan_g1_text_02_model_info(): """Test that amazon.titan-embed-g1-text-02 has correct pricing metadata""" model_info = litellm.get_model_info("amazon.titan-embed-g1-text-02") From d410787dcaab7b59fae2606e9486b29930bd107e Mon Sep 17 00:00:00 2001 From: bhumikadangayach Date: Sun, 7 Jun 2026 19:51:16 +0530 Subject: [PATCH 3/5] style: apply black formatting to embedding.py --- litellm/llms/bedrock/embed/embedding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.py index f78095a6d51..102dc8065e1 100644 --- a/litellm/llms/bedrock/embed/embedding.py +++ b/litellm/llms/bedrock/embed/embedding.py @@ -227,7 +227,7 @@ class BedrockEmbedding(BaseAWSLLM): elif model == "amazon.titan-embed-g1-text-02": returned_response = AmazonTitanG1Config()._transform_response( response_list=response_list, model=model - ) + ) elif provider == "twelvelabs": returned_response = ( TwelveLabsMarengoEmbeddingConfig()._transform_response( @@ -472,7 +472,7 @@ class BedrockEmbedding(BaseAWSLLM): elif model == "amazon.titan-embed-g1-text-02": transformed_request = AmazonTitanG1Config()._transform_request( input=i, inference_params=inference_params - ) + ) else: raise Exception( "Unmapped model. Received={}. Expected={}".format( From e22e0f8d802568b808eeab27f4a1210ee1bf6cc5 Mon Sep 17 00:00:00 2001 From: bhumikadangayach Date: Sun, 7 Jun 2026 19:52:39 +0530 Subject: [PATCH 4/5] style: apply black formatting to test_bedrock_embedding.py --- tests/llm_translation/test_bedrock_embedding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/llm_translation/test_bedrock_embedding.py b/tests/llm_translation/test_bedrock_embedding.py index d0e89d4b430..2bc4192833b 100644 --- a/tests/llm_translation/test_bedrock_embedding.py +++ b/tests/llm_translation/test_bedrock_embedding.py @@ -473,4 +473,4 @@ def test_bedrock_titan_g1_text_02_model_info(): assert model_info["litellm_provider"] == "bedrock" assert model_info["mode"] == "embedding" assert model_info["input_cost_per_token"] == 1e-07 - assert model_info["max_input_tokens"] == 8192 \ No newline at end of file + assert model_info["max_input_tokens"] == 8192 From fe123b1618a3446d354f8006af296f4a913c9d1b Mon Sep 17 00:00:00 2001 From: bhumikadangayach <139267865+bhumikadangayach@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:50:30 +0530 Subject: [PATCH 5/5] style: apply black formatting to embedding.py error message block --- litellm/llms/bedrock/embed/embedding.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.py index 102dc8065e1..8f971babde9 100644 --- a/litellm/llms/bedrock/embed/embedding.py +++ b/litellm/llms/bedrock/embed/embedding.py @@ -481,6 +481,7 @@ class BedrockEmbedding(BaseAWSLLM): "amazon.titan-embed-image-v1", "amazon.titan-embed-text-v1", "amazon.titan-embed-text-v2:0", + "amazon.titan-embed-g1-text-02", ], ) )