This guide explains how to integrate Refile’s PDF generation capabilities with the Vercel AI SDK in just a few lines of code. This integration allows AI models to generate PDFs directly from markdown content as part of their response flow.Documentation Index
Fetch the complete documentation index at: https://docs.refile.co/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A refile API key (available from your refile dashboard)
- Node.js project with Vercel AI SDK installed
- Basic familiarity with Vercel AI SDK usage patterns
Quick Start
- Install the dependencies:
- Copy the refile tool code from refileTool.js:
- Replace
<token>in index.js with your refile API key and start generating PDFs!
Customization Options
Want a different look? Just change these parameters when callinggetRefileTool():