Documentation

Language models

Use the service
View .mdOpenAPI

Classify pages

The Laya page classifier, laya-page-role, reads a web page's text, not its address, and gives one of five labels, detail, listing, landing, not_vacancy or unresolved, with the model's calibrated probability for each. Workspace specialists answer the same call with their own results. This page is about sending work; Jobs, progress and results is about following it.

Status. Live since 2026-10-08, with the upload time measured that day; specialists, fetched pages and the per-call options were added to this guide on 2026-11-16.

Two kinds of model

Page classifierWorkspace specialist
Model IDlaya-page-role, the defaultAny model your catalog lists with classify among its operations, such as laya-link-scorer or laya-vacancy-extractor
InputPage textFetched pages: url, final_url, http_status, content_type, sha256 and body_b64
AnswerOne of the five labels, with probabilitiesIts own result per page: labels from a classifier, fields from an extractor
How it runsAs a job: one call or a batch of any sizeIn the call, by its own pool: no job, no batch
ChargedPer page answeredPer token, at that pool's declared prices
AvailableTo every workspaceOnly where your catalog lists it

Read GET /v1/models to see which you have. The id laya-page-role can name both: sent as text it is the five-label classifier; sent as fetched pages from a workspace that has a specialist pool or a registered version under that id, it is that specialist, which answers page roles of its own. The rest of this page is about the five-label classifier unless it says otherwise.

One call or a batch

Every piece of work becomes a job; the two calls differ in how long they hold you.

One call: POST /v1/classifyBatch: POST /v1/jobs
Pages1 to 256any number your credit pays for
Answer200 with the results when the model is ready and they finish within 300 s; else 202 with the job and Retry-After201 with the job as soon as the upload is stored
Queueahead of batch workafter single calls
Price per pagethe samethe same

Both take an Idempotency-Key, so a retry returns the first answer rather than a second job (Errors and limits).

A batch as NDJSON

Send anything large as NDJSON: one object per line with the page's text and, if you want it back, your id. The model goes in the query string:

sh
curl -s "https://weights.fyi/run/v1/jobs?model=laya-page-role" \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/x-ndjson" \
  -H "Idempotency-Key: pages-batch-1" \
  --data-binary @pages.ndjson
json
{"text": "Senior data engineer, Utrecht. Apply today.", "id": "page-000001"}
{"text": "All open positions: 24 results. Filter by city or team.", "id": "page-000002"}

The upload is read as it arrives; 200,000 pages took 129 s on the live service on 2026-10-08. It is all or nothing: a bad line (400, with its number, never its content) or pages beyond your credit (402 queue_exceeds_credit, with pages_allowed) refuse the whole upload, and nothing runs. Because that answer can come before your upload is read to the end, some clients report a reset connection instead; curl prints the answer.

A small batch can also go as JSON, {"model": "laya-page-role", "pages": ["text", {"text": "…", "id": "…"}]}, up to 16 MiB in all. Every page must be non-empty text that fits one call to the model, 16 MiB with its envelope.

When the service is busy

the service holds a bounded amount of unfinished work for all accounts together, and refuses new work beyond it with 429 overloaded and a Retry-After, keeping nothing of it (Errors and limits). A single call can also ask not to be queued: with "options": {"rejectIfBusy": true}, POST /v1/classify answers 429 overloaded when the model is not ready or every call slot is taken, instead of 202. The option's name and behaviour follow Cloudflare's Workers AI; the call and the error shape stay this service's own.

Options on one call

POST /v1/classify takes these beside its pages; a batch takes none of them.

OptionWhat it does
options.rejectIfBusy429 overloaded instead of a queued job when the model is not ready or every call slot is taken.
options.waitColdKeeps waiting for the results while the model starts, within the same 300 s, instead of answering 202 at once.
jurisdictions, or the header X-Weights-JurisdictionsCountry codes, EU or EEA: the call runs only where the model's known location is inside them, else 409 jurisdiction_refused.
retain: "none"Zero retention: the answer is not stored for replay, so a retry with the same Idempotency-Key gets 409 replay_not_retained and a digest, not the answer. Only a specialist pool that answers in the call can do it; the five-label classifier keeps results and answers 409 retain_none_unavailable. The usage record of the call, its tokens and charge, is still kept.
version_id, calibration_sha256Pin a registered version of a specialist and its calibration; each result then names both.

A confidential workspace sends every call sealed; a plain one answers 400 encrypted_envelope_required (POST /v1/workspaces).