askimo 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/index.mjs +5 -1
- package/lib/providers.mjs +42 -2
- package/package.json +7 -6
- package/test/providers.mjs +9 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A CLI tool for communicating with AI providers.
|
|
9
9
|
|
|
10
|
-
**Supported providers:** Perplexity · OpenAI · Anthropic · xAI (Grok)
|
|
10
|
+
**Supported providers:** Perplexity · OpenAI · Anthropic · xAI (Grok) · Google Gemini
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -27,6 +27,7 @@ PERPLEXITY_API_KEY=your-perplexity-key
|
|
|
27
27
|
OPENAI_API_KEY=your-openai-key
|
|
28
28
|
ANTHROPIC_API_KEY=your-anthropic-key
|
|
29
29
|
XAI_API_KEY=your-xai-key
|
|
30
|
+
GOOGLE_GENERATIVE_AI_API_KEY=your-google-key
|
|
30
31
|
|
|
31
32
|
# Optional settings
|
|
32
33
|
DEFAULT_PROVIDER=perplexity
|
|
@@ -34,6 +35,7 @@ PERPLEXITY_MODEL=sonar
|
|
|
34
35
|
OPENAI_MODEL=gpt-4o
|
|
35
36
|
ANTHROPIC_MODEL=claude-sonnet-4-20250514
|
|
36
37
|
XAI_MODEL=grok-4
|
|
38
|
+
GEMINI_MODEL=gemini-3-pro-preview
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
---
|
|
@@ -54,11 +56,13 @@ askimo "What is the capital of France?"
|
|
|
54
56
|
| `-o` | OpenAI |
|
|
55
57
|
| `-a` | Anthropic |
|
|
56
58
|
| `-x` | xAI (Grok) |
|
|
59
|
+
| `-g` | Google Gemini |
|
|
57
60
|
|
|
58
61
|
```bash
|
|
59
62
|
askimo "explain quantum computing" -o # Use OpenAI
|
|
60
63
|
askimo "write a haiku" -a # Use Anthropic
|
|
61
64
|
askimo "what's happening today?" -x # Use xAI Grok
|
|
65
|
+
askimo "summarize this topic" -g # Use Google Gemini
|
|
62
66
|
```
|
|
63
67
|
|
|
64
68
|
### Continue a conversation
|
|
@@ -94,9 +98,9 @@ askimo -f error.log "find the bug"
|
|
|
94
98
|
```bash
|
|
95
99
|
askimo chat # Start new chat
|
|
96
100
|
askimo chat -o # Chat with OpenAI
|
|
97
|
-
askimo chat -
|
|
101
|
+
askimo chat -g # Chat with Gemini
|
|
98
102
|
askimo chat -c 1 # Continue last conversation
|
|
99
|
-
askimo chat --cid abc123
|
|
103
|
+
askimo chat --cid abc123 # Continue by conversation ID
|
|
100
104
|
```
|
|
101
105
|
|
|
102
106
|
Type `exit` or `Ctrl+C` to quit.
|
|
@@ -106,7 +110,7 @@ Type `exit` or `Ctrl+C` to quit.
|
|
|
106
110
|
```bash
|
|
107
111
|
askimo models # All providers
|
|
108
112
|
askimo models -p # Perplexity only
|
|
109
|
-
askimo models -
|
|
113
|
+
askimo models -g # Gemini only
|
|
110
114
|
```
|
|
111
115
|
|
|
112
116
|
### View conversation history
|
package/index.mjs
CHANGED
|
@@ -22,6 +22,7 @@ program
|
|
|
22
22
|
.option('-o, --openai', 'Use OpenAI')
|
|
23
23
|
.option('-a, --anthropic', 'Use Anthropic Claude')
|
|
24
24
|
.option('-x, --xai', 'Use xAI Grok')
|
|
25
|
+
.option('-g, --gemini', 'Use Google Gemini')
|
|
25
26
|
.option('-j, --json', 'Output as JSON instead of streaming')
|
|
26
27
|
.option('-c, --continue <n>', 'Continue conversation N (1=last, 2=second-to-last)', Number.parseInt)
|
|
27
28
|
.option('--cid <id>', 'Continue conversation by ID')
|
|
@@ -115,6 +116,7 @@ program
|
|
|
115
116
|
.option('-o, --openai', 'Use OpenAI')
|
|
116
117
|
.option('-a, --anthropic', 'Use Anthropic Claude')
|
|
117
118
|
.option('-x, --xai', 'Use xAI Grok')
|
|
119
|
+
.option('-g, --gemini', 'Use Google Gemini')
|
|
118
120
|
.option('-c, --continue <n>', 'Continue conversation N (1=last, 2=second-to-last)', Number.parseInt)
|
|
119
121
|
.option('--cid <id>', 'Continue conversation by ID')
|
|
120
122
|
.action(async (options) => {
|
|
@@ -144,6 +146,7 @@ program
|
|
|
144
146
|
.option('-o, --openai', 'Show only OpenAI models')
|
|
145
147
|
.option('-a, --anthropic', 'Show only Anthropic models')
|
|
146
148
|
.option('-x, --xai', 'Show only xAI models')
|
|
149
|
+
.option('-g, --gemini', 'Show only Gemini models')
|
|
147
150
|
.action(async (options) => {
|
|
148
151
|
try {
|
|
149
152
|
const config = await loadConfig()
|
|
@@ -153,8 +156,9 @@ program
|
|
|
153
156
|
if (options.openai) providers.push('openai')
|
|
154
157
|
if (options.anthropic) providers.push('anthropic')
|
|
155
158
|
if (options.xai) providers.push('xai')
|
|
159
|
+
if (options.gemini) providers.push('gemini')
|
|
156
160
|
|
|
157
|
-
const toShow = providers.length === 0 ? ['perplexity', 'openai', 'anthropic', 'xai'] : providers
|
|
161
|
+
const toShow = providers.length === 0 ? ['perplexity', 'openai', 'anthropic', 'xai', 'gemini'] : providers
|
|
158
162
|
|
|
159
163
|
const results = await Promise.all(
|
|
160
164
|
toShow.map(async (provider) => ({
|
package/lib/providers.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAnthropic } from '@ai-sdk/anthropic'
|
|
2
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google'
|
|
2
3
|
import { createOpenAI } from '@ai-sdk/openai'
|
|
3
4
|
import { createPerplexity } from '@ai-sdk/perplexity'
|
|
4
5
|
import { createXai } from '@ai-sdk/xai'
|
|
@@ -7,7 +8,8 @@ const DEFAULT_MODELS = {
|
|
|
7
8
|
perplexity: 'sonar',
|
|
8
9
|
openai: 'gpt-4o',
|
|
9
10
|
anthropic: 'claude-sonnet-4-20250514',
|
|
10
|
-
xai: 'grok-4'
|
|
11
|
+
xai: 'grok-4',
|
|
12
|
+
gemini: 'gemini-3-pro-preview'
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
// Perplexity doesn't have a models list API, so we hardcode these
|
|
@@ -66,6 +68,22 @@ async function fetchAnthropicModels(apiKey) {
|
|
|
66
68
|
}))
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
async function fetchGeminiModels(apiKey) {
|
|
72
|
+
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`)
|
|
73
|
+
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
throw new Error(`Google AI API error: ${response.status}`)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const data = await response.json()
|
|
79
|
+
return data.models
|
|
80
|
+
.filter((m) => m.name.includes('gemini'))
|
|
81
|
+
.map((m) => ({
|
|
82
|
+
id: m.name.replace('models/', ''),
|
|
83
|
+
displayName: m.displayName
|
|
84
|
+
}))
|
|
85
|
+
}
|
|
86
|
+
|
|
69
87
|
async function listModels(provider, config) {
|
|
70
88
|
switch (provider) {
|
|
71
89
|
case 'perplexity':
|
|
@@ -90,6 +108,14 @@ async function listModels(provider, config) {
|
|
|
90
108
|
case 'xai':
|
|
91
109
|
return XAI_MODELS
|
|
92
110
|
|
|
111
|
+
case 'gemini': {
|
|
112
|
+
const apiKey = config.GOOGLE_GENERATIVE_AI_API_KEY
|
|
113
|
+
if (!apiKey) {
|
|
114
|
+
throw new Error('GOOGLE_GENERATIVE_AI_API_KEY not found in config')
|
|
115
|
+
}
|
|
116
|
+
return fetchGeminiModels(apiKey)
|
|
117
|
+
}
|
|
118
|
+
|
|
93
119
|
default:
|
|
94
120
|
throw new Error(`Unknown provider: ${provider}`)
|
|
95
121
|
}
|
|
@@ -149,6 +175,19 @@ function getProvider(providerName, config) {
|
|
|
149
175
|
modelName
|
|
150
176
|
}
|
|
151
177
|
}
|
|
178
|
+
case 'gemini': {
|
|
179
|
+
const apiKey = config.GOOGLE_GENERATIVE_AI_API_KEY
|
|
180
|
+
if (!apiKey) {
|
|
181
|
+
throw new Error('GOOGLE_GENERATIVE_AI_API_KEY not found in config')
|
|
182
|
+
}
|
|
183
|
+
const modelName = config.GEMINI_MODEL || DEFAULT_MODELS.gemini
|
|
184
|
+
const google = createGoogleGenerativeAI({ apiKey })
|
|
185
|
+
return {
|
|
186
|
+
model: google(modelName),
|
|
187
|
+
name: 'gemini',
|
|
188
|
+
modelName
|
|
189
|
+
}
|
|
190
|
+
}
|
|
152
191
|
default:
|
|
153
192
|
throw new Error(`Unknown provider: ${providerName}`)
|
|
154
193
|
}
|
|
@@ -159,9 +198,10 @@ function determineProvider(options, config = {}) {
|
|
|
159
198
|
if (options.anthropic) return 'anthropic'
|
|
160
199
|
if (options.perplexity) return 'perplexity'
|
|
161
200
|
if (options.xai) return 'xai'
|
|
201
|
+
if (options.gemini) return 'gemini'
|
|
162
202
|
|
|
163
203
|
const defaultProvider = config.DEFAULT_PROVIDER?.toLowerCase()
|
|
164
|
-
if (defaultProvider && ['perplexity', 'openai', 'anthropic', 'xai'].includes(defaultProvider)) {
|
|
204
|
+
if (defaultProvider && ['perplexity', 'openai', 'anthropic', 'xai', 'gemini'].includes(defaultProvider)) {
|
|
165
205
|
return defaultProvider
|
|
166
206
|
}
|
|
167
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askimo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "A CLI tool for communicating with AI providers (Perplexity, OpenAI, Anthropic)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Amit Tal",
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
"ava": "^6.4.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
40
|
-
"@ai-sdk/
|
|
41
|
-
"@ai-sdk/
|
|
42
|
-
"@ai-sdk/
|
|
39
|
+
"@ai-sdk/anthropic": "^3.0.2",
|
|
40
|
+
"@ai-sdk/google": "^3.0.2",
|
|
41
|
+
"@ai-sdk/openai": "^3.0.2",
|
|
42
|
+
"@ai-sdk/perplexity": "^3.0.2",
|
|
43
|
+
"@ai-sdk/xai": "^3.0.3",
|
|
43
44
|
"@inquirer/input": "^5.0.2",
|
|
44
|
-
"ai": "^6.0.
|
|
45
|
+
"ai": "^6.0.6",
|
|
45
46
|
"commander": "^14.0.2",
|
|
46
47
|
"hcat": "^2.2.1"
|
|
47
48
|
}
|
package/test/providers.mjs
CHANGED
|
@@ -19,6 +19,11 @@ test('determineProvider returns anthropic when --anthropic flag is set', (t) =>
|
|
|
19
19
|
t.is(result, 'anthropic')
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
+
test('determineProvider returns gemini when --gemini flag is set', (t) => {
|
|
23
|
+
const result = determineProvider({ gemini: true })
|
|
24
|
+
t.is(result, 'gemini')
|
|
25
|
+
})
|
|
26
|
+
|
|
22
27
|
test('determineProvider prefers flag over config', (t) => {
|
|
23
28
|
const result = determineProvider({ openai: true }, { DEFAULT_PROVIDER: 'anthropic' })
|
|
24
29
|
t.is(result, 'openai')
|
|
@@ -57,3 +62,7 @@ test('DEFAULT_MODELS contains openai model', (t) => {
|
|
|
57
62
|
test('DEFAULT_MODELS contains anthropic model', (t) => {
|
|
58
63
|
t.is(DEFAULT_MODELS.anthropic, 'claude-sonnet-4-20250514')
|
|
59
64
|
})
|
|
65
|
+
|
|
66
|
+
test('DEFAULT_MODELS contains gemini model', (t) => {
|
|
67
|
+
t.is(DEFAULT_MODELS.gemini, 'gemini-3-pro-preview')
|
|
68
|
+
})
|