[PR #320] [MERGED] feat(kiro): add extended thinking passthrough and structured reasoning outputs #334

Closed
opened 2026-02-27 07:18:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/320
Author: @Asoubra12
Created: 2/11/2026
Status: Merged
Merged: 2/20/2026
Merged by: @justlovemaki

Base: mainHead: pr/kiro-extended-thinking-slim


📝 Commits (1)

  • 9f3040c feat(kiro): add request-side extended thinking support and structured reasoning outputs

📊 Changes

9 files changed (+491 additions, -100 deletions)

View changed files

📝 README.md (+70 -1)
📝 src/converters/strategies/ClaudeConverter.js (+17 -7)
📝 src/converters/strategies/OpenAIConverter.js (+28 -6)
📝 src/converters/strategies/OpenAIResponsesConverter.js (+6 -1)
📝 src/providers/claude/claude-kiro.js (+205 -85)
tests/claude-converter-thinking.test.js (+43 -0)
tests/kiro-thinking-parsing.test.js (+40 -0)
tests/openai-converter-thinking.test.js (+55 -0)
tests/openai-responses-converter-thinking.test.js (+27 -0)

📄 Description

Summary

Add enterprise-style extended thinking support for Kiro-backed Claude requests across both API styles:

  • OpenAI /v1/chat/completions
  • Anthropic /v1/messages

What This PR Changes

  • Adds request-side passthrough for extra_body.anthropic.thinking in OpenAI-compatible requests.
  • Supports both:
    • thinking: { "type": "enabled", "budget_tokens": N }
    • thinking: { "type": "adaptive", "effort": "low|medium|high" }
  • Extends Kiro request prefix generation for adaptive mode via Kiro meta tags.
  • Improves Kiro thinking-tag parsing in streaming and non-streaming paths.
  • Returns structured thinking output:
    • Anthropic: content[] with type: "thinking" and type: "text"
    • OpenAI: choices[0].message.reasoning_content

Compatibility / Safety

  • No changes to OAuth token acquisition/refresh semantics.
  • No changes to provider pool architecture.
  • Keeps existing behavior when thinking is not requested.

Validation

  • Added focused tests:
    • tests/openai-converter-thinking.test.js
    • tests/openai-responses-converter-thinking.test.js
    • tests/kiro-thinking-parsing.test.js
    • tests/claude-converter-thinking.test.js

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/justlovemaki/AIClient-2-API/pull/320 **Author:** [@Asoubra12](https://github.com/Asoubra12) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/20/2026 **Merged by:** [@justlovemaki](https://github.com/justlovemaki) **Base:** `main` ← **Head:** `pr/kiro-extended-thinking-slim` --- ### 📝 Commits (1) - [`9f3040c`](https://github.com/justlovemaki/AIClient-2-API/commit/9f3040cf4922db763a236b0f9f7c5589cbfaf785) feat(kiro): add request-side extended thinking support and structured reasoning outputs ### 📊 Changes **9 files changed** (+491 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+70 -1) 📝 `src/converters/strategies/ClaudeConverter.js` (+17 -7) 📝 `src/converters/strategies/OpenAIConverter.js` (+28 -6) 📝 `src/converters/strategies/OpenAIResponsesConverter.js` (+6 -1) 📝 `src/providers/claude/claude-kiro.js` (+205 -85) ➕ `tests/claude-converter-thinking.test.js` (+43 -0) ➕ `tests/kiro-thinking-parsing.test.js` (+40 -0) ➕ `tests/openai-converter-thinking.test.js` (+55 -0) ➕ `tests/openai-responses-converter-thinking.test.js` (+27 -0) </details> ### 📄 Description ## Summary Add enterprise-style extended thinking support for Kiro-backed Claude requests across both API styles: - OpenAI `/v1/chat/completions` - Anthropic `/v1/messages` ## What This PR Changes - Adds request-side passthrough for `extra_body.anthropic.thinking` in OpenAI-compatible requests. - Supports both: - `thinking: { "type": "enabled", "budget_tokens": N }` - `thinking: { "type": "adaptive", "effort": "low|medium|high" }` - Extends Kiro request prefix generation for adaptive mode via Kiro meta tags. - Improves Kiro thinking-tag parsing in streaming and non-streaming paths. - Returns structured thinking output: - Anthropic: `content[]` with `type: "thinking"` and `type: "text"` - OpenAI: `choices[0].message.reasoning_content` ## Compatibility / Safety - No changes to OAuth token acquisition/refresh semantics. - No changes to provider pool architecture. - Keeps existing behavior when thinking is not requested. ## Validation - Added focused tests: - `tests/openai-converter-thinking.test.js` - `tests/openai-responses-converter-thinking.test.js` - `tests/kiro-thinking-parsing.test.js` - `tests/claude-converter-thinking.test.js` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 07:18:59 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#334
No description provided.