You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chat.send() overloads do not narrow the response type #796
Confirmed against the current source. One thing worth adding for whoever picks this up upstream: this repository is fully generated by Speakeasy (see CONTRIBUTING.md), so the overload signatures can't be fixed by editing src/sdk/chat.ts directly.
The root cause is visible in the generated file anyway: the existing overloads all return operations.SendChatCompletionRequestResponse, which is itself the ChatResult | EventStream<ChatStreamChunk> union. For the generator to emit discriminated returns (stream?: false -> Promise<ChatResult>, stream: true -> Promise<EventStream<ChatStreamChunk>>), the upstream OpenAPI spec needs to expose stream as a request-level discriminator so Speakeasy can split the response per variant. The durable fix therefore lives in the spec/monorepo side rather than in this repo.
Happy to test the next generated release against both usage patterns from this report once it lands.
Activity
kritikmodi commentedon Aug 11, 2026
Related docs issue : OpenRouterTeam/docs#238
slegarraga commentedon Aug 21, 2026
Confirmed against the current source. One thing worth adding for whoever picks this up upstream: this repository is fully generated by Speakeasy (see CONTRIBUTING.md), so the overload signatures can't be fixed by editing
src/sdk/chat.tsdirectly.The root cause is visible in the generated file anyway: the existing overloads all return
operations.SendChatCompletionRequestResponse, which is itself theChatResult | EventStream<ChatStreamChunk>union. For the generator to emit discriminated returns (stream?: false->Promise<ChatResult>,stream: true->Promise<EventStream<ChatStreamChunk>>), the upstream OpenAPI spec needs to exposestreamas a request-level discriminator so Speakeasy can split the response per variant. The durable fix therefore lives in the spec/monorepo side rather than in this repo.Happy to test the next generated release against both usage patterns from this report once it lands.
f3tchcodes commentedon Oct 7, 2026
Facing this issue, has anyone opened a PR to fix this?