ai and @doconda/sdk, turn doconda.tools() into AI SDK tools with tool() and jsonSchema(), and pass
them to streamText in your chat route. When the user asks for a document, the model calls create_document and its
answer carries the download link, which useChat renders in the UI.
Steps
- Put your Doconda API key (dashboard → API keys) in
DOCONDA_API_KEYand your model provider’s key (here,ANTHROPIC_API_KEY; any AI SDK provider works). - Install the dependencies:
npm install ai @ai-sdk/anthropic @ai-sdk/react @doconda/sdk. - Create the chat route (server side) and the page:
What you get back
The tool returns this summary to the model, and the model writes the link into its answer:links: the file (docx,pptxorxlsx) and its PDF, or the PDF alone withformat: "pdf".- Links expire after 5 minutes; if the user comes back later, the agent calls
get_documentand gets fresh ones. status:ready,ready_with_warnings,needs_revieworfailed(not charged).
FAQ
Can I show the document being written on my site?
Can I show the document being written on my site?
Yes, without exposing the key: see Watch the document live.
Does it work with the AI SDK MCP client?
Does it work with the AI SDK MCP client?
Yes:
createMCPClient from @ai-sdk/mcp against https://api.eu.doconda.com/mcp with your key in Authorization.Does it work with OpenAI, Gemini or Bedrock?
Does it work with OpenAI, Gemini or Bedrock?
Yes, change the
model: the tools are the same with any AI SDK provider.How much does it cost?
How much does it cost?
You pay per delivered document. See pricing.
Keep reading
- AI SDK: the full guide.
- A Vercel AI SDK chatbot that returns a Word file: the step-by-step tutorial.
- Quickstart.