Skip to content

Commit 7ba2ad4

Browse files
Add Gemini 2.0 Flash Thinking model support
- Add Google Gemini 2.0 Flash Thinking as an available model - Free tier available with extended thinking capabilities - Add GOOGLE_API_KEY to .env.example for easy setup - Users can get a free API key at https://aistudio.google.com/apikey
1 parent 9099552 commit 7ba2ad4

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

chat-client/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# API Keys (Optional - can also be set via UI settings)
22
ANTHROPIC_API_KEY=sk-ant-...
33
OPENAI_API_KEY=sk-...
4+
GOOGLE_API_KEY=AIza...

chat-client/ai/providers.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { createOpenAI } from "@ai-sdk/openai";
22
import { createAnthropic } from "@ai-sdk/anthropic";
3+
import { createGoogleGenerativeAI } from "@ai-sdk/google";
34

4-
import {
5-
customProvider,
6-
wrapLanguageModel,
7-
extractReasoningMiddleware
5+
import {
6+
customProvider,
7+
wrapLanguageModel,
8+
extractReasoningMiddleware
89
} from "ai";
910

1011
export interface ModelInfo {
@@ -25,12 +26,12 @@ const getApiKey = (key: string): string | undefined => {
2526
if (process.env[key]) {
2627
return process.env[key] || undefined;
2728
}
28-
29+
2930
// Fall back to localStorage if available
3031
if (typeof window !== 'undefined') {
3132
return window.localStorage.getItem(key) || undefined;
3233
}
33-
34+
3435
return undefined;
3536
};
3637

@@ -43,12 +44,16 @@ const anthropicClient = createAnthropic({
4344
apiKey: getApiKey('ANTHROPIC_API_KEY'),
4445
});
4546

47+
const googleClient = createGoogleGenerativeAI({
48+
apiKey: getApiKey('GOOGLE_API_KEY'),
49+
});
4650

4751
// const xaiClient = createXai({
4852
// apiKey: getApiKey('XAI_API_KEY'),
4953
// });
5054

5155
const languageModels = {
56+
"gemini-2-flash-thinking": googleClient("gemini-2.0-flash-thinking-exp-01-21"),
5257
"gpt-5": openaiClient("gpt-5-2025-08-07"),
5358
"claude-4-sonnet": anthropicClient('claude-sonnet-4-20250514'),
5459
// "qwen-qwq": wrapLanguageModel(
@@ -61,6 +66,13 @@ const languageModels = {
6166
};
6267

6368
export const modelDetails: Record<keyof typeof languageModels, ModelInfo> = {
69+
"gemini-2-flash-thinking": {
70+
provider: "Google",
71+
name: "Gemini 2.0 Flash Thinking",
72+
description: "Google's reasoning model with extended thinking capabilities. Free tier available.",
73+
apiVersion: "gemini-2.0-flash-thinking-exp-01-21",
74+
capabilities: ["Deep Reasoning", "Thinking", "Free", "Agentic"]
75+
},
6476
"gpt-5": {
6577
provider: "OpenAI",
6678
name: "GPT-5",

0 commit comments

Comments
 (0)