BerriAI/litellm · error · ValueError
Invalid invoke provider: {invoke_provider}, for model: {mode
Error message
Invalid invoke provider: {invoke_provider}, for model: {model} What it means
On the streaming passthrough path for 'invoke' endpoints, AmazonInvokeConfig.get_bedrock_invoke_provider(model) is used to derive the provider from the model string. If it returns None (model string doesn't start with a known Bedrock provider prefix), litellm raises ValueError('Invalid invoke provider: None, for model: ...') because no event-stream decoder can be selected.
Source
Thrown at litellm/llms/bedrock/passthrough/transformation.py:200
3. Return the model_response
"""
from litellm.litellm_core_utils.streaming_handler import (
convert_generic_chunk_to_model_response_stream,
generic_chunk_has_all_required_fields,
)
from litellm.llms.bedrock.chat import get_bedrock_event_stream_decoder
from litellm.llms.bedrock.chat.invoke_transformations.base_invoke_transformation import (
AmazonInvokeConfig,
)
from litellm.main import stream_chunk_builder
from litellm.types.utils import GenericStreamingChunk, ModelResponseStream
all_translated_chunks: Final = []
if "invoke" in endpoint:
invoke_provider: Final = AmazonInvokeConfig.get_bedrock_invoke_provider(model)
if invoke_provider is None:
raise ValueError(f"Invalid invoke provider: {invoke_provider}, for model: {model}")
obj = get_bedrock_event_stream_decoder(
invoke_provider=invoke_provider,
model=model,
sync_stream=True,
json_mode=False,
)
elif "converse" in endpoint:
obj = get_bedrock_event_stream_decoder(
invoke_provider=None,
model=model,
sync_stream=True,
json_mode=False,
)
else:
return None
for chunk in all_chunks:
message = json.loads(chunk)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use the canonical model identifier with the correct lowercase provider prefix (e.g. 'anthropic.claude-3-haiku-20240307-v1:0').
- For converse endpoints, use /bedrock/converse/<model> which resolves the provider differently (invoke_provider=None).
- Check get_bedrock_invoke_provider's supported prefixes in your litellm version and match the model string to one.
- Upgrade litellm if the provider is newly supported.
Example fix
# before stream = litellm.completion(model='bedrock/invoke/MyClaude-Model', messages=msgs, stream=True) # after stream = litellm.completion(model='bedrock/invoke/anthropic.claude-3-haiku-20240307-v1:0', messages=msgs, stream=True)
Defensive patterns
Strategy: type-guard
Validate before calling
import re
def is_invoke_streamable_model(model: str) -> bool:
# get_bedrock_invoke_provider matches known provider prefixes; mirror that check
return re.match(r"^(amazon|anthropic|ai21|cohere|meta|mistral|stability|deepseek)\.", model) is not None Type guard
def has_invoke_provider_prefix(model: str) -> bool:
return "." in model and model.split(".")[0].islower() and model.split(".")[0] in {
"amazon", "anthropic", "ai21", "cohere", "meta", "mistral", "stability"
} Try / catch
try:
stream = litellm.completion(model=f"bedrock/invoke/{model}", messages=msgs, stream=True)
except ValueError as e:
if "Invalid invoke provider" in str(e):
# fall back to converse route which does not need provider derivation
stream = litellm.completion(model=f"bedrock/converse/{model}", messages=msgs, stream=True)
else:
raise Prevention
- Use lowercase canonical provider-prefixed model IDs for invoke streaming.
- Prefer converse over invoke for new integrations — it is provider-agnostic.
- Unit-test model strings against the prefix list at config load time.
When it happens
Trigger: Streaming from /bedrock/invoke/<model> where <model> lacks a recognized provider prefix — e.g. a bare custom model name, a provisioned-throughput ARN fragment, or a typo'd prefix like 'Anthropic.Claude...' (capitalized).
Common situations: Using provisioned custom names (e.g. 'my-custom-model') without provider prefix; copy-pasting model ARNs instead of the model name; case-sensitive prefix mismatches.
Related errors
- No provider config found for model: {model}
- Received streaming error - {e}
- Bedrock event-stream shape could not be loaded from botocore
- Bedrock event-stream shape could not be loaded from botocore
- Unclassified keys in {PRICES_PATH.name}: {', '.join(unclassi
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/dd6a327c9d60cbba.
Report an issue: GitHub.