Skip to content

Commit 64f4a8e

Browse files
committed
feat: add Grok/XAI support to the LLM abstraction
- Created XAI provider implementation - Updated provider registry and configuration - Added tests and documentation Closes #148
1 parent d73389a commit 64f4a8e

File tree

9 files changed

+20087
-4
lines changed

9 files changed

+20087
-4
lines changed

docs/grok-integration.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Grok/XAI Integration
2+
3+
MyCoder supports [Grok](https://grok.x.ai/) models from xAI as an alternative to Anthropic's Claude models.
4+
5+
## Configuration
6+
7+
To use Grok models, you need to:
8+
9+
1. Set your XAI API key
10+
2. Configure MyCoder to use the xai provider
11+
3. Specify a Grok model
12+
13+
### Setting Your XAI API Key
14+
15+
```bash
16+
mycoder config set XAI_API_KEY your-xai-api-key
17+
```
18+
19+
Alternatively, you can set the `XAI_API_KEY` environment variable:
20+
21+
```bash
22+
export XAI_API_KEY=your-xai-api-key
23+
```
24+
25+
### Configuring the Provider
26+
27+
To use Grok as your default provider:
28+
29+
```bash
30+
mycoder config set provider xai
31+
```
32+
33+
### Selecting a Grok Model
34+
35+
MyCoder supports various Grok models:
36+
37+
```bash
38+
# For Grok 2
39+
mycoder config set model grok-2-1212
40+
41+
# For Grok 2 with vision capabilities
42+
mycoder config set model grok-2-vision-1212
43+
44+
# For other available models
45+
mycoder config set model grok-beta
46+
mycoder config set model grok-vision-beta
47+
```
48+
49+
## Using Grok for a Single Command
50+
51+
You can also use Grok for a single command without changing your default configuration:
52+
53+
```bash
54+
mycoder --provider xai --model grok-2-1212 "Your prompt here"
55+
```
56+
57+
## Features
58+
59+
The Grok integration supports all MyCoder features, including:
60+
61+
- Tool usage for complex operations
62+
- Sub-agent spawning for parallel tasks
63+
- GitHub mode for working with issues and PRs
64+
- All file and shell operations
65+
66+
## Troubleshooting
67+
68+
If you encounter issues with the Grok integration, check the following:
69+
70+
1. Ensure your API key is correct and has sufficient permissions
71+
2. Verify that you're using a valid model name
72+
3. Check that your account has access to the specified model
73+
4. Ensure your API key has not expired or been revoked
74+
75+
For more detailed logs, run MyCoder with increased verbosity:
76+
77+
```bash
78+
mycoder --logLevel debug "Your prompt here"
79+
```
80+
81+
## Comparing Models
82+
83+
Different models have different strengths:
84+
85+
- **grok-2-1212**: General-purpose model with strong coding capabilities
86+
- **grok-2-vision-1212**: Supports image processing in addition to text
87+
- **grok-beta**: Earlier version of Grok, may be more suitable for simpler tasks
88+
- **grok-vision-beta**: Earlier vision-capable model
89+
90+
Experiment with different models to find the one that works best for your specific use case.

0 commit comments

Comments
 (0)