Transform the content of any page into a JSON schema you define, with AI, in a single call.
Extract returns data that already exists on the page. Generate produces data that does not exist on the page until the model creates it. That one distinction decides which endpoint you reach for: if the value is already sitting in the HTML, extract it. If a model has to read the content and produce something new, generate it.
That is the whole decision. If the field is already in the HTML, use extract. If the model has to read, reason, and produce it, use generate.
The Hacker News homepage makes the split obvious. Each story’s title is text on the page, so extract handles it. A category and a one-line summary are not on the page at all, so generate has to create them:
{
"summaries": [
{
"title": "New AI Model Released",
"category": "tech",
"summary": "A research lab announced a new language model that performs better on reasoning tasks."
}
]
}
title was extracted. category and summary did not exist until the model wrote them. The same response carries both kinds of field, which is exactly what generate is for: a schema where some values are read and others are produced.
Here is one generate call built around a value the page does not contain. The model reads each article and assigns a relevance_score, then returns it inside your schema.
If extract can get it, use extract. Both endpoints are AI-guided, but generate adds an explicit transformation step: you hand it instructions, and it produces content that is not on the page. That extra step usually makes generate slower and more expensive than extract, so reach for it only when the value has to be created.
Generate earns that cost when the value has to be reasoned into existence: scoring, summarizing, categorizing, sentiment, rewriting. It is not for pulling data that is already structured on the page. A product price, a published date, a table of specs: that is extract. A relevance score, a one-line summary, a sentiment label: that is generate.
This still matters when read and produced fields could share one schema. A generate.json call is billed as a generate request no matter how many of its fields are read-only, so folding easy-to-read fields into it saves nothing on those fields. When cost matters, split the work: pull the read-only fields with extract.json and use generate.json only for the derived outputs.
For the parameters that tune a generate call, see the how-to and the SDK reference rather than this page.