Skip to content

feat: add GMI Cloud provider support - #1179

Merged
njbrake merged 2 commits into
mozilla-ai:mainfrom
tao12345666333:feat-add-gmi
Jul 16, 2026
Merged

njbrake merged 2 commits into
mozilla-ai:mainfrom
tao12345666333:feat-add-gmi

Conversation

@tao12345666333

@tao12345666333 tao12345666333 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Added support for GMI Cloud as a new model provider.

Reference docs:

PR Type

  • 🆕 New Feature

Relevant issues

N/A

What changed

  • src/any_llm/providers/gmi/gmi.py adds an OpenAI-compatible GMI Cloud provider and remaps max_completion_tokens back to max_tokens
  • src/any_llm/providers/gmi/__init__.py exports the provider
  • src/any_llm/constants.py registers gmi in LLMProvider
  • pyproject.toml adds the gmi optional dependency entry and includes it in the all extra
  • tests/unit/providers/test_gmi_provider.py adds unit coverage for provider construction, metadata, and token param conversion
  • tests/conftest.py adds GMI model mappings for the shared provider test matrix

Testing

uv run pre-commit run --all-files --verbose
uv run pytest -v tests/unit

Checklist

  • I understand the code I am submitting.
  • I have added unit tests that prove my fix/feature works
  • I have run this code locally and verified it fixes the issue.
  • New and existing tests pass locally
  • Documentation was updated where necessary
  • I have read and followed the contribution guidelines
  • AI Usage:
    • No AI was used.
    • AI was used for drafting/refactoring.
    • This is fully AI-generated.

AI Usage Information

  • AI Model used: GPT-5.4
  • AI Developer Tool used: Factory Droid
  • Any other info you'd like to share: Minimal live verification was run against GMI Cloud with low-volume requests (list_models plus a single completion).

When answering questions by the reviewer, please respond yourself, do not copy/paste the reviewer comments into an AI system and paste back its answer. We want to discuss with you, not your AI :)

  • I am an AI Agent filling out this form (check box if true)

Summary by CodeRabbit

  • New Features
    • Added the GMI inference provider, including completion with reasoning and streaming support.
    • Added support for selecting the GMI provider via the available configuration extras.
    • Introduced GMI-specific credential/base URL configuration and parameter mapping.
  • Bug Fixes
    • Updated provider parsing so gmi is recognised as a supported provider value.
  • Tests
    • Added unit tests covering GMI provider setup, capabilities, factory integration, parameter conversion, and metadata.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1fe8fd44-38de-4a54-83da-a1bf9f7b7810

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce1fe7 and 669fc33.

📒 Files selected for processing (3)
  • src/any_llm/constants.py
  • tests/conftest.py
  • tests/unit/providers/test_gmi_provider.py

Walkthrough

Adds GMI as a supported provider, configures its optional-dependency targets, implements its OpenAI-compatible provider and token conversion, and adds model fixtures plus unit tests covering configuration, capabilities, factory wiring, metadata, and parameter handling.

Changes

GMI provider support

Layer / File(s) Summary
Provider registration and packaging
pyproject.toml, src/any_llm/constants.py
Registers gmi as a provider and optional-dependency target, and updates the aggregate provider extras.
GMI provider implementation
src/any_llm/providers/gmi/...
Adds and exports GmiProvider with its API configuration, capability flags, metadata, and max_completion_tokens conversion.
Provider fixtures and tests
tests/conftest.py, tests/unit/providers/test_gmi_provider.py
Adds the GMI model fixture and tests configuration, factory integration, capabilities, metadata, and token conversion.

Possibly related PRs

  • mozilla-ai/any-llm#1181: Extends the shared provider enum and model fixtures to register another provider through the factory.

