-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add xAI Provider Support for Grok Models #2976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added XaiProvider in crates/goose/src/providers/xai.rs with support for all Grok models - Supports grok-3, grok-3-fast, grok-3-mini, grok-3-mini-fast, grok-2-vision, grok-2-image, and legacy models - Follows x.ai OpenAI-compatible API format (https://api.x.ai/v1/chat/completions) - Requires XAI_API_KEY environment variable for authentication - Optional XAI_HOST configuration (defaults to https://api.x.ai) - Updated factory.rs to include xAI provider in the provider registry - Added xAI to the GUI provider registry in ProviderRegistry.tsx - Includes proper error handling for authentication, rate limits, and server errors - All tests pass, code formatted and lints clean
- Changed XAI_API_HOST from 'https://api.x.ai' to 'https://api.x.ai/v1' - Updated URL joining to append 'chat/completions' instead of 'v1/chat/completions' - This creates the correct endpoint: https://api.x.ai/v1/chat/completions - Updated UI provider registry with correct default host - Tested with curl and confirmed API returns proper 400 auth error instead of 404
- Added 'grok' pattern to MODEL_SPECIFIC_LIMITS with 131_072 token limit - This fixes the issue where CLI was showing 0/32000 tokens for Grok models - All Grok models (grok-3, grok-3-mini, etc) now correctly show 0/131072 tokens - Added debug logging to xAI provider for better troubleshooting
ScreenshotHere's the xAI provider with the custom logo in the Settings interface: (Uploading screenshot...) |
|
looks good to me jack, i'd approve if i could 👍🏽 |
…se into jackjackbits-feature/add-grok-models * 'feature/add-grok-models' of github.com:jackjackbits/goose: Add xAI to supported providers documentation Reduce xAI logo size to fit properly within circle Fix xAI logo visibility by applying CSS invert filter for black logo Add xAI logo to GUI provider selection Fix xAI API URL construction by ensuring base URL ends with slash Add Grok model context limits (131K tokens) Fix xAI API endpoint URL Add xAI provider support for Grok models
|
updated this to main and added .gitignore, hopefully didn't mess up the history (well hopefully goose didn't!), seemed to work for me |
|
it'd be good to add a test for xai provider, similar to the one here: goose/crates/goose/tests/providers.rs Lines 449 to 458 in d8b6e60
|
|
also don't worry about the apparent "extra" changes (which are already on main) its a forever github bug with showing synced fork diffs (will see if can get rid of it, but they aren't actual changes as already on main upstream/origin!) |
|
.. and cleaned up history again from github quirk |
|
wow |
|
Fantastic and this is all made with https://github.com/block/goose ? any tips on writing issues? |
Opened a PR against the base branch to add tests https://github.com/jackjackbits/goose/pull/1/files |
|
Tested these changes locally but grok-3 failed. |
|
@sambradbury that looked like it worked though? |
Yes the changes worked. My poorly delivered joke was about grok giving the wrong answer. |
|
WHO the hell deleted my comments? and WHY? |
skinder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@sambradbury I'm going to merge this PR in since it's working with manual testing, could you please retarget your PR from the fork to our main when that is done? Then we can have your test in our main repo too 🙏 |
Dear Jack Dorsey @jackjackbits , I Need Borrowing You're Money And I will do whatever I can for you please help me 😄 😄 😙 😙 😚 |
|
Dear Jack Dorsey @jackjackbits I Need Borrowing You're Money And I will do whatever I can for you please help me 😄 😄 😙 😙 😚 |
1 similar comment
|
Dear Jack Dorsey @jackjackbits I Need Borrowing You're Money And I will do whatever I can for you please help me 😄 😄 😙 😙 😚 |
|
Dear Jack Dorsey @jackjackbits I Need Borrowing You're Money And I will do whatever I can for you please help me 😄 😄 😙 😙 😚 > # Add xAI Provider Support for Grok Models
|
* main: fix: Improves reliability of flaky log tests (#3029) Add xAI Test Coverage (#3020) Reorganizing tutorials (#3028) feat(providers): update Google Gemini models to latest available models (#2989) fix(docker): install protoc to fix lance-encoding build (#2995) fix: updated openrouter known models (#3021) Mnovich/temporal foreground tasks (#2895) add 'install in goose' asset (#3016) Added useDarkMode hook for detecting dark mode setting dynamically (#3019) docs: add sagemaker provider (#2980) Docs: Add Goose Recipes Cookbook Page (#2998) feat (cli): add an alias --id for --name param for goose session --resume command (#3018) fix: disable extension (#3000) Add xAI Provider Support for Grok Models (#2976) removing dlls from core bin (#3014) docs: Update Leaderboard in New Community Landing Page (#2954) Douwe/fix include for recipes (#2914)
Co-authored-by: jack <jack@deck.local>
|
|
@jackjackbits Here's the xAI provider with the custom logo in the Settings interface: (Uploading screenshot...) |
|
Dear Jack Dorsey @jackjackbits , I Need Borrowing You're Money And I will do whatever I can for you please help me |
|
Try to mine :)
…On Tue, Jul 1, 2025, 20:57 illahnajih ***@***.***> wrote:
*illahnajih* left a comment (block/goose#2976)
<#2976 (comment)>
Dear Jack Dorsey @jackjackbits <https://github.com/jackjackbits> , I Need
Borrowing You're Money And I will do whatever I can for you please help me
—
Reply to this email directly, view it on GitHub
<#2976 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BHAVKJPETUVHIJQHGPM2AUD3GLDZBAVCNFSM6AAAAAB7RN6AICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMRVGAYTANJWGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
You know, I kept trying to borrow like you, but in the end they tried to
steal from me. I don't know by whom.
…On Tue, Jul 1, 2025, 21:10 Viorica Girbu ***@***.***> wrote:
Try to mine :)
On Tue, Jul 1, 2025, 20:57 illahnajih ***@***.***> wrote:
> *illahnajih* left a comment (block/goose#2976)
> <#2976 (comment)>
>
> Dear Jack Dorsey @jackjackbits <https://github.com/jackjackbits> , I
> Need Borrowing You're Money And I will do whatever I can for you please
> help me
>
> —
> Reply to this email directly, view it on GitHub
> <#2976 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BHAVKJPETUVHIJQHGPM2AUD3GLDZBAVCNFSM6AAAAAB7RN6AICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMRVGAYTANJWGU>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
|
Really |
|
Yes |
Co-authored-by: jack <jack@deck.local> Signed-off-by: Soroosh <soroosh.sarabadani@gmail.com>
Co-authored-by: jack <jack@deck.local>

Add xAI Provider Support for Grok Models
Summary
This PR adds comprehensive support for xAI's Grok models to Goose, enabling users to interact with models like grok-3, grok-3-mini, and grok-3-fast through the xAI API. The implementation includes both CLI and GUI support with proper authentication, context limits, and visual branding.
Motivation
xAI's Grok models offer competitive performance with a large 131,072 token context window, making them valuable alternatives for users seeking high-capacity language models. This addition expands Goose's provider ecosystem and gives users more flexibility in choosing their preferred AI models.
Changes
Core Provider Implementation
New xAI Provider (
crates/goose/src/providers/xai.rs)XAI_API_KEYenvironment variable or confighttps://api.x.ai/v1Provider Integration
crates/goose/src/providers/factory.rs)crates/goose/src/providers/mod.rs)Model Support
Context Limits (
crates/goose/src/model.rs)MODEL_SPECIFIC_LIMITSwith 131,072 token limitSupported Models
GUI Integration
Provider Logo
Desktop App Support
Documentation
documentation/docs/getting-started/providers.mdto include xAIBug Fixes
Testing
Usage
CLI
GUI
Configuration File
Screenshots
Notes
https://api.x.ai/v1/chat/completionsChecklist