Fix reasoning model issue by updating chat API to v2#287
Fix reasoning model issue by updating chat API to v2#287bitun123 wants to merge 2 commits intocohere-ai:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 98fc5e4. Configure here.
| (await core.Supplier.get(this._options.environment)) ?? | ||
| environments.CohereEnvironment.Production, | ||
| "v1/chat", | ||
| "v2/chat", |
There was a problem hiding this comment.
V1 request/response format sent to V2 endpoint
High Severity
The endpoint URL was changed from v1/chat to v2/chat, but the request type (ChatStreamRequest), request serializer (serializers.ChatStreamRequest), response parser (serializers.StreamedChatResponse), streaming response type ("streaming" vs "sse"), and event shape ("json" with "\n" terminator vs "sse" with "[DONE]" terminator) all remain v1-format. The v1 request uses a message string field, while v2 expects a messages array with role/content objects — these are completely incompatible schemas. This will cause all chatStream calls to fail at the API level.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 98fc5e4. Configure here.


🛠 Fix: Update Chat API to v2 for Reasoning Model Support
📌 Problem
The
v1/chatendpoint does not support reasoning models, causing issues when trying to use them.✅ Solution
v1/chat→v2/chat🔍 Changes Made
🚀 Impact
🧪 Testing
Note
Medium Risk
Low code complexity but changes the network endpoint used by
chatStream, which could alter response shape/behavior or break users if their backend expectsv1semantics.Overview
Switches the SDK’s streamed chat request (
chatStream) from hittingv1/chattov2/chatto support reasoning models.Adds a short README note documenting the endpoint version update and the rationale.
Reviewed by Cursor Bugbot for commit 98fc5e4. Bugbot is set up for automated code reviews on this repo. Configure here.