Skip to main content
CLI · API · Agent Skill

Agent-first PDF to Markdown from your terminal

BlazeDocs gives developers a fast install path for converting PDFs into clean, structured Markdown before they enter AI agents, RAG pipelines, OpenAI tools, LangChain loaders, or Vercel AI SDK routes.

$ npm i -g blazedocs
$ pnpm add -g blazedocs
$ yarn global add blazedocs
$ bun add -g blazedocs
$ npx skills add https://github.com/kyle93afc/blazedocs-cli --skill blazedocs
$ curl -X POST https://blazedocs.io/api/v1/convert \
  -H "Authorization: Bearer $BLAZEDOCS_API_KEY" \
  -F "file=@./paper.pdf"

One command

Use npx, bunx, pnpm dlx, the Skill installer, or direct API curl.

Agent-ready Markdown

Preserve hierarchy, tables, formulas, and reading order before embedding or prompting.

Production signals

Exit codes and structured errors make it safe to run in CI, agents, workers, and queues.

Agent integration examples

Put clean Markdown in the model context, not raw PDFs.

The CLI and API are intentionally boring: convert first, then pass structured Markdown into the AI stack you already use.

OpenAI tool call

Let your agent convert a PDF before retrieval or summarisation.

const result = await tools.blazedocs.convert({
  file: './briefing.pdf',
  output: 'markdown',
})

await openai.responses.create({
  model: 'gpt-4.1',
  input: result.markdown,
})

LangChain loader

Use BlazeDocs as the reliable PDF parsing step before chunking.

const markdown = await blazedocs.convert('./manual.pdf')

const docs = await splitter.createDocuments([markdown], [{
  source: 'manual.pdf',
  parser: 'blazedocs',
}])

await vectorStore.addDocuments(docs)

Vercel AI SDK route

Normalize PDFs to Markdown inside a Next.js route or background job.

import { generateText } from 'ai'

const markdown = await blazedocs.convert(file)
const { text } = await generateText({
  model,
  prompt: `Summarise this PDF:

${markdown}`,
})
Automation-safe

Exit codes and error reference

Agents need deterministic failure handling. BlazeDocs returns clear statuses so your workflow can retry, ask for a better file, or route the user to billing.

ExitMeaning
0Conversion completed and Markdown was written successfully.
1Invalid arguments, missing file, or unsupported command option.
2Authentication failed. Check BLAZEDOCS_API_KEY or create a key in the dashboard.
3Quota, page, token, or file-size limit reached for the current plan.
4Conversion failed because the PDF is corrupt, encrypted, or unreadable.
5Network or BlazeDocs API error. Retry with backoff.
AUTH_REQUIRED

No API key was provided. Set BLAZEDOCS_API_KEY or pass --api-key.

FILE_TOO_LARGE

The PDF exceeds your current plan limit. Compress it or upgrade.

PAGE_LIMIT_EXCEEDED

The document has more pages than your monthly/page-per-file allowance.

UNSUPPORTED_FILE

The uploaded file is not a valid PDF. Image support is planned next.

CONVERSION_FAILED

The document could not be converted cleanly. Retry or contact support with the request ID.

Ship the ingestion layer

Stop making agents parse PDFs raw.

Convert PDFs into predictable Markdown first, then let the model do the reasoning.

Create API key →