Skip to content

feat(providers/kimicode): add native Responses API support - #916

Draft
weselben wants to merge 2 commits into
ENTERPILOT:mainfrom
weselben:feat/kimicode-responses-api
Draft

feat(providers/kimicode): add native Responses API support#916
weselben wants to merge 2 commits into
ENTERPILOT:mainfrom
weselben:feat/kimicode-responses-api

Conversation

@weselben

@weselben weselben commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

The kimicode provider translated Responses API requests through chat completions, losing reasoning and usage shape. Kimi Code now serves the OpenAI Responses API natively at /responses. This PR forwards /v1/responses natively instead.

Files to review (3, +270 / -14):

File Why
internal/providers/kimicode/kimicode.go (start here) Native Responses/StreamResponses overrides plus request adaptation.
internal/providers/kimicode/kimicode_test.go Unit tests: adaptation rules and native round-trips.
docs/providers/kimicode.mdx Documents the native Responses path and its caveats.

Research

  • Official Kimi Code docs list Codex as a supported third-party tool; Codex uses the OpenAI Responses API: https://www.kimi.com/code/docs/en/third-party-tools/codex
  • Kimi platform docs list OpenAI Responses (/responses) as a supported protocol: https://platform.kimi.ai/docs/api/overview
  • Live upstream probe (2026-09-08): non-streaming returns a complete response object with reasoning and usage; streaming returns standard Responses SSE events; store: true returns 400; previous_response_id returns 400.
  • A https://api.kimi.ai/coding/v1 mirror answers with identical data. It is undocumented, and the official docs still list api.kimi.com/coding/v1. The base URL stays unchanged.

Reviewer notes

  • State is adapted, not rejected. The upstream retains no responses, so store: true is rewritten to false and previous_response_id is dropped before forwarding (Postel's law). Both would otherwise fail upstream with a 400.
  • Two adapter instances. The provider embeds openai.ChatCompatible for chat, models, embeddings, and passthrough, and holds an openai.CompatibleProvider for the native Responses transport. SetBaseURL updates both.
  • Bearer headers are set explicitly. NewCompatibleProvider applies no SetHeaders default, unlike NewChatCompatible.

Tests

  • go build ./... and go test ./... are green (run after make frontend for the dashboard-asset tests).
  • New tests cover: request adaptation (store pin, previous_response_id drop, no caller mutation), a non-streaming native round-trip against a recorded upstream shape, and streaming passthrough including the [DONE] marker appended by providers.EnsureResponsesDone.

Links


This PR description was generated with AI assistance.

Kimi Code serves the OpenAI Responses API natively at /responses
(documented for Codex integration, verified against the live upstream).
The provider now forwards /v1/responses natively instead of translating
through chat completions, keeping the chat-centric adapter for chat,
models, embeddings, and passthrough.

The upstream keeps no state: store=true is pinned to store=false and
previous_response_id is dropped before forwarding, since both are
rejected with a 400 otherwise.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/providers/kimicode/kimicode.go 92.30% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…the stream path

The streaming test sent a request without the state the adapter must
rewrite, so its previous_response_id assertion could never fail. Send
store=true and a previous_response_id, mirroring the non-streaming test.
Also point the package comment at adaptResponsesRequest instead of a
nonexistent responses.go.

@weselben weselben left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review summary

Automated review of the draft. Findings: 1 yellow (fixed), 1 blue (fixed), 1 question (answered below). No red findings.

  • 🟡 Stream-test wire assertion was vacuous — fixed in 7ea25c0.
  • 🔵 Package comment pointed at a nonexistent responses.go — fixed in 7ea25c0.
  • ❓ Upstream 400 behavior for store and previous_response_id — answered with probe evidence below.

Code change stays small and follows the existing chatgpt provider pattern. LGTM pending maintainer review.

Comment thread internal/providers/kimicode/kimicode_test.go
Comment thread internal/providers/kimicode/kimicode.go
Comment thread internal/providers/kimicode/kimicode.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants