Drex guides
Locate and Box
Find matching text spans or regions in a page image with the dedicated Locate and Box endpoints.
Locate finds answer spans in text. Box finds answer regions in one page image. Each request carries one instruction, and the endpoint selects its model.
| Operation | Input | Answer |
|---|---|---|
POST /v1/locate | state string and instructions | answers.q.spans with start, exclusive end, text, and score. |
POST /v1/box | Inline raster image and instructions | answers.q.boxes with bbox and score. |
These are dedicated operations, separate from systemone. They do not accept a model or questions field. The workspace CLI's locate tool searches workspace files and is a different operation.
Authentication and availability
The API root is https://console.nace.ai. Requests use your account's Bearer API key. An OAuth access token needs the inference scope.
Availability depends on the deployment's model configuration. An unavailable operation returns 503 before dispatch. Accounts configured for Zero retention cannot use these public endpoints. They receive 403 with code zero_retention_unavailable before their input is read or sent to the model. A model's presence in the console does not publish a new SDK package.
Locate text
curl https://console.nace.ai/v1/locate \
-H "Authorization: Bearer $NACE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"state":"Amount due: $42.","instructions":"Find the amount due."}'The answer includes spans and their scores. A successful response also includes model, measured usage, evaluation_time_ms, and the public request_id. The same request ID is in the x-request-id header.
This response excerpt omits model:
{
"answers": {
"q": {
"type": "locate",
"spans": [{ "start": 12, "end": 15, "text": "$42", "score": 0.94 }]
}
},
"usage": { "input_tokens": 48, "output_tokens": 0 },
"evaluation_time_ms": 86.5,
"request_id": "req_0123456789abcdef0123456789abcdef"
}Box a page image
Box accepts a PNG, JPEG, or WebP data URL in image. It does not accept an image URL, an uploaded-file reference, or a PDF. Convert a PDF page to a raster image before sending it.
This example reads a local PNG and uses Python's standard library to make the JSON body:
python3 - <<'PY' > /tmp/box-request.json
import base64
import json
from pathlib import Path
image = base64.b64encode(Path("page.png").read_bytes()).decode("ascii")
print(json.dumps({
"image": "data:image/png;base64," + image,
"instructions": "Find the amount due.",
}))
PY
curl https://console.nace.ai/v1/box \
-H "Authorization: Bearer $NACE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @/tmp/box-request.jsonEach bbox is [x0, y0, x1, y1], normalized to 0..1000. Multiply each x coordinate by the image width divided by 1000, and each y coordinate by the height divided by 1000, to get image pixels. A score is between 0 and 1.
{
"type": "box",
"boxes": [{ "bbox": [100, 200, 300, 400], "score": 0.91 }]
}This is the value of answers.q; the full response has the same metadata fields as Locate. Either operation can return an empty match list.
Pricing and limits
Both operations use the current Drex Max list rate of $0.03 per million input tokens. Only measured encoded input tokens are billed. Output-token counts are telemetry, not an extra charge.
The account reserves enough credit for the model's maximum encoded-input budget before dispatch. Successful validated output settles measured usage and releases unused credit. Failed or cancelled work is free. An account that cannot fund the hold receives 402, even if a smaller request might have cost less.
| Model | API id | Encoded token ceiling | Per account / 60 s | Global / 60 s |
|---|---|---|---|---|
| Locate | drex-max-locate | 32,768 | 12 | 60 |
| Box | drex-max-box | 32,768 | 12 | 60 |
These strict per-model ceilings are shared across API and console calls. The global ceiling covers all accounts. Ordinary account API admission also applies. If the shared limiter cannot confirm admission, the request returns 503 without dispatch.
The Locate API reference and Box API reference give request field limits. The encoded-input ceiling includes the image and request formatting, not just visible text.
| Status | Meaning |
|---|---|
401 | Missing, invalid, or revoked credential. |
402 | The account cannot fund the execution hold. |
403 | The OAuth token lacks the required scope, or the account uses Zero retention. |
413 | The hosting platform rejected the body before the handler. Its response may lack a Drex request ID. |
400 | Malformed JSON, unsupported content encoding, or a body over the application parser limit. |
422 | Unsupported input, an unexpected field, or a field over its limit. |
429 | An account or shared model ceiling was exceeded. Respect Retry-After when supplied. |
500 | The public request handler failed. |
502 | The model failed, timed out, or returned invalid output. |
503 | The operation is unavailable, the API is paused, or admission or funding could not be confirmed. |
Drex errors use the standard error envelope and public request_id. Quote that ID in support requests.
SDK support
The repository's Python sync and async clients and TypeScript client include locate and box methods. This is forthcoming package support until the SDKs are separately published. Existing installed releases may not contain these methods; direct HTTP calls above do not require an SDK update.
See the source contracts for Python and TypeScript. The model operations do not add CLI commands or MCP tools.