Skip to content

fix(models): strip :cloud/-cloud suffix from models.dev Ollama Cloud IDs - #16192

Closed
briandevans wants to merge 1 commit into
NousResearch:mainfrom
briandevans:fix/ollama-cloud-strip-cloud-suffix-16179
Closed

fix(models): strip :cloud/-cloud suffix from models.dev Ollama Cloud IDs#16192
briandevans wants to merge 1 commit into
NousResearch:mainfrom
briandevans:fix/ollama-cloud-strip-cloud-suffix-16179

Conversation

@briandevans

Copy link
Copy Markdown
Contributor

Summary

  • fetch_ollama_cloud_models() merges live API results with models.dev additions
  • models.dev appends :cloud / -cloud suffixes to Ollama Cloud IDs (e.g. kimi-k2.6:cloud, qwen3-coder:480b-cloud) that the live API does not use
  • Without normalisation, these suffixed IDs bypass the dedup check and appear alongside the correct clean IDs in /model and hermes model

The bug

models.dev lists Ollama Cloud model IDs with appended :cloud / -cloud suffixes. The live Ollama Cloud API (https://ollama.com/v1/models) returns the same models without those suffixes. In the merge loop:

for m in mdev_models:
    if m and m not in seen:   # "kimi-k2.6:cloud" ≠ "kimi-k2.6" → bypasses dedup
        seen.add(m)
        merged.append(m)       # broken ID added to cache

Users end up with entries like kimi-k2.6:cloud in the model picker. Selecting one triggers a 400/404 from the Ollama API because that ID does not exist.

The fix

Added _strip_ollama_cloud_suffix(model_id) that removes :cloud and -cloud tail suffixes, and applies it to each mdev model ID before the dedup check:

for m in mdev_models:
    normalized = _strip_ollama_cloud_suffix(m)
    if normalized and normalized not in seen:
        seen.add(normalized)
        merged.append(normalized)

Applies to both the case where live API models are available (prevents suffixed duplicates) and the no-API-key fallback (strips suffixes from mdev-only results).

Test plan

  • Before: old merge code produces ['kimi-k2.6', 'glm-5.1', 'kimi-k2.6:cloud', 'glm-5.1:cloud', 'qwen3-coder:480b-cloud'] — confirmed locally
  • After: test_no_duplicate_when_live_clean_and_mdev_suffixed — exactly one kimi-k2.6, no :cloud entries
  • :cloud suffix stripping: test_strips_colon_cloud_suffix
  • -cloud suffix stripping: test_strips_dash_cloud_suffix
  • Unsuffixed IDs unchanged: test_unsuffixed_model_id_unchanged
  • Helper unit test: test_strip_suffix_helper
  • All 45 existing + new test_ollama_cloud_provider.py tests pass

Related

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 26, 2026 19:17

Copilot AI 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.

Pull request overview

Fixes Ollama Cloud model ID duplication and invalid selections by normalizing models.dev-sourced IDs to match the live Ollama Cloud API, preventing :cloud / -cloud-suffixed entries from leaking into /model and hermes model.

Changes:

  • Added _strip_ollama_cloud_suffix() to remove trailing :cloud / -cloud from Ollama Cloud model IDs.
  • Applied normalization during the models.dev merge in fetch_ollama_cloud_models() so deduplication works correctly.
  • Added targeted unit/integration tests to verify suffix stripping and dedup behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
hermes_cli/models.py Adds suffix-stripping helper and normalizes models.dev IDs during the merge to prevent duplicates/broken IDs.
tests/hermes_cli/test_ollama_cloud_provider.py Adds coverage for :cloud / -cloud stripping and confirms no duplicates when live API and models.dev disagree.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard provider/ollama Ollama / local models labels Apr 26, 2026
models.dev appends :cloud and -cloud suffixes to Ollama Cloud model IDs
(e.g. kimi-k2.6:cloud, qwen3-coder:480b-cloud) that the live Ollama Cloud
API does not use. Without normalisation, these suffixed IDs bypass the
dedup check and appear alongside the correct clean IDs, causing 400/404
errors when users select them in /model or hermes model.

Add _strip_ollama_cloud_suffix() and apply it to mdev entries before the
dedup merge in fetch_ollama_cloud_models() so all model IDs stored in the
disk cache use the canonical form the API accepts.

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

teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvaged via #19881 onto current main - your commit authorship was preserved. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists provider/ollama Ollama / local models type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ollama Cloud model list shows wrong names with :cloud / -cloud suffix (e.g. kimi-k2.6:cloud), causing 400/404

4 participants