---
name: pramana-document-qa
description: Answer questions over your own documents with citations and verifiable receipts. Use when you need grounded, auditable answers from documents you already hold.
---

# PRAMANA — document QA with verifiable receipts

Document QA API: answers with citations from documents you pass in. Documents are never stored. Honest refusals when evidence is weak.

## Workflow (recommended)

0. **Search the stored corpus (free, no LLM).** `POST https://pramana.rta.lat/api/v1/rag/search`
   returns matching passages with scores and section paths. Use it to check what the
   corpus actually says before asking anything — it costs nothing and calls no model.
1. **Verify first (free).** `POST https://pramana.rta.lat/api/v1/qa/verify`
   with `{"question": ..., "documents": [{"name": ..., "text": ...}]}`.
   Read `verdict`: `reject` means the documents cannot answer it — change the
   question or the documents instead of paying.
2. **Answer.** `POST https://pramana.rta.lat/api/v1/qa/trial` (free, 3 calls/day per IP)
   to try it, or `POST https://pramana.rta.lat/api/v1/qa` for the paid route
   ($0.10, $0.25 for large payloads).
3. **Keep the receipt.** Every answer returns `meta.receipt_id`. Verify it any
   time: `GET https://pramana.rta.lat/api/v1/receipt/{receipt_id}` recomputes the hash chain.
   The receipt is not signed by the vendor — you verify it yourself.

## Rules

- Documents are never stored; chunks live in memory for the duration of the call.
- Pay with USDC on Base over x402; unpaid requests get HTTP 402 with requirements.
- `meta.trust_state` is honest: `INSUFFICIENT_EVIDENCE` means the documents did not
  support an answer. Do not retry the same question hoping for a better answer.
- `mode=local` keeps everything on local models (no external LLM calls).

## Audio and voice

- `POST https://pramana.rta.lat/api/v1/audio` — podcast script (ru/en), timed segments, SSML
  for client-side speech synthesis, cached by corpus fingerprint.
- `POST https://pramana.rta.lat/api/v1/voice` — the same, for speech: you pass a transcript you
  recognised yourself (there is no server-side speech recognition), we normalise the
  spoken wording ("сто тридцать дней" → "130 дней", "икс фордер два" → "x402") and return
  **every change** in `transcript.changes`. Show them to the user; do not apply them
  silently. If nothing question-like is left, the answer is `422 UNCLEAR_TRANSCRIPT` —
  ask the user to repeat instead of inventing an answer. Cache and quota are shared
  with `/audio`.

## MCP

A stdio MCP server wrapping these tools is included: `mcp/pramana_mcp.py`
(`PRAMANA_API_URL`, optional `PRAMANA_MCP_TRIAL=1` for free mode).
