TypeSafe System One
Evaluate JSON state with Jev using TypeSafe's native API. Use a rout.my inference or reseller API key. Model availability follows your configured catalog and access policy.
| Route | Purpose |
|---|---|
POST /v1/systemone | Evaluate state and typed questions. |
POST /typesafe/v1/systemone | Same operation under the native SDK prefix. |
GET /typesafe/v1/models | Authenticated native model list: { "models": [{ "name", "description", "release_date" }] }. |
Set SDK baseURL / base_url to https://api.rout.my/typesafe; the SDK appends /v1. The existing /v1/models keeps its OpenAI envelope and advertises endpoints: ["v1/systemone"] for these models. The former /v1/evaluate is removed.
REST
curl https://api.rout.my/v1/systemone \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev-latest",
"state": {"action": "refund", "completed": true},
"questions": {
"refunded": {"type": "noul", "instructions": "Was a refund completed?"},
"outcome": {
"type": "choice", "instructions": {"task": "Classify the action"},
"criteria": {"refund": {"meaning": "money returned"}, "other": null}
},
"quality": {
"type": "score", "instructions": "How completely was the action performed?",
"criteria": [{"meaning": "not done"}, {"meaning": "done"}]
}
}
}'model, state, and a nonempty questions map are required. State, optional instructions, and criterion descriptions accept strings, objects, arrays or null. Nested JSON values retain their types. Question IDs are returned unchanged. All questions share one state and run in a single upstream request. SDK extra body fields are forwarded; stream: true is unsupported.
| Question type | Criteria | Answer |
|---|---|---|
noul | Optional object with true / false descriptions, or null. | noul: probability of yes, between 0 and 1. |
choice | Nonempty map of option names to descriptions. | choice, confidence, and complete probabilities. |
score | Array of at least two ordered descriptions. | Fractional score from 0 to the last level, confidence, complete probabilities, and legend preserving each level's JSON description. |
Confidence is supplied by TypeSafe; it is not a guarantee of correctness. Choose application thresholds using representative inputs. Native rounded values are preserved without renormalization.
Example Noul response (illustrative):
{
"model": "jev-latest",
"answers": {"refunded": {"type": "noul", "noul": 0.98}},
"usage": {"input_tokens": 100, "output_tokens": 16}
}The response preserves the public model alias, including reseller aliases. TypeSafe's resolved version is used internally for pricing. Both usage counters are required and explicit zeros remain zero. Reseller responses can also include usage.cost, the client price in USD. Missing model metadata is an empty string.
JavaScript SDK
import { TypeSafeClient } from '@typesafe-ai/sdk';
const client = new TypeSafeClient({
apiKey: process.env.ROUTMY_API_KEY,
baseURL: 'https://api.rout.my/typesafe',
defaultModel: 'jev-latest',
});
const models = await client.models.list();
const result = await client.systemOne({
state: 'The support agent issued a full refund to the customer.',
questions: { refunded: { type: 'noul', instructions: 'Was a refund issued?' } },
});
console.log(models, result.answers.refunded.noul);Python SDK
import os
from typesafe_sdk import TypeSafeClient, Noul
with TypeSafeClient(
api_key=os.environ['ROUTMY_API_KEY'],
base_url='https://api.rout.my/typesafe',
model='jev-latest',
) as client:
models = client.models.list().models
result = client.system_one(
state='The support agent issued a full refund to the customer.',
questions={'refunded': Noul(instructions='Was a refund issued?')},
)
print(models, result.answers['refunded'].noul)AsyncTypeSafeClient uses the same base URL and payload. Choice/Score builders, structured criteria, confidence routing, fan-out and composite scoring run on top of these same endpoints; they do not require additional gateway routes.
Python SDK 0.7.0 requires non-null Score level descriptions and exposes legend keys as integers; use strings or objects for Score levels in Python. REST and the JavaScript SDK also support null levels.
Limits, errors and billing
- Non-streaming, text/JSON only. Public body cap: 64 MiB; shared language admission budget.
- Jev 1.13 limits: 64k tokens across state and all questions, 32k for state plus the longest question. TypeSafe enforces its tokenizer limits; your plan's context limit also applies.
- Subscription quota charges
ceil(input_tokens × input long-context multiplier × effective model multiplier). Output tokens are recorded but free. The effective multiplier includes the key's global multiplier. - Reserve before inference, settle once after JSON delivery. Invalid responses, upstream errors and cancellation before delivery release the reservation. Reseller PAYG uses its price profile and ledger; Kimi request packs do not apply.
- Official Jev 1.13.0 cost is estimated at $0.042 per million input tokens, with free output. Configured rate cards take precedence. Unknown future versions need a rate card; an alias does not pin a price.
422: invalid request;401: invalid gateway key;403: access denied;400: plan context limit;413: body too large;429: quota/rate limit;529: TypeSafe overloaded; other5xx: upstream/service error. Errors use the gateway JSON error envelope. Upstream credentials and raw error bodies are not exposed.Retry-Afterandretry-after-mspass through on upstream429/529. Both SDKs support retries; avoid immediate retry loops. A request validation422does not trigger provider fallback.
Provider configuration
In Admin → Providers choose TypeSafe (System One), URL https://api.typesafe.ai, and store the TypeSafe API key in the encrypted key field. Add active mappings jev-latest → jev-latest and jev-preview → jev-preview (or your own public aliases), then configure model access and multipliers. Versioned Jev IDs are also supported when the upstream accepts them. Enable Retry-After to cool down shared keys on 429/529; BYOK credentials remain request-scoped. Empty databases are not automatically seeded. This transport runs directly in Go.
References: TypeSafe documentation, HTTP contract, models, JavaScript SDK, Python SDK.