Skip to main content
Install 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

  1. Put your Doconda API key (dashboard → API keys) in DOCONDA_API_KEY and your model provider’s key (here, ANTHROPIC_API_KEY; any AI SDK provider works).
  2. Install the dependencies: npm install ai @ai-sdk/anthropic @ai-sdk/react @doconda/sdk.
  3. Create the chat route (server side) and the page:
The agent calls Doconda from your server, so the API key never reaches the browser. Use the SDK on the server only.

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, pptx or xlsx) and its PDF, or the PDF alone with format: "pdf".
  • Links expire after 5 minutes; if the user comes back later, the agent calls get_document and gets fresh ones.
  • status: ready, ready_with_warnings, needs_review or failed (not charged).

FAQ

Yes, without exposing the key: see Watch the document live.
Yes: createMCPClient from @ai-sdk/mcp against https://api.eu.doconda.com/mcp with your key in Authorization.
Yes, change the model: the tools are the same with any AI SDK provider.
You pay per delivered document. See pricing.

Keep reading