Optional System One model calls
Updated 2026-11-17.
The decide step is optional. Bring your own key. It speaks TypeSafe Jev's POST /v1/systemone contract, described in full below, and it can point at any other provider that implements the same contract by setting base_url. Asipipes has tested it against TypeSafe's own API (https://api.typesafe.ai) only.
It adds typed yes/no (noul), choice, and score answers with confidence to each item. Answers are cached per workspace and recorded on the run, so replays stay exact and never call the provider. Use it to cut noise before your agent reads anything.
Asipipes does not sell model calls and does not pay for them. You pay your provider directly with your own key.
Place it after a diff
A typical pipe fetches a feed, keeps only items that are new since the last run, asks System One whether each one is relevant, filters on decision.relevant.p > 0.9 (or on confidence), and then emits a webhook.
pipes: 0
name: relevant-watch
version: 0.1.0
permissions:
env:
- TYPESAFE_API_KEY
network:
- api.typesafe.ai
- hooks.example.com
steps:
- id: page
block: fetch_http
with:
url: https://example.com/feed.xml
- id: items
block: parse_rss
in: ${steps.page}
- id: new
block: diff_since_last
in: ${steps.items}
with:
key: id
- id: decide
block: decide
in: ${steps.new}
with:
api_key: ${env.TYPESAFE_API_KEY}
model: jev-1.14.0
state: '${item.title} ${item.summary}'
questions:
relevant:
type: noul
instructions: Is this item relevant to the watchlist?
topic:
type: choice
options:
- filings
- other
into: decision
- id: keep
block: filter
in: ${steps.decide}
with:
where:
field: decision.relevant.p
op: gt
value: 0.9
- id: hook
block: emit_webhook
in: ${steps.keep}
with:
url: https://hooks.example.com/new
skip_if_empty: true
output: ${steps.keep}
Step parameters
| Param | Required | What it does |
|---|---|---|
api_key |
yes | Your provider key. Use ${env.NAME}: store it with set_secret and list NAME under permissions.env. Any name works; TypeSafe's own SDKs read TYPESAFE_API_KEY. A missing or empty key fails the run before any call. |
model |
yes | Sent as model. Pin a versioned id such as jev-1.14.0 (see Cache and replay for why aliases such as jev-latest are a poor fit). |
state |
yes | A template over the item, such as '${item.title} ${item.summary}'. It may also be an object or array of templates; the rendered value is sent as state. |
questions |
yes | A map of question name to question. See Questions. |
base_url |
no | Default https://api.typesafe.ai. Asipipes POSTs {base_url}/v1/systemone, or base_url itself when it already ends in /systemone. Its host must be listed under permissions.network. |
into |
no | The field written on each item. Default decision. |
concurrency |
no | Provider calls in flight at once, 1 to 32. Default 4. |
retries |
no | Extra tries for one item after a 429, 529, 5xx, timeout, or connection failure, 0 to 3. Default 2. |
cache_ttl_hours |
no | How long cached answers from an alias model (one with no version number, such as jev-latest) stay in use. Default 24. Pinned versions never expire. |
images |
no | Up to 4 images per item, as a map of short name to an image URL template such as '${item.photo_url}'. Each image is a counted fetch under permissions.network, at most 4 MB. |
The contract
Request
For each item, Asipipes sends one request:
POST {base_url}/v1/systemone- Headers:
Authorization: Bearer <api_key>andContent-Type: application/json. A request with images or aboxquestion also sendsTypeSafe-Danger-Zone-Images: true. No compression. - Body: compact JSON with exactly three fields, keys in sorted order:
model(string),questions(object), andstate(the rendered string, object, or array).
There is no cross-item batching: one item is one request, carrying all of that item's questions. Items whose model, questions, rendered state, and base_url are identical within one run share one request (a stream batch often has repeats).
Questions
type |
Asipipes accepts | Sent to the provider | Limits |
|---|---|---|---|
noul (yes/no) |
instructions; optional criteria object with true and false descriptions |
type, instructions, criteria if given |
none |
choice |
instructions; criteria (option name to description), or options as a map or a list of names |
type, instructions, criteria (a list of names becomes a map of each name to itself) |
1 to 255 options |
score |
instructions; criteria or scale, an ordered list of level descriptions (level 0 first) |
type, instructions, criteria |
1 to 10 levels |
box |
optional instructions; use with images |
type, instructions |
answer is box (top, bottom, left, right) and confidence |
instructions and descriptions are passed through as given (string, object, or array). An empty instructions is left out. Any other type fails validation. The question names you choose come back as the answer names.
Response Asipipes parses
A JSON object with:
answers(required): an object keyed by question name.noul:{"type":"noul","noul":<number 0 to 1>}choice:{"type":"choice","choice":<option name>,"confidence":<number>,"probabilities":{<option>:<number>,…}}; all four fields required.score:{"type":"score","score":<number>,"confidence":<number>,"legend":{…},"probabilities":{…}};scoreandconfidencerequired,legendandprobabilitieskept as sent.model(optional): the model that answered. TypeSafe returns the versioned id here even when you sent an alias.
Anything else, such as TypeSafe's usage token counts, is ignored and not stored. A response body larger than 2,000,000 bytes is cut off, which then fails as a non-JSON body.
What lands on each item
The step returns the input items in order, each with an into object (default decision):
decision.<question>for anoul:p(thenoulprobability) andtype- for a
choice:label(the chosen option),p(that option's probability),confidence,probabilities, andtype - for a
score:score,confidence,legend,probabilities, andtype decision._model: the model you pinned in the stepdecision._version: themodelthe provider returned (your pin when it returns none)
Filter on decision.<question>.p, .label, .score, or .confidence.
Worked example
A real call made on 2026-11-14 with this step and the item {"title": "Acme Corp files 10-Q with the SEC: quarterly revenue up 12%, guidance raised"}:
- id: decide
block: decide
in: ${steps.new}
with:
api_key: ${env.TYPESAFE_API_KEY}
model: jev-1.14.0
state: '${item.title}'
questions:
relevant:
type: noul
instructions: Is this item about a company's SEC filing?
topic:
type: choice
instructions: What is this item mainly about?
options: [filings, earnings, other]
urgency:
type: score
instructions: How time-sensitive is this for an investor?
scale: [Can wait, This week, Today]
Request body Asipipes sent to https://api.typesafe.ai/v1/systemone:
{"model":"jev-1.14.0","questions":{"relevant":{"instructions":"Is this item about a company's SEC filing?","type":"noul"},"topic":{"criteria":{"earnings":"earnings","filings":"filings","other":"other"},"instructions":"What is this item mainly about?","type":"choice"},"urgency":{"criteria":["Can wait","This week","Today"],"instructions":"How time-sensitive is this for an investor?","type":"score"}},"state":"Acme Corp files 10-Q with the SEC: quarterly revenue up 12%, guidance raised"}
Response from TypeSafe (HTTP 200):
{"model":"jev-1.14.0","answers":{"relevant":{"type":"noul","noul":0.98},"topic":{"type":"choice","choice":"earnings","confidence":0.38,"probabilities":{"earnings":0.59,"filings":0.41,"other":0.0}},"urgency":{"type":"score","score":1.68,"confidence":0.52,"legend":{"0":"Can wait","1":"This week","2":"Today"},"probabilities":{"0":0.01,"1":0.3,"2":0.69}}},"usage":{"input_tokens":403,"output_tokens":74}}
The decision object Asipipes attached to the item:
{"_model":"jev-1.14.0","_version":"jev-1.14.0","relevant":{"p":0.98,"type":"noul"},"topic":{"confidence":0.38,"label":"earnings","p":0.59,"probabilities":{"earnings":0.59,"filings":0.41,"other":0.0},"type":"choice"},"urgency":{"confidence":0.52,"legend":{"0":"Can wait","1":"This week","2":"Today"},"probabilities":{"0":0.01,"1":0.3,"2":0.69},"score":1.68,"type":"score"}}
The same request sent a second time returned slightly different numbers (topic confidence 0.33 and urgency score 1.62, for example). Provider answers are not deterministic, which is why Asipipes caches and records them.
The cache key for this item, and the fingerprint on its tape entry, is b3:1aa25e0eda5b39f26c08fe6d449694f8047917b73e7f0422a6912644d0b8d45f: BLAKE3 of the canonical JSON {"base_url":"https://api.typesafe.ai","model":"jev-1.14.0","questions":…,"state":…}, with questions and state exactly as in the request body above.
Cache and replay
- Cache key: BLAKE3 over the canonical JSON of
{"base_url", "model", "questions", "state"}:base_urlas configured (trimmed, without a trailing slash; defaulthttps://api.typesafe.ai), the model string you pinned, the questions as sent, and the rendered state. It does not include the API key. - Scope: per workspace, shared by every pipe in it. Another workspace never reads your answers.
- Lifetime: answers from a pinned version such as
jev-1.14.0never expire; answers from an alias such asjev-latestexpire aftercache_ttl_hours(default 24). Until then, the same item and questions with the same model get the cached answer on every later run, with no provider call and no fetch counted. There is no tool to clear it, andreset_seenor deleting the pipe does not touch it. To ask again, change the model pin, a question, or the state. - Aliases: the key uses the model string you sent. With
jev-latest, a cached answer can stay in use for up tocache_ttl_hoursafter the alias moves to a new release, while new items get the new release. Pin a versioned id and change it on purpose;_versionshows which model actually answered. - Recording: every answer, cached or fresh, is written to the run's tape with its fingerprint, HTTP status, and latency. Replay (
POST /v1/runs/{id}/replayorreplay_run) reads the tape, never calls the provider, and reproduces the same output and receipt. Your key is never written to the tape, the cache, or the output.
Errors, timeouts, and retries
- Any failure fails the step and the run. The run error is JSON
{"error":"decide","message":…,"detail":…}(detailonly when there is one). One failed item fails the whole step:decidedoes not drop single items. - An HTTP status of 400 or above:
provider returned HTTP <status>, with the first 240 characters of the body asdetail. TypeSafe sends401for a bad key,400for an unknown model,422for a malformed request,429when over your rate limit, and529when overloaded. - A non-JSON body (
provider returned a non-JSON body), missinganswers, or an answer that is missing a required field or has anothertype(the message names the question). - Timeouts: each request waits up to the step's
timeout_ms(default 30 seconds). A timeout fails the run withprovider timeout; a connection failure givesprovider error: …. - Retries: a
429,529,5xx, timeout, or connection failure is retried up toretriestimes (default 2, at most 3), waiting the provider'sRetry-After(at most 10 seconds) or 0.5, 1, then 2 seconds. Other4xxstatuses are not retried. If the last try fails, the run fails; already-answered items come from the cache on the next run.
Limits
- Each provider request counts as one fetch toward the run's
fetches_per_run(40 on every plan today) and the workspace's dailyfetches_per_day. The host check and network rules forfetch_httpapply too. Cached answers and shared repeats do not count. If a step needs more new requests than the run has fetches left, it fails withfetch cap exceededbefore calling the provider, so putdecideafterdiff_since_lastorlimit. - At most
concurrencyrequests (default 4, at most 32) are in flight at once. Your provider's own rate limits still apply. - Request size and context limits are the provider's. TypeSafe documents a 32 MiB request body and per-request and per-question context limits per model.
Compatible providers
A provider works with decide when it:
- accepts
POSTat{base_url}/v1/systemone(or at abase_urlending in/systemone) withAuthorization: Bearer <key>and a JSON body ofmodel,questions, andstate; - understands the
noul,choice, andscorequestion shapes above; - answers 200 with a JSON object whose
answersare keyed by question name and carry the fields listed under Response; - uses an HTTP status of 400 or above for errors.
Asipipes has only tested TypeSafe's API. Add the provider's host to permissions.network.
Differences from TypeSafe's API
Checked on 2026-11-14 against https://docs.typesafe.ai and with live calls:
- TypeSafe also offers multipart requests and the long-context header.
decidesends neither. It supports Box questions and image assets (seeimages). - TypeSafe recommends retrying
429and529with backoff.decidedoes this (see Errors, timeouts, and retries). - TypeSafe returns
usagetoken counts. Asipipes does not keep them, so check usage in TypeSafe's console. - TypeSafe requires
usagein its own response schema. Asipipes does not, so a compatible provider may omit it. - TypeSafe's answer field for a yes/no is
noul. Asipipes exposes it asp, and addspfor the chosen option of a choice.
The 92% fewer tokens, 99.4% fewer when nothing is new, and exact replayable output figures are the measured Asipipes checks on /benchmarks. This page does not invent stats for decide.