triage function that takes comments from ScrapeCreators and returns one decision per comment with action: 'record' | 'review' | 'ignore', the reason, and Jev’s raw judgment.
Outcome: Running triage on a batch of Reddit and YouTube comments prints a decision list grouped by action, along with the ScrapeCreators credits spent, the total Jev cost, and the Jev cost per 1,000 comments.
1. Fetch Reddit and YouTube comments with the ScrapeCreators API
The first thing that happens in the pipeline is pulling the comments in. Two small fetchers call ScrapeCreators, one to search Reddit and one to read the top comments on a YouTube video. Both map results into the sameComment shape so the rest of the pipeline never has to care which platform a comment came from. Each fetcher also keeps the credits its request cost so the final report can show them.
Both responses are paginated. Reddit search returns an
after cursor passed back as the after query parameter. YouTube comments returns a continuationToken passed back as continuationToken. Each page is one request, and the captured run was charged one credit per page. The snippet fetches the first page of each so the captured run stays small.2. Classify relevance and run sentiment analysis with Jev
So to get topic relevance and sentiment for each comment, we send it to Jev with two questions: how relevant is the comment to your topic, and what’s the author feeling. Jev returns a probability for the first, andnegative, neutral, or positive for the second. Further, the sentiment response includes a confidence value, so the next step can decide by number instead of parsed text. The function also returns the request cost, and throws when any of the answer parts are missing. A bad judgment will fail loud and fast instead of being quietly recorded. To reach the right endpoint, the client sets serverURL to https://openrouter.ai, because the Decisions API lives under /api/alpha, a different path prefix than the SDK’s default /api/v1.
3. Set the human-review threshold and route each comment
The routing rule runs a series of tests on every judgment. If the relevance is at or below0.2, then the comment is ignored. If it’s between 0.2 and 0.8, then it’s sent to a human for review because Jev isn’t sure it’s even on topic. If it’s at or above 0.8, then the comment is recorded automatically only if the sentiment confidence is at least 0.7. If not, it goes to review too. Every decision also keeps the reason and the full judgment so a human reviewer can see why an item was queued.
SENTIMENT_CONFIDENCE_AT to 0.5. If recorded comments turn out to be off topic, raise RELEVANT_AT to 0.9. The judgment stays on every decision, so you can re-run decide with new thresholds against the stored judgments without paying for Jev again.
4. Produce the decision list
The last step runs the whole batch and prints the result.triage judges every comment in parallel and routes each one with the rule from step 3. After that the script prints one summary line with the number of comments in the batch, the ScrapeCreators credits spent to fetch them, the total Jev cost, and the Jev cost per 1,000 comments. Then the decisions follow, grouped by action. The empty-batch check makes a fetch that returns nothing fail plainly, instead of printing a meaningless cost per 1,000.
Worked example
Captured output from running the code above on 2026-09-21 against the queryopenrouter (7 Reddit comments) and one YouTube video (20 top comments). The run cost $0.00057 in Jev usage and 2 ScrapeCreators credits. Comment text is truncated to 160 characters by the script, and the summary line plus one item from each group are shown.
0.94 relevance, but Jev split between neutral and positive, so the confidence of 0.65 sent it to a human instead of recording a guess. The ignored item is a thank-you note on the video with no reference to the product. Jev’s numbers are not fully deterministic. For the 25 comments that appeared in two runs of this batch, per-request costs were identical, relevance shifted by up to 0.04 and sentiment confidence by up to 0.13, so a comment sitting near a threshold can land in a different group on a rerun. Reddit search with sort=new can also return a different comment set between runs as new comments arrive.
Check your work
- Each ScrapeCreators response parses with
success: trueand a numericcredits_charged. A wrong or missingx-api-keyfails atscrapewith a non-2xx status, not inside the Zod parse. - Every Jev response has
answers.relevant.type === 'noul'withnoulbetween 0 and 1, andanswers.sentiment.type === 'choice'withchoiceinnegative | neutral | positiveand aconfidencebetween 0 and 1. - A comment with
relevant <= 0.2getsaction: 'ignore'regardless of sentiment. A comment withrelevant >= 0.8andsentiment_confidence >= 0.7getsaction: 'record'. Everything else getsaction: 'review'with areasonnaming which threshold it missed. response.usage.costis a number on every Jev response and the printedper_1k_usdequals the summed cost divided by the comment count times 1,000.- Re-running
decideon stored judgments with different thresholds changes the action split without any new Jev or ScrapeCreators requests.
Next steps
- Gate agent tool calls with Jev to apply the same Noul-and-threshold pattern to actions instead of comments.
- Cut LLM cost with a Jev-verified cascade to use Choice confidence to decide when to escalate to a larger model.
- TypeSafe SDK guide to call Jev through the TypeSafe JavaScript or Python SDK instead of
@openrouter/sdk. - Jev Lab to try Jev’s triage and extraction demos in the browser.