Skip to content

fix(auth): add kimi-for-coding alias to _PROVIDER_ALIASES#6287

Closed
linxule wants to merge 1 commit into
NousResearch:mainfrom
linxule:fix/auth-kimi-for-coding-alias
Closed

fix(auth): add kimi-for-coding alias to _PROVIDER_ALIASES#6287
linxule wants to merge 1 commit into
NousResearch:mainfrom
linxule:fix/auth-kimi-for-coding-alias

Conversation

@linxule

@linxule linxule commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add "kimi-for-coding": "kimi-coding" to _PROVIDER_ALIASES in hermes_cli/auth.py, alongside the existing "kimi" and "moonshot" entries
  • Fixes "Unknown provider 'kimi-for-coding'" error when switching to Kimi via the Telegram interactive /model picker
  • Adds a unit test next to the other alias tests in TestResolveProvider

Details

Dual-registry mismatch

Kimi Code is keyed differently in the two provider registries:

Registry File Key
HERMES_OVERLAYS hermes_cli/providers.py kimi-for-coding
PROVIDER_REGISTRY hermes_cli/auth.py kimi-coding

_PROVIDER_ALIASES in resolve_provider() bridges several such gaps (glm → zai, google → gemini, claude → anthropic, etc.) but has no entry for kimi-for-coding → kimi-coding. Only kimi → kimi-coding and moonshot → kimi-coding are present.

User-visible symptom

The Telegram interactive /model picker enumerates providers via list_authenticated_providers(), which returns the overlay slug (kimi-for-coding) for Kimi. When the user selects Kimi from the picker, the handler passes that slug straight into resolve_provider(), which fails:

```
Error: Could not resolve credentials for provider 'Kimi For Coding':
Unknown provider 'kimi-for-coding'. Check 'hermes model' for available
providers, or run 'hermes doctor' to diagnose config issues.
```

The error is confusing because `hermes model` does list Kimi, and `KIMI_API_KEY` is correctly set — the mismatch happens purely because the overlay slug never gets normalized to the canonical provider ID.

Diff

```diff

  •    "kimi": "kimi-coding", "moonshot": "kimi-coding",
    
  •    "kimi": "kimi-coding", "kimi-for-coding": "kimi-coding", "moonshot": "kimi-coding",
    

```

Test plan

  • New test `test_alias_kimi_for_coding` added to `tests/hermes_cli/test_api_key_providers.py::TestResolveProvider`, placed alongside `test_alias_kimi` and `test_alias_moonshot`
  • `pytest tests/hermes_cli/test_api_key_providers.py::TestResolveProvider -v` → 38/38 passed (local run on Raspberry Pi 4B, Python 3.11, Hermes Agent v0.8.0 venv)
  • `pytest tests/hermes_cli/test_api_key_providers.py::TestResolveProvider::test_alias_kimi_for_coding -v` → PASSED
  • Verified end-to-end on gateway: `list_authenticated_providers()` in a KIMI_API_KEY-loaded env now returns all three providers (Nous Portal, Kimi For Coding, OpenAI Codex) without error

Related

This is the follow-up to the alias gap I reported as a comment on #5910 after PR #5911 was filed. The `model_switch.py` half of #5910 shipped upstream as part of #5983 / Hermes v0.8.0 (thanks @teknium1 for the salvage), but the `auth.py` alias was left behind because it was only described in a comment, not a separate PR.

This PR does not close #5910 — another contributor (@vmlinuzx) recently added more Codex-related `/model` bugs to that issue which are out of scope here.

Environment

  • Hermes Agent v0.8.0 (`ff6a86cb` + later commits on `main`)
  • Raspberry Pi 4B, aarch64, Python 3.11.15
  • Gateway mode (Telegram + Discord), `KIMI_API_KEY` env var authentication

🤖 Generated with Claude Code

`HERMES_OVERLAYS` (providers.py) keys Kimi Code as `kimi-for-coding`,
but `PROVIDER_REGISTRY` (auth.py) keys it as `kimi-coding`.
`_PROVIDER_ALIASES` bridges most mismatches but lacks an entry for
`kimi-for-coding`, so any code path that feeds the overlay slug
through `resolve_provider()` fails with:

    Error: Could not resolve credentials for provider 'Kimi For Coding':
    Unknown provider 'kimi-for-coding'.

The Telegram interactive `/model` picker hits this path: it resolves
the list of available providers via `list_authenticated_providers()`
(which returns overlay slugs), then passes the chosen slug directly to
`resolve_provider()` for credential lookup. Switching to Kimi from the
picker therefore fails even though the provider is enumerated and
`KIMI_API_KEY` is set.

Adds a one-entry alias to mirror the existing `kimi` and `moonshot`
mappings, plus a unit test alongside the other `_PROVIDER_ALIASES`
tests in `TestResolveProvider`.

Related to the alias gap reported in issue NousResearch#5910 (the `model_switch.py`
half of that issue was fixed in NousResearch#5983 via PR NousResearch#5911).
teknium1 added a commit that referenced this pull request Apr 10, 2026
HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes #5223. Based on work by HearthCore (#6492) and linxule (#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
teknium1 added a commit that referenced this pull request Apr 10, 2026
HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes #5223. Based on work by HearthCore (#6492) and linxule (#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #7373. Your kimi-for-coding alias fix was included alongside the broader overlay slug resolution. Your authorship is preserved as co-author. Thanks linxule!

@teknium1 teknium1 closed this Apr 10, 2026
@linxule

linxule commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing — this was picked up and landed as part of #7373 by @teknium1, which also fixes the broader overlay provider slug mismatch in the /model picker. Thanks @teknium1 for the comprehensive fix and @HearthCore for the parallel work in #6492.

Confirmed working on my Pi gateway (updated to ea81aa2e today, clean tree with no local patches for the first time since the Kimi migration).

Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 28, 2026
HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…earch#7373)

HERMES_OVERLAYS keys use models.dev IDs (e.g. 'github-copilot') but
_PROVIDER_MODELS curated lists and config.yaml use Hermes provider IDs
('copilot'). list_authenticated_providers() Section 2 was using the
overlay key directly for model lookups and is_current checks, causing:
- 0 models shown for copilot, kimi, kilo, opencode, vercel
- is_current never matching the config provider

Fix: build reverse mapping from PROVIDER_TO_MODELS_DEV to translate
overlay keys to Hermes slugs before curated list lookup and result
construction. Also adds 'kimi-for-coding' alias in auth.py so the
picker's returned slug resolves correctly in resolve_provider().

Fixes NousResearch#5223. Based on work by HearthCore (NousResearch#6492) and linxule (NousResearch#6287).

Co-authored-by: HearthCore <HearthCore@users.noreply.github.com>
Co-authored-by: linxule <linxule@users.noreply.github.com>
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.

OAuth providers (Nous, Codex) missing from /model picker — ImportError silently caught

2 participants