Learning resourcesReviewed · OpenRouter

Classify and Tag Text at Scale with Jev

This OpenRouter tutorial teaches TypeScript developers to classify and tag short texts with Jev, but reliable labels require questions and thresholds tuned to their own data. It combines one exclusive category with multiple tag scores, concurrent API requests, response validation and usage-based budgeting.

Researched 15 Nov 2026

In short.

This OpenRouter tutorial helps TypeScript developers build a text-labeling workflow with Jev, but its reported results depend on the dataset and label definitions. It uses typesafe/jev-1.13 through the Decisions API to return one category and six tag scores per text, then adds validation, retries, threshold selection and cost calculations. The page reports 350 correct categories across a 400-tweet batch and about $0.0256 per 1,000 items at its stated historical price. Several tags performed poorly despite threshold tuning. Current pricing, performance on other data and runtime behavior have not been independently verified.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected page at [https://openrouter.ai/docs/cookbook/evaluate-and-optimize/jev-classification.md], including its code, prerequisites, paid-request warning, optional response-field notices, retry distinctions, calibration example, cost calculations and reported results. Linked pages and their licenses, prices, terms and documentation are excluded. No code or API requests were executed. Runtime behavior, current availability, billing reconciliation and performance beyond the source-reported example remain unverified.

The overview

What the resource is

This is an OpenRouter documentation tutorial with TypeScript code for labeling short texts such as support tickets, social posts and product reviews. The original page is [https://openrouter.ai/docs/cookbook/evaluate-and-optimize/jev-classification.md].

It teaches an application workflow around Jev, which the page describes as a decision model rather than a text generator. The example requests typesafe/jev-1.13 through OpenRouter's Decisions API; the tutorial itself is not a separate application or installable library.

Practical fit

The tutorial is useful when each item needs one category and several potentially overlapping tags. Its strongest feature is connecting API integration to evaluation: it shows how to measure false positives, missed tags, category accuracy and cost instead of treating every returned score as trustworthy.

It provides a concrete starting point, but adopting its labels unchanged would be risky for accuracy. Its own example shows that some questions produce weak results, and a high category-confidence score still does not guarantee a correct answer. It does not establish suitability for sensitive decisions or performance beyond the reported tweet dataset.

Who it suits

The intended reader is a developer adding classification to an existing TypeScript application. Relevant tasks include routing support tickets, organizing reviews and tagging social content, provided the developer can define labels and obtain representative human judgments.

Beginners get a complete sequence from questions to budgeting, but the page assumes familiarity with asynchronous TypeScript, environment variables and the Decisions request format. Experienced developers will find specific implementation details, while still needing to add durable progress tracking and operational reporting for sustained use.

What it teaches

The example returns one of six categories, optional category confidence, six tag scores and token and cost usage for each text. Each score can later become a tag by crossing a separately chosen threshold.

The surrounding code validates responses with Zod, limits concurrent requests, retries selected transient failures and preserves input order in successful batch results. Evaluation helpers sweep tag thresholds, count true positives, false positives and false negatives, group category accuracy by confidence, and calculate cost per 1,000 items.

A batch consists of separate per-item API requests. The page does not demonstrate submitting many texts in a single Decisions request.

Using it

What you need

The stated prerequisites are an existing TypeScript application running on Node.js or Bun as an ES module, Zod 4, the appropriate Node or Bun type definitions, an OPENROUTER_API_KEY environment variable and a posts array containing strings. The example uses fetch, AbortSignal.timeout and top-level await.

API requests are paid. Useful evaluation also requires human-labeled examples; the tutorial suggests 100 to 200 representative items for calibration. It expects prior familiarity with the Decisions API or a linked introductory tutorial. Exact Node.js and Bun versions, account access conditions and service limits are not established in the selected page.

How the approach works

Each request places the text in state.post and supplies questions describing the desired labels. A choice question selects exactly one category from explicit criteria. Each noul question asks whether a particular tag applies and returns a value between 0 and 1. These separate tag questions permit several tags to apply to one item.

The response parser checks category membership, answer types, score ranges and usage fields. Missing category confidence remains undefined, allowing separate review handling. Missing usage.cost causes validation to fail rather than being interpreted as a free request.

A fixed worker pool makes requests concurrently. Retries cover HTTP 429, server errors, transport failures and a specifically identified in-flight-budget HTTP 402. A terminal failure stops workers from taking new items, while requests already in progress finish.

How to get started

Define the categories and tag questions, install Zod 4, configure the API key and provide the posts array. The example sends authenticated JSON requests to [https://openrouter.ai/api/alpha/decisions] with model set to typesafe/jev-1.13.

Keep category definitions in the choice criteria and express each tag as a yes-or-no question about the submitted text. If real inputs may fall outside the categories, add an other category to both the question and accepted response values. A choice answer otherwise has to select one of the listed options.

The supplied batch call uses eight workers. Treat that as the example's starting configuration, then adjust concurrency using observed rate limits. Calibrate thresholds and category review rules before applying them to a larger batch.

What the reported example shows

The page reports a run dated 2026-09-21 using 550 tweets from TweetTopic's test_2021 split: 150 for calibration and 400 for the subsequent batch. These are source-reported results, not independently reproduced measurements.

Category predictions matched 127 of 150 calibration labels and 350 of 400 batch labels. Within calibration, 114 of 122 items with confidence at least 0.8 were correct. A review cutoff of 0.8 would have sent the other 28 calibration items to a person.

Tag quality varied substantially. At threshold 0.8, sports had precision 0.98 and recall 0.94, while music had precision 0.94 and recall 0.88. Celebrity reached only 0.41 precision at threshold 0.9. Precision measures how often assigned tags were correct; recall measures what share of the relevant items received the tag. The page does not report held-out tag results after threshold selection.

Assessment & evidence

Limits and implementation gaps

The measured example is limited to tweets, one model version and a particular set of English label questions. Performance on support tickets, reviews, other languages or different domains is unknown. Returned probabilities and confidence are not established as calibrated measures of correctness on new data.

Thresholds cannot repair every question. The celebrity question includes pop culture, overlapping with music and film or television, and performs poorly against the dataset's celebrity labels. News and film_tv also have limited recall in the reported calibration sample.

The batch code has no demonstrated checkpoint or resume mechanism. If a terminal error occurs, runBatch rejects without returning its accumulated successful results. Inspection also shows that shared pauses delay subsequent attempts rather than canceling requests already in flight, and HTTP-date Retry-After values are ignored.

The parser accepts a model string but does not compare it with the requested model or return it in Classified. Per-attempt cost accounting and recovery from an ambiguous network failure are not demonstrated. No runtime behavior was tested for this report.

How to interpret the results

The strongest reason to use this approach is its explicit separation of exclusive categories from overlapping tags, followed by evaluation against human labels. For each tag, the acceptable balance between incorrect assignments and missed items should determine the threshold.

A higher threshold cannot increase the number of predicted positives on the same scores, but it does not guarantee higher precision. The page's music results illustrate this: precision falls from 0.94 at threshold 0.8 to 0.93 at 0.9, while recall also falls.

High category confidence is useful for prioritizing review, not proof of correctness: eight calibration items in the highest confidence band were still wrong. Because thresholds were chosen using calibration data, a separate held-out evaluation would provide stronger evidence of their usefulness on new items.

Other approaches mentioned

The tutorial contrasts Jev with chat-model labeling, describing Jev as avoiding free-text answer parsing and output-token charges. It supplies no comparative accuracy, latency or total-cost benchmark against a chat model, so relative performance is unknown.

It also points to the TypeSafe JavaScript or Python SDK as an alternative to raw fetch, and says other decision models can accept the same Decisions request format. Those linked resources were not assessed. Changing models would require fresh evaluation of thresholds and confidence behavior; equivalent quality or pricing is not established.

Basis of the findings

The evidence is the complete OpenRouter documentation page at [https://openrouter.ai/docs/cookbook/evaluate-and-optimize/jev-classification.md], captured on 2026-11-15. It includes implementation code, a response example, calibration counts, aggregate category results and usage totals.

The performance and timing claims come from the page's own reported run. The supplied material does not include request logs, all individual predictions or independent replication. It reports 400 requests completing in 8.6 seconds with eight workers and no retries; that observation does not establish throughput or reliability under other conditions.

Linked model, dataset, SDK, API-reference and rate-limit pages are outside the evidence supplied here.

Access & freshness

Pricing and budgeting

The page states a price at the time of writing of $0.042 per million input tokens, with no output-token charge. Current pricing is unknown from this evidence. The linked model page is [https://openrouter.ai/typesafe/jev-1.13], whose contents are outside the supplied scope.

For its reported 400-item batch, the page lists 243,962 input tokens, a cost of $0.010246404 and $0.02561601 per 1,000 items. The complete 550-item example reportedly cost about $0.0141. These figures apply to that text length and question set; longer texts or additional tags can increase input usage.

Nonzero output-token counts appear in the example despite the stated absence of output-token charges. The cost helper sums usage.cost from returned results. It does not establish complete charges for failed or retried requests. Calibration requests also cost money, while human-labeling and integration costs are not quantified.

Reuse and data terms

The selected page does not state a license for its prose or code, or establish the reuse and redistribution terms of TweetTopic. Those rights remain unknown from the supplied evidence.

The implementation sends submitted text to OpenRouter. The page does not establish data retention, processing location, training use, provider contractual terms or ownership provisions for submitted data and results. The example dataset masks usernames and URLs, but the code does not demonstrate masking new inputs.

Dates and version sensitivity

The supplied page was captured on 2026-11-15, and its worked example is dated 2026-09-21. No separate publication or last-update date is established. The code specifies typesafe/jev-1.13 and uses an API endpoint whose path contains alpha.

Current model availability, endpoint behavior, pricing and account limits are unknown from this snapshot. Model or question changes can alter score distributions, so the reported thresholds and confidence bands should not be assumed to transfer unchanged.

Recommended next steps

First define labels for the actual task and manually label representative examples, including enough positive cases for every tag. Tighten overlapping questions, particularly the broad celebrity example, before spending effort on threshold tuning.

Choose tag thresholds and a category review rule using calibration data, then measure their behavior on a separate held-out sample. Record missed items as well as incorrect labels, and keep missing-confidence items visible for review.

Before a large batch, confirm current service access, pricing and data terms. Add persistent per-item results, failure records, the returned model identifier and per-attempt usage accounting. Estimate costs from representative text and keep calibration spending separate from the larger batch budget.

Evidence for this report

selected-page.txtselected · checked 2026-11-15