Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
84084d9
feat(bedrock): send grok chat completions through runtime openai path
mateo-berri Sep 11, 2026
df7e9da
Merge remote-tracking branch 'origin/main' into litellm_bedrock_grok_…
mateo-berri Sep 19, 2026
6b9f067
feat(bedrock): serve gpt-oss and gpt-5.6 chat completions on runtime'…
mateo-berri Sep 20, 2026
a1c089f
fix(bedrock): route gpt-oss response_format to Converse and decide th…
mateo-berri Sep 20, 2026
b90c2f1
fix(bedrock): serve region-path and GovCloud gpt-oss ids on native Ch…
mateo-berri Sep 20, 2026
22b217b
fix(bedrock): keep params AWS refuses natively off the chat completio…
mateo-berri Sep 21, 2026
0a85e27
fix(bedrock): keep schema-less json_object on Converse for the chat c…
mateo-berri Sep 21, 2026
0139dd0
fix(bedrock): keep every json_object response_format on Converse for …
mateo-berri Sep 21, 2026
36759ee
Merge origin/main into litellm_bedrock_grok_chat_completions
mateo-berri Sep 24, 2026
c4c24dd
fix(rust): declare the bedrock runtime chat completions flags on Mode…
mateo-berri Sep 24, 2026
ff8e15d
fix(bedrock): opt into the native chat completions route through supp…
mateo-berri Sep 24, 2026
4101c0c
docs(cost-map): describe the bedrock native chat completions capabili…
mateo-berri Sep 25, 2026
61a130c
revert: docs(cost-map): describe the bedrock native chat completions …
mateo-berri Sep 25, 2026
e706095
merge: main into litellm_bedrock_grok_chat_completions
mateo-berri Sep 26, 2026
c60249f
test(bedrock): move the native chat completions tests under tests/unit
mateo-berri Sep 26, 2026
f4d84f8
fix(bedrock): drop reasoning_effort none for grok on the native chat …
mateo-berri Sep 26, 2026
e653217
fix(bedrock): keep converse extension params on the converse route
mateo-berri Sep 26, 2026
093a9d4
fix(bedrock): inline http image urls and keep stop on converse for na…
mateo-berri Sep 26, 2026
daba257
refactor(bedrock): share the sync remote media inliner
mateo-berri Sep 26, 2026
cbf01c2
fix(image-handling): infer the image mime type when the server sends …
mateo-berri Sep 26, 2026
4900a1a
fix(bedrock): stop sending aws_bedrock_project_id as OpenAI-Project o…
mateo-berri Sep 26, 2026
ef03d19
Merge remote-tracking branch 'origin/main' into litellm_bedrock_grok_…
mateo-berri Sep 28, 2026
3a390e6
feat(bedrock): make native chat completions an opt-in bedrock/chat_co…
mateo-berri Sep 29, 2026
84ae459
fix(bedrock): keep chat_completions/-prefixed deployments on the nati…
mateo-berri Sep 29, 2026
77204f8
fix(bedrock): keep provider response headers on the runtime chat comp…
mateo-berri Sep 29, 2026
615eff5
Merge remote-tracking branch 'origin/main' into litellm_bedrock_grok_…
mateo-berri Sep 30, 2026
3e3b9cd
feat(bedrock): serve gpt-5.6 and newer on runtime chat completions by…
mateo-berri Sep 30, 2026
22e35c6
fix(bedrock): refuse temperature and top_p natively on GPT 5.6 and ne…
mateo-berri Sep 30, 2026
952adfc
fix(bedrock): refuse GPT sampling and logprob params natively only wh…
mateo-berri Oct 1, 2026
19176f6
refactor(bedrock): keep the Converse route-prefix strip inside the be…
mateo-berri Oct 1, 2026
a0cef91
fix(bedrock): forward a non-string reasoning_effort on the native rou…
mateo-berri Oct 1, 2026
708f5a5
chore: merge main into litellm_bedrock_grok_chat_completions
mateo-berri Oct 1, 2026
dae29c1
fix(bedrock): route overlong GPT version digits to Converse and send …
mateo-berri Oct 1, 2026
578f26e
fix(bedrock): route model_id overrides to Converse and never send an …
mateo-berri Oct 1, 2026
4ee7ff4
test(bedrock): audit the native GPT chat completions route on the int…
mateo-berri Oct 1, 2026
2f27eb3
test(bedrock): harden the runtime chat completions audit cells
mateo-berri Oct 2, 2026
6daf0b7
fix(bedrock): refuse or drop a non-string reasoning_effort before the…
mateo-berri Oct 2, 2026
e518e0e
test(bedrock): pin router retries off and give the chaos bursts confi…
mateo-berri Oct 2, 2026
a109787
Merge remote-tracking branch 'origin/main' into litellm_bedrock_grok_…
mateo-berri Oct 2, 2026
6befa50
test(bedrock): wait for the replacement worker before tearing down th…
mateo-berri Oct 3, 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
4 changes: 4 additions & 0 deletions litellm-rust/crates/model-catalog/src/model_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ pub struct ModelInfo {
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_audio_output: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_bedrock_runtime_chat_completions_response_format: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_bedrock_runtime_chat_completions_tools_with_reasoning: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_computer_use: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_embedding_image_input: Option<bool>,
Expand Down
3 changes: 3 additions & 0 deletions litellm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,9 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None:
from .llms.bedrock.chat.invoke_transformations.amazon_openai_transformation import (
AmazonBedrockOpenAIConfig as AmazonBedrockOpenAIConfig,
)
from .llms.bedrock.chat.chat_completions.transformation import (
AmazonBedrockRuntimeChatCompletionsConfig as AmazonBedrockRuntimeChatCompletionsConfig,
)
from .llms.bedrock.image_generation.amazon_stability1_transformation import (
AmazonStabilityConfig as AmazonStabilityConfig,
)
Expand Down
5 changes: 5 additions & 0 deletions litellm/_lazy_imports_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"AmazonTwelveLabsPegasusConfig",
"AmazonInvokeConfig",
"AmazonBedrockOpenAIConfig",
"AmazonBedrockRuntimeChatCompletionsConfig",
"AmazonStabilityConfig",
"AmazonStability3Config",
"AmazonNovaCanvasConfig",
Expand Down Expand Up @@ -868,6 +869,10 @@
".llms.bedrock.chat.invoke_transformations.amazon_openai_transformation",
"AmazonBedrockOpenAIConfig",
),
"AmazonBedrockRuntimeChatCompletionsConfig": (
".llms.bedrock.chat.chat_completions.transformation",
"AmazonBedrockRuntimeChatCompletionsConfig",
),
"AmazonStabilityConfig": (
".llms.bedrock.image_generation.amazon_stability1_transformation",
"AmazonStabilityConfig",
Expand Down
59 changes: 33 additions & 26 deletions litellm/litellm_core_utils/prompt_templates/image_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import asyncio
import base64
from collections.abc import Callable, Mapping
from collections.abc import Callable, Iterable, Mapping
from dataclasses import dataclass
from itertools import chain
from types import MappingProxyType
from typing import Final

Expand All @@ -15,6 +16,7 @@
from litellm import verbose_logger
from litellm.caching.caching import InMemoryCache
from litellm.constants import MAX_IMAGE_URL_DOWNLOAD_SIZE_MB
from litellm.litellm_core_utils.prompt_templates.common_utils import infer_content_type_from_url_and_content
from litellm.litellm_core_utils.url_utils import SSRFError, async_safe_get, safe_get
from litellm.types.llms.openai import AllMessageValues

Expand Down Expand Up @@ -55,23 +57,16 @@ def _process_image_response(response: Response, url: str) -> str:

base64_image: Final = base64.b64encode(image_bytes).decode("utf-8")

image_type: Final = response.headers.get("Content-Type")
if image_type is None:
img_type = url.split(".")[-1].lower()
_img_type: Final = {
"jpg": "image/jpeg",
"jpeg": "image/jpeg",
"png": "image/png",
"gif": "image/gif",
"webp": "image/webp",
}.get(img_type)
if _img_type is None:
raise Exception(
f"Error: Unsupported image format. Format={_img_type}. Supported types = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']"
)
img_type = _img_type
else:
img_type = image_type
try:
img_type: Final = infer_content_type_from_url_and_content(
url=url,
content=bytes(image_bytes),
current_content_type=response.headers.get("Content-Type"),
)
except ValueError as e:
raise litellm.ImageFetchError(
f"Error: Unable to determine image content type from the server's headers, the URL, or the image bytes. url={url}"
) from e

result: Final = f"data:{img_type};base64,{base64_image}"
in_memory_cache.set_cache(url, result)
Expand Down Expand Up @@ -308,18 +303,30 @@ async def _fetch_data_urls(remote_urls: tuple[str, ...]) -> tuple[str, ...]:
raise


def _remote_urls_to_inline(
messages: Iterable[AllMessageValues], should_inline: Callable[[RemoteMedia], bool]
) -> tuple[str, ...]:
parts: Final = chain.from_iterable(_content_parts(message) for message in messages)
remotes: Final = (remote for part in parts if (remote := _parse_remote_part(part)) is not None)
return tuple(dict.fromkeys(remote.url for remote in remotes if should_inline(_remote_media(remote))))


def inline_remote_media(
messages: list[AllMessageValues], # mutable-ok: every transform_request takes list[AllMessageValues]
should_inline: Callable[[RemoteMedia], bool] = inline_every_remote_url,
) -> list[AllMessageValues]: # mutable-ok: every transform_request takes list[AllMessageValues]
remote_urls: Final = _remote_urls_to_inline(messages, should_inline)
if not remote_urls:
return messages
data_urls: Final = MappingProxyType({url: convert_url_to_base64(url) for url in remote_urls})
return [_inline_message(message, data_urls, should_inline) for message in messages]


async def async_inline_remote_media(
messages: list[AllMessageValues], # mutable-ok: every transform_request takes list[AllMessageValues]
should_inline: Callable[[RemoteMedia], bool] = inline_every_remote_url,
) -> list[AllMessageValues]: # mutable-ok: every transform_request takes list[AllMessageValues]
remote_urls: Final = tuple(
dict.fromkeys(
remote.url
for message in messages
for part in _content_parts(message)
if (remote := _parse_remote_part(part)) is not None and should_inline(_remote_media(remote))
)
)
remote_urls: Final = _remote_urls_to_inline(messages, should_inline)
if not remote_urls:
return messages
data_urls: Final = await _fetch_data_urls(remote_urls)
Expand Down
Loading
Loading