fix(kilo): Fix provider integration with correct API, SDK, model IDs, and auth#172
fix(kilo): Fix provider integration with correct API, SDK, model IDs, and auth#172
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #171
#171) Added rawModel field to the "using explicit provider/model" log message to help diagnose cases where the parsed model differs from what the user specified. This aids in identifying caching issues or argument parsing problems. Also created comprehensive case study documentation in docs/case-studies/issue-171/ with root cause analysis (likely stale Bun module cache). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
--model kilo/glm-5-free is not workingCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 9ee983a.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Please check my feedback, and redo analysis, we still don't get this model working. Use original requirements as a hint: #171 (comment) Also you asked me to use commands to clean the bun cache, that don't work globally, that should be also reflected in analysis so we will not repeat these mistakes. Ensure all changes are correct, consistent, validated, tested and fully meet all discussed requirements (check issue description and all comments in issue and in pull request). Ensure all CI/CD checks pass. |
|
🤖 AI Work Session Started Starting automated work session at 2026-02-14T12:15:54.992Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Root cause: The kilo provider was misconfigured with wrong API endpoint
(api/gateway instead of api/openrouter), wrong SDK package
(@ai-sdk/openai-compatible instead of @openrouter/ai-sdk-provider),
wrong anonymous API key ('public' instead of 'anonymous'), and missing
device auth support.
Changes:
- Fix base URL from /api/gateway to /api/openrouter
- Switch SDK from @ai-sdk/openai-compatible to @openrouter/ai-sdk-provider
- Change anonymous key from 'public' to 'anonymous'
- Add required Kilo headers (User-Agent, X-KILOCODE-EDITORNAME)
- Add Kilo device auth plugin for `agent auth login`
- Add Kilo to auth provider priority list
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated all Kilo model ID mappings to match what's actually available on the Kilo API (https://api.kilo.ai/api/openrouter/models): - glm-5-free: z-ai/glm-5 -> z-ai/glm-5:free (the non-:free is paid) - Replaced glm-4.7-free (not on API) with glm-4.5-air-free (z-ai/glm-4.5-air:free) - Removed kimi-k2.5-free (moonshot/ prefix wrong, not free on Kilo) - Replaced minimax-m2.1-free (not on API) with minimax-m2.5-free (minimax/minimax-m2.5:free) - giga-potato-free: giga-potato:free -> giga-potato (no :free suffix) - trinity-large-preview: arcee/ -> arcee-ai/trinity-large-preview:free - Added deepseek-r1-free (deepseek/deepseek-r1-0528:free) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added: - docs/case-studies/issue-171/README.md: Full root cause analysis with 6 compounding failures identified, timeline, lessons learned - docs/case-studies/issue-171/original-failure-log.txt: Original log - experiments/issue-171/test-kilo-sdk.mjs: SDK integration test script Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 AI Work Session Completed Summary of ChangesDeep investigation found 6 compounding root causes for the Fixes Applied
Files Changed
Upstream Issue Filed
CI StatusAll checks passing: ✅ Changesets, ✅ Lint & Format, ✅ Unit Tests (macOS, Windows, Ubuntu) Usage After This Fix# First authenticate (one-time):
agent auth login # Select "Kilo Gateway (Device Authorization)"
# Then use kilo models:
agent --model kilo/glm-5-free
agent --model kilo/deepseek-r1-free
agent --model kilo/minimax-m2.5-freePrevious Misdiagnosis CorrectedThe v0.12.1 fix incorrectly attributed the failure to a stale Bun cache. The actual problem was a completely broken Kilo provider integration requiring fixes across 6 dimensions. The case study documents this to prevent similar misdiagnoses. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Fixes #171 -
--model kilo/glm-5-freewas completely non-functional due to 6 compounding integration bugs.Root Causes Found
/api/gatewayinstead of/api/openrouter@ai-sdk/openai-compatibleinstead of@openrouter/ai-sdk-provider'public'instead of'anonymous'z-ai/glm-5should bez-ai/glm-5:free)Changes
How to Use
After this fix, users need to authenticate with Kilo first:
```bash
agent auth login # Select "Kilo Gateway (Device Authorization)"
```
Then use Kilo models:
```bash
agent --model kilo/glm-5-free
agent --model kilo/minimax-m2.5-free
agent --model kilo/deepseek-r1-free
```
Upstream Issue Filed
Filed Kilo-Org/kilo#315 about anonymous access not working for completions.
Test plan
🤖 Generated with Claude Code