From 0d07b421dfa2452c778d786e68deee3a0f3d2fcc Mon Sep 17 00:00:00 2001 From: Evan <58194240+celestial-vault@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:04:09 -0700 Subject: [PATCH] Stream Grok 3 Mini reasoning tokens (#2829) * stream reasoning tokens * changeset * Update .changeset/sixty-jokes-hope.md Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: Dennis Bartlett Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- .changeset/sixty-jokes-hope.md | 5 +++++ src/api/providers/xai.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/sixty-jokes-hope.md diff --git a/.changeset/sixty-jokes-hope.md b/.changeset/sixty-jokes-hope.md new file mode 100644 index 00000000..8c16b769 --- /dev/null +++ b/.changeset/sixty-jokes-hope.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Stream Grok 3 mini reasoning tokens diff --git a/src/api/providers/xai.ts b/src/api/providers/xai.ts index 07d0418a..355ad170 100644 --- a/src/api/providers/xai.ts +++ b/src/api/providers/xai.ts @@ -35,6 +35,14 @@ export class XAIHandler implements ApiHandler { } } + if ("reasoning_content" in delta && delta.reasoning_content) { + yield { + type: "reasoning", + // @ts-ignore-next-line + reasoning: delta.reasoning_content, + } + } + if (chunk.usage) { yield { type: "usage",