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.What you get back
answer.startandanswer.endindex into theansweryou sent.source.startandsource.endindex into thedocumentyou sent.textis the exact substring each range covers, so you can skip the integers entirely if you only need the text.confidenceis the strength of the link, from0to1. Use it to rank or annotate citations.
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/generateendpoint exists for demos only.) - Not a correctness score.
confidencesays 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
- Quickstart: make your first request.
- How attribution works: what each field means.
- Inline citations cookbook: render citations end to end.
