Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
343ef87
fix: correct amazon.titan-embed-text-v2 input price to $0.02/1M token…
Srivatsa03 Jun 22, 2026
45b4dca
fix(sensitive_data_masker): fully mask secrets at or below the reveal…
Srivatsa03 Jun 22, 2026
2b29b92
refactor(fireworks_ai): remove deprecated audio transcriptions endpoi…
shzdehmd Jun 22, 2026
19450bd
feat: add darkbloom provider (#30876)
jychp Jun 22, 2026
488f787
fix: fail fast for non-Postgres database URLs (#30883)
krishvsoni Jun 22, 2026
67c0183
fix(bedrock): surface modeled HTTP status for mid-stream error events…
kingdoooo Jun 22, 2026
0a359ce
fix(mcp): re-land native tool preservation with typed annotations (#3…
ayushh0110 Jun 22, 2026
e5ce7ab
fix(sambanova): return embeddings supported params instead of droppin…
hoangsonww Jun 22, 2026
7fa04db
fix(router): send fallback metadata when streaming (#30914)
talmar-island Jun 22, 2026
37a2a32
fix(mistral): drop output-only reasoning fields from input messages (…
hemant1026 Jun 22, 2026
8f4a2bc
fix(perplexity): bill search queries at the per-request price, not 1/…
devYRPauli Jun 22, 2026
ad2b395
fix: include model_access_groups when expanding all-team-models in ge…
factnn Jun 22, 2026
da85887
fix(fireworks_ai): return None for transcription in get_supported_ope…
Sameerlite Jun 22, 2026
e7ff3e1
fix(proxy): gate include_fallback_errors behind expose_fallback_error…
Sameerlite Jun 22, 2026
db2bc49
test(proxy): opt in to expose_fallback_errors_to_caller in streaming …
Sameerlite Jun 22, 2026
0a82e13
test(prompt_templates): make test_convert_url hermetic instead of hit…
mateo-berri Jun 22, 2026
5663bcf
fix(interactions): drop role from Interaction response to match Googl…
mateo-berri Jun 22, 2026
d093dc2
fix: align all-team-models sentinel access
cursoragent Jun 22, 2026
dc6611b
fix(router): forward include_fallback_errors through multi-hop fallbacks
mateo-berri Jun 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions litellm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ def identify(event_details):
dashscope_models: Set = set()
moonshot_models: Set = set()
publicai_models: Set = set()
darkbloom_models: Set = set()
v0_models: Set = set()
morph_models: Set = set()
lambda_ai_models: Set = set()
Expand Down Expand Up @@ -927,6 +928,8 @@ def add_known_models(model_cost_map: Optional[Dict] = None):
moonshot_models.add(key)
elif value.get("litellm_provider") == "publicai":
publicai_models.add(key)
elif value.get("litellm_provider") == "darkbloom":
darkbloom_models.add(key)
elif value.get("litellm_provider") == "v0":
v0_models.add(key)
elif value.get("litellm_provider") == "morph":
Expand Down Expand Up @@ -1075,6 +1078,7 @@ def add_known_models(model_cost_map: Optional[Dict] = None):
| dashscope_models
| moonshot_models
| publicai_models
| darkbloom_models
| v0_models
| morph_models
| lambda_ai_models
Expand Down Expand Up @@ -1179,6 +1183,7 @@ def add_known_models(model_cost_map: Optional[Dict] = None):
"modelscope": modelscope_models,
"moonshot": moonshot_models,
"publicai": publicai_models,
"darkbloom": darkbloom_models,
"v0": v0_models,
"morph": morph_models,
"lambda_ai": lambda_ai_models,
Expand Down Expand Up @@ -1922,9 +1927,6 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None:
from .llms.fireworks_ai.completion.transformation import (
FireworksAITextCompletionConfig as FireworksAITextCompletionConfig,
)
from .llms.fireworks_ai.audio_transcription.transformation import (
FireworksAIAudioTranscriptionConfig as FireworksAIAudioTranscriptionConfig,
)
from .llms.fireworks_ai.embed.fireworks_ai_transformation import (
FireworksAIEmbeddingConfig as FireworksAIEmbeddingConfig,
)
Expand Down
5 changes: 0 additions & 5 deletions litellm/_lazy_imports_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@
"SambaNovaEmbeddingConfig",
"FireworksAIConfig",
"FireworksAITextCompletionConfig",
"FireworksAIAudioTranscriptionConfig",
"FireworksAIEmbeddingConfig",
"FriendliaiChatConfig",
"JinaAIEmbeddingConfig",
Expand Down Expand Up @@ -1027,10 +1026,6 @@
".llms.fireworks_ai.completion.transformation",
"FireworksAITextCompletionConfig",
),
"FireworksAIAudioTranscriptionConfig": (
".llms.fireworks_ai.audio_transcription.transformation",
"FireworksAIAudioTranscriptionConfig",
),
"FireworksAIEmbeddingConfig": (
".llms.fireworks_ai.embed.fireworks_ai_transformation",
"FireworksAIEmbeddingConfig",
Expand Down
1 change: 1 addition & 0 deletions litellm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@
"docker_model_runner",
"ragflow",
"pinstripes", # Pinstripes - JSON-configured provider
"darkbloom",
]
openai_text_completion_compatible_providers: List = (
[ # providers that support `/v1/completions`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,6 @@ def transform_responses_response_to_interactions_response(
"total_output_tokens": getattr(usage, "output_tokens", 0),
}

# Add role
interactions_response_dict["role"] = "model"

# Add updated (same as created for now)
interactions_response_dict["updated"] = created

Expand Down
8 changes: 4 additions & 4 deletions litellm/litellm_core_utils/get_supported_openai_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def get_supported_openai_params(
model=model
)
elif request_type == "transcription":
return litellm.FireworksAIAudioTranscriptionConfig().get_supported_openai_params(
model=model
)
return None
else:
return litellm.FireworksAIConfig().get_supported_openai_params(model=model)
elif custom_llm_provider == "nvidia_nim":
Expand Down Expand Up @@ -191,7 +189,9 @@ def get_supported_openai_params(
)
elif custom_llm_provider == "sambanova":
if request_type == "embeddings":
litellm.SambaNovaEmbeddingConfig().get_supported_openai_params(model=model)
return litellm.SambaNovaEmbeddingConfig().get_supported_openai_params(
model=model
)
else:
return litellm.SambanovaConfig().get_supported_openai_params(model=model)
elif custom_llm_provider == "nebius":
Expand Down
10 changes: 8 additions & 2 deletions litellm/litellm_core_utils/sensitive_data_masker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(
visible_prefix: int = 4,
visible_suffix: int = 4,
mask_char: str = "*",
mask_short_values: bool = True,
):
self.sensitive_patterns = sensitive_patterns or {
"password",
Expand All @@ -38,12 +39,17 @@ def __init__(
self.visible_prefix = visible_prefix
self.visible_suffix = visible_suffix
self.mask_char = mask_char
self.mask_short_values = mask_short_values

def _mask_value(self, value: str) -> str:
if not value or len(str(value)) < (self.visible_prefix + self.visible_suffix):
value_str = str(value)
if not value_str:
return value
if len(value_str) <= (self.visible_prefix + self.visible_suffix):
return (
self.mask_char * len(value_str) if self.mask_short_values else value_str
)

value_str = str(value)
masked_length = len(value_str) - (self.visible_prefix + self.visible_suffix)

# Handle the case where visible_suffix is 0 to avoid showing the entire string
Expand Down
19 changes: 2 additions & 17 deletions litellm/llms/bedrock/chat/invoke_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
from ..common_utils import (
BedrockError,
ModelResponseIterator,
build_bedrock_stream_error,
get_bedrock_response_stream_shape,
get_bedrock_tool_name,
)
Expand Down Expand Up @@ -1841,23 +1842,7 @@ def _parse_message_from_event(self, event) -> Optional[str]:
parsed_response = self.parser.parse(response_dict, response_stream_shape)

if response_dict["status_code"] != 200:
decoded_body = response_dict["body"].decode()
if isinstance(decoded_body, dict):
error_message = decoded_body.get("message")
elif isinstance(decoded_body, str):
error_message = decoded_body
else:
error_message = ""
exception_status = response_dict["headers"].get(":exception-type")
error_message = exception_status + " " + error_message
raise BedrockError(
status_code=response_dict["status_code"],
message=(
json.dumps(error_message)
if isinstance(error_message, dict)
else error_message
),
)
raise build_bedrock_stream_error(response_dict, response_stream_shape)
if "chunk" in parsed_response:
chunk = parsed_response.get("chunk")
if not chunk:
Expand Down
65 changes: 47 additions & 18 deletions litellm/llms/bedrock/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@
import functools
import json
import os
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Literal,
Mapping,
Optional,
TypedDict,
Union,
)

if TYPE_CHECKING:
from botocore.model import Shape

from litellm.types.llms.bedrock import BedrockCreateBatchRequest

import httpx
Expand Down Expand Up @@ -1132,6 +1144,39 @@ def get_bedrock_response_stream_shape():
return _load_bedrock_response_stream_shape()


class BedrockEventStreamResponseDict(TypedDict):
status_code: int
headers: Mapping[str, str]
body: bytes


def build_bedrock_stream_error(
response_dict: BedrockEventStreamResponseDict,
response_stream_shape: Shape | None,
) -> BedrockError:
"""Build a BedrockError for a non-200 event-stream error event.

botocore hard-codes HTTP 400 on every mid-stream error event, so the modeled
ResponseStream member's httpStatusCode is the real status. Resolve it from the
shape and fall back to the raw status when the type is not modeled.
"""
exception_type = response_dict["headers"].get(":exception-type")
decoded_body = response_dict["body"].decode()
message = f"{exception_type} {decoded_body}" if exception_type else decoded_body

status_code = response_dict["status_code"]
if exception_type is not None and response_stream_shape is not None:
member = response_stream_shape.members.get(exception_type)
if member is not None:
modeled_status = (
(member.metadata or {}).get("error", {}).get("httpStatusCode")
)
if modeled_status is not None:
status_code = int(modeled_status)

return BedrockError(status_code=status_code, message=message)


class BedrockEventStreamDecoderBase:
"""
Base class for event stream decoding for Bedrock
Expand All @@ -1156,23 +1201,7 @@ def _parse_message_from_event(self, event) -> Optional[str]:
parsed_response = self.parser.parse(response_dict, response_stream_shape)

if response_dict["status_code"] != 200:
decoded_body = response_dict["body"].decode()
if isinstance(decoded_body, dict):
error_message = decoded_body.get("message")
elif isinstance(decoded_body, str):
error_message = decoded_body
else:
error_message = ""
exception_status = response_dict["headers"].get(":exception-type")
error_message = exception_status + " " + error_message
raise BedrockError(
status_code=response_dict["status_code"],
message=(
json.dumps(error_message)
if isinstance(error_message, dict)
else error_message
),
)
raise build_bedrock_stream_error(response_dict, response_stream_shape)
if "chunk" in parsed_response:
chunk = parsed_response.get("chunk")
if not chunk:
Expand Down
17 changes: 0 additions & 17 deletions litellm/llms/fireworks_ai/audio_transcription/transformation.py

This file was deleted.

21 changes: 21 additions & 0 deletions litellm/llms/mistral/chat/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ def _transform_messages(
The above statement is not valid now. Need to plan to remove all the #1,2,3
Mistral API supports content as a list.
"""
messages = [self._strip_output_only_fields(m) for m in messages]

## 1. If 'image_url' or 'file' in content, then transform with base class and mistral-specific handling
for m in messages:
_content_block = m.get("content")
Expand Down Expand Up @@ -409,6 +411,25 @@ def _clean_tool_schema_for_mistral(cls, tools: list) -> list:

return cleaned_tools

@classmethod
def _strip_output_only_fields(cls, message: AllMessageValues) -> AllMessageValues:
"""
``reasoning_content`` and ``thinking_blocks`` are output-only fields that
LiteLLM attaches to assistant responses. Mistral's input schema forbids
unknown fields, so replaying them verbatim in a follow-up turn triggers a
422 ``extra_forbidden``. Drop them before the request is sent.
"""
if message["role"] != "assistant":
return message
return cast(
AllMessageValues,
{
k: v
for k, v in message.items()
if k not in ("reasoning_content", "thinking_blocks")
},
)

@classmethod
def _handle_name_in_message(cls, message: AllMessageValues) -> AllMessageValues:
"""
Expand Down
8 changes: 8 additions & 0 deletions litellm/llms/openai_like/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@
"max_completion_tokens": "max_tokens"
}
},
"darkbloom": {
"base_url": "https://api.darkbloom.dev/v1",
"api_key_env": "DARKBLOOM_API_KEY",
"api_base_env": "DARKBLOOM_API_BASE",
"param_mappings": {
"max_completion_tokens": "max_tokens"
}
},
"neosantara": {
"base_url": "https://api.neosantara.xyz/v1",
"api_key_env": "NEOSANTARA_API_KEY",
Expand Down
9 changes: 5 additions & 4 deletions litellm/llms/perplexity/cost_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ def _safe_float_cast(
if num_search_queries > 0 and search_cost_value is not None:
# Handle both dict and float formats
if isinstance(search_cost_value, dict):
# Use the "low" size as default - tests expect 0.005 / 1000
search_cost_per_query = (
_safe_float_cast(search_cost_value.get("search_context_size_low", 0))
/ 1000
# search_context_cost_per_query stores the per-request price in USD
# (e.g. sonar low = $0.005/request). Use it directly, matching the
# gemini cost calculator which reads the same field per request.
search_cost_per_query = _safe_float_cast(
search_cost_value.get("search_context_size_low", 0)
)
else:
search_cost_per_query = _safe_float_cast(search_cost_value)
Expand Down
Loading
Loading