DocsMaple Proxy

System One decisions API

Ask typed questions about private text and images and get probabilities from decision models inside secure enclaves. Jev-compatible schema.

POST /v1/systemone answers typed questions about a JSON state with probabilities instead of generated text, from a model inside a secure enclave. The request and response follow the System One schema TypeSafe’s Jev introduced, so clients built for it work against Maple by changing the base URL and model. Use it where you would otherwise write a classifier, a router or an if statement around an LLM, and where the state is data you do not want leaving an enclave: screens, inboxes, documents, health and money.

This API is experimental. It needs Maple Proxy 0.4.2 or newer and a Maple API key. As with any OpenAI-compatible API, clients written for TypeSafe need two changes: the base URL, pointed at the proxy, and model, set to one of the models below. TypeSafe’s client libraries read both from TYPESAFE_BASE_URL and TYPESAFE_DEFAULT_MODEL, with TYPESAFE_API_KEY holding your Maple API key. API usage draws from your plan’s usage first, then from any extra credits you’ve bought. See pricing.

Request

Shell
curl http://127.0.0.1:8080/v1/systemone \
  -H "Authorization: Bearer $MAPLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5-3-flash",
    "state": {"ticket": "Payment went through twice and I need one refunded today."},
    "questions": {
      "is_urgent": {"type": "noul", "instructions": "Does the customer need help today?"},
      "intent": {
        "type": "choice",
        "instructions": "What does the customer want?",
        "criteria": {"refund": "money back", "question": "information", "praise": "thanks"}
      },
      "frustration": {
        "type": "score",
        "instructions": "How frustrated is the customer?",
        "criteria": ["Low", "Medium", "High"]
      }
    }
  }'

state is any JSON; the model reads it as given. Questions are answered in the order you list them, and choice options are numbered in the order of their keys. Everything Maple adds to the schema is optional and defaults to the recommended setting, so a request written for TypeSafe works unchanged:

FieldDefaultNotes
modelglm-5-3-flashOne of the models below; other names return 422.
imagesnoneglm-5-3-flash only. Up to four data: URLs shown with the state, as in "images": ["data:image/png;base64,..."]. PNG, JPEG, WebP and GIF work.
temperatureglm-5-3-flash: calibrated for the option count. Decision models: 1.Divides the log-probabilities before they are normalised. 1 returns the raw probabilities.

The response adds fields TypeSafe’s schema does not have, and they are safe to ignore: id, the temperature and option_mass on every answer, and cached_tokens and requests in usage.

JSON
{
  "id": "so_7f3c…",
  "model": "glm-5-3-flash",
  "answers": {
    "is_urgent": {"type": "noul", "noul": 0.94, "temperature": 2.48, "option_mass": 1.0},
    "intent": {
      "type": "choice", "choice": "refund",
      "probabilities": {"refund": 0.86, "question": 0.10, "praise": 0.04},
      "confidence": 0.79, "temperature": 2.41, "option_mass": 0.99
    },
    "frustration": {
      "type": "score", "score": 1.2,
      "legend": {"0": "Low", "1": "Medium", "2": "High"},
      "probabilities": {"0": 0.12, "1": 0.56, "2": 0.32},
      "confidence": 0.34, "temperature": 2.48, "option_mass": 0.99
    }
  },
  "usage": {"input_tokens": 612, "output_tokens": 3, "cached_tokens": 0, "requests": 3}
}

Models

ModelReadsOptions per choiceHow it answers
glm-5-3-flashtext and images2 to 255GLM-5.3 Flash, one masked token per question, calibrated
decision-smalltext2 to 26a 4B decision model, every question in one pass
decision-mediumtext2 to 26a 9B decision model, every question in one pass
decision-largetext2 to 26a 27B decision model, every question in one pass

The decision models are classifiers trained for this task (vLLM-SR’s d3 family, served in Tinfoil’s attested enclaves). They report their own trained probabilities, so their answers carry a temperature of 1 unless you set one, and an option_mass of 1: they only ever score the offered options. In our tests on sentiment and news-topic classification, decision-large was the most accurate of the four models and decision-small and decision-medium came close to glm-5-3-flash at a fraction of its price. Use glm-5-3-flash for images and long option lists.

Question types

TypeAnswerLimits
noulnoul: probability that the statement is true. Optional criteria: {"true": …, "false": …} describes each side.
choicechoice: the most probable option, plus probabilities per option and confidence.2 to 255 options (26 on decision models)
scorescore: the expected level (0-based), plus legend, probabilities per level and confidence.2 to 10 ordered levels, lowest first

confidence follows TypeSafe’s definitions. For a choice it is how far the top probability sits above an even split, (p_max - 1/n) / (1 - 1/n). For a score it is one minus the probability mass away from the most likely level, scaled so that a uniform spread scores 0. Both measure how decided the distribution is, not whether the answer is right.

Up to 64 questions per request. The state may be up to 32,000 tokens and 1 MiB, each question with its criteria up to 16,000 tokens, and a request up to 200,000 upstream prompt tokens in total; as a rule of thumb, 32,000 tokens is about 150 KB of English prose, 100 KB of dense JSON or 40 KB of base64. Images may be 4 MiB each and 8 MiB in total. On a decision model, the state and any one question together must also fit the model’s 32,768-token context. Every answer carries the calibration temperature applied and option_mass, the share of the model’s next-token probability that fell on the offered options. On glm-5-3-flash, a low option_mass means the question did not fit the state well; check it before trusting a confident-looking answer.

Errors

Schema problems return 422 and size limits 413, each with a message that names the problem and an x-opensecret-error-code header such as system_one_too_many_questions, system_one_bad_option_count or system_one_state_too_large; the same code is in the body’s error.code. Images sent to a decision model return system_one_images_unsupported, and a state and question too long for its context return system_one_context_exceeded. Unknown and missing fields are schema problems too: files instead of images returns 422 with system_one_unknown_field and the message Unknown field \files`, expected one of …`, rather than an answer that quietly ignored the image. Malformed JSON returns 400. Quota, plan and capacity failures use the same statuses and codes as chat. A request that fails part-way returns no partial answers.

Cost and speed

On glm-5-3-flash, usage is billed as GLM-5.3 Flash tokens: one upstream request per question (two for a choice with more than 128 options), each carrying the state and the question, with one output token. A text question on a short state is about 200 input tokens. Measured on a 1080p screenshot with three questions: 1.2 to 2.9 seconds per request and about $0.001, because the image prefix is cached after the first question. TypeSafe’s client libraries default to a 10-second timeout per attempt, which is tight for image requests and large batches of questions; raise it.

A decision model answers every question of a request in one upstream request and generates nothing, so usage is input tokens only: each question is counted with the state, and a short question about a short state is about 100 tokens. Input is $0.03, $0.09 and $0.60 per million tokens for decision-small, decision-medium and decision-large. In our tests a request took about half a second, whether it asked one question or 64.

Privacy

The state, the images and the answers are decrypted only inside Maple’s attested enclave and the model provider’s attested confidential-computing enclave, and are never stored. See how Maple’s enclaves work.

Last updated