+

Generate Word, Excel, PowerPoint and PDF
with OpenAI

Code

Python or TypeScript

GPT writes. Doconda delivers the file.

Give GPT Doconda's tools as functions and your agent delivers finished, editable, reviewed Word, Excel, PowerPoint and PDF files.

  1. 01Install the SDKpip install doconda or npm install @doconda/sdk, and your API key.
  2. 02Give your agent the toolsDoconda's tools, in OpenAI's format.
  3. 03Your agent delivers the fileYour agent gets the link to the reviewed file.
import json
from doconda import Doconda
from openai import OpenAI

openai = OpenAI()
tools = Doconda().tools()
specs = [{"type": "function", "function": {"name": t.name, "description": t.description,
          "parameters": t.input_schema}} for t in tools]
messages = [{"role": "user", "content": "Write a memo for the team: the office closes on Friday"}]

while True:
    message = openai.chat.completions.create(model="gpt-5", messages=messages, tools=specs).choices[0].message
    messages.append(message)
    if not message.tool_calls:
        break
    for call in message.tool_calls:
        out = next(t for t in tools if t.name == call.function.name).run(json.loads(call.function.arguments))
        messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(out)})

print(message.content)

FAQ

Common questions

01 / 04

How do I generate a Word file with the OpenAI API?

Install the SDK (pip install doconda or npm install @doconda/sdk), pass doconda.tools() as functions to chat.completions and run the one the model calls. Doconda returns the link to the Word file and its PDF.

The document API for AI agents, ready for production.