Before you start
1
Get a personal access token
Dashboard: Organization → API Tokens. The value is shown once. Export it as
TALQING_API_KEY. See authentication.2
Add an OpenAI provider key
Dashboard: Build → Provider Keys. Without it, publishing fails with
no OpenAI API key for this workspace - add one under Provider keys. See provider keys.The whole script
What each call does
The same calls in cURL:
Streaming the reply
Add"stream": true and the same request answers as server-sent events: assistant.started, assistant.delta (chunks that append, not cumulative) and assistant.completed, an item.created per item, then one turn.result carrying the normal JSON body. See streaming.
cURL
POST /v1/chats/{chat_id}/token), and the page uses TalqingChat from @talqing/client.
Next
Chats
Streaming, browser tokens, items and the chat lifecycle.
Tools
Give the agent something to call before it answers.