In short
- Same agent, any screen.Replies come from the same knowledge, instructions and rules as your website chat.
- Streamed word by word.Ask for a stream and the reply arrives as it is written, in the AI SDK UI Message Stream format.
- Sources come with it.Each reply includes the sources it cited, with titles and links for web pages.
- Retries never double-bill.Retry with the same Idempotency-Key and you get the stored reply, not a second answer.
Your website is not the only place people have questions. Support staff want answers inside your helpdesk, customers want help inside your mobile app, and your product may need an agent in its own interface. The chat API lets you use your OneType agent anywhere you can make an HTTPS request, without the website widget.
Two calls to a cited answer
- Create a key with the conversations.write permission.
- Open a conversation for an agent with POST /v1/conversations.
- Send the visitor's message with POST /v1/conversations/{id}/messages.
- Read the reply: text parts plus a source part for each cited source.
Each reply is written, stored and counted exactly like an answer in your website chat. The conversation shows up in your inbox next to your website chats, and opening it shows that it came through the API, so your team sees everything in one place.
Streaming
Send stream: true and the reply arrives as server-sent events while it is being written, so your interface can show words as they appear. The format is the AI SDK UI Message Stream, version 1. If you use the Vercel AI SDK on your server, you can pass the response straight through to its chat hook. The stream ends with a finish event that tells you how the turn ended, and a final done marker.
Safe retries
Networks drop. Send an Idempotency-Key header with every message. If you retry with the same key, you get the stored reply instead of a second answer. Retrying a stream that already finished returns the stored reply as JSON. Disconnecting does not cancel an answer: it is still written and stored, so nothing is lost.
Limits
Each key can send up to 20 chat messages every 10 seconds, within the general limit of 100 requests every 10 seconds, the same on every paid plan. Keys are for servers only, so the chat API belongs in your backend, not in a web page. API keys need Premium or Enterprise. Free has none.
What people build with it
- A help panel inside your web or mobile app, powered by your backend.
- An agent inside an internal tool, so staff get cited answers from your docs.
- A bot in another messaging tool you run, forwarding questions to your agent.
- Automated checks that ask your agent a fixed set of questions and read the outcome.
In every case the answers follow the same instructions, knowledge and safety rules you set in the dashboard, and a streamed reply ends by telling you how the turn ended.
Replies arrive with their sources as separate parts, each with a title and, for web pages, a link, so your interface can show citations the way it likes. Every message also says whether it was written by AI, which helps you label it clearly for your users.