Skip to content

Commit 9365dda

Browse files
committed
feat(models): add support for GPT-5 and Claude 4.5 models
Add configurations for new AI models including GPT-5, GPT-5 Mini, GPT-5 Nano, Claude Sonnet 4.5, and Claude Haiku 4.5 across background, content, options, and utils scripts. This expands the extension's AI capabilities with updated model options for improved summarization.
1 parent 4dab157 commit 9365dda

File tree

4 files changed

+108
-8
lines changed

4 files changed

+108
-8
lines changed

background.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,17 @@ async function tryOpenAI(
712712
{
713713
role: 'user',
714714
content: `IMPORTANT: Provide ONLY a <ul> list with 5 <li> items and no introduction, titles, or extra text. Format like this:
715-
715+
716716
<ul>
717717
<li>[First bullet content]</li>
718718
<li>[Second bullet content]</li>
719719
<li>[Third bullet content]</li>
720720
<li>[Fourth bullet content]</li>
721721
<li>[Fifth bullet content]</li>
722722
</ul>
723-
723+
724724
Provide the summary in the following language: ${language}
725-
725+
726726
Content to summarize:
727727
${content.substring(0, 12000)}`,
728728
},
@@ -778,17 +778,17 @@ async function tryGeminiAPI(
778778
parts: [
779779
{
780780
text: `Provide the summary in the following language: ${language}
781-
781+
782782
IMPORTANT: Provide ONLY a <ul> list with 5 <li> items and no introduction, titles, or extra text. Format like this:
783-
783+
784784
<ul>
785785
<li>[First bullet content]</li>
786786
<li>[Second bullet content]</li>
787787
<li>[Third bullet content]</li>
788788
<li>[Fourth bullet content]</li>
789789
<li>[Fifth bullet content]</li>
790790
</ul>
791-
791+
792792
Content to summarize:
793793
${content.substring(0, 12000)}`,
794794
},
@@ -859,15 +859,15 @@ async function tryAnthropicAPI(
859859
{
860860
role: 'user',
861861
content: `IMPORTANT: Provide ONLY a <ul> list with 5 <li> items and no introduction, titles, or extra text. Format like this:
862-
862+
863863
<ul>
864864
<li>[First bullet content]</li>
865865
<li>[Second bullet content]</li>
866866
<li>[Third bullet content]</li>
867867
<li>[Fourth bullet content]</li>
868868
<li>[Fifth bullet content]</li>
869869
</ul>
870-
870+
871871
Content to summarize:
872872
${content.substring(0, 12000)}`,
873873
},

content.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,18 @@ async function checkChromeBuiltinSupport(): Promise<boolean> {
113113
'gpt-4',
114114
'gpt-4-turbo',
115115
'gpt-4o',
116+
'gpt-5',
117+
'gpt-5-mini',
118+
'gpt-5-nano',
116119
'gemini-2.5-pro',
117120
'gemini-2.5-flash',
118121
'gemini-2.0-flash-exp',
119122
'claude-3-haiku',
120123
'claude-3-sonnet',
121124
'claude-3-opus',
122125
'claude-3.5-sonnet',
126+
'claude-sonnet-4.5',
127+
'claude-haiku-4.5',
123128
];
124129

125130
for (const model of alternativeModels) {
@@ -298,6 +303,24 @@ async function checkChromeBuiltinSupport(): Promise<boolean> {
298303
name: 'GPT-4o',
299304
cost: 0.005,
300305
},
306+
'gpt-5': {
307+
provider: 'openai',
308+
modelId: 'gpt-5',
309+
name: 'GPT-5',
310+
cost: 0.00125,
311+
},
312+
'gpt-5-mini': {
313+
provider: 'openai',
314+
modelId: 'gpt-5-mini',
315+
name: 'GPT-5 Mini',
316+
cost: 0.00025,
317+
},
318+
'gpt-5-nano': {
319+
provider: 'openai',
320+
modelId: 'gpt-5-nano',
321+
name: 'GPT-5 Nano',
322+
cost: 0.00005,
323+
},
301324
'gemini-2.5-pro': {
302325
provider: 'gemini',
303326
modelId: 'gemini-2.5-pro',
@@ -340,6 +363,18 @@ async function checkChromeBuiltinSupport(): Promise<boolean> {
340363
name: 'Claude 3.5 Sonnet',
341364
cost: 0.003,
342365
},
366+
'claude-sonnet-4.5': {
367+
provider: 'anthropic',
368+
modelId: 'claude-sonnet-4.5',
369+
name: 'Claude Sonnet 4.5',
370+
cost: 0.003,
371+
},
372+
'claude-haiku-4.5': {
373+
provider: 'anthropic',
374+
modelId: 'claude-haiku-4.5',
375+
name: 'Claude Haiku 4.5',
376+
cost: 0.001,
377+
},
343378
};
344379
return models[model];
345380
}
@@ -847,13 +882,18 @@ async function checkChromeBuiltinSupport(): Promise<boolean> {
847882
{ value: 'gpt-4', label: 'GPT-4' },
848883
{ value: 'gpt-4-turbo', label: 'GPT-4 Turbo' },
849884
{ value: 'gpt-4o', label: 'GPT-4o' },
885+
{ value: 'gpt-5', label: 'GPT-5' },
886+
{ value: 'gpt-5-mini', label: 'GPT-5 Mini' },
887+
{ value: 'gpt-5-nano', label: 'GPT-5 Nano' },
850888
{ value: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' },
851889
{ value: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash' },
852890
{ value: 'gemini-2.0-flash-exp', label: 'Gemini 2.0 Flash' },
853891
{ value: 'claude-3-haiku', label: 'Claude 3 Haiku' },
854892
{ value: 'claude-3-sonnet', label: 'Claude 3 Sonnet' },
855893
{ value: 'claude-3-opus', label: 'Claude 3 Opus' },
856894
{ value: 'claude-3.5-sonnet', label: 'Claude 3.5 Sonnet' },
895+
{ value: 'claude-sonnet-4.5', label: 'Claude Sonnet 4.5' },
896+
{ value: 'claude-haiku-4.5', label: 'Claude Haiku 4.5' },
857897
];
858898

859899
// Get API keys to check availability

options.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,24 @@ function optionsGetModelConfig(model: string): ModelConfig | undefined {
287287
name: 'GPT-4o',
288288
cost: 0.005,
289289
},
290+
'gpt-5': {
291+
provider: 'openai',
292+
modelId: 'gpt-5',
293+
name: 'GPT-5',
294+
cost: 0.00125,
295+
},
296+
'gpt-5-mini': {
297+
provider: 'openai',
298+
modelId: 'gpt-5-mini',
299+
name: 'GPT-5 Mini',
300+
cost: 0.00025,
301+
},
302+
'gpt-5-nano': {
303+
provider: 'openai',
304+
modelId: 'gpt-5-nano',
305+
name: 'GPT-5 Nano',
306+
cost: 0.00005,
307+
},
290308
'gemini-2.5-pro': {
291309
provider: 'gemini',
292310
modelId: 'gemini-2.5-pro',
@@ -329,6 +347,18 @@ function optionsGetModelConfig(model: string): ModelConfig | undefined {
329347
name: 'Claude 3.5 Sonnet',
330348
cost: 0.003,
331349
},
350+
'claude-4-5-sonnet': {
351+
provider: 'anthropic',
352+
modelId: 'claude-4-5-sonnet',
353+
name: 'Sonnet 4.5',
354+
cost: 0.003,
355+
},
356+
'claude-4-5-haiku': {
357+
provider: 'anthropic',
358+
modelId: 'claude-4-5-haiku',
359+
name: 'Haiku 4.5',
360+
cost: 0.001,
361+
},
332362
};
333363
return models[model];
334364
}

utils.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,24 @@ export function getModelConfig(model: string): ModelConfig | undefined {
155155
name: 'GPT-4o',
156156
cost: 0.005,
157157
},
158+
'gpt-5': {
159+
provider: 'openai',
160+
modelId: 'gpt-5',
161+
name: 'GPT-5',
162+
cost: 0.00125,
163+
},
164+
'gpt-5-mini': {
165+
provider: 'openai',
166+
modelId: 'gpt-5-mini',
167+
name: 'GPT-5 mini',
168+
cost: 0.00025,
169+
},
170+
'gpt-5-nano': {
171+
provider: 'openai',
172+
modelId: 'gpt-5-nano',
173+
name: 'GPT-5 nano',
174+
cost: 0.00005,
175+
},
158176
'gemini-2.5-pro': {
159177
provider: 'gemini',
160178
modelId: 'gemini-2.5-pro',
@@ -197,6 +215,18 @@ export function getModelConfig(model: string): ModelConfig | undefined {
197215
name: 'Claude 3.5 Sonnet',
198216
cost: 0.003,
199217
},
218+
'claude-4.5-sonnet': {
219+
provider: 'anthropic',
220+
modelId: 'claude-4.5-sonnet',
221+
name: 'Sonnet 4.5',
222+
cost: 0.003,
223+
},
224+
'claude-4.5-haiku': {
225+
provider: 'anthropic',
226+
modelId: 'claude-4.5-haiku',
227+
name: 'Haiku 4.5',
228+
cost: 0.001,
229+
},
200230
};
201231
return models[model];
202232
}

0 commit comments

Comments
 (0)