mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
[PR #49] [CLOSED] feat: add Cursor compatibility and improve tool_results handling #67
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jwadow/kiro-gateway/pull/49
Author: @somehow-paul
Created: 1/21/2026
Status: ❌ Closed
Base:
main← Head:feat/cursor-compatibility📝 Commits (1)
4fdc7e6feat: add Cursor compatibility and improve tool_results handling📊 Changes
7 files changed (+228 additions, -57 deletions)
View changed files
📝
kiro/converters_core.py(+28 -14)📝
kiro/converters_openai.py(+22 -5)📝
kiro/model_resolver.py(+18 -0)📝
kiro/models_openai.py(+17 -2)📝
tests/unit/test_converters_core.py(+41 -27)📝
tests/unit/test_converters_openai.py(+68 -0)📝
tests/unit/test_models_openai.py(+34 -9)📄 Description
PR Description
Summary
Add Cursor IDE compatibility and improve tool_results handling for better client support.
Changes
1. Cursor-style Flat Tool Format Support
Cursor IDE sends tools in a flat format instead of the standard OpenAI nested format:
Files changed:
kiro/models_openai.py- ExtendedToolmodel to accept both formatskiro/converters_openai.py- Added conversion logic for flat format2. Orphaned tool_results Handling Improvement
Previously, when a message contained
tool_resultswithout a preceding assistant message withtool_calls, the tool_results were silently stripped. Now they are converted to text representation and appended to the message content, preserving context for the model.Files changed:
kiro/converters_core.py- Convert orphaned tool_results to text instead of stripping3. Inverted Model Name Normalization
Added support for inverted model name format used by some clients:
Files changed:
kiro/model_resolver.py- Added pattern matching for inverted formatTesting
Kiro Gateway - Cursor IDE API Compatibility Test Report
Report Date: January 21, 2026
Gateway Version: Kiro Gateway (AGPL-3.0)
Test Client: Cursor IDE
API Standard: OpenAI Chat Completions API
Executive Summary
This report evaluates the compatibility between Kiro Gateway and Cursor IDE's AI agent functionality. The gateway acts as a proxy that translates OpenAI-compatible API requests to the Kiro (AWS CodeWhisperer) backend, enabling Cursor to use Claude models through the Kiro infrastructure.
text/event-stream1. API Endpoint Compatibility
1.1 Supported Endpoints
/v1/chat/completions/v1/models/health/1.2 Authentication
Authorization: Bearer {key}x-api-keyheader2. Request Format Analysis
2.1 Captured Cursor Request Structure
Based on the captured
request_body.json, Cursor sends requests with the following structure:{
"model": "claude-4.5-opus-high",
"messages": [...],
"tools": [...],
"max_tokens": 4096,
"system": [...],
"metadata": {"user_id": "..."},
"tool_choice": {"type": "auto"},
"stream": true,
"stream_options": {"include_usage": true}
}
There is still an unresolved problem: when using Cursor, the connection occasionally drops / the stream gets interrupted.
I’m not sure whether this is related to my FRP setup.
Since using the API in Cursor requires forwarding traffic through a public IP, FRP is involved in the network path.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.