document, question, and answer your application used. TokenPath picks out the phrases in the answer worth citing and returns, for each one, the supporting range in the document and a confidence.
Omit Authorization for keyless access, or send a Bearer API key with the attributions:write scope for normal billed access. Invalid supplied credentials are rejected.
Keyless access
Small requests work without an account or API key and do not consume credits. The response format and attribution model are the same as for keyed requests.
Keyless requests use one model context and do not split long documents into windows. Oversized inputs return
413 anonymous_input_too_large. These character counts are independent of your chosen offset encoding.
The initial shared budget is 60 keyless requests per minute per service process, across all callers. It is best-effort access, not a guaranteed per-user allowance. A busy service returns 429 with Retry-After; wait that many seconds before retrying. Limits may change during the experiment. If keyless access is temporarily disabled, requests without a key return 401 missing_api_key.
Browser applications can call this endpoint directly with JSON and credentials: "omit". Responses expose Retry-After and X-Request-ID. Browser sandbox network policies still apply.
Use a valid API key for larger inputs and your usual billed limits. Generation and raw heatmaps continue to require authentication.
Request body
string
required
The source text the model read. Keyless: 1 to 20,000 Unicode characters. Keyed: 1 to 4,000,000 characters and at most 1,050,000 tokens. Keyed documents that do not fit one model context are split into overlapping windows automatically. See Long documents.
string
required
The question or task the model was given. 1 to 2,000 Unicode characters without a key, or 10,000 with a key.
string
required
The model’s answer, exactly as you display it. 1 to 2,000 Unicode characters without a key, or 10,000 with a key.
string
default:"utf-16"
The unit for every offset in the request and response:
utf-16 (JavaScript, Java, C#, Swift), utf-32 (Python, Ruby), or utf-8 (Go, Rust). See Offsets and encoding.array of [integer, integer]
Optional. Exact answer ranges to attribute instead of letting TokenPath choose. Each range is half-open, in
offset_encoding units, and must satisfy 0 <= start < end <= len(answer). Send at least one range, and at most 32 without a key. [] and null are rejected, so omit the field to use automatic selection. See Explicit answer spans.number
default:"0.001"
Attention below this value is ignored when resolving sources. Range
0 to 1. The default suits almost every use.Response
array of object
One entry per attributed phrase, in answer order. With explicit
spans, one entry per range you sent, in the order you sent them. An empty array means nothing in the answer could be tied to the document.string
The unit every
start and end is counted in.Explicit spans
To attribute exact ranges, passspans. Keep each range fact-sized, such as a number, a name, or a date:
Timeouts
Documents that fit one model context usually return in a few seconds, so a 90-second client timeout is plenty. Keyed windowed requests for long documents run sequentially and return only when every window succeeds. Give those a client timeout of at least 300 seconds.Errors
In addition to the authentication errors:
See Errors for details and a retrying client.
