diff --git a/litellm/utils.py b/litellm/utils.py index 9ca2cdff0..ccb6c70e7 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4168,13 +4168,18 @@ def cost_per_token( model_without_prefix = model_parts[1] else: model_without_prefix = model - - if model in model_cost_ref: # Option 1. use model passed, model="gpt-4" - model = model - elif ( + """ + Code block that formats model to lookup in litellm.model_cost + Option1. model = "bedrock/ap-northeast-1/anthropic.claude-instant-v1". This is the most accurate since it is region based. Should always be option 1 + Option2. model = "openai/gpt-4" - model = provider/model + Option3. model = "anthropic.claude-3" - model = model + """ + if ( model_with_provider in model_cost_ref ): # Option 2. use model with provider, model = "openai/gpt-4" model = model_with_provider + elif model in model_cost_ref: # Option 1. use model passed, model="gpt-4" + model = model elif ( model_without_prefix in model_cost_ref ): # Option 3. if user passed model="bedrock/anthropic.claude-3", use model="anthropic.claude-3"