Freezing text
Freezing preserves selected parts of the text exactly as written while the surrounding text is rewritten. Use it for quotations, names, figures and citations.
Freezing is enabled per account and is supported for English text. Contact support to request it. On accounts without freezing, freeze_citations is ignored and <freeze> tags are treated as ordinary characters in the text. Confirm that responses contain frozen_items before relying on this feature.
Freeze a passage#
Enclose the passage in <freeze> and </freeze> tags within text.
{ "text": "Our study found a clear effect. <freeze>Results may vary by role.</freeze> Managers should weigh these findings carefully."}- Tags are removed before any other processing. They are not returned, not counted toward the word limit and not charged.
- Tags cannot be nested and cannot overlap.
- A tagged passage that spans multiple lines is preserved line by line, so line breaks are retained. Each line is a separate entry in
frozen_items.
Freeze citations#
When freeze_citations is true, the API detects and preserves the following:
- Numbered references such as
[1],[1, 3]and[2–4]. - Bracketed citation keys such as
[ref_3]and[Smith2020]. - Author-year references such as
(Smith et al., 2020), including page numbers and multiple sources within one set of parentheses. - URLs and DOIs.
A reference list at the end of the text is also preserved as written. It is preserved as a single block and is not listed in frozen_items. freeze_citations can be combined with <freeze> tags in the same request.
Example#
The following request freezes one citation with freeze_citations and one sentence with <freeze> tags:
{ "text": "Remote work raised reported productivity by 13% in one large trial (Bloom et al., 2015). <freeze>Results may vary by role.</freeze> Managers should weigh these findings carefully.", "freeze_citations": true}{ "id": "hum_a1b2c3d4-e5f", "created": 1778533901580, "results": [ "In one large trial, remote work lifted reported productivity by 13% (Bloom et al., 2015). Results may vary by role. Managers would do well to think these findings through." ], "scores": null, "input_words": 26, "words_remaining": { "included": 124974, "topup": 0, "total": 124974 }, "model": "standard", "frozen_items": [ [ { "text": "(Bloom et al., 2015)", "start": 68, "end": 88 }, { "text": "Results may vary by role.", "start": 90, "end": 115 } ] ]}Reading frozen_items#
frozen_items contains one list for each entry of results, in the same order. Each list contains every frozen item in the order it appeared in the input, with its position in that result.
startandendare offsets in Unicode code points, andendis exclusive. In Python,result[start:end]returns the item. JavaScript strings are indexed in UTF-16 code units, so useArray.from(result).slice(start, end).join("").- Frozen text is preserved in nearly all cases. If an item could not be preserved in a result, its
startandendarenull, and that part of the result was rewritten with the rest of the text. - If
freeze_citationsistrueand the text contains no citations,frozen_itemsis still present and contains empty lists.
If every frozen item must be preserved, check for null before using a result:
const allKept = out.frozen_items[0].every((item) => item.start !== null);if (!allKept) { // On Premium, check out.results[1] against out.frozen_items[1], or resend the request.}Errors#
The following errors are returned with status 422. None is charged.
Limits#
- English only. Text in another language is still rewritten and the tags are still removed, but frozen items are unlikely to be preserved.
- SDKs.
<freeze>tags are supported by the SDKs, because they are part oftext. The published SDK versions do not acceptfreeze_citations. Send that field through the REST API.