Skip to content

Commit

Permalink
o1 openai models (#89)
Browse files Browse the repository at this point in the history
Modelled on this commit
d90b1b9,
I've added the new openai
[o1](https://openai.com/index/introducing-openai-o1-preview/) models.
  • Loading branch information
williamjameshandley authored Sep 15, 2024
1 parent d90b1b9 commit fb03452
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions gptcli/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def get_completion_provider(model: str) -> CompletionProvider:
or model.startswith("ft:gpt")
or model.startswith("oai-compat:")
or model.startswith("chatgpt")
or model.startswith("o1")
):
return OpenAICompletionProvider()
elif model.startswith("claude"):
Expand Down
13 changes: 13 additions & 0 deletions gptcli/providers/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ def complete(
"response": 0.600 / 1_000_000,
}

O_1_PREVIEW_PRICE_PER_TOKEN: Pricing = {
"prompt": 15.0 / 1_000_000,
"response": 60.0 / 1_000_000,
}

O_1_MINI_PRICE_PER_TOKEN: Pricing = {
"prompt": 3.0 / 1_000_000,
"response": 12.0 / 1_000_000,
}

def gpt_pricing(model: str) -> Optional[Pricing]:
if model.startswith("gpt-3.5-turbo-16k"):
Expand All @@ -140,5 +149,9 @@ def gpt_pricing(model: str) -> Optional[Pricing]:
return GPT_4_TURBO_PRICE_PER_TOKEN
elif model.startswith("gpt-4"):
return GPT_4_PRICE_PER_TOKEN
elif model.startswith("o1-preview"):
return O_1_PREVIEW_PRICE_PER_TOKEN
elif model.startswith("o1-mini"):
return O_1_MINI_PRICE_PER_TOKEN
else:
return None

0 comments on commit fb03452

Please sign in to comment.