Skip to content

Commit dfe009f

Browse files
feat: add Groq and xAI providers with API key support
1 parent 92dfcdf commit dfe009f

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ This will guide you through:
3939

4040
- **TogetherAI** (recommended) - Get your API key from [TogetherAI](https://api.together.ai/)
4141
- **OpenAI** - Get your API key from [OpenAI API Keys page](https://platform.openai.com/account/api-keys)
42+
- **Groq** - Get your API key from [Groq Console](https://console.groq.com/keys)
43+
- **xAI** - Get your API key from [xAI Console](https://console.x.ai/)
4244
- **OpenRouter** - Get your API key from [OpenRouter](https://openrouter.ai/keys)
4345
- **Ollama** (local) - Run AI models locally with [Ollama](https://ollama.ai)
4446
- **LM Studio** (local) - No API key required. Runs on your computer via [LM Studio](https://lmstudio.ai/)
@@ -287,7 +289,7 @@ Model to use for OpenAI-compatible providers.
287289

288290
#### provider
289291

290-
The selected AI provider. Set automatically during `aicommits setup`. Valid values: `openai`, `togetherai`, `ollama`, `custom`.
292+
The selected AI provider. Set automatically during `aicommits setup`. Valid values: `openai`, `togetherai`, `groq`, `xai`, `openrouter`, `ollama`, `lmstudio`, `custom`.
291293

292294
#### locale
293295

src/feature/providers/groq.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ProviderDef } from './base.js';
2+
3+
export const GroqProvider: ProviderDef = {
4+
name: 'groq',
5+
displayName: 'Groq',
6+
baseUrl: 'https://api.groq.com/openai/v1',
7+
apiKeyFormat: 'gsk_',
8+
modelsFilter: (models) =>
9+
models
10+
.filter(
11+
(m: any) =>
12+
m.id && (!m.type || m.type === 'chat' || m.type === 'language'),
13+
)
14+
.map((m: any) => m.id),
15+
defaultModels: [
16+
'openai/gpt-oss-120b',
17+
'llama-3.1-8b-instant',
18+
'openai/gpt-oss-20b',
19+
],
20+
requiresApiKey: true,
21+
};

src/feature/providers/providers-data.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import { OllamaProvider } from './ollama.js';
44
import { OpenAiCustom } from './openaiCustom.js';
55
import { OpenRouterProvider } from './openrouter.js';
66
import { LMStudioProvider } from './lmstudio.js';
7+
import { GroqProvider } from './groq.js';
8+
import { XAiProvider } from './xai.js';
79

810
export const providers = [
911
TogetherProvider,
1012
OpenAiProvider,
13+
GroqProvider,
14+
XAiProvider,
1115
OllamaProvider,
1216
LMStudioProvider,
1317
OpenRouterProvider,

src/feature/providers/xai.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ProviderDef } from './base.js';
2+
3+
export const XAiProvider: ProviderDef = {
4+
name: 'xai',
5+
displayName: 'xAI',
6+
baseUrl: 'https://api.x.ai/v1',
7+
apiKeyFormat: 'xai-',
8+
modelsFilter: (models) =>
9+
models
10+
.filter(
11+
(m: any) =>
12+
m.id && (!m.type || m.type === 'chat' || m.type === 'language'),
13+
)
14+
.map((m: any) => m.id),
15+
defaultModels: ['grok-4.1-fast', 'grok-4-fast', 'grok-code-fast-1'],
16+
requiresApiKey: true,
17+
};

0 commit comments

Comments
 (0)