#accessing reasoning tokens

1 messages · Page 1 of 1 (latest)

weak summit
#

From what I can see, it doesn't appear possible to stream back reasoning tokens from models like ChatOpenAI. These are present in my AI runs, but not at all in the CopilotKit runtime.

I am using useCopilotChatHeadless_c.

Can someone tell me if this is planned, or I am missing something?

proud abyssBOT
#

This solution has been AI generated

It’s not currently possible to stream or access reasoning tokens in CopilotKit. The runtime and useCopilotChatHeadless_c only stream message content and tool calls; they don’t expose reasoning_tokens or similar usage fields from providers like OpenAI.

Current Status

  • Not supported: CopilotKit’s OpenAI adapter streams text and tool-call chunks, but does not capture or return reasoning token usage or final usage stats.
  • No runtime API: There are no stream completion callbacks or fields exposing reasoning_tokens in the runtime.
  • Hook scope: useCopilotChatHeadless_c provides standard chat primitives (messages, sendMessage, isLoading, suggestions) without reasoning-token access.

What’s Available Instead

const {
  messages,
  sendMessage,
  isLoading,
  generateSuggestions,
  interrupt,
} = useCopilotChatHeadless_c();
  • Streams content and tool calls.
  • No reasoning token metrics in the returned data.

Workarounds

  • Direct provider integration: Call your LLM provider directly (e.g., non-streaming completion) to read final usage fields, including reasoning tokens, alongside CopilotKit.
  • Custom runtime changes: Extend CopilotKit’s OpenAI adapter to capture and emit final usage stats once the stream completes.
  • Contribution/feature request: This capability isn’t present in the codebase; adding it would require framework changes.

References

Was this helpful?

If this solution worked for you, please click on the appropriate option below to help us improve:

proud abyssBOT
#

Thank you for your feedback! Our team will provide additional assistance. 🔄

weak summit
#

Hi <@&1229452952104603650> I assume this is on the roadmap – can you give me a rough ETA so our team can decide on direct LLM integration or not

proud abyssBOT
#

Hey! I've shared this with the team - they'll check and get back to you. Thanks!

ivory dune
#

It is about 2 weeks away I'd say @weak summit

weak summit
#

@ivory dune thanks for the update – that timing works brilliantly.

wispy herald
#

+1 on the request!! super excited for CPK 1.5 Version

proud abyssBOT
wispy herald
#

yess I did!

proud abyssBOT
#

Nice!! Thanks for signing up.

austere axle
#

@gusty hamlet can you provide a brief overview of what to expect with v1.50? I also signup and looking forward to exploring the new updates.

gusty hamlet
open wing
#

Hey @austere axle, I can share a quick update on what’s actually coming in CopilotKit v1.50, and what's changing under the hood.

So yes - v1.50 is fully built on AG-UI now. What this means is that the frontend is speaking directly to agents through the AG-UI protocol instead of our older runtime bridge. It’s a big architectural shift, and it unlocks a lot of flexibility going forward.

A few specifics worth calling out:

  • Thread support now works across frameworks. You can keep the conversation state whether you’re in Next.js, React, etc.
  • You can reconnect to running agents. Drop your session, come back later, and pick up right where you left off.
  • The entire AG-UI client API is exposed on the frontend now — things like subscribing to events, connecting to live agents, and even running agents outside of the chat flow.
  • You can run multiple agents at once in the same UI.

For full customization, you can now subscribe to all AG-UI events and define your own behavior for how agents interact with your app.

Docs are here if you want to dig into what’s new on the client side:
👉 https://docs.ag-ui.com/sdk/js/client/subscriber

Also, sign up for the early access (we'll notify you once the prelease is out) at https://copilotkit.ai

short dew
#

Can’t wait to try v1.50

#

Can we still use direct LLMs?

#

Wanted to use ai-ask models in the past but it was not supported

austere axle
#

Awesome, thank you Nathan! Looking forward to trying it out. Already signed up.

austere axle
#

@sacred turtle FYI

sacred turtle
#

Thanks @austere axle

open wing
#

Just an update here, we were hoping to ship the pre-release today but it's looking more like Monday. I will keep everyone posted!

open wing
ivory dune
#

1.50.0 is out for everyone following this thread!

wispy herald
#

@ivory dune where can I find the docs to access reasoning tokens?

ivory dune