The normalizeMessages function in transform.ts was missing a block that
normalizes tool call IDs for Claude models. This block exists in the
upstream OpenCode repo but was inadvertently removed in our fork.
The normalization replaces any characters that are not alphanumeric,
underscore, or hyphen with underscores in toolCallId fields. This
prevents Claude from rejecting messages with tool call IDs containing
invalid characters.
Disable reasoning for Claude models via Kilo Gateway until the
OpenRouter AI SDK is upgraded to v2.x (which includes the fix for
reasoning_details duplication - OpenRouterTeam/ai-sdk-provider#344).
Changes:
- Remove hardcoded reasoning effort for Claude in options()
- Return empty variants for Claude in variants()
- Remove Claude-specific reasoning.effort in smallOptions()
- Keep thinking/reasoning block stripping code (prevents corrupt
reasoning_details from being sent back to the API)
- Caching continues to work via model.api.id matching
Fixes#303
Previously prompt caching via applyCaching() was disabled for both
OpenRouter and Kilo Gateway to avoid modifying thinking blocks. PR #270
re-enabled it for Kilo Gateway only. This change re-enables it for both
providers by including isOpenRouterOrKilo in the caching condition.
Thinking block stripping still applies to both providers before caching
is applied, so the original concern about modified thinking blocks is
addressed.
* feat: changelog generation
* refactor: rename all ENV variables to KILO prefix
* refactor: publish rework
* refactor: publish rework
* refactor: unify git commiter action
* refactor: add all kilobots to the team
* fix: use 'max' instead of 'xhigh' as highest reasoning effort for Anthropic models on Kilo Gateway
Anthropic's native effort levels are low/medium/high/max, not xhigh.
The upstream merge replaced the Kilo-specific effort mapping with
OPENAI_EFFORTS which uses xhigh. This restores 'max' as the
user-facing variant name while mapping it to 'xhigh' on the wire
for OpenRouter API compatibility.
* fix: clarify comment about OpenRouter effort naming vs Anthropic naming
* feat: enable reasoning for Claude models via Kilo Gateway
Enable extended thinking/reasoning support for Claude models when using
Kilo Gateway (OpenRouter-based). This includes:
- Add Kilo Gateway to OpenRouter SDK key mapping
- Skip toolCallId normalization for OpenRouter/Kilo to preserve thinking blocks
- Strip thinking/reasoning blocks from messages before sending to avoid
Anthropic API signature validation errors (blocks must be unchanged)
- Skip caching for OpenRouter/Kilo to avoid modifying thinking blocks
- Add Claude-specific reasoning effort variants for Kilo Gateway
- Enable default medium reasoning effort for Claude via Kilo Gateway
- Add proper smallOptions handling for Claude vs other models
The key insight is that Anthropic's API requires thinking blocks to be
EXACTLY unchanged with valid signatures. Since our storage reconstructs
messages, we strip thinking blocks (already shown to user) rather than
risk signature validation failures.
* fix: drop empty messages after stripping thinking blocks
GPT models accessed through Kilo Gateway were missing the
'include: ["reasoning.encrypted_content"]' option, causing
organization_id mismatch errors when encrypted reasoning content
was passed back in multi-turn conversations.
- Add reasoningSummary and include options to effortVariants for Kilo Gateway
- Extend options() condition to include @kilocode/kilo-gateway npm package