Repository: All-Hands-AI/OpenHands

Issue:
[Bug]:
### Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).

- [x] I have checked the existing issues.

### Describe the bug and reproduction steps

your getting errors on the new models -     result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrewcz/.local/lib/python3.12/site-packages/litellm/main.py", line 3452, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/home/andrewcz/.local/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2301, in exception_type
    raise e
  File "/home/andrewcz/.local/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2163, in exception_type
    raise BadRequestError(
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\"code\":\"Client specified an invalid argument\",\"error\":\"Argument not supported on this model: stop\"}","provider_name":"xAI"}},"user_id":"user_2eAn7X41fXHSR6Tu6RRbAllRZls"}

20:35:23 - openhands:ERROR: loop.py:24 - BadRequestError: litellm.BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\"code\":\"Client specified an invalid argument\",\"error\":\"Argument not supported on this model: stop\"}","provider_name":"xAI"}},"user_id":"user_2eAn7X41fXHSR6Tu6RRbAllRZls"}
⚠️ Session was interrupted: error

(work_env) 📦[andrewcz@ work_curves_nn_test]$ 

### OpenHands Installation

Docker command in README

### OpenHands Version

_No response_

### Model Name

_No response_

### Operating System

None

### Logs, Errors, Screenshots, and Additional Context

_No response_

Discussion hints:

Solution patch:
diff --git a/openhands/llm/model_features.py b/openhands/llm/model_features.py
index 6f5d1b349..48a40a38f 100644
--- a/openhands/llm/model_features.py
+++ b/openhands/llm/model_features.py
@@ -122,6 +122,7 @@ SUPPORTS_STOP_WORDS_FALSE_PATTERNS: list[str] = [
     'o1*',
     # grok-4 specific model name (basename)
     'grok-4-0709',
+    'grok-code-fast-1',
     # DeepSeek R1 family
     'deepseek-r1-0528*',
 ]


Test patch:
diff --git a/tests/unit/llm/test_model_features.py b/tests/unit/llm/test_model_features.py
index 35aae2b24..8424268fd 100644
--- a/tests/unit/llm/test_model_features.py
+++ b/tests/unit/llm/test_model_features.py
@@ -286,6 +286,8 @@ def test_prompt_cache_haiku_variants():
 def test_stop_words_grok_provider_prefixed():
     assert get_features('xai/grok-4-0709').supports_stop_words is False
     assert get_features('grok-4-0709').supports_stop_words is False
+    assert get_features('xai/grok-code-fast-1').supports_stop_words is False
+    assert get_features('grok-code-fast-1').supports_stop_words is False
 
 
 @pytest.mark.parametrize(
@@ -294,6 +296,7 @@ def test_stop_words_grok_provider_prefixed():
         'o1-mini',
         'o1-2024-12-17',
         'xai/grok-4-0709',
+        'xai/grok-code-fast-1',
         'deepseek/DeepSeek-R1-0528:671b-Q4_K_XL',
         'DeepSeek-R1-0528',
     ],