Skip to content

Commit 24cebaf

Browse files
committed
add o3 and o4 models
1 parent 858b5f6 commit 24cebaf

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

request_llms/bridge_all.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,49 @@ def decode(self, *args, **kwargs):
314314
"openai_force_temperature_one": True,
315315
},
316316

317+
"gpt-4.1":{
318+
"fn_with_ui": chatgpt_ui,
319+
"fn_without_ui": chatgpt_noui,
320+
"has_multimodal_capacity": True,
321+
"endpoint": openai_endpoint,
322+
"max_token": 828000,
323+
"tokenizer": tokenizer_gpt4,
324+
"token_cnt": get_token_num_gpt4,
325+
},
326+
327+
"gpt-4.1-mini":{
328+
"fn_with_ui": chatgpt_ui,
329+
"fn_without_ui": chatgpt_noui,
330+
"has_multimodal_capacity": True,
331+
"endpoint": openai_endpoint,
332+
"max_token": 828000,
333+
"tokenizer": tokenizer_gpt4,
334+
"token_cnt": get_token_num_gpt4,
335+
},
336+
337+
"o3":{
338+
"fn_with_ui": chatgpt_ui,
339+
"fn_without_ui": chatgpt_noui,
340+
"has_multimodal_capacity": True,
341+
"endpoint": openai_endpoint,
342+
"max_token": 828000,
343+
"tokenizer": tokenizer_gpt4,
344+
"token_cnt": get_token_num_gpt4,
345+
"openai_disable_system_prompt": True,
346+
"openai_disable_stream": True,
347+
"openai_force_temperature_one": True,
348+
},
349+
350+
"o4-mini":{
351+
"fn_with_ui": chatgpt_ui,
352+
"fn_without_ui": chatgpt_noui,
353+
"has_multimodal_capacity": True,
354+
"endpoint": openai_endpoint,
355+
"max_token": 828000,
356+
"tokenizer": tokenizer_gpt4,
357+
"token_cnt": get_token_num_gpt4,
358+
},
359+
317360
"gpt-4-turbo": {
318361
"fn_with_ui": chatgpt_ui,
319362
"fn_without_ui": chatgpt_noui,

shared_utils/key_pattern_manager.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,22 @@ def what_keys(keys):
7979

8080
return f"检测到: OpenAI Key {avail_key_list['OpenAI Key']} 个, Azure Key {avail_key_list['Azure Key']} 个, API2D Key {avail_key_list['API2D Key']} 个"
8181

82+
def is_o_family_for_openai(llm_model):
83+
if not llm_model.startswith('o'):
84+
return False
85+
if llm_model in ['o1', 'o2', 'o3', 'o4', 'o5', 'o6', 'o7', 'o8']:
86+
return True
87+
if llm_model[:3] in ['o1-', 'o2-', 'o3-', 'o4-', 'o5-', 'o6-', 'o7-', 'o8-']:
88+
return True
89+
return False
8290

8391
def select_api_key(keys, llm_model):
8492
import random
8593
avail_key_list = []
8694
key_list = keys.split(',')
8795

8896
if llm_model.startswith('gpt-') or llm_model.startswith('chatgpt-') or \
89-
llm_model.startswith('one-api-') or llm_model == 'o1' or llm_model.startswith('o1-'):
97+
llm_model.startswith('one-api-') or is_o_family_for_openai(llm_model):
9098
for k in key_list:
9199
if is_openai_api_key(k): avail_key_list.append(k)
92100

0 commit comments

Comments
 (0)