Skip to content

feat(providers): add GMI Cloud as first-class API-key provider#16663

Merged
kshitijk4poor merged 2 commits into
mainfrom
salvage/gmi-cloud-provider-11955
Apr 27, 2026
Merged

feat(providers): add GMI Cloud as first-class API-key provider#16663
kshitijk4poor merged 2 commits into
mainfrom
salvage/gmi-cloud-provider-11955

Conversation

@kshitijk4poor

@kshitijk4poor kshitijk4poor commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Salvage of #11955 (GMI Cloud first-class provider) by @isaachuangGMICLOUD, cherry-picked onto current main with conflict resolution and review fixes applied in a follow-up commit.


What this adds

GMI Cloud (api.gmi-serving.com) as a full first-class API-key provider — on par with arcee, kilocode, xiaomi, etc.:

  • hermes_cli/auth.pyProviderConfig (id="gmi", auth_type="api_key", GMI_API_KEY / GMI_BASE_URL)
  • hermes_cli/providers.pyHermesOverlay with extra_env_vars=("GMI_API_KEY",) (needed for models.dev detection since GMI isn't in models.dev yet)
  • hermes_cli/models.py — curated vendor/model catalog (slash-form, GMI is a multi-vendor aggregator); live /v1/models fetch with static fallback; CANONICAL_PROVIDERS entry
  • hermes_cli/main.py"gmi" in both _named_custom_provider_map tuple and --provider argparse choices; dispatches to _model_flow_api_key_provider generically
  • agent/model_metadata.py_URL_TO_PROVIDER["api.gmi-serving.com"] = "gmi"; _PROVIDER_PREFIXES entries; dedicated context-length probe block (GMI's /models endpoint has authoritative context_length data, and it's a known URL so the generic custom-endpoint probe skips it)
  • agent/auxiliary_client.py — provider aliases; _compat_model fix to preserve slash-form model IDs on cached aggregator-style clients; gmi aux model entry
  • hermes_cli/doctor.py — GMI in provider connectivity checks
  • hermes_cli/config.pyGMI_API_KEY / GMI_BASE_URL in OPTIONAL_ENV_VARS
  • tests/conftest.py — explicit GMI_BASE_URL clearing (not caught by _API_KEY suffix pattern)
  • Docsproviders.md, environment-variables.md, cli-commands.md, fallback-providers.md, configuration.md, quickstart.md (expands provider table)

Aliases

gmi, gmi-cloud, gmicloud all resolve to canonical gmi.

Provider flow coverage (verified against arcee pattern)

Touchpoint Status
auth.py ProviderConfig
providers.py HermesOverlay
models.py _PROVIDER_MODELS + CANONICAL_PROVIDERS + _PROVIDER_LABELS + _PROVIDER_ALIASES
models.py provider_model_ids() live fetch
main.py _named_custom_provider_map + --provider choices + _model_flow_api_key_provider dispatch
model_metadata.py _URL_TO_PROVIDER + _PROVIDER_PREFIXES + context-length probe
auxiliary_client.py aliases + _API_KEY_PROVIDER_AUX_MODELS
doctor.py connectivity check
config.py OPTIONAL_ENV_VARS
runtime_provider.py ✓ (generic resolve_api_key_provider_credentials path, no changes needed)
setup.py ✓ (unified since March 2026 — auto-inherits from main.py dispatch)
status.py ✓ (uses generic resolve_provider() + provider_label())
fallback_providers.md table
providers.md inline fallback list
environment-variables.md
cli-commands.md --provider list
conftest.py hermetic env

Changes from original PR (follow-up commit)

Issue Fix
ENV_VARS_BY_VERSION[17] is dead code — current _config_version is 22, so no existing user would ever be prompted Removed; matches how arcee was added (no version entry)
_API_KEY_PROVIDER_AUX_MODELS["gmi"] = "anthropic/claude-opus-4.6" — most expensive model, inconsistent with other providers (all use cheap flash/turbo variants) Changed to google/gemini-3.1-flash-lite-preview (already in GMI's curated catalog)
Test write_text("GMI_API_KEY=*** encoding="utf-8") — mismatched quote, writes literal "GMI_API_KEY=*** encoding=" to .env file Fixed to write_text("GMI_API_KEY=***\n", encoding="utf-8")
providers.md inline "Supported providers" fallback list (line ~1181) missing gmi Added
cli-commands.md --provider choices list missing gmi Added
Conflict resolution in test_auxiliary_client.py left stale assertions (fresh-agent-key, fresh_base) in test_try_nous_uses_pool_entry; also introduced a duplicate test_try_nous_pool_entry with wrong expected model Fixed assertions; removed duplicate

Test plan

  • tests/hermes_cli/test_gmi_provider.py — 35 focused GMI tests: 35/35 passed
  • tests/hermes_cli/test_api_key_providers.py — full provider registry regression: 135/135 passed
  • tests/agent/test_auxiliary_client.py — aux client tests incl. pool + GMI cache tests: 97/97 passed
  • Total: 267/267 passed

Closes #11955 — original contributor's commits preserved with authorship via rebase merge.

)

Add GMI Cloud (api.gmi-serving.com) as a full first-class API-key provider
with built-in auth, aliases, model catalog, CLI entry points, auxiliary client
routing, context length resolution, doctor checks, env var tracking, and docs.

- auth.py: ProviderConfig for 'gmi' (api_key, GMI_API_KEY / GMI_BASE_URL)
- providers.py: HermesOverlay with extra_env_vars for models.dev detection
- models.py: curated slash-form model catalog; live /v1/models fetch
- main.py: 'gmi' in _named_custom_provider_map and --provider choices
- model_metadata.py: _URL_TO_PROVIDER, _PROVIDER_PREFIXES, dedicated
  context-length probe block (GMI's /models has authoritative data)
- auxiliary_client.py: alias entries; _compat_model fix for slash-form
  models on cached aggregator-style clients; gmi aux default model
- doctor.py: GMI in provider connectivity checks
- config.py: GMI_API_KEY / GMI_BASE_URL in OPTIONAL_ENV_VARS
- conftest.py: explicit GMI_BASE_URL clearing (not caught by _API_KEY suffix)
- docs: providers.md, environment-variables.md, fallback-providers.md,
  configuration.md, quickstart.md (expands provider table)

Co-authored-by: Isaac Huang <isaachuang@Isaacs-MacBook-Pro.local>
- config.py: remove dead ENV_VARS_BY_VERSION[17] entry (current _config_version
  is 22, so all users are past version 17 and would never be prompted for
  GMI_API_KEY on upgrade — consistent with how arcee was added)
- auxiliary_client.py: use google/gemini-3.1-flash-lite-preview as GMI aux
  model instead of anthropic/claude-opus-4.6 (matches cheap fast-model pattern
  used by all other providers: zai→glm-4.5-flash, kimi→kimi-k2-turbo-preview,
  stepfun→step-3.5-flash, kilocode→google/gemini-3-flash-preview)
- test_gmi_provider.py: fix malformed write_text() call in doctor test
  (was: write_text("GMI_API_KEY=*** encoding="utf-8") → missing closing quote,
  wrote literal string 'GMI_API_KEY=*** encoding=' to .env file)
- test_gmi_provider.py + test_auxiliary_client.py: update aux model assertions
  to match new cheaper default
- docs/integrations/providers.md: add 'gmi' to inline 'Supported providers'
  fallback list (was only in the table, not the inline list at line ~1181)
- docs/reference/cli-commands.md: add 'gmi' to --provider choices list
@kshitijk4poor kshitijk4poor force-pushed the salvage/gmi-cloud-provider-11955 branch from 384411d to db3d75c Compare April 27, 2026 18:16
@kshitijk4poor kshitijk4poor merged commit 5672414 into main Apr 27, 2026
10 of 13 checks passed
@kshitijk4poor kshitijk4poor deleted the salvage/gmi-cloud-provider-11955 branch April 27, 2026 18:18
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.

1 participant