Skip to content

Commit

Permalink
add prices informations
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJlvt committed Oct 3, 2024
1 parent fc92535 commit c7446dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pricing_data = LlmPricingScraper.scrape()
for entry in pricing_data:
print(f"Model: {entry.model}")
print(f"Provider: {entry.provider}")
print(f"1M input tokens: {entry.input_tokens_price}")
print(f"1M output tokens: {entry.output_tokens_price}")
print(f"1M input tokens: {entry.input_tokens_price}$")
print(f"1M output tokens: {entry.output_tokens_price}$")
print(f"Context: {entry.context}")
print(f"Source: {entry.source}")
print(f"Updated: {entry.updated}")
Expand All @@ -39,8 +39,8 @@ print("GPT-4o models:")
for entry in gpt_4o_models:
print(f"Model: {entry.model}")
print(f"Provider: {entry.provider}")
print(f"1M input tokens: {entry.input_tokens_price}")
print(f"1M output tokens: {entry.output_tokens_price}")
print(f"1M input tokens: {entry.input_tokens_price}$")
print(f"1M output tokens: {entry.output_tokens_price}$")
print(f"Context: {entry.context}")
print(f"Source: {entry.source}")
print(f"Updated: {entry.updated}")
Expand Down
18 changes: 11 additions & 7 deletions llm_pricing_sdk/llm_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ def __init__(self, model, provider, input_tokens_price,
output_tokens_price, context, source, updated):
self.model = model
self.provider = provider
self.input_tokens_price = input_tokens_price
self.output_tokens_price = output_tokens_price
self.context = context
self.source = source
self.input_tokens_price = input_tokens_price # price per 1M tokens in dollars USD
self.output_tokens_price = output_tokens_price # price per 1M tokens in dollars USD
self.context = context # context for the model
self.source = source # source of the pricing information
self.updated = updated

def __str__(self):
return f"Model: {self.model}, Provider: {self.provider}, Input Price: {self.input_tokens_price}, " \
f"Output Price: {self.output_tokens_price}, Context: {self.context}, " \
f"Source: {self.source}, Updated: {self.updated}"
return f"Model: {self.model}, " \
f"Provider: {self.provider}, " \
f"Input Price: {self.input_tokens_price}, " \
f"Output Price: {self.output_tokens_price}, " \
f"Context: {self.context}, " \
f"Source: {self.source}, " \
f"Updated: {self.updated}"

class LlmPricingScraper:
@staticmethod
Expand Down

0 comments on commit c7446dc

Please sign in to comment.