-
-
Notifications
You must be signed in to change notification settings - Fork 889
feat: add support for xAI Grok 4.1 Fast, Grok 4.1 Fast Non-Reasoning, grok-code-fast-1 models #340
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
base: main
Are you sure you want to change the base?
feat: add support for xAI Grok 4.1 Fast, Grok 4.1 Fast Non-Reasoning, grok-code-fast-1 models #340
Conversation
…'Grok Code Fast 1' to configuration files and update model selection logic for enhanced reasoning and coding capabilities
…rok Code Fast 1 with enhanced descriptions and aliases
Summary of ChangesHello @BjornMelin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for xAI's recently released Grok 4.1 Fast models, including both reasoning and non-reasoning variants, which boast a 2M context window and are tailored for high-performance agentic tool calling. The changes involve updating model registries, provider logic, and extensive documentation across the system to seamlessly integrate these new capabilities, while also ensuring backward compatibility for existing model references. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request adds support for the new xAI Grok models, and the changes are comprehensive, covering model configurations, provider logic, tests, and documentation. The refactoring in providers/xai.py is a nice improvement for maintainability, and the test coverage for the new models is thorough. I've identified a few minor issues related to configuration and documentation consistency, which are detailed in the review comments. Overall, this is a solid contribution.
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.
Pull Request Overview
This PR adds support for xAI's newly released Grok 4.1 Fast models with 2M context windows, optimized for high-performance agentic tool calling. The changes replace the previous grok-4-fast models with the updated grok-4-1-fast naming convention and introduce both reasoning and non-reasoning variants.
Key Changes:
- Added three new xAI models:
grok-4-1-fast(primary reasoning model with 2M context),grok-4-1-fast-non-reasoning(speed-optimized variant), andgrok-code-fast-1(coding specialist) - Updated provider preference logic to prioritize new cost-efficient models in auto-mode selection
- Comprehensive test coverage for new model validation, resolution, capabilities, and auto-mode assignments
- Documentation updated across all tool parameter lists and configuration guides
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
conf/xai_models.json |
Added three new model entries with capabilities, aliases, and intelligence scores (15, 13, 14) |
conf/openrouter_models.json |
Added OpenRouter entries for x-ai/grok-4.1-fast and x-ai/grok-code-fast-1 |
providers/xai.py |
Updated model preference lists for EXTENDED_REASONING, FAST_RESPONSE, and BALANCED categories to prioritize new models |
tests/test_xai_provider.py |
Added comprehensive capability tests for three new models including alias resolution |
tests/test_supported_models_aliases.py |
Added alias validation tests for new models and case-insensitive resolution |
tests/test_auto_mode_comprehensive.py |
Updated expected model assignments for XAI-only provider configuration |
docs/configuration.md |
Updated provider table and XAI_ALLOWED_MODELS examples with new models |
docs/custom_models.md |
Added "Latest xAI releases" section documenting the three new models |
docs/model_ranking.md |
Added new Grok models to intelligence score guidance table |
docs/advanced-usage.md |
Added three new model entries to the model table and updated all tool parameter lists |
docs/tools/*.md (9 files) |
Updated model parameter lists to include the three new xAI models |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ation and documentation
…including adjustments in documentation and tests
- Introduced `grok-4-fast` and `grok-4-fast-non-reasoning` models with 2M context. - Updated model aliases and capabilities in the documentation. - Enhanced model selection logic to prioritize new models for reasoning and fast responses. - Updated tests to cover new models and their capabilities.
Description
This PR adds support for xAI's newly released Grok 4.1 Fast models (reasoning and non-reasoning variants) released on November 19, 2025. The models feature a 2M context window and are optimized for high-performance agentic tool calling. This replaces the previous
grok-4-fastmodels with the updatedgrok-4-1-fastnaming convention.Changes Made
Registry updates (
conf/xai_models.json):grok-4-fastwithgrok-4-1-fast(primary model name)grok-4-1-fast-non-reasoningentrygrok-4-1-fast-reasoning→ alias,grok-4-1-fast→ primaryOpenRouter updates (
conf/openrouter_models.json):x-ai/grok-4.1-fast(matching OpenRouter API identifier)Provider logic (
providers/xai.py):grok-4-fasttogrok-4-1-fastTest updates:
tests/test_xai_provider.py- Model validation, resolution, and capability teststests/test_supported_models_aliases.py- Alias resolution and case-insensitive teststests/test_auto_mode_comprehensive.py- Auto-mode model assignmentsDocumentation updates:
docs/custom_models.md- Added Grok 4.1 Fast to latest xAI releases sectiondocs/configuration.md- Updated provider table and XAI_ALLOWED_MODELS examplesdocs/advanced-usage.md- Updated model table and all tool parameter listsdocs/model_ranking.md- Added Grok 4.1 Fast models to intelligence score guidancedocs/tools/*.md) - Updated model parameter lists (9 files)No breaking changes (aliases maintain backward compatibility)
No dependencies added/removed
Testing
Please review our Testing Guide before submitting.
Run all linting and tests (required):
tests/simulator_tests/(N/A - no tool changes)Related Issues
Fixes #339
Checklist
source .zen_venv/bin/activate && ./code_quality_checks.shAdditional Notes
Model Naming Convention
The primary model name is
grok-4-1-fast(following xAI's official naming), withgrok-4-1-fast-reasoningas an alias. This aligns with the pattern where shorter names are preferred as primary identifiers.OpenRouter Model Identifier
OpenRouter uses
x-ai/grok-4.1-fast(with a dot) as the API identifier, which differs from the native xAI naming. The configuration correctly maps to this identifier.Backward Compatibility
All previous references to
grok-4-fasthave been updated. The alias system ensures that if any external code references the old names, they will resolve correctly through the alias mechanism.Intelligence Scores
grok-4-1-fast: 15 (Strong general models with large context)grok-4-1-fast-non-reasoning: 13 (Balanced assistants)These scores align with the model ranking guidance in
docs/model_ranking.md.