Skip to content

Conversation

@BjornMelin
Copy link
Contributor

@BjornMelin BjornMelin commented Nov 21, 2025

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-fast models with the updated grok-4-1-fast naming convention.

Changes Made

  • Registry updates (conf/xai_models.json):

    • Replaced grok-4-fast with grok-4-1-fast (primary model name)
    • Added grok-4-1-fast-non-reasoning entry
    • Updated aliases: grok-4-1-fast-reasoning → alias, grok-4-1-fast → primary
    • Set intelligence scores: 15 for reasoning variant, 13 for non-reasoning
    • Configured capability flags (reasoning, function calling, JSON mode, images)
  • OpenRouter updates (conf/openrouter_models.json):

    • Updated model name to x-ai/grok-4.1-fast (matching OpenRouter API identifier)
    • Updated aliases and description per OpenRouter model card
  • Provider logic (providers/xai.py):

    • Updated model preference lists for EXTENDED_REASONING, FAST_RESPONSE, and BALANCED categories
    • Changed references from grok-4-fast to grok-4-1-fast
  • Test updates:

    • Updated tests/test_xai_provider.py - Model validation, resolution, and capability tests
    • Updated tests/test_supported_models_aliases.py - Alias resolution and case-insensitive tests
    • Updated tests/test_auto_mode_comprehensive.py - Auto-mode model assignments
  • Documentation updates:

    • docs/custom_models.md - Added Grok 4.1 Fast to latest xAI releases section
    • docs/configuration.md - Updated provider table and XAI_ALLOWED_MODELS examples
    • docs/advanced-usage.md - Updated model table and all tool parameter lists
    • docs/model_ranking.md - Added Grok 4.1 Fast models to intelligence score guidance
    • All tool docs (docs/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):

# Activate virtual environment first
source .zen_venv/bin/activate

# Run comprehensive code quality checks (recommended)
./code_quality_checks.sh

# Run specific test suites
pytest tests/test_xai_provider.py -v
pytest tests/test_supported_models_aliases.py -v
pytest tests/test_auto_mode_comprehensive.py -v
  • All linting passes (ruff, black, isort)
  • All unit tests pass
  • For new features: Unit tests updated in tests/
  • For tool changes: Simulator tests added in simulator_tests/ (N/A - no tool changes)
  • For bug fixes: Tests updated to prevent regression
  • Manual testing completed with realistic scenarios

Related Issues

Fixes #339

Checklist

  • PR title follows the format guidelines above
  • Activated venv and ran code quality checks: source .zen_venv/bin/activate && ./code_quality_checks.sh
  • Self-review completed
  • Tests added for ALL changes (see Testing section above)
  • Documentation updated as needed
  • All unit tests passing
  • Relevant simulator tests passing (if tool changes) - N/A
  • Ready for review

Additional Notes

Model Naming Convention

The primary model name is grok-4-1-fast (following xAI's official naming), with grok-4-1-fast-reasoning as 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-fast have 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.

…'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
Copilot AI review requested due to automatic review settings November 21, 2025 04:12
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • New xAI Grok 4.1 Fast Models: Added comprehensive support for xAI's newly released Grok 4.1 Fast (reasoning) and Grok 4.1 Fast Non-Reasoning models, featuring a 2M context window and optimized for high-performance agentic tool calling.
  • Model Registry Updates: The conf/xai_models.json registry has been updated to replace grok-4-fast with grok-4-1-fast as the primary model name, introduce grok-4-1-fast-non-reasoning, and update aliases and intelligence scores (15 for reasoning, 13 for non-reasoning).
  • OpenRouter Integration: Configured OpenRouter (conf/openrouter_models.json) to support the new x-ai/grok-4.1-fast model, including its specific API identifier, aliases, and description, alongside x-ai/grok-code-fast-1.
  • Provider Logic Refinement: The providers/xai.py logic has been updated to prioritize the new Grok 4.1 Fast models in preference lists for EXTENDED_REASONING, FAST_RESPONSE, and BALANCED categories, ensuring optimal model selection.
  • Comprehensive Documentation & Test Coverage: All relevant documentation (custom models, configuration, advanced usage, model ranking, and tool-specific docs) and unit tests have been updated to reflect the new models and their capabilities, ensuring proper validation, alias resolution, and backward compatibility.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@BjornMelin BjornMelin changed the title feat: add support for xAI Grok 4.1 Fast and Grok 4.1 Fast Non-Reasoning models feat: add support for xAI Grok 4.1 Fast, Grok 4.1 Fast Non-Reasoning, grok-code-fast-1 models Nov 21, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Copy link

Copilot AI left a 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), and grok-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.

- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add support for xAI Grok 4.1 Fast and Grok 4.1 Fast Non-Reasoning models

2 participants