feat(providers/kimicode): add native Responses API support - #916
feat(providers/kimicode): add native Responses API support#916weselben wants to merge 2 commits into
Conversation
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.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report❌ Patch coverage is
📢 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
left a comment
There was a problem hiding this comment.
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.
TL;DR
The
kimicodeprovider 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/responsesnatively instead.Files to review (3, +270 / -14):
internal/providers/kimicode/kimicode.go(start here)Responses/StreamResponsesoverrides plus request adaptation.internal/providers/kimicode/kimicode_test.godocs/providers/kimicode.mdxResearch
/responses) as a supported protocol: https://platform.kimi.ai/docs/api/overviewresponseobject with reasoning and usage; streaming returns standard Responses SSE events;store: truereturns 400;previous_response_idreturns 400.https://api.kimi.ai/coding/v1mirror answers with identical data. It is undocumented, and the official docs still listapi.kimi.com/coding/v1. The base URL stays unchanged.Reviewer notes
store: trueis rewritten tofalseandprevious_response_idis dropped before forwarding (Postel's law). Both would otherwise fail upstream with a 400.openai.ChatCompatiblefor chat, models, embeddings, and passthrough, and holds anopenai.CompatibleProviderfor the native Responses transport.SetBaseURLupdates both.NewCompatibleProviderapplies noSetHeadersdefault, unlikeNewChatCompatible.Tests
go build ./...andgo test ./...are green (run aftermake frontendfor the dashboard-asset tests).previous_response_iddrop, no caller mutation), a non-streaming native round-trip against a recorded upstream shape, and streaming passthrough including the[DONE]marker appended byproviders.EnsureResponsesDone.Links
This PR description was generated with AI assistance.