Extraction endpoints¶
POST /v1/typed¶
Fill a schema from text (context), a conversation (messages) or an image
(image, base64).
Request body¶
| Parameter | Type | Default | Description |
|---|---|---|---|
schema |
object | required | Field name → field spec. |
context |
string | "" |
The document or text to read. Required unless messages or image is given. |
messages |
array | null |
A conversation in OpenAI format: [{"role": "user", "content": "..."}], roles user, assistant, system. See Conversations. Not combinable with image. |
image |
string | null |
Base64 image, with or without a data: prefix. See Images. |
system |
string | null |
Instructions shared by all fields. Cannot be combined with a system message in messages. |
max_new_tokens |
integer | 32 |
Answer budget per field, 1–512. Raise it for long text fields (150–300 for replies and summaries). |
review_threshold |
number | 0.5 |
Fields with confidence below this are listed in needs_review (0–1). |
secrets |
object | null |
Strings for {{secret.name}} placeholders in tool calls. Never logged or returned. |
model |
string | null |
Model to use instead of the deployment's default. Loading another model takes time and memory; leave empty unless told otherwise. |
thinking |
boolean | false |
Let the model reason freely before each answer. Only for Thinking models; others return HTTP 400. |
thinking_budget |
integer | 128 |
Maximum reasoning tokens per field when thinking is on (1–4096). |
dtype |
string | "bfloat16" |
Numeric precision for some model types; ignored otherwise. |
Example¶
curl https://api.trusttyped.com/v1/typed \
-H "Content-Type: application/json" \
-d '{
"system": "Copy values exactly. Never guess.",
"context": "Invoice INV-0932. PT Sinar Jaya. Total due 3.885.000. Status: UNPAID.",
"schema": {
"invoice_no": {"type": "string", "extract": true},
"vendor": {"type": "string", "extract": true},
"total": {"type": "number", "integer": true, "max_digits": 10},
"paid": {"type": "bool"}
},
"review_threshold": 0.7
}'
Response¶
A response object, with "mode": "text" or
"mode": "image".
Streaming¶
POST /v1/typed/stream takes the same body and returns NDJSON
(application/x-ndjson): progress events, then one final event with
"done": true. See Streaming for the event format
and client code.
Text-only endpoints¶
POST /v1/generate and POST /v1/generate/stream accept the same body
without image, and their responses do not contain mode. Prefer
/v1/typed for new integrations.