Skip to main content
An LLM answer is only as useful as your reader’s ability to check it. TokenPath shows where each statement in an answer came from: the exact sentence, figure, or clause in the source text.

How it works

1

Generate an answer with any model

Use GPT, Claude, Gemini, an open-weight model, or a multi-step agent. Keep the exact source text, question, and answer strings.
2

Send all three to TokenPath

Call POST /v1/attributions with document, question, and answer. TokenPath picks out the phrases in the answer that carry facts and finds the text in the document that supports each one.
3

Render the links

Each result has an answer range, a source range, and a confidence. Use them to draw citations, highlight evidence, or rank sources.
TokenPath measures attribution from the attention of its own attribution model, run over your document and answer. It needs no access to your generator’s weights, logprobs, or prompts, so it works the same with every provider.

What you get back

  • answer.start and answer.end index into the answer you sent.
  • source.start and source.end index into the document you sent.
  • text is the exact substring each range covers, so you can skip the integers entirely if you only need the text.
  • confidence is the strength of the link, from 0 to 1. Use it to rank or annotate citations.
Offsets are counted in the response’s offset_encoding. The default, utf-16, matches JavaScript strings. Python callers should send "offset_encoding": "utf-32". See Offsets and encoding.

What TokenPath is not

  • Not a generator. It attributes answers you already have. (The optional /v1/generate endpoint exists for demos only.)
  • Not a correctness score. confidence says how strongly an answer phrase is tied to a source range. It does not say whether the answer is right.
  • Not a retriever. Send the text your model actually read, such as a document, retrieved chunks joined together, or extracted PDF text.

Next steps