Docs

Guides

Files & Documents

Files & Documents

Attach images and documents to a request to analyze, compare or reference them.

Attach up to five supported images or documents to a request. Aivana can read them, answer questions about them, and compare several side by side. The API, the SDKs' attachment support and the Playground all follow the limits below.

Supported files and limits

KindTypes (mime_type)Limit
Imagesimage/png, image/jpeg, image/webp, image/gif8 MiB each
PDFapplication/pdf10 MiB each; 150 pages in all
Wordapplication/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx)10 MiB each
CSVtext/csv10 MiB each
  • At most 5 files per request, in any mix, and 40 MiB in all.
  • Word and CSV text together can't exceed 400,000 characters per request.
  • A file that can't be read (an encrypted PDF or Word document, an old .doc file, a CSV that isn't text) is refused with an error that says why, and which file.

How files are read

  • A PDF is read as the original file, its pages as well as its text, so charts and scanned pages are read too, and answers cite pages, like (p. 4).
  • A Word document is read as its text, with its headings, lists, tables and footnotes. Pictures inside it aren't read.
  • A CSV file is read with totals, averages and ranges computed exactly over every row.
  • Attach two or more documents to compare them: answers say which document each point comes from, by its title or its number in the order you attached them.

API request

Send each file base64-encoded in the attachments field, with its mime_type. The SDKs take the same two fields (Node.js spells the second mimeType), so you don't build the request body yourself.

bash
curl https://api.aivana.ai/v1/generate \
  -H "X-API-Key: $AIVANA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Summarize the key risks in this contract.",
    "attachments": [
      { "mime_type": "application/pdf", "data": "<base64 of the file>" }
    ]
  }'

Usage and billing

Files are billed as input tokens, and are included in usage.input_tokens. Each image counts as its pixels divided by 750 after it is scaled to fit, at most 1,534 tokens. A PDF counts as 2,300 tokens a page. A Word or CSV file counts as one token for every 4 characters of its text. A request that doesn't finish isn't charged for its files.

Follow-ups reuse files

Files you send again with a follow-up can be served from cache, and cached input is charged at the cached-input rate. See Pricing & Billing.

Learn more

Parameters

Every option the Generate API accepts.

View in Docs

Try the Playground

Experiment with Aivana MMI — no account or code required.

Open PlaygroundView in Docs

Quickstart Guide

Get your key and make your first request in minutes.

Still have questions? We are here to help!

Try live

Run chat interactively in the Playground without any setup.

On this page

Files & DocumentsSupported files and limitsHow files are readAPI requestUsage and billing

Helpful links

Aivana Status

Was this helpful?

Still have questions? We are here to help!