mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
fix(image_endpoints): apply key/team router_settings to /v1/images/generations endpoint
Signed-off-by: cf3901646 <cf3901646@users.noreply.github.com>
This commit is contained in:
parent
9fbeebc988
commit
82fd95d550
1 changed files with 21 additions and 0 deletions
|
|
@ -150,6 +150,27 @@ async def image_generation(
|
|||
data["prompt"] = get_str_from_messages(messages)
|
||||
data.pop("messages", None)
|
||||
|
||||
## APPLY KEY/TEAM ROUTER SETTINGS ##
|
||||
# Read key/team router_settings and apply them to route_request
|
||||
# This matches the behavior in base_process_llm_request
|
||||
if proxy_config is not None:
|
||||
try:
|
||||
from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing
|
||||
|
||||
# Create a temporary processor to get router_settings_override
|
||||
temp_processor = ProxyBaseLLMRequestProcessing(data=data)
|
||||
router_settings_override = temp_processor.common_processing_pre_call_logic(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
data=data,
|
||||
route_type="aimage_generation",
|
||||
proxy_config=proxy_config,
|
||||
)
|
||||
if router_settings_override:
|
||||
data["router_settings_override"] = router_settings_override
|
||||
except Exception:
|
||||
# If reading router_settings fails, continue without override
|
||||
pass
|
||||
|
||||
## ROUTE TO CORRECT ENDPOINT ##
|
||||
llm_call: Final = await route_request(
|
||||
data=data,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue