Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Nov 3, 2025

Fixes #8998

Problem

Users were unable to use the minimax-M2 model through NVIDIA API endpoints (integrate.api.nvidia.com) when using the OpenAI Compatible provider. The API was returning body errors when attempting to stream responses.

Root Cause

The OpenAI handler was sending stream_options: { include_usage: true } parameter with streaming requests, which is not supported by NVIDIA API endpoints.

Solution

  • Added _isNvidiaApi() method to detect NVIDIA API endpoints
  • Excluded stream_options parameter for NVIDIA endpoints (similar to existing Grok XAI workaround)
  • Made hostname detection specific to known NVIDIA API endpoints:
    • integrate.api.nvidia.com
    • build.nvidia.com
    • *.api.nvidia.com

Testing

  • All existing tests pass ✅
  • Linting passes ✅
  • Type checking passes ✅

Additional Context

The user provided a Python example showing they were using https://integrate.api.nvidia.com/v1 as the base URL with the minimax-M2 model. This fix ensures compatibility by not sending unsupported parameters to NVIDIA endpoints.


Important

Adds NVIDIA API compatibility to OpenAiHandler by excluding unsupported stream_options in requests.

  • Behavior:
    • Excludes stream_options parameter for NVIDIA API endpoints in OpenAiHandler.
    • Adds _isNvidiaApi() method to detect NVIDIA API endpoints.
  • Detection:
    • _isNvidiaApi() checks for integrate.api.nvidia.com, build.nvidia.com, and *.api.nvidia.com.
  • Request Options:
    • Modifies request options in createMessage() and handleO3FamilyMessage() to exclude stream_options for NVIDIA APIs.

This description was created by Ellipsis for ff2ec78. You can customize this summary. It will automatically update as commits are pushed.

- Added _isNvidiaApi() method to detect NVIDIA API endpoints
- Excluded stream_options parameter for NVIDIA endpoints (similar to Grok XAI)
- Fixes issue #8998 where NVIDIA API returns body errors with stream_options
- Changed from broad .includes("nvidia.com") to specific hostnames
- Now checks for integrate.api.nvidia.com, build.nvidia.com, or *.api.nvidia.com
- Follows review feedback for more precise endpoint detection
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 3, 2025 19:53
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Nov 3, 2025
@roomote
Copy link
Author

roomote bot commented Nov 3, 2025

See this task on Roo Code Cloud

Review completed. The implementation correctly adds NVIDIA API compatibility by excluding unsupported parameters, following the same pattern as the existing Grok xAI workaround. One issue identified:

  • Add test coverage for NVIDIA API detection (similar to existing Grok xAI tests)

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

Comment on lines +429 to +437
private _isNvidiaApi(baseUrl?: string): boolean {
const urlHost = this._getUrlHost(baseUrl)
// NVIDIA API endpoints for AI models
return (
urlHost === "integrate.api.nvidia.com" ||
urlHost === "build.nvidia.com" ||
urlHost.endsWith(".api.nvidia.com")
)
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new NVIDIA API detection functionality lacks test coverage. Similar to the existing Grok xAI tests (lines 527-565 in the test file), this change should include tests that verify: (1) _isNvidiaApi() correctly identifies NVIDIA endpoints, (2) stream_options is excluded when using NVIDIA API in both streaming and non-streaming modes, and (3) the behavior works correctly with O3 family models. Without tests, future changes could inadvertently break this compatibility fix.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 3, 2025
@daniel-lxs daniel-lxs closed this Nov 3, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 3, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Unable to use minimax-M2 on OpenAI Compatible API

4 participants