dexter
dexter copied to clipboard
Feat/add grok api key
Summary
This PR adds xAI (Grok) as a new LLM provider, expanding Dexter's multi-provider capabilities alongside OpenAI, Anthropic, Google, and Ollama.
Why xAI/Grok?
- Cutting-edge reasoning: Grok models excel at complex reasoning tasks and real-time information processing
-
Fast inference:
grok-4-1-fast-reasoningoffers optimized speed for tool calling and agentic workflows - OpenAI-compatible API: Seamless integration using existing LangChain infrastructure
- Growing ecosystem: xAI is rapidly evolving with competitive pricing and unique capabilities
Changes
LLM Integration (src/model/llm.ts)
- Add
grok-prefix handler routing to xAI API athttps://api.x.ai/v1 - Register
grok-4-1-fast-reasoningas fast model variant for lightweight tasks - Use
XAI_API_KEYenvironment variable for authentication
Model Selector
(src/components/ModelSelector.tsx)
- Add xAI to provider list with display name and available models
- Support
grok-4-0709(flagship) andgrok-4-1-fast-reasoning(optimized) - Auto-detect xAI provider for models starting
with
grok-
Developer Experience
- Add file logging system (
logs/dexter.log) for easier debugging - Logs include financial search routing, tool calls, and API responses
- File-only logging option to avoid cluttering the CLI
Configuration
- Add
XAI_API_KEYtoenv.example
Test plan
- [ ] Configure
XAI_API_KEYin.env - [ ] Launch Dexter and run
/model - [ ] Verify xAI appears as a selectable provider
- [ ] Select
grok-4-0709orgrok-4-1-fast-reasoning - [ ] Send a test prompt and verify response
- [ ] Test financial query to confirm tool calling works (e.g., "What is Apple's stock price?")
- [ ] Check
logs/dexter.logfor debug output
These logs were created for debugging and call tracking. If you don't find them helpful, i will remove them.
Hey! @virattt I've removed the file logging changes as requested. The PR now only contains the xAI (Grok) integration:
- LLM provider config with
grok-prefix handler - ModelSelector update with Grok models
- README documentation
- env.example with XAI_API_KEY
Clean single commit, ready for review!