Async Rust client and JSON-first CLI for the TypeSafe API.
Install from this checkout:
cargo install --path cli --locked
export TYPESAFE_API_KEY='your-api-key'
# Read a file or piped stdin
typesafe request.json
typesafe < request.jsonA request:
{"state":"Payouts are blocked","questions":{"urgent":{"type":"noul","instructions":"Is this urgent?"}}}- Question types:
noul(yes/no probability),choice,score. - Options:
--model NAME,--url URL,--pretty,--help. - Success: JSON on stdout, exit 0. Errors: JSON on stderr with
errorandkind; API errors also includestatusandbody. - Exit 2: usage, input, or configuration. Exit 1: request, response, or output failure.
- HTTP timeout: 60 seconds, no automatic retries.
Requires a Tokio runtime with I/O and timers enabled.
use typesafe_rs::{Client, Question};
let response = Client::from_env()?
.evaluate("Payouts are blocked", [("urgent", Question::noul("Urgent?"))])
.await?;See the runnable example. Use Client::with_http_client to configure timeouts, TLS, or proxies; the library has no default request timeout.
MIT.