Evoduce API
Give Evoduce your rules, then send typed questions through the decision gateway. Rules can answer first; Jev or OpenAI, on your own key, handles what they cannot settle. With an API key, repeated confident answers over structured facts can become candidate rules for review.
Vocabulary checks prove structural consistency. A provider's typed choice is still a judgment; use the same vocabulary as Choice options to keep labels consistent.
Vocabulary proof quickstart
Register with an invite code to get a free API key (10,000 usage units a month), and export it as EVODUCE_API_KEY. Then save a vocabulary as vocab.json:
{
"name": "spatial_relations",
"axes": {
"duration": {"values": ["absolute", "temporary"]},
"type": {"values": ["contact", "proximity", "containment"]}
},
"rules": [
{"type": "AXIS_COVERAGE"},
{"type": "SYMMETRIC_IS_SELF_INVERSE"},
{"type": "REQUIRES_INVERSE"},
{"type": "NO_DUPLICATE"}
],
"predicates": {
"touching": {"duration": "temporary", "type": "contact", "symmetric": true}
}
}
Then verify a proposal:
curl -s https://www.evoduce.com/v1/verify \
-H "Authorization: Bearer $EVODUCE_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"vocabulary\": $(cat vocab.json),
\"proposal\": {\"name\": \"resting_on\", \"duration\": \"temporary\", \"type\": \"contact\"}}"
{
"sat": false,
"reason": "[REQUIRES_INVERSE] Non-symmetric predicate 'resting_on' has no inverse declared. ...",
"violated_rules": ["REQUIRES_INVERSE"],
"counterexample": {
"proposal": "resting_on",
"axes": {"duration": "temporary", "type": "contact"},
"violations": {"REQUIRES_INVERSE": "..."}
},
"compliance": 1.0,
"unmet_soft": []
}
Add "inverse": "supports" (or "symmetric": true) and the same call returns "sat": true.
SDKs
Both clients are thin, typed wrappers over the HTTP API. They read EVODUCE_API_KEY and EVODUCE_BASE_URL from the environment.
Python
pip install evoduce
from evoduce import Client, EvoduceError
with Client() as nse:
r = nse.verify(vocab, "resting_on", duration="temporary", type="contact")
r.sat, r.violated_rules, r.counterexample
grown = nse.accept(vocab, "resting_on", inverse="supports",
duration="temporary", type="contact").vocabulary
nse.optimize(vocab, proposals, content_value={"x": 5}).admitted
nse.prove(grown).sat, nse.audit(grown).passed
Axis values are keyword arguments. A neurosymbolic_evaluator.Vocabulary object works anywhere a dict does.
TypeScript
npm install evoduce
import { Client, EvoduceError } from "evoduce";
const nse = new Client(); // or { apiKey, baseUrl }
const r = await nse.verify(vocab, { name: "resting_on", duration: "temporary", type: "contact" });
const { vocabulary: grown } = await nse.accept(vocab, { name: "resting_on", inverse: "supports", duration: "temporary", type: "contact" });
No dependencies; runs on Node 18+, Deno, Bun, edge runtimes and browsers. In both SDKs, a non-2xx response raises EvoduceError with status, detail and a retry-after value.
Authentication & limits
Send your key as a bearer token: Authorization: Bearer evd_…. Requests without a key use the anonymous tier, which is how the playground works.
| Tier | Rate | Notes |
|---|---|---|
| Anonymous | 30 req/min per IP | No key needed |
| Developer key | 600 req/min per key, 10,000 usage units/month per account | An invalid or revoked key returns 401; it never falls back to anonymous. The monthly quota resets on the 1st (UTC). |
Standard API calls use one quota unit. Evolve and Extract use ten. Usage is recorded under the calling key and the project selected for that call.
Your Evoduce key is the only key you need. When a model answers a decision, that answer is included with your key and shows in your usage; see model answers and your usage.
Request bodies are capped at 256 KB. Each check has a 10 s budget; a call that runs past it returns 504.
Vocabulary format
Every request carries the full vocabulary, so your vocabularies are never stored server-side (what is kept, and where, is listed under where data lives). The format is the one Vocabulary.from_dict reads, and /v1/accept returns the same shape.
| Key | Type | Meaning |
|---|---|---|
name | string | Required. |
axes | object | {axis: {values: [...], exclusive?: true, optional?: false}}: the classification dimensions. |
rules | array | {type, name?, axis?, metadata_key?, params?, weight?}. With no rules key, the vocabulary has no rules. |
predicates | object | {name: {<axis>: value, symmetric?, inverse?, aliases?, metadata?}} |
aliases | object | {other name: predicate}: the alias map. It says which predicate a name stands for when more than one lists it. See shared names. |
default_rules | boolean | false switches off the rules every vocabulary otherwise has (today: ALIAS_UNAMBIGUOUS). |
state_graphs | object | {axis: {edges: [[from,to]], initial?, terminal?}}, used by TRANSITION rules. |
temporal_invariants | array | Reachability invariants over a state graph. |
A proposal is a flat object: name, optional symmetric, inverse, metadata and aliases, and every other key is an axis value.
Rule types
| Type | Checks |
|---|---|
AXIS_COVERAGE | Every predicate is classified on all non-optional axes |
MUTUAL_EXCLUSION | Exactly one value per exclusive axis |
SYMMETRIC_IS_SELF_INVERSE | Symmetric predicates are their own inverse |
INVERSE_BIDIRECTIONAL | If P→Q is declared, then Q→P |
REQUIRES_INVERSE | Non-symmetric predicates declare an inverse |
INVERSE_EXISTS | A declared inverse names a predicate that is in the vocabulary |
NO_DUPLICATE | The name isn't already in the vocabulary |
ALIAS_UNAMBIGUOUS | A name two predicates list as an alias is settled by the alias map. On by default; see shared names for what the service does about it |
METADATA_REQUIRED | metadata_key is present on the predicate |
TRANSITION | A proposed {from,to} is an edge on a state graph (params.axis) |
COMPARISON | metadata[left] op metadata[right] | value (params) |
CUSTOM rules are Python callables and can't be submitted over HTTP. They're available on Enterprise deployments.
Strict vs graded
A rule with no weight is a hard invariant: one violation makes the result UNSAT. A rule with a weight is a soft preference. Strict endpoints ignore soft rules. The graded endpoints let hard rules gate and turn soft rules into a compliance score (satisfied soft weight ÷ total soft weight).
{"type": "METADATA_REQUIRED", "name": "PREFER_REVIEWED", "metadata_key": "reviewed", "weight": 3}
Use cases
A use case is what you sign up to do. It has a type, and the type sets its configuration: how a name two terms share is handled, how sure a model must be before its answer is used, what the service learns, and where each kind of data lives. You pick the type when you sign up and can add more use cases later, each with its own key.
| Type | For | Settings and their defaults |
|---|---|---|
basic | Rule sets you write, checked on every change and grown from your own data | aliases: settle, remember_aliases: true, min_confidence: 0.7, auto_accept: true |
graph | A graph built from your data inputs, where one name can fit several things | aliases: candidates, remember_aliases: true, min_confidence: 0.7, auto_accept: true |
decision | Typed decisions in Jev's style through the decision gateway | learning: propose, min_support: 5, answer_cache_days: 7 |
| Setting | Values | Meaning |
|---|---|---|
aliases | settle | candidates | strict | off | What happens when two terms claim the same other name. See shared names. |
remember_aliases | boolean | Keep alias decisions and picks between calls. |
min_confidence | 0.5 to 1 | How sure the decision model must be before evolve uses its answer without asking the tier above. A request's own min_confidence wins. |
auto_accept | boolean | Add a new term as soon as it has been proven consistent. A request's own auto_accept wins. |
learning | off | propose | auto | How a question seen for the first time starts out. A question that already has a policy keeps its own. |
min_support | 2 to 1000 | How many agreeing answers it takes before a rule is learned, for a new question. |
answer_cache_days | 0 to 30 | How long a model's answer is reused for the same question. 0 keeps none. |
Subprojects keep their data apart. Decision rules, learned rules, the answers they were learned from, reused model answers and remembered alias decisions all belong to the subproject a call runs under. Two subprojects on one account can use the same question id and never see each other's rules. Calls made with no subproject use the account's own set.
Which use case a call runs under. A key made for a use case carries it on every call. A new project key can access only that project; a header naming another returns 403. An account key can select any of its projects with X-Evoduce-Use-Case: <name>. A call with neither, or with no key, runs on the standard settings: every default in the tables above, with aliases: settle. Every endpoint works under every type; the type only sets the defaults.
No key needed. Returns each type with its config, what each setting means, its storage list, and store: whether the durable store is on.
Requires an account key. Body: {name, type, config?, key?}. name is lowercase letters, digits, - and _. config overrides any setting the type lists. key is "new" (the default: a new project-restricted key returned once as api_key), "current" (bind the calling account key as its default project) or "none". At most 20 use cases per account.
Your use cases, each with its settings in force, your overrides, its storage and the prefixes of the keys bound to it. GET /v1/usecases/{name} returns one.
Body: {config: {setting: value}}. Changes take effect within 15 seconds. A null value restores the type's default.
Shared names
A name sends a term to exactly one predicate, by exact match. So when two predicates list the same alias, something has to decide which one it means. The aliases setting of the call's use case says what:
aliases | What happens |
|---|---|
settle | The name keeps meaning what it means today: the choice remembered for you, else the predicate declared last. The choice is written into the vocabulary's aliases map for that call, remembered, and reported as aliases_settled. A proposal that claims a name an existing predicate already has does not take it; the name stays where it is and the response says so. Nothing is rejected. |
candidates | Both predicates stay candidates. Nothing is rejected; the open names are reported as aliases_shared. When one of them arrives as a term in evolve, the decision model reads the text around it and picks which is meant, and the pick is counted. |
strict | The check fails with ALIAS_UNAMBIGUOUS until the vocabulary's aliases map names the owner. |
off | Not checked. |
A vocabulary that says so itself is left alone under every setting: one that declares ALIAS_UNAMBIGUOUS in its rules gets the strict check, and one that carries default_rules gets what it asked for. An entry in the vocabulary's own aliases map always wins over a remembered choice.
# response to /v1/audit, /v1/prove, /v1/verify, /v1/accept, /v1/optimize, /v1/evolve under "settle"
"aliases_settled": {
"next to": {"term": "near", "candidates": ["touching", "near"], "by": "order"}
}
by is order (declared last), you (you named the owner), or kept (a proposal asked for a name that already had an owner; not_taken_by lists the proposals). Under candidates, an evolve result for such a term carries "alias": {"candidates": [...], "picked_by": "tier0" | "claude"}, or comes back needs_review when no tier is sure.
What has been remembered for a use case, per vocabulary name: settled (name, owner, how it was chosen, when) and picks (how often each candidate was picked). Add ?vocabulary= for one vocabulary.
Body: {vocabulary, alias, term}. Names the owner yourself. It is used from the next call on, whenever that predicate is among the ones claiming the name.
/v1/prove covers the structure of the whole vocabulary: axes and inverses. Per-predicate rules such as ALIAS_UNAMBIGUOUS and METADATA_REQUIRED are checked by /v1/audit. Under strict, a vocabulary with an open shared name passes prove and fails audit.
Where data lives
Each type of use case keeps different things, in different places. There are three stores. The durable store is Redis with its append-only log on and no expiry on these keys; it holds what the service has learned for you and must survive a restart. The cache is the same Redis with an expiry on every entry; losing it costs time, never an answer. The database is Postgres.
| Type | What | Where | Kept |
|---|---|---|---|
basic | Your vocabularies | Not stored | Sent with each call |
| Alias decisions | Durable store | Until you change them | |
| Proof results | Cache | 7 days; dropped when the engine is updated | |
| Background jobs | Cache | 24 hours | |
graph | Shared names and which term each was read as | Durable store | Until you change them |
| Your graph's terms | Not stored | Returned to you on each call | |
| Proof results | Cache | 7 days; dropped when the engine is updated | |
| Background jobs | Cache | 24 hours | |
decision | Decision rules, yours and learned | Database | Until you change them |
| Model answers used for learning | Database | The latest 2,000 per question | |
| Model answers for reuse | Cache | answer_cache_days | |
| Your upstream model key | Not stored | Used for the one call it arrives on |
Callers without a key have nothing remembered. If the durable store is unreachable, calls still succeed: a shared name is settled by order for that call and nothing is recorded. GET /healthz and GET /v1/usecases/types report the store's state under store; durable is true only when the log is on and the server will not evict keys that have no expiry.
Endpoints
Strict check of one proposal. Body: {vocabulary, proposal}. Returns a VerificationResult:
sat | bool | true = provably safe to add |
reason | string | Human-readable explanation |
violated_rules | string[] | Names of the hard rules broken |
counterexample | object | null | The proposal, its axes and one message per violation |
compliance | number | Graded only; 1.0 otherwise |
unmet_soft | string[] | Graded only |
Same body and result as /verify. Hard rules gate the result, and weighted rules fill in compliance and unmet_soft.
Verifies the proposal and, if SAT, adds it. Returns {result: VerificationResult, vocabulary: object | null}. Persist the returned vocabulary yourself; nothing is stored on our side.
MaxSMT batch admission. Body: {vocabulary, proposals: Proposal[], content_value?: {name: int}}. Admits the maximum-weight consistent subset of competing proposals.
{
"admitted": ["x"],
"rejected": ["x"],
"extensions": [
{"name": "x", "admitted": true, "compliance": 1.0, "hard_violations": [], "unmet_soft": []},
{"name": "x", "admitted": false, "compliance": 0.0, "hard_violations": [], "unmet_soft": ["PREFER_REVIEWED"]}
],
"objective": 8
}
A consistency proof over the whole vocabulary. Body: {vocabulary}. Returns a VerificationResult.
The same proof laid out as a graph, so it can be drawn. Body: {vocabulary}. Returns {name, proven, counts, checks_listed, nodes, edges}. The proof map draws it two ways: as a map you open level by level, and as a squid plot with every check as one link.
Each node has a type, a label and a parent (an index into nodes, or null at the top). The types are verdict; whole, the consistency proof of /v1/prove; rule; check, one for every rule and every predicate the rule applies to, under its rule; axis and its values; and terms, which holds one term per predicate. A check carries its own status (pass, fail, or unmet for a soft rule) and, when it did not pass, the reason. A rule carries checks and failed; one that only applies when a predicate is added, such as NO_DUPLICATE, has the status not_checked.
An edge [a, b] says b needs a: a value classifies a term, a check reads a term, the verdict rests on each hard rule and on the consistency proof. [a, b, "inverse"] joins two predicates that are each other's inverse, and [a, b, "transition"] is a move a state graph allows; neither is a need.
proven is true when the consistency proof holds and no hard rule failed, which is what /v1/prove and /v1/audit say together. Soft rules are scored and do not decide it. Past 20,000 checks only the ones that did not pass are listed one by one, and checks_listed is "failed" instead of "all"; the counts stay whole. The consistency proof inside is cached like /v1/prove; the graph itself is built on each call and not kept.
Re-verifies every predicate. Returns {predicates, passed, failures: [{predicate, ...VerificationResult}]}.
Lists the rule types a submitted vocabulary may declare.
Decision gateway
Send typed decisions to POST /v1/systemone. Its request and response follow the Jev-compatible shape, whether Jev or the configured open model answers. The same gateway takes OpenAI's request shape at POST /v1/decisions. Evoduce answers each question from the cheapest source that can settle it:
| Source | When | What you get |
|---|---|---|
| rules | Your decision rules for that question id settle it from the facts in state | A certain answer (confidence 1.0, one-hot probabilities) and the rules that fired. No model call, about a millisecond. |
| parsed | A question the engine's parser settles from the text: in one of your domains, by rules the state itself states ("refunds need a receipt unless…"), or from what the question's own text asks | A certain answer, and in details.parsed how it was read (by, why, and the domain it was read in). No model call. Anything the parser does not read whole goes on to the next source. |
| cache | The same state and question were answered before (7 days) | The earlier answer. No model call. |
| model | Anything left | A model answers. It is included with your Evoduce key and shows in your usage; you need no other key. Confident answers are recorded and rules are learned from them. |
Facts come from state when it's a JSON object (or a JSON string), or from a separate facts field when state is prose. Rules settle choice and yes/no questions; the parser settles those and score questions too. A plain-text state with no facts is read by the parser, and what it does not settle goes to the model.
Headers: Authorization: Bearer evd_… (your Evoduce key; all you need), X-Upstream-Key (optional: your own Jev key, for answers on your Jev account instead of ours), and X-Evoduce-Upstream: auto (default: your Jev key if you sent one, else the server's model), jev, open (the server's open model), or none (rules only). The body follows Jev's API reference: {state, questions, model?}; state and instructions may be strings or objects, and a structured state keeps its object or array form when forwarded. Evoduce also accepts optional facts for prose state. Counts as one request.
Inline rules. A question may carry rules in the decision-rule format; they are used instead of your policy for that question and stripped before anything goes to a model. Without a key the gateway still works at the anonymous rate with inline rules, or with your own provider key in X-Upstream-Key. It has no policies and learns nothing, and a model answer on our account needs a (free) key: without one you get 401. Drop-in: Jev's own SDK accepts a TYPESAFE_BASE_URL; point it here with your Evoduce key as TYPESAFE_API_KEY and your code is unchanged. See the examples.
{
"model": "jev-1.13.0",
"answers": {
"route": {"type": "choice", "choice": "billing", "confidence": 1.0, "probabilities": {"billing": 1.0, "sales": 0.0}},
"urgent": {"type": "noul", "noul": 0.93}
},
"usage": {"input_tokens": 100, "output_tokens": 1},
"evoduce": {
"sources": {"route": "rules", "urgent": "model"},
"details": {"route": {"rules": ["refunds"]}},
"upstream_calls": 1,
"learned_pending": {"urgent": 2}
}
}
If two of your rules demand different answers for the same facts, neither is used: the question goes to the model and details names the conflicting rules. If no model is available for a question rules can't settle, you get 503 naming it.
Model answers and your usage
You need only your Evoduce key. When rules and reused answers leave a question, a model answers it, and that answer is included with your key: there is no second account to open and no second bill. Every question is counted by what answered it (your rules, a reused answer, or a model), and the model calls behind them are listed with their tokens. You can see all of it on the dashboard and in GET /v1/account.
| What | How it works |
|---|---|
| Monthly allowance | Each plan includes a number of model-answered questions a month; the dashboard shows how many you have used. Past it, a request that needs a model is paid for from your credit. With no credit it is refused until the 1st: 402 where credit can be bought, 429 otherwise. Your rules and reused answers keep working, and they never count against it. |
| Credit | Bought by card on the dashboard, or with POST /v1/account/credit. It pays for the model tokens of requests past the allowance, at the price per million tokens that the dashboard and GET /v1/account show. Rules and reused answers are never charged. Once an account has bought credit, the monthly quota of usage units no longer stops its calls to /v1/systemone and /v1/decisions. |
| Answers the model is unsure of | A server can hold its model to a bar. When it does, an answer the model gives with less than the bar's probability is asked again of a second model: sources then says escalated, and details gives how sure the first answer was. If no second model answers, the first answer is returned with below_bar in details. Either way the question counts once against your allowance. |
| Your own provider key | Optional. Send your Jev or OpenAI key in X-Upstream-Key and those questions are answered on your account with that provider. They are shown apart in your usage and are not counted against the allowance. |
| A model that is starting | After a quiet spell the model can take about a minute to start. A call that arrives while it does returns 503 with a Retry-After header saying how many seconds to wait; nothing is counted for it. Send the same request again after that. Rules and reused answers are never held up by it. |
| Tokens | usage.input_tokens counts the state once per request, however many of its questions Evoduce's model answers; each question adds its own text. So thirteen questions about one long document cost about what one does, and it pays to send them together. Questions that rules or reused answers settle add nothing. When another provider answers, its own count is passed on as it reports it. |
Use an NS vocabulary in a typed Choice
Add an Evoduce vocabulary to a choice question. Its predicate names become the exact criteria option keys. Evoduce makes a short option description from each predicate's axis values, then removes vocabulary before asking a decision model. You can provide your own criteria descriptions if their keys match the predicate names exactly.
{
"state": {"ticket": {"category": "refund", "amount": 40}},
"model": "jev-latest",
"questions": {
"route": {
"type": "choice",
"instructions": "Which department should handle this ticket?",
"vocabulary": {
"name": "ticket_departments",
"axes": {"department": {"values": ["billing", "support"]}},
"rules": [{"type": "AXIS_COVERAGE"}],
"predicates": {
"billing": {"department": "billing", "symmetric": true},
"support": {"department": "support", "symmetric": true}
}
}
}
}
}
The forwarded question uses Jev-compatible Choice syntax: {type: "choice", instructions, criteria: {billing: "department: billing", support: "department: support"}}. Jev is one provider; the configured open model adapter accepts the same question shape. A Choice has at most 255 options. Keep the same question id for learned decision rules; confident model choices become observations for that policy, and a rule can later settle the question without a model call.
The vocabulary defines which answers are allowed and its structural rules govern additions through /v1/verify and /v1/accept. A model choice is a judgment, not a proof that it is the correct label. The decision rules are checked separately against the facts in state.
The same gateway in OpenAI's request shape
If your code already calls OpenAI's Decisions API, send the same request here. Your rules answer first, earlier answers are reused, and only what is left goes to a model. The response comes back in OpenAI's shape with the evoduce block added. Evoduce is independent of OpenAI and TypeSafe AI; “compatible” describes the request and response shapes only.
Body: {model, input, questions} as in OpenAI's guide. input is a string or a list of messages with input_text, input_image and input_json parts. Each question is a predicate, a choice (with choices) or a score (with levels), and may have a name. prompt_cache_key, prompt_cache_options and safety_identifier go to OpenAI as you sent them. Evoduce adds two optional fields and removes them before anything reaches a model: rules on a question (the decision-rule format) and top-level facts. Up to 50 questions and 256 KB per request, so send images by URL. Audio and video are not accepted. Counts as one request.
| What | How it works here |
|---|---|
| Facts | facts if you send it. Otherwise input when it is a JSON object in a string, or the input_json parts of the user messages (a later part's fact replaces an earlier one of the same name). Plain text and images carry no facts and go to the model. |
| Rules and learning | A question's name is its question id: /v1/policies/{name} holds its rules, and confident answers are learned under it. A /v1/systemone question with the same id shares that policy. A question with no name can only use inline rules, and nothing is learned from it. |
| What rules settle | predicate (then is true or false) and choice (then is one of the values). score always goes to the model. |
| The model | With only your Evoduce key, the server's model answers text and JSON input, and its answers come back in OpenAI's shape; they are included with your key. Images and tool calls are beyond that model: they go to OpenAI, on the server's account where it has one, otherwise on yours. To use your own OpenAI account for everything, send your OpenAI key in X-Upstream-Key: the questions rules can't settle are forwarded to OpenAI as you wrote them, and are not counted against your allowance. X-Evoduce-Upstream picks: auto (default: your OpenAI key if you sent one, else the server's model), openai (your key if you sent one, else the server's), jev (X-Upstream-Key is then a Jev key), open, or none (rules only). |
{
"model": "gpt-6-luna",
"answers": [
{"type": "choice", "name": "route", "choice": "billing", "confidence": 1.0,
"probabilities": [{"value": "billing", "probability": 1.0}, {"value": "sales", "probability": 0.0}]},
{"type": "predicate", "name": "urgent", "probability": 0.93}
],
"usage": {"input_tokens": 42, "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
"output_tokens": 0, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 42},
"evoduce": {
"sources": ["rules", "model"],
"details": [{"rules": ["refunds"]}, {}],
"upstream_calls": 1,
"learned_pending": {"urgent": 2}
}
}
answers, sources and details are in the order you asked; learned_pending is by name. An answer from rules is certain: probability 1 or 0, confidence 1. When the model declines a question, its refusal is passed on as it came, and is neither reused nor learned from. An answer from the server's open model also carries calibration, as on /v1/systemone: logprobs when the probabilities were read from the model, self_reported when it could only estimate them. If nothing can answer a question you get 503 naming it; if the model fails, 502.
Any client that lets you set the base URL can call it: your Evoduce key is the bearer key, and that is all it needs. Your own OpenAI key, if you want to use one, goes in X-Upstream-Key. From the SDKs: nse.decisions(input, questions, upstream_key=…) in Python and nse.decisions({ input, questions }, { upstreamKey }) in TypeScript. GET /v1/models on this server lists models in Jev's shape, not OpenAI's.
Decision rules
A policy is the set of rules behind one question id. Each rule says: when these facts hold, the answer is this. Signed in, you can write and review them on the Rules page, which uses the calls below.
{"name": "big deals",
"when": [{"var": "category", "op": "==", "val": "quote"},
{"var": "amount", "op": ">=", "val": 10000}],
"then": "sales"}
op is one of ==, !=, <, <=, >, >= or in (with a list). Nested facts use dotted names (customer.vip). For a yes/no question, then is true or false. A rule whose condition depends on a fact the request didn't include still applies when the solver can show the answer is forced regardless.
Learning
Every confident model answer over structured facts is an observation. A pattern that holds in at least min_support observations (default 5) and fails in none becomes a learned rule: one fact, a numeric threshold, or two facts together. A later model answer that contradicts a learned rule withdraws it. Each policy's learning mode is:
propose (default) | Learned rules wait for you to approve them; learned_pending in each response shows how many. |
auto | Learned rules answer immediately. |
off | No observations are kept. |
A learned rule is a generalisation of what the model did, so it can be wrong where the model would have decided differently. Your own rules are never changed by learning; if a learned rule contradicts one of yours on some facts, that's a conflict and the model decides.
Every question id this account has rules or observations for, with counts.
{question_id, rules, learned, learning, min_support}. Learned rules carry learned.support.
The latest model answers kept for the question, newest first: {question_id, kept, answers: [{facts, answer, at}]}. ?limit= is 1 to 200 (default 50). These are what learned rules are found in; the dashboard lists them under Decisions.
Body: any of {rules, learning, min_support}; unspecified fields keep their value. Rules are checked for shape and type consistency.
Body: {indexes?: [0, 2]}. Moves the given learned rules (all, if omitted) into the policy's own rules.
Domains
A domain is one question's rules read once into a form the parser decides plain text with: the variables the question turns on, the words a text uses for each value, and a rule for each answer. With one stored, a state of that question written in prose is settled with no model whenever the parser reads it whole (source parsed above). Keep as many as you have questions; each subproject keeps its own. Domains use the evaluator's domain format (variables, rule_sentences, definitions, rules).
Body: {question, text, domain}: the question in Jev's shape, the text the rules come from, and the domain. It is stored only if it passes six checks, none of which calls a model: its shape; its words are in text (a word that is not is dropped and listed in dropped_names); its numbers are written there; its vocabulary holds together; no two answers' rules can hold at once; and some answer's rule holds whatever the facts. A refusal is 422 naming the check that failed and why. One question has one domain: a second one for the same question under another name is 409, and putting under the same name replaces it.
{domains: [{name, question, text, domain, updated_at}], parsing}, in the order they were stored. parsing says whether this server parses at all.
Extract
Turn a document into rules. Send a policy, a handbook or a specification; get back the variables the rules are written over, the questions they answer, and the rules, each tied to the sentence it came from. Nothing is used until you say so: review the result, then add the rules to a subproject with apply, or keep them in your own code.
{
"text": "Full-time employees with at least 12 months of continuous service are eligible for parental leave. ...",
"instructions": "An HR assistant answers questions about leave eligibility.",
"k": 3
}
| Field | Meaning |
|---|---|
text | Up to 50,000 characters. Rules work best stated as a condition and an outcome. Split a longer document and extract each part. |
target | decision_rules (default): rules in the decision-rule format, answering typed questions. constraints: what must hold over the variables, as atom clauses, checked for consistency. |
variables | Optional. [{name, type, values?, description?}] with type bool, int, real or enum. Given, they are used as they are and no others are added; left out, they are found in the document. |
questions | Optional, decision rules only. The questions the rules answer, in the gateway's question format. |
instructions | Optional. What the rules are for and the questions people will ask; it steers what is extracted. |
k | How many times each rule sentence is read, 1 to 5 (default 3). Readings are compared by meaning; a sentence whose readings disagree goes to review instead of into the rules. |
apply | Add the accepted rules to the calling subproject's decision rules, skipping any it already has. |
# the response (abridged)
{
"variables": [{"name": "months_of_service", "type": "int", "description": "months of continuous service"}, ...],
"questions": {"parental_leave": {"type": "noul", "instructions": "Eligible for parental leave?"}},
"rules": [{"name": "r1 (sentence 4)", "question": "parental_leave", "then": true,
"when": [{"var": "full_time", "op": "==", "val": true},
{"var": "months_of_service", "op": ">=", "val": 12}],
"source": {"sentence": 3, "text": "Full-time employees with ...", "start": 63, "end": 160},
"agreement": 1.0}],
"policies": {"parental_leave": [ ...the rules, ready for PUT /v1/policies... ]},
"review": [{"issue": "conflict", "question": "parental_leave", "rules": ["r1 (sentence 4)", "r3 (sentence 6)"],
"detail": "both can apply at once and answer parental_leave differently ..."}],
"fidelity": {"sentences": 11, "rule_sentences": 7, "grounded": 6, "coverage": 0.86, "draws": 3}
}
What goes to review, never into the rules:
issue | Meaning |
|---|---|
ambiguous | The readings of a sentence disagree. Every reading is listed with how many draws gave it. |
no_reading | Too few usable readings: the rest were malformed, used a variable that does not exist, or stated a number neither the sentence nor the one before it states. |
no_rule | The sentence looked like a rule, but its readings agree it states none over these variables and questions. Usually a variable or question is missing. |
conflict | Two rules can apply at once and give different answers; or, for constraints, the ones that cannot all hold. |
unconditional | A rule with no condition: it would answer its question the same way always. |
duplicate | Says the same as a rule already extracted. |
unused_variable | A variable no accepted rule uses. |
fidelity counts the sentences, the ones that state a rule, and how many of those produced an accepted rule. Rule names carry their sentence number, so when the gateway answers from an extracted rule its details point back to the document. A model does the reading, so extract needs one configured on the server; it is metered like evolve. For long documents use /v1/jobs with op: "extract" and the same fields.
Evolve
The endpoints above check a change you already have. /v1/evolve finds the changes: give it text or a list of candidate terms, and it works out which are already covered, which are new, and where each new one belongs. Nothing is added until it has been proven consistent with your rules.
It uses up to two model tiers, cheapest first:
| Tier | What it does | When it hands off |
|---|---|---|
| Tier 0: a fast decision model | Picks from fixed options with a confidence score: is this a term you already have, and what is its value on each axis? All axes are asked in one request. | Its confidence is below min_confidence (default 0.7); the answer needs a new name it can't write; or the proof check rejects its proposal. |
| Claude | Reads prose, names new terms, and revises a proposal using the exact rule the proof check says it broke. | After max_repair_attempts the term comes back as rejected. |
Tier 0 is any typed-decision model: Jev from TypeSafe AI, or an open model served through an OpenAI-compatible endpoint (Ollama, vLLM and similar). With an open model, each question is posed as a lettered list and the option probabilities are read from the model's own next-token distribution, so they are what the model assigned rather than a number it wrote down; a server that can't return those falls back to a self-reported estimate and the answer says so. GET /v1/evolve/tiers reports which tiers a server has and which tier-0 provider. With only tier 0, send terms; reading text needs Claude.
Body: {vocabulary, text | terms, auto_accept?: true, max_repair_attempts?: 3, min_confidence?: 0.7}. Send exactly one of text (up to 20,000 characters) or terms (up to 25). Requires an API key and counts as 10 requests; limited to 10 calls a minute per key.
{
"results": [
{"term": "touching", "action": "mapped", "canonical": "touching", "trace": []},
{"term": "near", "action": "accepted", "canonical": null,
"repair": {"axes": {"duration": "temporary", "type": "proximity"}, "symmetric": true, "inverse": null},
"verification": {"sat": true, "reason": "...", "violated_rules": []},
"trace": [{"step": "adjudicate", "tier": "tier0", "confidence": 0.93},
{"step": "repair", "tier": "claude", "escalated_because": "axis type: confidence 0.41 is below 0.7"}]}
],
"accepted": ["near"],
"vocabulary": { ... },
"tiers": {"tier0": true, "claude": true},
"usage": {"tier0": {"calls": 2, "escalations": ["repair: ..."]}, "claude": {"llm_calls": 1, "input_tokens": 812, "output_tokens": 96}}
}
action is one of mapped (an existing term or a synonym of one), accepted, rejected (no proposal passed the proof check), noise, out_of_scope, needs_review (tier 0 was unsure and there is no tier above it) or declined. vocabulary is the updated vocabulary when anything changed, otherwise null. trace shows which tier settled each step and why it escalated. For long inputs, submit {"op": "evolve", ...} to /v1/jobs.
Background jobs
Synchronous calls get a 10 s solver budget, which is plenty for verify and audit at any size. A full prove grows quickly with vocabulary size: about 0.5 s at 100 terms and over 10 s at 1,000. For large vocabularies, run prove, audit or optimize as a job. Jobs run on dedicated solver workers with a 60 s budget, and nothing is held open while they run.
Body: {op: "prove" | "audit" | "optimize", vocabulary, proposals?, content_value?}. Input is validated before it's queued, so a bad vocabulary still gets an immediate 422. Returns 202 with a job and a Location header, or 200 with the finished job if the result is already cached. Each submission counts as one request against your quota.
Returns {id, op, status, created_at, started_at?, finished_at?, result?, error?, cache_hit?}. status is queued, running, succeeded or failed. On failure, error.code is one of:
| Code | Meaning |
|---|---|
inconclusive | The solver ran out of budget, so there is no verdict. This never means UNSAT. |
worker_lost | The worker stopped mid-job. Resubmit it. |
invalid | The input was rejected while solving. |
internal | An unexpected error. |
Polling doesn't count against your quota but is limited to 120 per minute per IP. Job IDs are unguessable and act as the credential for reading the job. Jobs expire after 24 hours.
# Python
result = nse.prove_in_background(vocab) # submit + wait
job = nse.submit_job("optimize", vocab, proposals=[...]); nse.wait_job(job)
// TypeScript
const result = await nse.proveInBackground(vocab);
const job = await nse.submitJob("audit", vocab); await nse.waitJob(job);
Caching
prove, audit and optimize results are cached for 7 days, keyed on a hash of the input and the exact evaluator build. Top-level keys that start with _ (such as _comment) are ignored for the key. Synchronous responses carry X-Evoduce-Cache: hit | miss. A new evaluator release can never return a stale proof, and timeouts are never cached.
Account endpoints
These back the dashboard. They take an account key as the bearer token and don't count toward your quota. Project keys cannot use account endpoints.
Body: {email, use_cases?}, where use_cases is a list of {type, name?, config?}: one entry per thing you are building (see use cases). Each becomes its own subproject with its own key, settings and data; two of the same type need different names. Creates the account and returns {email, plan, id, api_key, prefix, name, use_cases?}, where each use case carries its own api_key. The first key is an account key, bound to the first project's defaults; additional keys are restricted to their projects. If any entry is invalid, no account is created. A single use_case object is also accepted. api_key appears only in this response; we store a SHA-256 hash of it. Limited to 5 signups per hour per IP. While Evoduce is in private beta, sign-up needs the invite link opened in the same browser and takes only the email the invite is for; otherwise it returns 403.
Requires an account key. Returns account quota units and the last 30 days of daily totals, plus monthly usage by API key, project, and key/project combination. Each key includes scope (account or project), scope_project, month_units, and month_requests; each project includes id, name, requests, and units. usage_by_key_project contains {key_id, project_id, requests, units} rows. Account keys can select another project with X-Evoduce-Use-Case; project keys cannot. Older usage from before project tracking appears in unattributed_units; it remains in account and key totals. Call counts begin with project tracking. Existing keys issued before project restrictions remain account keys until rotated.
questions covers the decision gateway this month: month counts questions by what answered them, {rules, reused, model, own_key}, where own_key is the part of model answered on your own provider key; allowance is {used, limit} for model answers included with your key; and model_usage lists model calls as {provider, model, paid_by, calls, input_tokens, output_tokens}. paid_by is evoduce for calls included with your key and caller for calls on your own provider key. Model calls made by evolve and extract are listed there too.
credit is what pays for model tokens past the allowance: balance_usd; price_per_million_tokens as {input, output} in dollars; spent_this_month as {usd, input_tokens, output_tokens}; can_buy and the amounts_usd on offer; and added, the last ten additions as {at, usd, source}.
The last 30 days of decision questions: {since, daily: [{day, project_id, rules, reused, model, own_key}]}, one entry for each day and project that was asked anything, counted by what answered. project_id is a project's id from GET /v1/account, or 0 for calls that named no use case. The dashboard's Decisions section is drawn from it.
Body: {usd}, one of credit.amounts_usd. Returns {url}: a payment page to open in a browser. The credit is added once the payment has gone through, usually within a minute of paying.
Body: {name}. Creates another account key (at most 5 active) and returns it once.
Revokes a key. You can't revoke your last active account key. Revocation reaches every server within a minute.
Errors
| Status | When |
|---|---|
401 | Unknown or revoked API key, or a decision that needs a model sent with no key |
402 | The month's model-answer allowance is used up and the account has no credit. Add credit, or wait for the 1st |
409 | Email already registered, or key limit reached |
413 | Body over 256 KB |
422 | Malformed vocabulary, unknown axis or rule type, or an axis value outside the declared enum. detail says which. |
429 | Rate limited (honour Retry-After), monthly quota reached, or the month's model-answer allowance used up on a server where credit can't be bought |
503 | The model is starting (honour Retry-After), no model can answer the question, background jobs are temporarily unavailable, /v1/evolve has no model tier configured for the request, or the model behind /v1/evolve or /v1/extract is not answering (the message says why) |
504 | The solver ran out of budget, so there is no verdict. This is never reported as UNSAT. Retry as a job. |
An UNSAT verdict is not an error: it's a 200 with "sat": false.