BerriAI/litellm · error · ValueError
Bedrock Mantle auth failed: no Bearer token and no usable…
Error message
Bedrock Mantle auth failed: no Bearer token and no usable AWS credentials. Set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) or pass api_key for Bearer auth, or provide AWS credentials (IAM role / access key / profile / web identity) for SigV4.
What it means
Bedrock Mantle (AWS's Bedrock-compatible endpoint) auth tries Bearer first (BEDROCK_MANTLE_API_KEY or AWS_BEARER_TOKEN_BEDROCK env, or api_key), then falls back to the AWS SigV4 chain. When no bearer exists and the chain raises NoCredentialsError, PartialCredentialsError, ProfileNotFound, or CredentialRetrievalError, LiteLLM raises this ValueError chaining the original exception and listing both auth options.
Solutions
- If you have a bearer token: set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) or pass api_key on the call
- Otherwise fix SigV4: valid AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, an existing profile, or a working IAM role / web identity; verify with aws sts get-caller-identity
- Inspect the chained original exception (__cause__) to see which chain failure occurred (no creds vs. profile not found vs. retrieval error)
Example fix
# before litellm.completion(model="bedrock_mantle/<model>", messages=[...]) # raises ValueError # after (bearer auth) os.environ["BEDROCK_MANTLE_API_KEY"] = "<token>" litellm.completion(model="bedrock_mantle/<model>", messages=[...])
Defensive patterns
Strategy: validation
Validate before calling
import botocore.session
has_bearer = bool(os.environ.get("BEDROCK_MANTLE_API_KEY") or os.environ.get("AWS_BEARER_TOKEN_BEDROCK"))
has_sigv4 = botocore.session.get_session().get_credentials() is not None
if not (has_bearer or has_sigv4):
raise SystemExit(
"bedrock_mantle needs a bearer token (BEDROCK_MANTLE_API_KEY) or resolvable AWS credentials"
) Type guard
def bedrock_mantle_auth_ready() -> bool:
"""True when bearer auth or the AWS credential chain is available for Mantle."""
import os, botocore.session
return (
bool(os.environ.get("BEDROCK_MANTLE_API_KEY") or os.environ.get("AWS_BEARER_TOKEN_BEDROCK"))
or botocore.session.get_session().get_credentials() is not None
) Try / catch
try:
resp = litellm.completion(model=f"bedrock_mantle/{model}", messages=msgs)
except ValueError as e:
if "Bedrock Mantle auth failed" in str(e):
raise AuthConfigError("set BEDROCK_MANTLE_API_KEY or configure AWS credentials") from e
raise Prevention
- Prefer bearer auth (BEDROCK_MANTLE_API_KEY / AWS_BEARER_TOKEN_BEDROCK) for Mantle deployments and set it in the environment
- When using SigV4, verify the chain with aws sts get-caller-identity and check AWS_PROFILE exists
- Add a startup auth readiness check so misconfiguration fails at boot, not mid-request
When it happens
Trigger: Calling a bedrock_mantle model with no bearer token configured while the AWS credential chain also fails: no env keys, AWS_PROFILE pointing at a missing profile, broken STS/web-identity setup, or no attached IAM role.
Common situations: First-time Mantle setups where only one auth method was configured, CI containers without credentials, expired or rotated web identity tokens, renamed AWS profiles.
Related errors
- BedrockException Invalid Authentication
- No AWS credentials found for Bedrock realtime. Set aws_*…
- api_key is required
- API key is required
- api_key is required for Volcengine authentication
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/edc369b88755dce4.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock_mantle/common_utils.py:103
try:
return self._aws_signer._sign_request(
service_name="bedrock",
headers=headers,
optional_params=optional_params,
request_data=request_data,
api_base=api_base,
api_key=bearer,
model=model,
stream=stream,
fake_stream=fake_stream,
)
except (
NoCredentialsError,
PartialCredentialsError,
ProfileNotFound,
CredentialRetrievalError,
) as e:
raise ValueError(
"Bedrock Mantle auth failed: no Bearer token and no usable AWS "
"credentials. Set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) "
"or pass api_key for Bearer auth, or provide AWS credentials "
"(IAM role / access key / profile / web identity) for SigV4."
) from e
def mantle_supports_responses(model: str | None, model_cost: dict) -> bool:
"""Whether a Bedrock Mantle model can serve the native Responses API.
Purely data-driven from the model's price-map capability signal -- either
/v1/responses in supported_endpoints, or mode=responses -- both overridable
via register_model and proxy model_info, so onboarding a model is a JSON
change, never a code change. There is deliberately NO model-name match here:
capability is per-model, not per-family (openai.gpt-oss-120b supports
Responses while openai.gpt-oss-safeguard-120b does not, despite sharing the
gpt-oss substring), so a substring gate would be wrong. A model absent from
model_cost simply has no signal and returns False (chat-completions emulation).View on GitHub (pinned to 77b7c6c40c)