From e0af091b5e28d831545923601e17970ed09964a5 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 23 May 2024 16:27:08 -0700 Subject: [PATCH 1/2] feat - add prixing for vertex_ai image gen --- litellm/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index c8c49175400..72b734ffac9 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4659,6 +4659,11 @@ def completion_cost( or call_type == CallTypes.aimage_generation.value ): ### IMAGE GENERATION COST CALCULATION ### + if custom_llm_provider == "vertex_ai": + # https://cloud.google.com/vertex-ai/generative-ai/pricing + # Vertex Charges Flat $0.20 per image + return 0.020 + # fix size to match naming convention if "x" in size and "-x-" not in size: size = size.replace("x", "-x-") From 39d6821cd970844a908ba2d96eb398ac0a91a575 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 23 May 2024 16:34:27 -0700 Subject: [PATCH 2/2] feat - add vertex imagegeneration to model price json --- litellm/model_prices_and_context_window_backup.json | 6 ++++++ model_prices_and_context_window.json | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index bede36764e9..7b62772aca9 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -1272,6 +1272,12 @@ "supports_function_calling": true, "supports_vision": true }, + "vertex_ai/imagegeneration@006": { + "cost_per_image": 0.020, + "litellm_provider": "vertex_ai-image-models", + "mode": "image_generation", + "source": "https://cloud.google.com/vertex-ai/generative-ai/pricing" + }, "textembedding-gecko": { "max_tokens": 3072, "max_input_tokens": 3072, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index bede36764e9..7b62772aca9 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -1272,6 +1272,12 @@ "supports_function_calling": true, "supports_vision": true }, + "vertex_ai/imagegeneration@006": { + "cost_per_image": 0.020, + "litellm_provider": "vertex_ai-image-models", + "mode": "image_generation", + "source": "https://cloud.google.com/vertex-ai/generative-ai/pricing" + }, "textembedding-gecko": { "max_tokens": 3072, "max_input_tokens": 3072,