Skip to content

Commit 9f12a34

Browse files
committed
add new model pricings, model aliases for o1
1 parent b9ace1f commit 9f12a34

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ chatblade can be used with an Azure OpenAI endpoint, in which case in addition t
226226
### Help
227227

228228
```
229-
usage: Chatblade [-h] [--openai-api-key key] [--temperature t] [-c CHAT_GPT] [-i] [-s] [-t] [-p name] [-e] [-r] [-n] [-o] [--theme theme] [-l] [-S sess] [--session-list] [--session-path] [--session-dump] [--session-delete]
230-
[--session-rename newsess]
229+
usage: Chatblade [-h] [--openai-api-key key] [--openai-base-url key] [--temperature t] [-c CHAT_GPT] [-i] [-s] [-t] [--version] [-p name] [-e] [-r] [-n] [-o] [--theme theme] [-l]
230+
[-S sess] [--session-list] [--session-path] [--session-dump] [--session-delete] [--session-rename newsess]
231231
[query ...]
232232
233233
a CLI Swiss Army Knife for ChatGPT
@@ -241,12 +241,12 @@ options:
241241
--openai-base-url key A custom url to use the openAI against a local or custom model, eg ollama
242242
--temperature t temperature (openai setting)
243243
-c CHAT_GPT, --chat-gpt CHAT_GPT
244-
ChatGPT model - use either the fully qualified model name, or one of 3.5 (gpt-3.5-turbo), 4 (gpt-4),
245-
4t (gpt-4-turbo), 4o (gpt-4o), mini (gpt-4o-mini). Default is gpt-4o-mini. Can also be set via env variable OPENAI_API_MODEL, see
246-
https://platform.openai.com/docs/models/continuous-model-upgrades for available models.
244+
chat GPT model use either the fully qualified model name, or 3.5 (gpt-3.5-turbo), 4 (gpt-4), 4t (gpt-4-turbo), 4o (gpt-4o), mini (gpt-4o-mini),
245+
o1 (o1-preview), o1mini (o1-mini). Can also be set via env variable OPENAI_API_MODEL
247246
-i, --interactive start an interactive chat session. This will implicitly continue the conversation
248247
-s, --stream Stream the incoming text to the terminal
249248
-t, --tokens display what *would* be sent, how many tokens, and estimated costs
249+
--version display the chatblade version
250250
-p name, --prompt-file name prompt name - will load the prompt with that name at ~/.config/chatblade/name or a path to a file
251251
252252
result formatting options:
@@ -265,3 +265,4 @@ session options:
265265
--session-delete delete session
266266
--session-rename newsess rename session
267267
```
268+

chatblade/chat.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ def import_yaml(cls, seq):
3434

3535
costs = [
3636
CostConfig("gpt-3.5-turbo", 0.5, 1.5),
37-
CostConfig("gpt-4", 5, 15),
38-
CostConfig("gpt-4-1106-preview", 5, 15),
39-
CostConfig("gpt-4o-mini", 0.15, 0.6),
37+
CostConfig("gpt-4-turbo", 10, 30),
38+
CostConfig("gpt-4", 30, 60),
39+
CostConfig("gpt-4-1106-preview", 10, 60),
40+
CostConfig("gpt-4o-mini", 0.15, 0.075),
41+
CostConfig("o1-preview", 15, 60),
42+
CostConfig("o1-mini", 3, 1.5),
4043
]
4144

4245

@@ -113,7 +116,9 @@ def build_client(config):
113116
azure_deployment=os.environ.get("OPENAI_API_AZURE_ENGINE"),
114117
)
115118
else:
116-
return openai.OpenAI(api_key=config["openai_api_key"], base_url=config["openai_base_url"])
119+
return openai.OpenAI(
120+
api_key=config["openai_api_key"], base_url=config["openai_base_url"]
121+
)
117122

118123

119124
def query_chat_gpt(messages, config):

chatblade/parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ def get_openai_key(options):
2727
"4t": "gpt-4-turbo",
2828
"4o": "gpt-4o",
2929
"mini": "gpt-4o-mini",
30+
"o1": "o1-preview",
31+
"o1mini": "o1-mini",
3032
}
3133

34+
DEFAULT_MODEL = "mini"
35+
3236

3337
def get_openai_model(options):
3438
choice = options["chat_gpt"]
3539
if not choice:
3640
if "OPENAI_API_MODEL" in os.environ:
3741
choice = os.environ["OPENAI_API_MODEL"]
3842
else:
39-
choice = "mini"
43+
choice = DEFAULT_MODEL
4044

4145
if choice in model_mappings:
4246
return model_mappings[choice]

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = chatblade
3-
version = 0.6.4
3+
version = 0.7.0
44
description = CLI Swiss Army Knife for ChatGPT
55
long_description = file: README.md
66
long_description_content_type=text/markdown

0 commit comments

Comments
 (0)