Streaming

Get partial responses in real time with stream=True. Ideal for low-latency apps that thrive on fast feedback.

The Chat Completions API uses server-sent events (SSE) to stream a sequence of chunks. Handle them in real time to update your UI as the agent reasons, searches, and responds.

Here how to do this in Python and TypeScript.

1from openai import OpenAI
2
3client = OpenAI(
4 base_url="https://api.reka.ai/v1",
5 api_key=API_KEY
6)
7
8stream = client.chat.completions.create(
9 model="reka-flash-research",
10 messages=[
11 {
12 "role": "user",
13 "content": "Who won the UEFA Nations League 2025?",
14 },
15 ],
16 stream=True,
17)
18
19for chunk in stream:
20 delta = chunk.choices[0].delta
21 if delta.reasoning_steps:
22 if delta.reasoning_steps[-1]["tool_calls"]:
23 print(delta.reasoning_steps[-1]["reasoning_content"])
24 print(delta.reasoning_steps[-1]["tool_calls"])
25 else:
26 print(delta.reasoning_steps[-1]["content"])
27 else:
28 print(delta.reasoning_content)
29 print(delta.content)
30 print("****************")

What you get back

Each streamed chunk contains a delta: a partial result from the model. You’ll get reasoning steps, tool calls, and final answers in real time — exactly as the agent generates them.

Output
I'll search for the UEFA Nations League 2025 winner to find the most recent and accurate result from official or trusted sports sources.
[{'name': 'search_web', 'args': {'query': 'UEFA Nations League 2025 winner'}}]
****************
{
"tool_name": "search_web",
"tool_output": [
{
"url": "https://en.wikipedia.org/wiki/2025_UEFA_Nations_League_Finals",
"title": "2025 UEFA Nations League Finals - Wikipedia",
"snippet": "Spain were the defending champions, having won the 2023 finals. Portugal won the final against Spain on penalties, following a 2\u20132 draw after extra time, for\u00a0...Format \u00b7 Qualified teams \u00b7 Host selection \u00b7 Final",
"age": null
},
{
...
****************
Multiple credible sources (Wikipedia, UEFA.com, BBC, USA Today) confirm Portugal won the 2025 UEFA Nations League final against Spain. The information is consistent across all results; no further action needed.
Portugal won the 2025 UEFA Nations League, defeating Spain 5-3 on penalties after a 2-2 draw in the final ([wikipedia.org](https://en.wikipedia.org/wiki/2025_UEFA_Nations_League_Finals), [uefa.com](https://www.uefa.com/uefanationsleague/news/0297-1d5ccb0b6747-d10a8fc4eb86-1000--portugal-meet-the-nations-league-winners/), [bbc.com](https://www.bbc.com/sport/football/articles/cvg5w9nw28no)).
****************