Suggested reviewers: njbrake

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the main change: adding GMI Cloud provider support.
Description check ✅ Passed The description matches the template and includes the required sections, checklist, testing, and AI usage details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 16, 2026
8 of 11 tasks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/providers/test_gmi_provider.py`:
- Around line 34-39: Wrap the CompletionParams instantiation in
test_gmi_remaps_max_tokens_back_to_max_tokens across multiple lines so each line
stays within the 120-character limit, matching the formatting of the neighboring
test while preserving all arguments and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32eef75b-73fe-4f8f-830c-4139cf2bb496

📥 Commits

Reviewing files that changed from the base of the PR and between 549b1a4 and 7ce1fe7.

📒 Files selected for processing (6)
  • pyproject.toml
  • src/any_llm/constants.py
  • src/any_llm/providers/gmi/__init__.py
  • src/any_llm/providers/gmi/gmi.py
  • tests/conftest.py
  • tests/unit/providers/test_gmi_provider.py

Comment thread tests/unit/providers/test_gmi_provider.py
@njbrake
njbrake temporarily deployed to integration-tests July 16, 2026 13:39 — with GitHub Actions Inactive
@codecov

codecov Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/any_llm/providers/gmi/gmi.py 96.15% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/any_llm/constants.py 100.00% <100.00%> (ø)
src/any_llm/providers/gmi/__init__.py 100.00% <100.00%> (ø)
src/any_llm/providers/gmi/gmi.py 96.15% <96.15%> (ø)

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ormat

Address review nits on the GMI provider PR: move the GMI enum member
after GITHUB to keep LLMProvider alphabetical, correct the test model
id from GLM-5.2-FP8 to the documented GLM-5-FP8, and apply ruff format
to the provider test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@njbrake njbrake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: this review was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.

Thanks for this. I verified GMI independently: it is a real NVIDIA Cloud Partner, and the api.gmi-serving.com/v1 base plus Bearer auth match their published LLM API docs. The provider mirrors our deepseek/github OpenAI-compatible pattern correctly, including the max_completion_tokens to max_tokens remap, and the unit tests plus mypy are clean.

I rebased onto main to clear the conflict and folded in three small review nits: ordered the GMI enum member after GITHUB to keep LLMProvider alphabetical, corrected the test model id to the documented zai-org/GLM-5-FP8, and applied ruff format to the provider test. CI is green.

GMI is intentionally not wired into the CI integration suite (no key configured), so it skips there; that behavior is expected.

@njbrake
njbrake merged commit dcd4dac into mozilla-ai:main Jul 16, 2026
14 checks passed
@github-actions github-actions Bot added the 1.21.0 Included in release 1.21.0 label Jul 16, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jul 17, 2026
9 of 11 tasks
@tao12345666333 tao12345666333 mentioned this pull request Jul 22, 2026
7 of 11 tasks
liukidar pushed a commit to Zyphra/any-llm that referenced this pull request Jul 22, 2026
## Description
<!-- What does this PR do? -->
Enable GMI Cloud Responses API capability through the inherited
OpenAI-compatible implementation.

Cover the capability in provider flags and metadata tests.

I tested with GPT-5.5 and GPT-5.6 series models from GMI Cloud, and they
only worked perfectly when using the response API, which may be due to a
limitation of OpenAI. Other models worked fine using the normal chat
completion interface.
related mozilla-ai#1179 



## PR Type
<!-- Delete the types that don't apply -->

- 🆕 New Feature

## Relevant issues
<!-- e.g. "Fixes mozilla-ai#123" -->

## Checklist
<!-- If this checklist is deleted from the PR submission it will be
immediately closed -->
- [x] I understand the code I am submitting.
- [x] I have added unit tests that prove my fix/feature works
- [x] I have run this code locally and verified it fixes the issue.
- [x] New and existing tests pass locally
- [x] Documentation was updated where necessary
- [x] I have read and followed the [contribution
guidelines](https://github.com/mozilla-ai/any-llm/blob/main/CONTRIBUTING.md)
- [ ] **AI Usage:**
    - [ ] No AI was used.
    - [x] AI was used for drafting/refactoring.
    - [ ] This is fully AI-generated.

## AI Usage Information
<!-- We welcome the use of AI to aid in contribution! Optional: We're
interested in hearing about your setup. What LLM are you using (e.g.
Opus 4.5, GPT-5, Minimax), and which tooling (Claude Code, VsCode,
OpenCode, etc) -->

- AI Model used: GPT-5.6-Sol
- AI Developer Tool used: Amp 
- Any other info you'd like to share: 

When answering questions by the reviewer, please respond yourself, do
not copy/paste the reviewer comments into an AI system and paste back
its answer. We want to discuss with you, not your AI :)

- [ ] I am an AI Agent filling out this form (check box if true)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
  - Enabled response-style outputs for the GMI provider.
  - Provider metadata now correctly indicates support for responses.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 22, 2026
8 of 11 tasks

This branch was previously deployed

1 inactive deployment
integration-tests — 669fc33e Deployed Jul 16, 2026 by njbrake via run-docs-tests #2181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.21.0 Included in release 1.21.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants