Skip to main content
Helpers for creating bedrock backends from openai/litellm.

Functions

FUNC list_mantle_models

list_mantle_models(region: str | None = None) -> list
Return all models available at a bedrock-mantle endpoint. Args:
  • region: AWS region name (e.g. "us-east-1"), or None to use the default region.
Returns:
  • List of model objects returned by the Bedrock Mantle models API.

FUNC stringify_mantle_model_ids

stringify_mantle_model_ids(region: str | None = None) -> str
Return a human-readable list of all models available at the mantle endpoint for an AWS region. Args:
  • region: AWS region name, or None to use the default region.
Returns:
  • Newline-separated string of model IDs prefixed with " * ".

FUNC create_bedrock_mantle_backend

create_bedrock_mantle_backend(model_id: ModelIdentifier | str, region: str | None = None) -> OpenAIBackend
Return an OpenAI backend that points to Bedrock mantle for the given model. Args:
  • model_id: The model to use, either as a [ModelIdentifier](model_ids#class-modelidentifier) (which must have a bedrock_name) or a raw Bedrock model ID string.
  • region: AWS region name, or None to use the default region ("us-east-1").
Returns:
  • An OpenAIBackend configured to call the specified model via AWS Bedrock Mantle.
Raises:
  • Exception: If model_id is a [ModelIdentifier](model_ids#class-modelidentifier) with no bedrock_name set.
  • AssertionError: If the AWS_BEARER_TOKEN_BEDROCK environment variable is not set.
  • Exception: If the specified model is not available in the target region.