fix(bedrock_mantle): correct responses URL fallback for bare hosts
Some checks failed
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled

Ensure Bedrock Mantle Responses URLs always include the OpenAI-compatible /openai/v1 prefix for bare API bases and remove unreachable api_base guard logic.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sameer Kankute 2026-06-02 14:38:35 +05:30
parent f63ce0445b
commit dbcf2ea1f1
No known key found for this signature in database
2 changed files with 15 additions and 8 deletions

View file

@ -5,7 +5,7 @@ Routes /v1/responses to the provider's native Responses endpoint instead of
the chat-completions translation fallback.
"""
from typing import Optional
from typing import Optional, cast
from litellm.llms.bedrock_mantle.chat.transformation import BedrockMantleChatConfig
from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig
@ -45,17 +45,16 @@ class BedrockMantleResponsesAPIConfig(OpenAIResponsesAPIConfig):
api_base=api_base or litellm_params.get("api_base"),
api_key=litellm_params.get("api_key"),
)
if not resolved_api_base:
raise ValueError(
"api_base is required for bedrock_mantle Responses API. "
"Set BEDROCK_MANTLE_API_BASE or BEDROCK_MANTLE_REGION."
)
api_base = resolved_api_base.rstrip("/")
api_base = cast(str, resolved_api_base).rstrip("/")
if api_base.endswith("/responses"):
return api_base
if api_base.endswith("/openai/v1"):
return f"{api_base}/responses"
if api_base.endswith("/openai"):
return f"{api_base}/v1/responses"
if api_base.endswith("/v1"):
return f"{api_base}/responses"
return f"{api_base}/v1/responses"
return f"{api_base}/openai/v1/responses"
def supports_native_websocket(self) -> bool:
return False

View file

@ -107,6 +107,14 @@ class TestBedrockMantleResponsesConfig:
url = cfg.get_complete_url(api_base=None, litellm_params={})
assert url == "https://bedrock-mantle.us-east-1.api.aws/openai/v1/responses"
def test_responses_complete_url_bare_api_base(self, monkeypatch):
monkeypatch.setenv(
"BEDROCK_MANTLE_API_BASE", "https://bedrock-mantle.us-east-1.api.aws"
)
cfg = BedrockMantleResponsesAPIConfig()
url = cfg.get_complete_url(api_base=None, litellm_params={})
assert url == "https://bedrock-mantle.us-east-1.api.aws/openai/v1/responses"
def test_provider_config_manager_registers_responses(self):
cfg = ProviderConfigManager.get_provider_responses_api_config(
provider="bedrock_mantle",