Merge pull request #3809 from BerriAI/litellm_add_pricing_forvertex_imagen

[Feat] Add Cost Tracking for `vertex_ai/imagegeneration@006`
This commit is contained in:
Ishaan Jaff 2024-05-23 16:40:25 -07:00 committed by GitHub
commit 8febdadef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -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,

View file

@ -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-")

View file

@ -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,