Skip to content

Commit

Permalink
Add more OpenAI models
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolvoet committed Aug 5, 2024
1 parent c75fe2b commit dab444c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/scrapeghost/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
@dataclass
class Model:
name: str
prompt_token_cost: float # per 1k
completion_token_cost: float # per 1k
max_tokens: int
json_mode: bool
prompt_token_cost: float # $ per 1k input tokens, see https://openai.com/api/pricing
completion_token_cost: float # $ per 1k output tokens, see https://openai.com/api/pricing
max_tokens: int # max output tokens
json_mode: bool # see https://platform.openai.com/docs/guides/json-mode

def cost(self, prompt_tokens: int, completion_tokens: int) -> float:
return (
Expand All @@ -20,6 +20,10 @@ def cost(self, prompt_tokens: int, completion_tokens: int) -> float:
Model("gpt-4", 0.03, 0.06, 8192, False),
Model("gpt-4-32k", 0.06, 0.12, 32768, False),
Model("gpt-4-1106-preview", 0.01, 0.03, 128000, True),
Model("gpt-4-turbo", 0.01, 0.03, 4096, True),
Model("gpt-4-turbo-preview", 0.01, 0.03, 4096, True),
Model("gpt-4o", 0.005, 0.015, 4096, True),
Model("gpt-4o-mini", 0.00015, 0.0006, 16384, True),
Model("gpt-3.5-turbo", 0.001, 0.002, 16384, False),
Model("gpt-3.5-turbo-1106", 0.001, 0.002, 16384, True),
]
Expand Down

0 comments on commit dab444c

Please sign in to comment.