litellm - ✅(Solved) Fix [Feature]: Image Edit Support for Amazon Nova Canvas [6 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24267Fetched 2026-04-08 01:08:57
View on GitHub
Comments
0
Participants
1
Timeline
11
Reactions
0
Participants
Timeline (top)
cross-referenced ×7labeled ×3referenced ×1

Error Message

INFO: Started server process [1] INFO: Waiting for application startup.

██╗ ██╗████████╗███████╗██╗ ██╗ ███╗ ███╗ ██║ ██║╚══██╔══╝██╔════╝██║ ██║ ████╗ ████║ ██║ ██║ ██║ █████╗ ██║ ██║ ██╔████╔██║ ██║ ██║ ██║ ██╔══╝ ██║ ██║ ██║╚██╔╝██║ ███████╗██║ ██║ ███████╗███████╗███████╗██║ ╚═╝ ██║ ╚══════╝╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝

query-engine ac9d7041ed77bcc8a8dbd2ab6616b39013829574 INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:4000 (Press CTRL+C to quit)

#------------------------------------------------------------#

'The thing I wish you improved is...'

https://github.com/BerriAI/litellm/issues/new

#------------------------------------------------------------#

Thank you for using LiteLLM! - Krrish & Ishaan

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new

Setting Cache on Proxy LiteLLM: Proxy initialized with Config, Set models: amazon-nova-canvas sd3.5-core sd3.5-large sd3.5-ultra INFO: 127.0.0.1:38032 - "GET /health/liveliness HTTP/1.1" 200 OK 04:41:39 - LiteLLM Proxy:ERROR: common_request_processing.py:1220 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0 Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit return bedrock_image_edit.image_edit( # type: ignore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ model=model, ^^^^^^^^^^^^ ...<10 lines>... REDACTED"api_key"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit prepared_request = self._prepare_request( model=model, ...<6 lines>... api_key=api_key, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request data = self._get_request_body( model=model, ...<2 lines>... optional_params=optional_params, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body config_class = self.get_config_class(model=model) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class raise ValueError(f"Unsupported model for bedrock image edit: {model}") ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0 . Received Model Group=amazon-nova-canvas Available Model Group Fallbacks=None LiteLLM Retried: 2 times, LiteLLM Max Retries: 2 Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit return bedrock_image_edit.image_edit( # type: ignore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ model=model, ^^^^^^^^^^^^ ...<10 lines>... REDACTED"api_key"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit prepared_request = self._prepare_request( model=model, ...<6 lines>... api_key=api_key, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request data = self._get_request_body( model=model, ...<2 lines>... optional_params=optional_params, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body config_class = self.get_config_class(model=model) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class raise ValueError(f"Unsupported model for bedrock image edit: {model}") ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5508, in async_function_with_retries response = await self.make_call(original_function, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call response = await response ^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper raise e File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper response = await response # type: ignore ^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async raise e File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async result = await original_function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit raise litellm.exception_type( ...<5 lines>... ) File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit init_response = await loop.run_in_executor(None, func_with_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper raise e File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper result = original_function(*args, **kwargs) File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit raise litellm.exception_type( ~~~~~~~~~~~~~~~~~~~~~~^ model=model, ^^^^^^^^^^^^ ...<3 lines>... extra_kwargs=kwargs, ^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type raise e File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type raise APIConnectionError( ...<8 lines>... ) litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0 Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit return bedrock_image_edit.image_edit( # type: ignore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ model=model, ^^^^^^^^^^^^ ...<10 lines>... REDACTED"api_key"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit prepared_request = self._prepare_request( model=model, ...<6 lines>... api_key=api_key, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request data = self._get_request_body( model=model, ...<2 lines>... optional_params=optional_params, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body config_class = self.get_config_class(model=model) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class raise ValueError(f"Unsupported model for bedrock image edit: {model}") ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/proxy/image_endpoints/endpoints.py", line 304, in image_edit_api return await processor.base_process_llm_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<16 lines>... ) ^ File "/usr/lib/python3.13/site-packages/litellm/proxy/common_request_processing.py", line 953, in base_process_llm_request responses = await llm_responses ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5005, in async_wrapper return await self._ageneric_api_call_with_fallbacks( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ) ^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3722, in _ageneric_api_call_with_fallbacks raise e File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3709, in _ageneric_api_call_with_fallbacks response = await self.async_function_with_fallbacks(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5411, in async_function_with_fallbacks return await self.async_function_with_fallbacks_common_utils( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<8 lines>... ) ^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5368, in async_function_with_fallbacks_common_utils raise original_exception File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5402, in async_function_with_fallbacks response = await self.async_function_with_retries(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5665, in async_function_with_retries raise original_exception File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5594, in async_function_with_retries response = await self.make_call(original_function, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call response = await response ^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper raise e File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper response = await response # type: ignore ^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async raise e File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async result = await original_function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit raise litellm.exception_type( ...<5 lines>... ) File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit init_response = await loop.run_in_executor(None, func_with_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper raise e File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper result = original_function(*args, **kwargs) File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit raise litellm.exception_type( ~~~~~~~~~~~~~~~~~~~~~~^ model=model, ^^^^^^^^^^^^ ...<3 lines>... extra_kwargs=kwargs, ^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type raise e File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type raise APIConnectionError( ...<8 lines>... ) litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0 Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit return bedrock_image_edit.image_edit( # type: ignore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ model=model, ^^^^^^^^^^^^ ...<10 lines>... REDACTED"api_key"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit prepared_request = self._prepare_request( model=model, ...<6 lines>... api_key=api_key, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request data = self._get_request_body( model=model, ...<2 lines>... optional_params=optional_params, ) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body config_class = self.get_config_class(model=model) File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class raise ValueError(f"Unsupported model for bedrock image edit: {model}") ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0 . Received Model Group=amazon-nova-canvas

Fix Action

Fixed

PR fix notes

PR #24459: feat(bedrock): Amazon Nova Canvas image edit (fixes #24267)

Description (problem / solution / changelog)

Summary

Adds Amazon Nova Canvas image edit on Bedrock (InvokeModel), wires it through the handler and ProviderConfigManager, tightens mask / routing behavior, expands tests and docs, applies Black where CI required, and refactors A2A / Anthropic guardrail handlers to satisfy Ruff PLR0915.

Closes #24267 (if that’s the tracking issue—adjust if not).

Relevant issues

https://github.com/BerriAI/litellm/issues/24267

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

Summary Adds OpenAI-compatible image_edit() support for Amazon Nova Canvas on Bedrock (InvokeModel), with task routing aligned to AWS Nova Canvas (e.g. IMAGE_VARIATION, INPAINTING, OUTPAINTING, BACKGROUND_REMOVAL), validation for unknown taskType, and correct handling of masks / maskPrompt / outPaintingMode.

Routing uses supports_nova_canvas_image_edit: true in model_prices_and_context_window.json (and the bundled backup) so new inference IDs are config-driven, not hardcoded name checks in code.

Implementation notes BedrockAmazonNovaCanvasImageEditConfig (amazon_nova_canvas_image_edit_transformation.py): maps OpenAI-style inputs to Nova Canvas request bodies; omits imageGenerationConfig for BACKGROUND_REMOVAL per AWS constraints. BedrockImageEdit.get_config_class and ProviderConfigManager.get_provider_image_edit_config agree on Nova vs Stability; unknown Bedrock image-edit models still fall back to the Stability adapter with a warning (legacy behavior). get_complete_url: raises NotImplementedError — real URLs are built in BedrockImageEdit._prepare_request (SigV4 / runtime endpoint), not a placeholder URL. model_prices_and_context_window.json (+ backup): supports_nova_canvas_image_edit for amazon.nova-canvas-v1:0, us. / eu. / ap. cross-region IDs where applicable. Tests Unit tests for task types, error paths, handler/helper/PCM routing parity, and ProviderConfigManager dispatch (mock-only; no live network calls). Autouse fixture merges Nova Canvas model_cost entries when CI loads a remote cost map that lags this PR. Docs docs/my-website/docs/providers/bedrock_image_gen.md: Nova Canvas image edit section (inference IDs, supports_nova_canvas_image_edit, proxy examples). Out of scope / follow-ups user_api_key_project_alias changes in unrelated modules (e.g. PagerDuty / spend tracking), if present on the branch, are better as a separate PR unless this branch intentionally bundles them. Optional hardening: quality (hd → premium) in transform_image_edit_request for callers that bypass map_openai_params; docs example should use a with open(...) context manager for file handles.

Changed files

  • docs/my-website/docs/providers/bedrock_image_gen.md (modified, +20/-1)
  • enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py (modified, +4/-0)
  • litellm/llms/a2a/chat/guardrail_translation/handler.py (modified, +89/-53)
  • litellm/llms/anthropic/chat/guardrail_translation/handler.py (modified, +81/-61)
  • litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py (added, +465/-0)
  • litellm/llms/bedrock/image_edit/handler.py (modified, +19/-2)
  • litellm/llms/openai/chat/guardrail_translation/handler.py (modified, +3/-3)
  • litellm/model_prices_and_context_window_backup.json (modified, +11/-2)
  • litellm/proxy/management_helpers/audit_logs.py (modified, +9/-5)
  • litellm/proxy/spend_tracking/spend_tracking_utils.py (modified, +1/-0)
  • litellm/utils.py (modified, +3/-3)
  • model_prices_and_context_window.json (modified, +11/-2)
  • tests/test_litellm/llms/bedrock/image_edit/test_amazon_nova_canvas_image_edit.py (added, +450/-0)
  • tests/test_litellm/test_utils.py (modified, +1/-0)

PR #24461: feat(mistral): Mistral Small 4 reasoning via supports_reasoning (fixes #24416)

Description (problem / solution / changelog)

Summary

Closes #24416.

  • Gate thinking / reasoning_effort on litellm.supports_reasoning(model, custom_llm_provider='mistral') instead of requiring magistral in the model id.
  • Add mistral/mistral-small-2603 to model_prices_and_context_window.json with supports_reasoning: true.
  • Unit test + mistral.md docs update.

CI hygiene

  • Refactor A2A / Anthropic guardrail handlers to fix PLR0915.
  • Black on files flagged by LiteLLM Linting (litellm_logging.py, OpenAI guardrail handler, audit_logs.py, proxy/utils.py).

Relevant issues

https://github.com/BerriAI/litellm/issues/24416

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changed files

  • docs/my-website/docs/providers/mistral.md (modified, +5/-4)
  • enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py (modified, +4/-0)
  • litellm/litellm_core_utils/litellm_logging.py (modified, +4/-4)
  • litellm/llms/a2a/chat/guardrail_translation/handler.py (modified, +89/-53)
  • litellm/llms/anthropic/chat/guardrail_translation/handler.py (modified, +81/-61)
  • litellm/llms/mistral/chat/transformation.py (modified, +80/-12)
  • litellm/llms/openai/chat/guardrail_translation/handler.py (modified, +3/-3)
  • litellm/model_prices_and_context_window_backup.json (modified, +16/-0)
  • litellm/proxy/_types.py (modified, +1/-0)
  • litellm/proxy/batches_endpoints/endpoints.py (modified, +68/-0)
  • litellm/proxy/management_helpers/audit_logs.py (modified, +9/-5)
  • litellm/proxy/openai_files_endpoints/common_utils.py (modified, +59/-0)
  • litellm/proxy/spend_tracking/spend_tracking_utils.py (modified, +1/-0)
  • model_prices_and_context_window.json (modified, +16/-0)
  • tests/batches_tests/test_batches_logging_unit_tests.py (modified, +17/-9)
  • tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py (modified, +37/-19)
  • tests/test_litellm/conftest.py (modified, +5/-0)
  • tests/test_litellm/llms/mistral/test_mistral_chat_transformation.py (modified, +19/-2)

PR #24497: Issue 24267 v2

Description (problem / solution / changelog)

Summary

Adds Amazon Nova Canvas image edit on Bedrock (InvokeModel), wires it through the handler and ProviderConfigManager, tightens mask / routing behavior, expands tests and docs, applies Black where CI required, and refactors A2A / Anthropic guardrail handlers to satisfy Ruff PLR0915.

Closes #24267 (if that’s the tracking issue—adjust if not).

Relevant issues

https://github.com/BerriAI/litellm/issues/24267

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

Bedrock Nova Canvas image edit

New config: BedrockAmazonNovaCanvasImageEditConfig + get_bedrock_image_edit_config_for_model() in amazon_nova_canvas_image_edit_transformation.py. Maps OpenAI-style image_edit to Nova task types: IMAGE_VARIATION, INPAINTING, OUTPAINTING, BACKGROUND_REMOVAL (per AWS Nova docs). BedrockImageEdit.get_config_class and handler routing include Nova Canvas alongside existing Stability edit models. ProviderConfigManager.get_provider_image_edit_config for BEDROCK uses get_bedrock_image_edit_config_for_model() so proxy/SDK paths match the handler.

Correctness & errors

Unsupported models: Unknown Bedrock image-edit models (neither a known Stability edit id nor Nova Canvas via supports_nova_canvas_image_edit in model_prices_and_context_window.json) fall back to BedrockStabilityImageEditConfig for legacy compatibility, with a verbose_logger.warning that explains the situation and how to fix it. Routing order matches BedrockImageEdit.get_config_class / get_bedrock_image_edit_config_for_model: Stability → Nova → Stability fallback + warning (not a hard error at routing time).

INPAINTING / OUTPAINTING: Require maskPrompt or maskImage (OpenAI mask=) before building the request; OUTPAINTING fails fast with an explicit error if both are missing (avoids opaque AWS validation errors).

OUTPAINTING mask precedence: maskPrompt wins when both maskPrompt and a binary mask are present.

Tests

tests/test_litellm/llms/bedrock/image_edit/test_amazon_nova_canvas_image_edit.py: routing, transforms, response mapping, unsupported model, OUTPAINTING variants (mask / maskPrompt / precedence / missing mask), ProviderConfigManager dispatch + end-to-end transform, handler vs helper parity.

Docs

docs/my-website/docs/providers/bedrock_image_gen.md: Nova Canvas image edit section (tasks, masks, ValueError for unsupported models). Lint / CI hygiene Black (CI): litellm_logging.py, OpenAI guardrail handler.py, audit_logs.py, proxy/utils.py (and related formatting-only edits). Ruff PLR0915: Split process_output_streaming_response (A2A) and process_output_response (Anthropic) into small helpers—no intended behavior change.

Changed files

  • docs/my-website/docs/providers/bedrock_image_gen.md (modified, +25/-0)
  • enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py (modified, +4/-0)
  • litellm/llms/a2a/chat/guardrail_translation/handler.py (modified, +89/-53)
  • litellm/llms/anthropic/chat/guardrail_translation/handler.py (modified, +81/-61)
  • litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py (added, +478/-0)
  • litellm/llms/bedrock/image_edit/handler.py (modified, +19/-2)
  • litellm/llms/openai/chat/guardrail_translation/handler.py (modified, +3/-3)
  • litellm/model_prices_and_context_window_backup.json (modified, +25/-2)
  • litellm/proxy/management_helpers/audit_logs.py (modified, +9/-5)
  • litellm/proxy/spend_tracking/spend_tracking_utils.py (modified, +1/-0)
  • litellm/utils.py (modified, +3/-3)
  • model_prices_and_context_window.json (modified, +25/-2)
  • tests/test_litellm/llms/bedrock/image_edit/test_amazon_nova_canvas_image_edit.py (added, +521/-0)
  • tests/test_litellm/test_utils.py (modified, +1/-0)

PR #24519: feat(bedrock): Amazon Nova Canvas image edit (fixes #24267) #24459

Description (problem / solution / changelog)

Summary

Adds Amazon Nova Canvas image edit on Bedrock (InvokeModel), wires it through the handler and ProviderConfigManager, tightens mask / routing behavior, expands tests and docs, applies Black where CI required, and refactors A2A / Anthropic guardrail handlers to satisfy Ruff PLR0915.

Closes #24267 (if that’s the tracking issue—adjust if not).

Relevant issues

https://github.com/BerriAI/litellm/issues/24267

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

Summary Adds OpenAI-compatible image_edit() support for Amazon Nova Canvas on Bedrock (InvokeModel), with task routing aligned to AWS Nova Canvas (e.g. IMAGE_VARIATION, INPAINTING, OUTPAINTING, BACKGROUND_REMOVAL), validation for unknown taskType, and correct handling of masks / maskPrompt / outPaintingMode.

Routing uses supports_nova_canvas_image_edit: true in model_prices_and_context_window.json (and the bundled backup) so new inference IDs are config-driven, not hardcoded name checks in code.

Implementation notes BedrockAmazonNovaCanvasImageEditConfig (amazon_nova_canvas_image_edit_transformation.py): maps OpenAI-style inputs to Nova Canvas request bodies; omits imageGenerationConfig for BACKGROUND_REMOVAL per AWS constraints. BedrockImageEdit.get_config_class and ProviderConfigManager.get_provider_image_edit_config agree on Nova vs Stability; unknown Bedrock image-edit models still fall back to the Stability adapter with a warning (legacy behavior). get_complete_url: raises NotImplementedError — real URLs are built in BedrockImageEdit._prepare_request (SigV4 / runtime endpoint), not a placeholder URL. model_prices_and_context_window.json (+ backup): supports_nova_canvas_image_edit for amazon.nova-canvas-v1:0, us. / eu. / ap. cross-region IDs where applicable. Tests Unit tests for task types, error paths, handler/helper/PCM routing parity, and ProviderConfigManager dispatch (mock-only; no live network calls). Autouse fixture merges Nova Canvas model_cost entries when CI loads a remote cost map that lags this PR. Docs docs/my-website/docs/providers/bedrock_image_gen.md: Nova Canvas image edit section (inference IDs, supports_nova_canvas_image_edit, proxy examples). Out of scope / follow-ups user_api_key_project_alias changes in unrelated modules (e.g. PagerDuty / spend tracking), if present on the branch, are better as a separate PR unless this branch intentionally bundles them. Optional hardening: quality (hd → premium) in transform_image_edit_request for callers that bypass map_openai_params; docs example should use a with open(...) context manager for file handles.

Changed files

  • docs/my-website/docs/providers/bedrock_image_gen.md (modified, +25/-0)
  • enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py (modified, +4/-0)
  • litellm/llms/a2a/chat/guardrail_translation/handler.py (modified, +89/-53)
  • litellm/llms/anthropic/chat/guardrail_translation/handler.py (modified, +81/-61)
  • litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py (added, +481/-0)
  • litellm/llms/bedrock/image_edit/handler.py (modified, +19/-2)
  • litellm/llms/openai/chat/guardrail_translation/handler.py (modified, +3/-3)
  • litellm/model_prices_and_context_window_backup.json (modified, +25/-2)
  • litellm/proxy/management_helpers/audit_logs.py (modified, +9/-5)
  • litellm/proxy/spend_tracking/spend_tracking_utils.py (modified, +1/-0)
  • litellm/utils.py (modified, +3/-3)
  • model_prices_and_context_window.json (modified, +25/-2)
  • tests/test_litellm/llms/bedrock/image_edit/test_amazon_nova_canvas_image_edit.py (added, +521/-0)
  • tests/test_litellm/test_utils.py (modified, +1/-0)

PR #24520: feat(bedrock): Amazon Nova Canvas image edit (fixes #24267)

Description (problem / solution / changelog)

Relevant issues

This PR adds Amazon Nova Canvas image-edit support on Bedrock (amazon.nova-canvas-v1:0 and regional variants) by introducing BedrockAmazonNovaCanvasImageEditConfig, which maps OpenAI-style image-edit requests to Nova Canvas task types (INPAINTING, OUTPAINTING, IMAGE_VARIATION, BACKGROUND_REMOVAL). It also ships a collection of unrelated fixes: A2A and Anthropic guardrail handlers are refactored (long methods split into private helpers with no logic change), managed-files double-encoding of batch IDs is corrected, get_batch_from_database now stamps _hidden_params for the managed-files hook, and user_api_key_project_alias is propagated to PagerDuty and spend-tracking payloads.

Pre-Submission checklist

https://github.com/BerriAI/litellm/issues/24267

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

Error handling in transform_image_edit_response now correctly checks HTTP status, an errors field, finish_reasons (correctly exempting "SUCCESS"), and a message field guarded by the absence of images. get_config_class and ProviderConfigManager both route to the correct config class/instance for all known Bedrock image-edit models; the legacy Stability fallback for unrecognised models is preserved with a warning log. All new tests use in-memory/mock data (no real network calls), satisfying the repo's test isolation rule.

Changed files

  • docs/my-website/docs/providers/bedrock_image_gen.md (modified, +25/-0)
  • enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py (modified, +4/-0)
  • enterprise/litellm_enterprise/proxy/hooks/managed_files.py (modified, +6/-3)
  • litellm/llms/a2a/chat/guardrail_translation/handler.py (modified, +89/-53)
  • litellm/llms/anthropic/chat/guardrail_translation/handler.py (modified, +81/-61)
  • litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py (added, +499/-0)
  • litellm/llms/bedrock/image_edit/handler.py (modified, +19/-2)
  • litellm/llms/openai/chat/guardrail_translation/handler.py (modified, +3/-3)
  • litellm/model_prices_and_context_window_backup.json (modified, +11/-2)
  • litellm/proxy/management_helpers/audit_logs.py (modified, +9/-5)
  • litellm/proxy/openai_files_endpoints/common_utils.py (modified, +13/-0)
  • litellm/proxy/spend_tracking/spend_tracking_utils.py (modified, +1/-0)
  • litellm/utils.py (modified, +3/-3)
  • model_prices_and_context_window.json (modified, +11/-2)
  • tests/test_litellm/llms/bedrock/image_edit/test_amazon_nova_canvas_image_edit.py (added, +563/-0)
  • tests/test_litellm/test_utils.py (modified, +1/-0)

PR #7838: add support for Amazon Nova Canvas model

Description (problem / solution / changelog)

Title

Add initial support for Amazon Nova Canvas image generation

Relevant issues

<!-- e.g. "Fixes #000" -->

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

  • Adds Nova Canvas model to provider list and adds supporting transformations for Bedrock

[REQUIRED] Testing - Attach a screenshot of any new tests passing locally

Added new test TestBedrockNova image

Changed files

  • litellm/__init__.py (modified, +1/-0)
  • litellm/llms/bedrock/image/amazon_nova_canvas_transformation.py (added, +106/-0)
  • litellm/llms/bedrock/image/image_handler.py (modified, +3/-0)
  • litellm/model_prices_and_context_window_backup.json (modified, +17/-11)
  • litellm/types/llms/bedrock.py (modified, +57/-0)
  • litellm/utils.py (modified, +1/-0)
  • model_prices_and_context_window.json (modified, +17/-11)
  • tests/image_gen_tests/test_image_generation.py (modified, +10/-0)

Code Example

INFO:     Started server process [1]
INFO:     Waiting for application startup.

   ██╗     ██╗████████╗███████╗██╗     ██╗     ███╗   ███╗
   ██║     ██║╚══██╔══╝██╔════╝██║     ██║     ████╗ ████║
   ██║     ██║   ██║   █████╗  ██║     ██║     ██╔████╔██║
   ██║     ██║   ██║   ██╔══╝  ██║     ██║     ██║╚██╔╝██║
   ███████╗██║   ██║   ███████╗███████╗███████╗██║ ╚═╝ ██║
   ╚══════╝╚═╝   ╚═╝   ╚══════╝╚══════╝╚══════╝╚═╝     ╚═╝

query-engine ac9d7041ed77bcc8a8dbd2ab6616b39013829574
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:4000 (Press CTRL+C to quit)

#------------------------------------------------------------#
#                                                            #
#            'The thing I wish you improved is...'            #
#        https://github.com/BerriAI/litellm/issues/new        #
#                                                            #
#------------------------------------------------------------#

 Thank you for using LiteLLM! - Krrish & Ishaan



Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new



Setting Cache on Proxy
LiteLLM: Proxy initialized with Config, Set models:
    amazon-nova-canvas
    sd3.5-core
    sd3.5-large
    sd3.5-ultra
INFO:     127.0.0.1:38032 - "GET /health/liveliness HTTP/1.1" 200 OK
04:41:39 - LiteLLM Proxy:ERROR: common_request_processing.py:1220 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
. Received Model Group=amazon-nova-canvas
Available Model Group Fallbacks=None LiteLLM Retried: 2 times, LiteLLM Max Retries: 2
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5508, in async_function_with_retries
    response = await self.make_call(original_function, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call
    response = await response
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper
    response = await response  # type: ignore
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit
    raise litellm.exception_type(
    ...<5 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit
    init_response = await loop.run_in_executor(None, func_with_context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper
    result = original_function(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit
    raise litellm.exception_type(
          ~~~~~~~~~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type
    raise APIConnectionError(
    ...<8 lines>...
    )
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/image_endpoints/endpoints.py", line 304, in image_edit_api
    return await processor.base_process_llm_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<16 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/common_request_processing.py", line 953, in base_process_llm_request
    responses = await llm_responses
                ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5005, in async_wrapper
    return await self._ageneric_api_call_with_fallbacks(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3722, in _ageneric_api_call_with_fallbacks
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3709, in _ageneric_api_call_with_fallbacks
    response = await self.async_function_with_fallbacks(**kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5411, in async_function_with_fallbacks
    return await self.async_function_with_fallbacks_common_utils(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5368, in async_function_with_fallbacks_common_utils
    raise original_exception
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5402, in async_function_with_fallbacks
    response = await self.async_function_with_retries(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5665, in async_function_with_retries
    raise original_exception
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5594, in async_function_with_retries
    response = await self.make_call(original_function, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call
    response = await response
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper
    response = await response  # type: ignore
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit
    raise litellm.exception_type(
    ...<5 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit
    init_response = await loop.run_in_executor(None, func_with_context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper
    result = original_function(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit
    raise litellm.exception_type(
          ~~~~~~~~~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type
    raise APIConnectionError(
    ...<8 lines>...
    )
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
. Received Model Group=amazon-nova-canvas
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

The Feature

Please add image edit support for Nova Canvas in Bedrock. This doesn't seem to be supported by LiteLLM.

INFO:     Started server process [1]
INFO:     Waiting for application startup.

   ██╗     ██╗████████╗███████╗██╗     ██╗     ███╗   ███╗
   ██║     ██║╚══██╔══╝██╔════╝██║     ██║     ████╗ ████║
   ██║     ██║   ██║   █████╗  ██║     ██║     ██╔████╔██║
   ██║     ██║   ██║   ██╔══╝  ██║     ██║     ██║╚██╔╝██║
   ███████╗██║   ██║   ███████╗███████╗███████╗██║ ╚═╝ ██║
   ╚══════╝╚═╝   ╚═╝   ╚══════╝╚══════╝╚══════╝╚═╝     ╚═╝

query-engine ac9d7041ed77bcc8a8dbd2ab6616b39013829574
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:4000 (Press CTRL+C to quit)

#------------------------------------------------------------#
#                                                            #
#            'The thing I wish you improved is...'            #
#        https://github.com/BerriAI/litellm/issues/new        #
#                                                            #
#------------------------------------------------------------#

 Thank you for using LiteLLM! - Krrish & Ishaan



Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new



Setting Cache on Proxy
LiteLLM: Proxy initialized with Config, Set models:
    amazon-nova-canvas
    sd3.5-core
    sd3.5-large
    sd3.5-ultra
INFO:     127.0.0.1:38032 - "GET /health/liveliness HTTP/1.1" 200 OK
04:41:39 - LiteLLM Proxy:ERROR: common_request_processing.py:1220 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
. Received Model Group=amazon-nova-canvas
Available Model Group Fallbacks=None LiteLLM Retried: 2 times, LiteLLM Max Retries: 2
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5508, in async_function_with_retries
    response = await self.make_call(original_function, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call
    response = await response
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper
    response = await response  # type: ignore
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit
    raise litellm.exception_type(
    ...<5 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit
    init_response = await loop.run_in_executor(None, func_with_context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper
    result = original_function(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit
    raise litellm.exception_type(
          ~~~~~~~~~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type
    raise APIConnectionError(
    ...<8 lines>...
    )
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/image_endpoints/endpoints.py", line 304, in image_edit_api
    return await processor.base_process_llm_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<16 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/common_request_processing.py", line 953, in base_process_llm_request
    responses = await llm_responses
                ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5005, in async_wrapper
    return await self._ageneric_api_call_with_fallbacks(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3722, in _ageneric_api_call_with_fallbacks
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3709, in _ageneric_api_call_with_fallbacks
    response = await self.async_function_with_fallbacks(**kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5411, in async_function_with_fallbacks
    return await self.async_function_with_fallbacks_common_utils(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5368, in async_function_with_fallbacks_common_utils
    raise original_exception
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5402, in async_function_with_fallbacks
    response = await self.async_function_with_retries(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5665, in async_function_with_retries
    raise original_exception
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5594, in async_function_with_retries
    response = await self.make_call(original_function, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5676, in make_call
    response = await response
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3834, in _ageneric_api_call_with_fallbacks_helper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/router.py", line 3820, in _ageneric_api_call_with_fallbacks_helper
    response = await response  # type: ignore
               ^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 2072, in wrapper_async
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1892, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1060, in aimage_edit
    raise litellm.exception_type(
    ...<5 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 1051, in aimage_edit
    init_response = await loop.run_in_executor(None, func_with_context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1775, in wrapper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/utils.py", line 1596, in wrapper
    result = original_function(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 980, in image_edit
    raise litellm.exception_type(
          ~~~~~~~~~~~~~~~~~~~~~~^
        model=model,
        ^^^^^^^^^^^^
    ...<3 lines>...
        extra_kwargs=kwargs,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2456, in exception_type
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2432, in exception_type
    raise APIConnectionError(
    ...<8 lines>...
    )
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/images/main.py", line 914, in image_edit
    return bedrock_image_edit.image_edit(  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        model=model,
        ^^^^^^^^^^^^
    ...<10 lines>...
        REDACTED"api_key"),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 76, in image_edit
    prepared_request = self._prepare_request(
        model=model,
    ...<6 lines>...
        api_key=api_key,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 207, in _prepare_request
    data = self._get_request_body(
        model=model,
    ...<2 lines>...
        optional_params=optional_params,
    )
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 262, in _get_request_body
    config_class = self.get_config_class(model=model)
  File "/usr/lib/python3.13/site-packages/litellm/llms/bedrock/image_edit/handler.py", line 59, in get_config_class
    raise ValueError(f"Unsupported model for bedrock image edit: {model}")
ValueError: Unsupported model for bedrock image edit: amazon.nova-canvas-v1:0
. Received Model Group=amazon-nova-canvas

I am having no issues generating images.

This was supposed to be added in a separate PR (https://github.com/BerriAI/litellm/pull/7838#issuecomment-2701994906) but that doesn't seem to have happened.

Thanks, Rodney

Motivation, pitch

Image editing on LiteLLM is necessary for some internal workflows are are building.

What part of LiteLLM is this about?

SDK (litellm Python package)

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To add image edit support for Nova Canvas in Bedrock, we need to update the get_config_class method in handler.py to support the amazon.nova-canvas-v1:0 model.

Here are the steps:

  • Update the get_config_class method to include the amazon.nova-canvas-v1:0 model.
  • Add a new config class for the amazon.nova-canvas-v1:0 model.
  • Update the image_edit method to use the new config class.

Example code:

# handler.py
def get_config_class(self, model):
    # ... existing code ...
    if model == "amazon.nova-canvas-v1:0":
        return AmazonNovaCanvasV1Config
    # ... existing code ...

class AmazonNovaCanvasV1Config:
    def __init__(self, model):
        self.model = model

    def _prepare_request(self, model, api_key, optional_params):
        # implementation for amazon.nova-canvas-v1:0 model
        pass

    def _get_request_body(self, model, optional_params):
        # implementation for amazon.nova-canvas-v1:0 model
        pass

Verification

To verify that the fix worked, you can test the image edit functionality with the amazon.nova-canvas-v1:0 model. You can use the following code:

# test_handler.py
def test_image_edit():
    handler = BedrockImageEditHandler()
    model = "amazon.nova-canvas-v1:0"
    api_key = "your_api_key"
    optional_params = {}
    response = handler.image_edit(model, api_key, optional_params)
    assert response.status_code == 200

Extra Tips

  • Make sure to update the documentation to reflect the new image edit support for Nova Canvas in Bedrock.
  • Test the image edit functionality thoroughly to ensure it works as expected.
  • Consider adding error handling for cases where the amazon.nova-canvas-v1:0 model is not supported.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Feature]: Image Edit Support for Amazon Nova Canvas [6 pull requests, 1 participants]