Latest in AI
Perplexity Context API: Freshness, Partial Failures and Pricing
How to fetch known URLs, retry only missing pages and keep an old price out of a current answer.
Perplexity's Context API reads URLs you already have and returns page content you can give to a model. For a pricing comparison, I'd use it to fetch the pricing pages live, let the supporting documentation come from cache, and make the answer say which vendors it couldn't verify. Those choices belong in the application, not the prompt.
Search first, fetch second
The Context API launch addresses the gap between finding a link and having enough evidence to answer a question. A search result might give you the headline price but leave out the fair-use policy that changes whether the plan fits. Context doesn't find that policy URL for you or write the final comparison. It reads the pages your application selects.
Use Markdown when an exception could appear anywhere on the page. Use the API's highlights format when you have a narrow question and want a smaller input for the model. The endpoint reference calls the parameter highlights, even though the announcement describes the output as snippets. One query applies across a request. I wouldn't use an omitted highlight as evidence that the policy doesn't exist.
Put pricing pages and docs in separate requests
Perplexity generally accepts a cached copy fetched within the previous two days, otherwise it fetches live. Freshness is a request setting, so don't mix URLs that have materially different requirements. Here is an illustrative body for POST https://api.perplexity.ai/v1/context. Replace the sample URLs with the public pricing pages you want to compare.
{
"urls": [
"https://example.com/pricing",
"https://example.org/pricing"
],
"formats": ["markdown"],
"max_age_seconds": 0
}
Send the reference docs in another request. I'd accept the default there, or choose a longer age for pages I know rarely change. If the application must not contact the origin, use cache_only: true with a positive age limit or keep the default age. An absent qualifying copy then produces no_content; the service won't make a live fetch to fill the gap.
Store metadata.source_url, metadata.origin and metadata.fetched_at alongside content when available. The fetch time says when Perplexity read the page. It tells you nothing about when the vendor last updated its price or whether the page is the right one for the user's country.
An HTTP 200 can hide a failed fetch
Check status.type on every result. Suppose two prices come back as ok and a third returns crawl_timeout. Keep the first two, retry the third with a bounded time budget, and mark that vendor unverified if the retry fails. Avoid substituting old content without a label. For blocked or bot_challenge, stop and use an authorized public source if there is one.
Separate those outcomes from a request-level failure. The quickstart's error guide explains when the entire call returns no results. For a request-level 429, the wait comes from Retry-After. At Tier 0, budget for 10 URLs per call and one request per second; the published limits for higher tiers allow larger batches.
What Perplexity actually bills
The Context API rate is $1 per 1,000 billable URLs. A ten-URL call with eight ok results and two failures costs $0.008 at list price without criteria scoring. That excludes search and the model that produces the final answer. Pulling metadata alone doesn't make a successful URL free.
There's also a small trap if you're maintaining copies: not_modified is billable. If the site previously supplied metadata.last_modified, you can send that value as if_modified_since on a single-URL live request. A not_modified result tells you to keep your old body, and saves you sending it through your pipeline again. It doesn't save the fetch fee. Use usage.fetched_urls in cost logs instead of counting requests or estimating from the number of returned bodies.
The design I'd start with is simple: assign each source a maximum age, keep the evidence from each successful page, and define what the answer should do when a required page is missing. A fetch API can make a thin search result usable, but it's your application that decides whether it has enough evidence to put a number on the screen.
I’m Paras. I write about how AI tools work and where they fit into real products.
I help AI founders turn API releases into technical stories developers can try for themselves.