Skip to main content
Decision Models is in beta. Telnyx manages model selection; there is no customer-selectable model setting.
POST https://api.telnyx.com/v2/ai/typesafe/v1/systemone evaluates shared context against named questions and returns structured answers. Use choice to select a category, noul to evaluate a yes/no condition, and score to rate an ordered rubric. A request can combine all three question types. The endpoint supports a subset of the TypeSafe System One API request format and preserves its typed answer shapes. It returns one complete JSON response. See the API reference for the full request and response schemas.

Classify a support incident

Set TELNYX_API_KEY to a Telnyx API key. Send the incident as state, then use named questions to select the team, identify a production incident, and rate urgency in one request.
The response contains model, answers, and usage directly, with no data wrapper. The model value is an opaque Telnyx-controlled compatibility identifier, not a selectable model name. Each key in answers matches a key in questions. The following example rounds values for readability; results and token counts can vary.
Read answers.team.choice to choose a destination. Interpret answers.production_incident.noul as a numeric yes-score, and answers.urgency.score on the requested 0–3 rubric. Token usage includes shared-context preparation and question evaluation, so it can exceed the size of the unique input text.

Choose question types

Every question requires type and instructions. Instructions and state can be strings, JSON objects, or arrays. Text-only conversation histories are supported; image and audio inputs are not supported. A choice question selects one option. Use separate noul questions when several independent conditions can be true at once. For example, a support message can both request a refund and report a service fault. A score answer can be fractional. For criteria ["Low", "Normal", "High", "Critical"], the range is 0–3. Compute the expected score as sum(index * probability); do not treat it as a 0–1 probability or an array index without an application-specific decision rule.

Use scores in application logic

Option scores are normalized relative preferences across the supplied choices. Changing the choices or their wording can change the distribution. They are not calibrated probabilities that a decision is correct. For choice and score, confidence is normalized entropy: 1 - H(p) / ln(N), where H(p) = -sum(p * ln(p)) and N is the number of options. It approaches 0 for a uniform distribution and 1 when the score is concentrated on one option. It is different from the winning option’s probability. Choose review thresholds using representative examples from the application. The following Python example uses direct HTTP, selects a team, and falls back to manual review when the winning option has a low relative score. The 0.8 threshold is illustrative and must be evaluated for the application’s data.

Migrate a TypeSafe request

Point HTTP requests to https://api.telnyx.com/v2/ai/typesafe/v1/systemone and authenticate with a Telnyx Bearer API key. Send state and questions, keeping the question IDs used by the application. Telnyx chooses the underlying model. Compatibility applies to the supported JSON request subset and typed answer shapes. It does not imply identical model predictions, confidence calibration, pricing, or token accounting. The official TypeSafe Python SDK appends /v1/systemone to the configured base URL. The route preserves that behavior. Its client.models.list() method uses a separate TypeSafe route and is outside this endpoint’s compatibility scope. There is no public model-selection setting. The SDK automatically sends its model value; Telnyx ignores it, so existing client defaults and overrides cannot choose the underlying model.

Use the TypeSafe Python SDK

Install the official SDK:
Set the Telnyx base URL and API key. Existing system_one() calls using the supported question subset keep the same method and answer accessors. This example uses the SDK’s Choice, Noul, and Score types.
The SDK sends a Bearer authorization header from api_key. Use a Telnyx key for Telnyx requests. Keep /v1/systemone out of base_url; the SDK adds it.

Limits and failures

Use up to 64 named questions against one shared state. Split larger workloads into separate requests and bound client concurrency. Responses arrive after the complete evaluation; there is no streaming or per-question partial-success envelope. Request-body and token limits also apply, so question count alone does not guarantee that a request fits. The public request fields are state and questions. The SDK-supplied model value is ignored for compatibility. Other unknown fields are rejected. Do not send input, labels, tier, stream, temperature, or max_tokens to this endpoint. Check the HTTP status before parsing an answer. Honor Retry-After when present. Correct validation failures before retrying; retries repeat evaluation work. A decision model service error uses this shape, with a message describing the failure: