Reflex API
Typed decisions: send a state and named questions, get a probability per answer back. No text generation, no parsing.
Overview
Most of what an agent asks a model is not a paragraph. It is “which queue does this ticket go to”, “how severe is this”, “does this message need a human”. Asking a chat model means generating text, parsing it, and hoping the number it wrote reflects anything. Reflex skips the generation: the model reads the state and reports the probability of every option for every question, so your code branches on numbers.POST /v1/systemone takes a state (text or JSON), optional inline images, and a map of named questions of three types. Every answer is a distribution over the options you gave.
reflex, Morph’s decision model, trained to read a state and answer typed questions about it. Requests sent as d3-ultra, its launch name, still work.
Images
Sendimages as an array of inline base64 data URLs (data:image/jpeg;base64,...). PNG, JPEG and WebP are accepted. The request may contain at most 16 images total, with at most 8,000,000 decoded bytes per image. Remote URLs are not fetched.
Alternatively, include {"type":"image_url","image_url":{"url":"data:image/jpeg;base64,..."}} parts inside state. Image parts belong in the state, not in a question’s instructions or criteria. Image tokens count toward input usage and the context limit.
Writing questions
instructions is what you want judged. criteria describes the options: for choice a map of option name to description (or null), for score an ordered list of level descriptions from lowest to highest, for noul an optional {"true": ..., "false": ...} pair. Descriptions do the work: an option the model can only see by name gets answered by the name alone.
An optional top-level instructions string is placed ahead of the questions, for context every question shares.
Ask every question about one state in one call. Questions are answered in the order you send them.
Reading answers
probabilitiessum to 1 per question.choiceis the argmax;scoreis the expected level, so a 3-level scale answering{0: 0.0, 1: 0.7, 2: 0.3}scores 1.3.confidence(0 to 1) is the probability the model put on the answer it gave, measured over everything it could have produced, not only your options. It equals the answer’s entry inprobabilitiestimes the total probability on the answer labels, so it is never higher than that entry. Forscorethe answer is the most likely level; fornoulit is the more likely of yes and no. Gate actions on it: act automatically above a threshold you choose per action, route to a person below it.- When returned,
diagnostics.<id>.label_massis how much of the model’s probability landed on your options at all. A low value means the question or its options read poorly to the model; reword them. usage.input_tokenssums the state plus each question, including expanded image tokens.usage.input_tokens_details.cached_tokensis the part of it served from the prefix cache, billed at the cached-input rate.usage.output_tokensis always 0: nothing is generated.
Pricing
$0.042 per million input tokens, $0.002 per million cached input tokens, no output charge.Errors
400: the request does not fit the contract (for example achoicewith no options, orscorecriteria that are not a list). The message names the question.401: missing or invalid key.429: your key’s rate limit.404: unknownmodel.422: unsupported media, including remote image URLs, audio, video, and images inside questions.503: the decision engine is unavailable; retry with exponential backoff.- Every response carries
x-request-id.
Switching from another typed-decision API
If you already send{model, state, questions} with noul, choice and score questions to a /v1/systemone endpoint, the bodies are the same here. Change three things: the base URL to https://api.morphllm.com, the key to a Morph key, and model to reflex.Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
The state and the questions to answer about it.
A state and the typed questions to answer about it.
reflex.
"reflex"
What the questions are about: text or JSON. Image content parts may appear here with type image_url and image_url.url set to an inline base64 data URL. Input usage includes the state for each question.
"Hi, I've been trying to connect my Stripe account for 3 days and it keeps failing. I'm losing sales. Please help ASAP."
Named questions, asked in this order. The answer for each comes back under the same name.
Inline base64 data URLs: data:image/png;base64,..., data:image/jpeg;base64,... or data:image/webp;base64,... . At most 16 images total across the request, up to 8 MB (8,000,000 decoded bytes) each. Remote URLs are not fetched. Images are billed as expanded input tokens.
16Optional context placed ahead of the questions.
Response
One answer per question.
The answers and what they cost.
The model that answered.
"reflex"
One answer per question, under the name you gave it.
Token accounting for the request.
Decision id, when returned.
"dec-6f1c0b9e2a7d4c3e"
structured_decision Unix seconds, when returned.
1793577600
When returned: per question, how much of the model's probability landed on the options.