Skip to content

fix(models): add kimi-coding implicit provider template#22526

Merged
Takhoffman merged 1 commit intoopenclaw:mainfrom
lailoo:fix/kimi-coding-provider-template-22409
Feb 21, 2026
Merged

fix(models): add kimi-coding implicit provider template#22526
Takhoffman merged 1 commit intoopenclaw:mainfrom
lailoo:fix/kimi-coding-provider-template-22409

Conversation

@lailoo
Copy link
Copy Markdown
Contributor

@lailoo lailoo commented Feb 21, 2026

Summary

  • Bug: Kimi Coding provider missing from resolveImplicitProviders(), causing 403 errors when using kimi-coding/k2p5 model
  • Root cause: No buildKimiCodingProvider() function and no kimi-coding handling in resolveImplicitProviders(); applyKimiCodeProviderConfig() only set model alias without provider api/baseUrl
  • Fix: Add buildKimiCodingProvider() with anthropic-messages API type and wire it into implicit provider resolution

Fixes #22409

Problem

When a user configures Kimi Coding via openclaw configure or sets KIMI_API_KEY, the provider is not auto-discovered because resolveImplicitProviders() has no handling for kimi-coding. Every other provider (moonshot, minimax, nvidia, xiaomi, etc.) has a corresponding buildXxxProvider() function and implicit resolution block, but kimi-coding was missing.

Additionally, applyKimiCodeProviderConfig() (used during onboarding) only set the model alias without writing the provider's api type or baseUrl to the config — unlike applyMoonshotProviderConfig() which correctly calls applyProviderConfigWithDefaultModel().

Root cause analysis:

  • 成因: Copy-paste omission — when kimi-coding was added as a separate provider from moonshot, the implicit provider resolution and onboarding config were not fully implemented. The auth credential flow was added but the provider template was not.
  • 引入时间: When kimi-coding was first added as a distinct provider (separate from moonshot)
  • 影响范围: All users configuring Kimi Coding via API key — the provider config is incomplete, causing 403 errors from the Kimi API
  • 严重程度: Feature completely non-functional — Kimi Coding cannot be used without manual JSON editing

Before fix:

KIMI_API_KEY=xxx openclaw configure → kimi-coding provider not created
→ API calls use wrong endpoint → 403 "Kimi For Coding is currently only available for Coding Agents"

Changes

  • src/agents/models-config.providers.ts — Add buildKimiCodingProvider() with api: "anthropic-messages" and baseUrl: "https://api.kimi.com/coding/"; add kimi-coding block in resolveImplicitProviders()
  • src/commands/onboard-auth.config-core.ts — Fix applyKimiCodeProviderConfig() to call applyProviderConfigWithDefaultModel() with correct api/baseUrl instead of only setting model alias
  • src/agents/models-config.providers.kimi-coding.test.ts — New: 3 tests covering implicit provider creation, build config, and no-key behavior

After fix:

KIMI_API_KEY=xxx openclaw configure → kimi-coding provider created with api: "anthropic-messages"
→ API calls use correct endpoint → model responds normally

Test plan

  • New test: kimi-coding provider created when KIMI_API_KEY is set (api=anthropic-messages, baseUrl correct)
  • New test: buildKimiCodingProvider() returns correct config
  • New test: kimi-coding not created when no API key configured
  • All 7 existing provider tests pass (models-config.providers.nvidia.test.ts)
  • All 10 model-selection tests pass

Effect on User Experience

Before: Users configuring Kimi Coding get 403 errors because the provider template is missing. Manual JSON editing required to fix.

After: Kimi Coding works out of the box when configured via openclaw configure or KIMI_API_KEY environment variable, using the correct anthropic-messages API endpoint.

Greptile Summary

This PR adds the missing kimi-coding implicit provider template that was causing 403 errors when users tried to configure Kimi for Coding via KIMI_API_KEY environment variable or openclaw configure.

Key changes:

  • Added buildKimiCodingProvider() function with correct anthropic-messages API type and base URL
  • Wired kimi-coding into resolveImplicitProviders() to auto-discover the provider when KIMI_API_KEY is set
  • Fixed applyKimiCodeProviderConfig() to properly call applyProviderConfigWithDefaultModel() instead of only setting the model alias
  • Added comprehensive test coverage (3 tests) for the new provider

The implementation follows the same pattern used by other providers (moonshot, minimax, nvidia) and correctly fixes the root cause where the provider api type and baseUrl were not being written to config during onboarding.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation correctly follows established patterns from other providers (moonshot, nvidia, minimax), includes comprehensive test coverage (3 tests), and directly addresses the reported 403 error issue. The fix properly wires the provider template into both implicit resolution and onboarding config paths using the correct anthropic-messages API type. Only minor style suggestion about constant reuse.
  • No files require special attention

Last reviewed commit: 961c47c

@openclaw-barnacle openclaw-barnacle bot added commands Command implementations agents Agent runtime and tooling size: S experienced-contributor labels Feb 21, 2026
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

agentModels: models,
providerId: "kimi-coding",
api: "anthropic-messages",
baseUrl: "https://api.kimi.com/coding/",
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.

hardcoded baseURL duplicates constant from models-config.providers.ts. consider either exporting KIMI_CODING_BASE_URL or using buildKimiCodingProvider().baseUrl like applyXiaomiProviderConfig does

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/onboard-auth.config-core.ts
Line: 220

Comment:
hardcoded baseURL duplicates constant from `models-config.providers.ts`. consider either exporting `KIMI_CODING_BASE_URL` or using `buildKimiCodingProvider().baseUrl` like `applyXiaomiProviderConfig` does

How can I resolve this? If you propose a fix, please make it concise.

@HenryLoenwind
Copy link
Copy Markdown
Contributor

I am not sure if this is correct. I use kimi-coding/k2p5, and aside from setting it as primary and having the API key in the environment, I have absolutely no configuration for that provider. So, unless some recent change ruined kimi-coding (I'm 2 versions back because of regressions), this already works.

@Takhoffman Takhoffman force-pushed the fix/kimi-coding-provider-template-22409 branch from 961c47c to a7f0e20 Compare February 21, 2026 13:34
@Takhoffman Takhoffman merged commit c62a6e7 into openclaw:main Feb 21, 2026
6 checks passed
@Takhoffman
Copy link
Copy Markdown
Contributor

PR #22526 - fix(models): add kimi-coding implicit provider template (#22526)

Merged via squash.

  • Merge commit: c62a6e7
  • Verified: pnpm build, pnpm check, pnpm test:macmini
  • Changes made:
    M CHANGELOG.md
    A src/agents/models-config.providers.kimi-coding.test.ts
    M src/agents/models-config.providers.ts
    M src/commands/onboard-auth.config-core.ts
  • Why these changes were made:

Summary

  • Changelog: CHANGELOG.md updated=true required=true opt_out=false

Thanks @lailoo!

mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
…) thanks @lailoo

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: lailoo <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
obviyus pushed a commit to guirguispierre/openclaw that referenced this pull request Feb 22, 2026
…) thanks @lailoo

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: lailoo <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…) thanks @lailoo

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: lailoo <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…) thanks @lailoo

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: lailoo <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built-in Kimi provider template uses wrong API type, gets overwritten on upgrade/doctor

3 participants