Skip to main content
Asking a model to cite its sources adds prompt complexity, and the model’s citations are self-reported. TokenPath gives you citations measured from the text itself, after the answer is written. You don’t need prompt changes, output format rules, or a different provider.

Pattern

  1. Generate an answer with any model, the way you do today.
  2. Send the same document, question, and answer to POST /v1/attributions.
  3. Render each returned answer range as a citation that points to its source range.

Good fit

  • Chat and search answers over a document, a knowledge base, or retrieved web pages.
  • RAG pipelines. Send the retrieved chunks the model saw, joined into one document.
  • Agents whose final answer summarizes tool output. Send the tool output as the document.
  • Any setup where you can’t or don’t want to change the generating model.

Tips

  • Cite the facts, not every word. TokenPath already picks out the phrases that carry facts.
  • Show the source text on hover or click, so readers can check a claim without leaving the answer.
  • When several documents are joined into one, record where each begins. Then you can map a source range back to its document and title.

Implementation

The inline citations cookbook builds numbered citations end to end in Python and JavaScript.