BETA

TESI Agent API

Put TESI to work.

Commission a complete, tested software project or verifiable deliverable with Work—from a runnable service with replay tests to a clean-room download check or cleaned CSV with a validation report—or use Ask for a direct answer on your key’s own TESI computer.

Prepaid credits from $10 USD (zero monthly subscription). Pick a one-time pack for an isolated Linux VM + reusable tesi_ak_... bearer key at published token rates:

Explore example briefs before buying

Previewing a brief is free. The catalog lists the minimum balance to start each example as written. Paid Work can use more credit as it runs. You can download the draft and check its starting balance before submitting it.

Review public docs

Suggested effort: medium

Review the public onboarding page at https://toolsenabled.ai/agents/. Return a short Markdown table of any unclear steps, the link or section for each, and one suggested wording change per finding.

Acceptance checks
  • Cover discovery, funding and the first request.
  • Cite only what you can read publicly. Include exact source links and label anything you could not verify.
  • Use public reads only.

Sample finding · The reviewed Ask example omitted the request ID needed to recover a lost reply. Suggested fix: save the ID before sending. Download reviewed HTML (plain text)

Download a sample docs review (Markdown)
Clean up a CSV

Suggested effort: medium

Normalize this CSV and return the corrected CSV plus a short validation report. Keep one row per SKU and preserve the first occurrence. sku,title A-11, Cable B-03, Adapter A-11, Cable

Acceptance checks
  • Trim title whitespace and preserve both original SKUs.
  • Return two data rows in input order and report one duplicate removed.
  • Put the complete CSV in the reply.

Input CSV · Expected CSV · Python checker

Save your cleaned file as result.csv and compare it offline with python3 -I check-sku.py sku-expected.csv result.csv.

Scope a supplier CSV merge

Suggested effort: low

Draft a one-page merge specification for two synthetic supplier exports. North lists SKU A-11, price 12.00, updated 03/04/2026. South lists A-11, price 13.50, updated 2026-04-02, plus B-03 with a blank price. The buyer wants one row per SKU. Return a clarification question, a proposed conflict policy and an acceptance checklist a second agent can run after approval.

Acceptance checks
  • Ask which date convention North uses and which price source takes precedence. Keep the A-11 price unresolved until the buyer answers.
  • Specify how to flag the missing B-03 price, preserve source rows and report the input and distinct SKU counts for this sample.
  • Give one check that catches a delivery defect under the agreed rules and one example of a later request that changes those rules.
Download the sample merge specification (Markdown)
Build a webhook service

Suggested effort: medium

Build a small Python 3 webhook service with the standard library and SQLite. POST /events stores JSON with id, type and date (YYYY-MM-DD). GET /reports/YYYY-MM-DD returns counts by event type. Return a unified diff, tests and exact startup and test commands. Bind to localhost and use synthetic data.

Acceptance checks
  • Submit two signup events and one purchase for the same date.
  • An identical retry returns 200 with no extra row. Reusing the ID with changed content returns 409. An invalid date returns 400.
  • After restarting on the same database, the daily report still has signup=2 and purchase=1.
  • Include test results and any unmet check.
Download webhook acceptance cases (JSON)
Verify a public download link

Suggested effort: low

Fetch https://toolsenabled.ai/agents/examples/newsletter-proof.json from a clean computer without signing in. Report the final URL, HTTP status, Content-Type, exact byte count, and SHA-256 digest, then parse the JSON and verify schema equals tesi-newsletter-proof/v1.

Acceptance checks
  • Confirm HTTP 200 with Content-Type application/json and zero sign-in cookies or credentials.
  • Report the exact byte count and confirm SHA-256 equals e9f0ec1f19f1d166aff11bf27a1bdccc2e0f97bda5e590c1044cf702195a3366.
  • State clearly whether this exact link is safe to hand to a customer expecting JSON and why.
Read the target proof JSON
Reconcile orders against settlements

Suggested effort: medium

Save these two id,amount_cents CSV ledgers on your computer, run an exact reconciliation script, and return a JSON report. orders.csv: id,amount_cents A101,1200 A102,800 A103,500 settlements.csv: id,amount_cents A101,1200 A102,750 A104,200

Acceptance checks
  • Report ordersTotalCents=2500, settlementsTotalCents=2150, netDeltaCents=-350 and matchedCount=1.
  • Report missingIds=["A103"] and unexpectedIds=["A104"].
  • Report amountDifferences=[{"id":"A102","orderCents":800,"settlementCents":750,"deltaCents":-50}].

Sample fixture (JSON) · Offline reconciliation checker

Build a responsive quote calculator prototype

Suggested effort: high

Build a self-contained HTML, CSS and JavaScript print-shop invitation quote prototype (index.html plus local assets only, no external fonts or network requests). Quantity is a whole number 25 to 500 inclusive. Matte paper is $0.40 each, linen is $0.65 each, plus a $12.00 setup fee. Rush adds 25% of (items + setup) rounded half-up to the cent. Support saving a valid quote locally, reloading it, editing it and resetting the demo.

Acceptance checks
  • Expose accessible controls named Quantity, Paper, Rush, Save quote, Edit quote and Reset demo.
  • Reject out-of-range quantities without overwriting a previously saved valid quote.
  • Verify in a headless browser that both 390px mobile and 1280px desktop render with zero horizontal overflow.
  • Return complete runnable files with path labels and the browser check results.

Sample prototype (ZIP) · Offline prototype checker · Proof JSON

JSON catalog

Integration paths

Connect your agent in 60 seconds.

Pick the integration that matches your agent runtime. All three paths quote starting credit for free before spending, keep tesi_ak_... bearer keys private, and recover interrupted turns by requestId.

1. Official MCP server (Recommended)

Zero-dependency Python 3.10+ stdio server exposing 12 tools, 4 resources & 4 prompts (tesi_discover, tesi_quote, tesi_shortlist_work, opaque 0600 key claiming, tesi_ask, tesi_work with safe local sourceDir packing & extractFilesTo, tesi_usage, and receipt recovery).

curl -fsS https://toolsenabled.ai/agents/tesi-agent-mcp.py.txt -o tesi-agent-mcp.py
python3 -I tesi-agent-mcp.py --self-check
claude mcp add --transport stdio tesi -- python3 -I ./tesi-agent-mcp.py
# Or in Codex CLI: codex mcp add tesi -- python3 -I ./tesi-agent-mcp.py

2. Drop-in Agent Skill

Single compact Markdown skill (tesi-agent-api) teaching coding and autonomous agents when to delegate to TESI, how to quote before spending, and how to verify deliverables.

curl -fsS https://toolsenabled.ai/agents/SKILL.md -o SKILL.md
Read SKILL.md

3. 2-Command HTTP 402 & Python CLI

Mint a $10 USD key over plain HTTPS (HTTP 402 guide), or use stdlib tesi-buy.py, tesi-receipt.py, and OpenAPI 3.1.1.

# 1. Start $10 USD Checkout (returns HTTP 402 checkoutUrl & sessionId):
curl -sS -X POST https://toolsenabled.ai/api/v1/agents/keys \
  -H 'Content-Type: application/json' -d '{"amountCents":1000}'
# 2. After Stripe payment, POST {"sessionId":"cs_live_..."} to claim key
Compact quickstart

Strong fit for TESI

  • Scoped coding, data cleanup, or specification tasks with explicit, runnable acceptance checks.
  • Isolated execution on a dedicated computer (1 vCPU, 2 GB RAM, 4 GB disk) outside the caller’s host environment.
  • Pay-per-pack usage from $10 USD with zero monthly subscription and deterministic pre-spend credit quotes.

When not to use TESI

  • Sub-100ms token-streaming autocomplete or raw model pass-through.
  • Tasks requiring direct access to unexportable secrets or internal VPC databases.
  • Unattended card charging without a human purchaser approving Stripe Checkout.

How can my AI agent hand off a coding task and get back a tested project? Inspect a real runnable deliverable and 4-way engineering comparison →

Check the offer and fund a key.

Use the free checks below, then choose a credit pack when you’re ready. Open the terminal quickstart.

Check availability without a key

This GET reads the current offer without spending credits. Check available and amountsCents. Read buyerGuide for Checkout, sample verification and tasks with acceptance checks.

curl -fsS https://toolsenabled.ai/api/v1/agents

Verify before funding.

Check the public offer and OpenAPI document, or try the newsletter sample locally. These free reads use no API key or credits.

Read modes, effort choices and quote links in JSON.

Try the CSV cleanup example for free

Start with three product rows. Keep the first row for each SKU in its original order and trim spaces around each title. Compare your result with the two rows in the expected output.

Download input CSV · Download expected CSV

Check your result locally

Save your output as result.csv beside the downloaded sku-expected.csv. This offline check compares the header and each row in order. It accepts equivalent CSV quoting and line endings.

Download the Python checker and run python3 -I check-sku.py result.csv to check the header and both rows against the built-in sample. To verify your downloaded reference too, use the inline command below.

To check the delivered counts alongside the CSV, save the values from the delivery as report.json. This sample expects {"inputRows":3,"outputRows":2,"duplicatesRemoved":1}.

python3 -I check-sku.py result.csv --report report.json
python3 -I - sku-expected.csv result.csv <<'PY'
import csv
import sys
from itertools import zip_longest

sample = [("sku", "title"), ("A-11", "Cable"), ("B-03", "Adapter")]

def rows(stream):
    return map(tuple, csv.reader(stream, strict=True))

with open(sys.argv[1], encoding="utf-8-sig", newline="") as expected, open(
    sys.argv[2], encoding="utf-8-sig", newline=""
) as result:
    for number, (known, wanted, found) in enumerate(zip_longest(sample, rows(expected), rows(result)), 1):
        if wanted != known:
            sys.exit(f"Reference differs from the published sample at CSV record {number}")
        if wanted != found:
            sys.exit(f"Mismatch at CSV record {number} (header is record 1)")
print("CSV matches the reference")
PY
Check a delivery against your own CSV

Use the downloaded checker with your original sku,title file and the delivered CSV and report. It keeps the first row for each exact SKU, preserves their order and trims titles before comparing. SKU matching is case-sensitive.

Before commissioning Work, preview the expected counts from your local input. Use them as acceptance criteria for the delivery.

python3 -I check-sku.py --input input.csv --preview-counts

To use the expected counts in a brief, copy the command below and paste its output into the Work builder’s acceptance checks. Add the CSV you intend to share to the brief separately.

python3 -I check-sku.py --input input.csv --preview-checks

To prepare the whole brief locally, use a CSV you intend to share. This prints Work JSON containing the CSV and checks. Save it as a new work.json and open it in the Work builder to review before submitting.

python3 -I check-sku.py --input input.csv --draft-work
python3 -I check-sku.py --input input.csv result.csv --report report.json

Prepare this CSV Work request in your terminal

The sample uses the same request parser as paid Work. Read the sample and validation result.

Run the free checks in a terminal

Download the Python client. Verify its SHA-256 using the public offer, then run this command for a JSON report.

python3 -I tesi-receipt.py --verify-public
Check a saved request against the API

The Python client sends the full saved request to the validation endpoint. Use a non-sensitive draft. This checks format and starting credit with no key or paid Work.

python3 -I tesi-receipt.py --file work.json --server-check

Try a newsletter service with simulated billing and a local mailbox. Replaying the billing event should leave one accepted event. Resending the same issue after a restart should leave one message. Changing its content under the same issue ID should return HTTP 409.

Download the newsletter sample (ZIP) · Python service, demo and README

Inspect the newsletter replay report

This report comes from running the newsletter sample with simulated billing and a local mailbox.

Read the evidence JSON · Download the replay script

Place the script and ZIP in the same directory. Run python3 -I -B newsletter-replay.py newsletter.zip to reproduce the report.

Run and compare the sample locally

Run this in a Linux shell with curl, sha256sum, Python 3 and jq. It prints a new working directory, checks all three downloads and prints true when the replay matches the expected report.

(
  set -e
  cd "$(mktemp -d)"
  pwd
  base=https://toolsenabled.ai/agents/examples
  curl -fsS "$base/newsletter.zip" -o newsletter.zip
  curl -fsS "$base/newsletter-replay.py.txt" -o newsletter-replay.py
  curl -fsS "$base/newsletter-proof.json" -o expected.json
  sha256sum -c <<'HASHES'
561d8335e9924808711f6af4d69616aaeef0ba3bb9898906eb4534c1a7307d21  newsletter.zip
c0f71dcff6a681fad9507f029ae4aff9f2a84ad7ef4adfeb840a05180a47443a  newsletter-replay.py
e9f0ec1f19f1d166aff11bf27a1bdccc2e0f97bda5e590c1044cf702195a3366  expected.json
HASHES
  python3 -I -B newsletter-replay.py newsletter.zip > actual.json
  jq -e -s 'length == 2 and .[0] == .[1]' expected.json actual.json
)

Buy prepaid agent credits.

Buying for your first Ask? Prepare the question and check its starting credit first. Use a browser-issued key once you have one.

Pick a one-time USD pack for a new Agent API key. Complete the purchase on Stripe, then return in this browser to claim and save the key for your agent. If the link is interrupted, resume the same Checkout here. This browser can recover the purchase for up to 48 hours, until you confirm that you saved the key. For an existing key, add credits to that key.

What could these credits cover?

Price one uncached call with reference token counts at the current GPT-6.2 Sol rate. Actual usage depends on the models, tokens and calls used by your task. Work can use several calls. See the published token rates.

Download the Python buyer client · API funding quickstart

Review a pack from your terminal

Use the downloaded buyer client to check an exact amount against the current offer. Share its review link with the purchaser. This step uses no key and creates no Checkout.

python3 -I tesi-buy.py quote --amount-cents 1000

Have a saved Work brief? The receipt client checks whether the selected pack covers its starting credit. Share the resulting review link and the brief privately. Work can use more credit as it runs.

python3 -I tesi-receipt.py --file work.json --review-pack 2500

To find the lowest-priced pack that covers starting credit, use smallest.

python3 -I tesi-receipt.py --file work.json --review-pack smallest

Run a small paid Ask

Download tesi-receipt.py. The first command saves a sample ask.json with its own request ID, without using a key or credits.

Set up a verified Ask draft from scratch

On Linux with GNU coreutils, curl and Python 3, this block verifies the download and saves a draft in tesi-ask/. To use your own question, save it as UTF-8 and set export TESI_ASK_QUESTION_FILE=question.txt before running the block. The question stays local until you submit it. For a separate draft, set export TESI_ASK_DIR=tesi-ask-followup before running the block. Then enter the chosen directory.

To reuse a saved client, set export TESI_ASK_CLIENT_FILE=tesi-ask/tesi-receipt.py. Setup checks its copy against the current published checksum. Setup saves the verified digest in tesi-receipt.sha256. Keep that file with the client. For offline setup, point TESI_ASK_OFFLINE_FROM at the original verified directory before running the setup block.

export TESI_ASK_OFFLINE_FROM=tesi-ask
(
  set -e
  destination=${TESI_ASK_DIR-tesi-ask}
  case "$destination" in
    ''|.|..|*/*)
      echo 'TESI_ASK_DIR must be a new directory name in the current folder.' >&2
      exit 1
      ;;
  esac
  if [ -e "$destination" ] || [ -L "$destination" ]; then
    echo 'The draft directory already exists. Open it or choose a new TESI_ASK_DIR.' >&2
    exit 1
  fi
  question=${TESI_ASK_QUESTION_FILE-}
  if [ -n "$question" ]; then
    case "$question" in /*) ;; *) question="$PWD/$question" ;; esac
    if [ ! -f "$question" ] || [ ! -r "$question" ]; then
      echo 'TESI_ASK_QUESTION_FILE must name a readable text file.' >&2
      exit 1
    fi
  fi
  client=${TESI_ASK_CLIENT_FILE-}
  expected=${TESI_ASK_CLIENT_SHA256-}
  if [ "${TESI_ASK_OFFLINE_FROM+x}" = x ]; then
    if [ -z "$TESI_ASK_OFFLINE_FROM" ] || [ -n "$client" ] || [ -n "$expected" ]; then
      echo 'Set TESI_ASK_OFFLINE_FROM to a verified folder by itself.' >&2
      exit 1
    fi
    client="$TESI_ASK_OFFLINE_FROM/tesi-receipt.py"
    digest_file="$TESI_ASK_OFFLINE_FROM/tesi-receipt.sha256"
    if [ ! -f "$digest_file" ] || ! IFS= read -r expected < "$digest_file" || [ -z "$expected" ]; then
      echo 'The verified folder must contain its saved tesi-receipt.sha256.' >&2
      exit 1
    fi
  fi
  if [ -n "$client" ]; then
    case "$client" in /*) ;; *) client="$PWD/$client" ;; esac
    if [ ! -f "$client" ] || [ ! -r "$client" ]; then
      echo 'TESI_ASK_CLIENT_FILE must name a readable client file.' >&2
      exit 1
    fi
  fi
  if [ -n "$expected" ]; then
    case "$expected" in
      *[!0-9a-f]*) echo 'Use a trusted lowercase SHA-256 digest.' >&2; exit 1 ;;
    esac
    if [ "${#expected}" -ne 64 ] || [ -z "$client" ]; then
      echo 'TESI_ASK_CLIENT_SHA256 requires a trusted SHA-256 digest and TESI_ASK_CLIENT_FILE.' >&2
      exit 1
    fi
  fi
  stage=$(mktemp -d ./.tesi-ask.XXXXXXXX)
  trap 'rm -f -- "$stage/tesi-receipt.py" "$stage/ask.json" "$stage/tesi-receipt.sha256"; rmdir -- "$stage" 2>/dev/null || :' EXIT
  (
    cd "$stage"
    if [ -n "$client" ]; then
      cp -- "$client" tesi-receipt.py
    else
      curl -fsS https://toolsenabled.ai/agents/tesi-receipt.py.txt -o tesi-receipt.py
    fi
    if [ -z "$expected" ]; then
      expected=$(curl -fsS https://toolsenabled.ai/api/v1/agents/quickstart |
        python3 -I -c 'import json, sys; print(json.load(sys.stdin)["askDraft"]["sha256"])')
    fi
    if ! python3 -I -c '
import hashlib, pathlib, sys
actual = hashlib.sha256(pathlib.Path("tesi-receipt.py").read_bytes()).hexdigest()
sys.exit(0 if sys.argv[1] == actual else 1)
' "$expected"; then
      echo 'Receipt client checksum mismatch. Use the trusted matching copy or clear the saved-client and checksum settings to download again.' >&2
      exit 1
    fi
    printf '%s\n' "$expected" > tesi-receipt.sha256
    if [ -n "$question" ]; then
      python3 -I tesi-receipt.py --file ask.json --prepare-ask --message-stdin < "$question"
    else
      python3 -I tesi-receipt.py --file ask.json --prepare-ask
    fi
  )
  mv -nT -- "$stage" "$destination"
  if [ -d "$stage" ]; then
    echo 'The draft directory already exists. Open it or choose a new TESI_ASK_DIR.' >&2
    exit 1
  fi
  trap - EXIT
)
Return to browser-key steps
python3 -I tesi-receipt.py --file ask.json --prepare-ask
Preview an Ask about an incomplete import

Example question

Write a two-line handoff for the next shift. We imported 48 of 51 records. Three lacked supplier IDs. The report needs all 51. What can we publish now, and what should we check next?

Illustrative reply
Hold the report until all 51 records are present.
Fill in the three missing supplier IDs, retry those records, and confirm the import count reaches 51.

Prepare an Ask from a text file

Save your question as UTF-8 in question.txt (up to 500,000 bytes). Use this command if you haven’t created ask.json yet. It prepares the draft locally.

python3 -I tesi-receipt.py --file ask.json --prepare-ask --message-stdin < question.txt

To use your own question, edit the message in ask.json before sending it. Check the starting balance for that exact draft for free. The lookup sends only the question’s byte count. Read minimumAvailableCredits for the TESI credits needed to start. Final usage can be higher.

python3 -I tesi-receipt.py --file ask.json --check-credit
Review a credit pack for this Ask

Find the smallest advertised pack that covers the starting balance for ask.json. Open the returned reviewUrl to review the pack before Checkout. This check is free and needs no key. Actual usage depends on the request.

python3 -I tesi-receipt.py --file ask.json --review-pack smallest
Does my saved key have enough credit?

If you ran cd tesi-ask after setup and bought credits from its parent directory, set the key path once in this shell. Use the same path for the balance check, top-up, submission and receipt lookup.

TESI_KEY_FILE=../tesi-purchase/key.json

Set TESI_KEY_FILE to your actual key file if it lives elsewhere. The commands default to ./tesi-purchase/key.json.

Run this free check with the key file saved by the buyer client. availableCredits is the spendable balance. When meetsStartingCredit is true, the balance covers the starting requirement at the time of the check. If the balance lookup fails, check again before submitting.

python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" --file ask.json --check-credit

If meetsStartingCredit is false, check the original receipt and plan a top-up for this key. This read-only command shows whether an earlier payment is pending or which pack covers the shortfall.

python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" --file ask.json --plan-topup
Use a key from your browser

Need the client and ask.json? Prepare a verified draft for free.

Load the saved key from your secret store as TESI_API_KEY. Use that key for each step.

Compare this draft’s starting credit with your spendable balance in one read.

python3 -I tesi-receipt.py --file ask.json --check-credit --compare-key-balance

If the balance falls short, get a same-key top-up recommendation. Share approvalSummary with the purchaser before preparing Checkout.

python3 -I tesi-receipt.py --file ask.json --plan-topup
Open Checkout after approval

Set APPROVED_TOPUP_CENTS to the exact recommendedAmountCents the purchaser approved. Keep the original TESI_API_KEY loaded. Share the returned Stripe link privately with the purchaser.

(
  set +x
  set -e
  amount="${APPROVED_TOPUP_CENTS:?Set the purchaser-approved amount in cents}"
  key="${TESI_API_KEY:?Load the original key from your secret store}"
  printf '%s\n' "$key" | jq -eRs 'test("\\Atesi_ak_[A-Za-z0-9_-]{20,80}\\n\\z")' >/dev/null
  body=$(jq -ecn --arg amount "$amount" '
    $amount | select(test("\\A[1-9][0-9]{2,6}\\z")) | tonumber |
    select(. <= 1000000) | {amountCents: .}
  ')
  response=$(printf 'Authorization: Bearer %s\n' "$key" |
    curl --disable --fail-with-body --silent --show-error --max-time 20 \
      --header @- --header 'Content-Type: application/json' --data-binary "$body" \
      'https://toolsenabled.ai/api/v1/agents/topup')
  printf '%s\n' "$response" | jq -er --argjson approved "$amount" '
    select(.status == "open" and .amountCents == $approved and .currency == "usd") |
    .checkoutUrl | strings | select(test("\\Ahttps://checkout\\.stripe\\.com/[^[:space:]]+\\z"))
  '
)

If the link is missing, look up that same amount with the original key.

python3 -I tesi-receipt.py --recover-topup "$APPROVED_TOPUP_CENTS"

After payment, refresh the original key and check this draft. Submit when meetsStartingCredit is true.

python3 -I tesi-receipt.py --file ask.json --check-credit --compare-key-balance --refresh

When ready, submit once using prepaid credit.

python3 -I tesi-receipt.py --file ask.json --submit --no-checkout --wait 120

Recover with the same key and unchanged brief.

python3 -I tesi-receipt.py --file ask.json --wait 120

If the client reports restore_original_key, reload the original key from the source named in keySource. Keep the same draft and request ID. Once access is restored, recover the reply or check the balance again. If the original key still fails, contact support with the request ID and HTTP status. Keep the bearer key private.

The default arithmetic question asks for 42. This command can spend prepaid credits. It uses the buyer client’s saved key file. To use a browser-issued key, load it from your secret store as TESI_API_KEY and omit --key-file and its path. Get a funded key.

python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" --file ask.json --submit --no-checkout --wait 120

If the reply is missing, keep the original ask.json. This command checks for the original receipt for up to 120 seconds, even if it hasn’t appeared yet. If the receipt is still missing, the charge is unknown. Run this lookup again later with the same file and key.

python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" --file ask.json --wait 120
Save and verify the Ask reply

Save the original Ask, verified reply and receipt in one new ZIP. Share it through a trusted channel.

python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" --file ask.json --wait 120 --reply-bundle ask-reply.zip

Verify the ZIP offline before using the reply.

python3 -I tesi-receipt.py --verify-reply-bundle ask-reply.zip

Use the original draft and key to retrieve the reply. This lookup saves the reply to ask-reply.md and the export metadata to ask-receipt.json. Both filenames must be available.

(
  set -C
  if [ -e ask-receipt.json ] || [ -L ask-receipt.json ]; then
    printf '%s\n' 'ask-receipt.json already exists.' >&2
    exit 1
  fi
  receipt=$(python3 -I tesi-receipt.py --key-file "${TESI_KEY_FILE:-./tesi-purchase/key.json}" \
    --file ask.json --reply-file ask-reply.md --wait 120) || {
    printf '%s\n' "$receipt" >&2
    exit 1
  }
  printf '%s\n' "$receipt" > ask-receipt.json
)

Keep the original draft, reply and metadata together. Run this offline to compare them without a key.

python3 -I tesi-receipt.py --file ask.json --reply-file ask-reply.md --verify-reply ask-receipt.json
Send the saved Ask with curl

Load TESI_API_KEY from your secret store. With curl and jq, this block confirms manual top-up support before submitting once. It can spend prepaid credits. An insufficient balance returns HTTP 402 with no Checkout. Keep the original file for recovery.

(
  set -e
  offer=$(curl --disable -fsS 'https://toolsenabled.ai/api/v1/agents')
  printf '%s\n' "$offer" | jq -e '
    .available == true and
    .buyerGuide.request.manualTopupHeader == {name:"TESI-Topup-Mode",value:"manual"}
  ' >/dev/null
  key="${TESI_API_KEY:?Set TESI_API_KEY in your secret environment}"
  printf 'Authorization: Bearer %s\n' "$key" |
    curl --disable --fail-with-body -sS 'https://toolsenabled.ai/api/v1/agents/chat' \
      --header @- --header 'Content-Type: application/json' \
      --header 'TESI-Topup-Mode: manual' --data-binary @ask.json
)

If the response is missing, look up the receipt by the request ID in your original ask.json. Run the same GET again if it is processing. A missing receipt leaves the outcome unknown.

(
  set -e
  id=$(jq -ers 'select(length == 1) | .[0] | .requestId |
    strings | select(test("\\Amw_[a-f0-9]{32}\\z"))' ask.json)
  key="${TESI_API_KEY:?Set TESI_API_KEY in your secret environment}"
  printf '%s\n' "$key" | jq -eRs 'test("\\Atesi_ak_[A-Za-z0-9_-]{20,80}\\n\\z")' >/dev/null
  printf 'Authorization: Bearer %s\n' "$key" |
    curl --disable --fail-with-body -sS --header @- \
      "https://toolsenabled.ai/api/v1/agents/turns/$id"
)
Fund and claim a key through the API

Check available packs

Read GET /api/v1/agents and pick an offered amountsCents value. Price usage at the published token rates.

Prepare Checkout

Create and save a private purchaseId of 64 lowercase hexadecimal characters. Send it with amountCents in a JSON body to POST /api/v1/agents/keys. Expect HTTP 402 with checkoutUrl and sessionId. If the response is lost, repeat the same payload to recover the purchase.

Complete payment and save the key

After the purchaser pays at checkoutUrl, POST the original sessionId and purchaseId to the same endpoint. Save the bearer key from the 201 response. The same claim can recover the original key for up to 48 hours after issuance or until you confirm it is saved. See the quickstart for confirmation and recovery. Keep keys and purchase IDs out of URLs.

Redeem an issued code

Send {"giftCode":"YOUR_CODE","preview":true} to POST /api/v1/agents/keys to check creditCents and redeemable. When ready, send {"giftCode":"YOUR_CODE"} once and save the key from the 201 response. Keep codes out of URLs.

What runs on your key

Send Ask to POST /api/v1/agents/chat and Work to POST /api/v1/agents/work with your bearer key. Both run on your key’s isolated TESI computer with 1 vCPU, 2 GB RAM and 4 GB disk. Requests use prepaid credit at the published token rates. The response includes your reply and balance.

First project: an event-to-report webhook service. Ask for a deployable Python service with SQLite storage, a command-line client and deployment instructions. Test that replaying the same event counts it once, a conflicting ID is rejected, and the daily report survives a restart. Use the Work request builder to write your own brief, or see the complete webhook example.

Add credit to your existing key.

Keep the same tesi_ak_... bearer key and workspace across projects—including keys minted from promotional codes. Check your spendable balance or open a same-key Stripe Top-Up below, or call GET /api/v1/agents/balance and POST /api/v1/agents/topup from your agent.

After payment, click Confirm payment & refresh balance above or send {"sessionId":"…"} to POST /api/v1/agents/topup with the same bearer key. A 200 response with status: "paid" includes the updated balance. If you get 402 payment_required, check the same session again once payment settles.

printf 'Authorization: Bearer %s\n' "${TESI_API_KEY:?Set TESI_API_KEY in your secret environment}" |
  curl -fsS 'https://toolsenabled.ai/api/v1/agents/balance' --header @-

If a turn times out or the connection drops, use the same key to read GET /api/v1/agents/turns/{requestId}. The receipt can recover a verified reply after a lost response. If it says processing or outcome_unknown, check the same receipt again. If it stays unknown or is missing, contact support with the request ID and approximate time. Keep the bearer key private.

Build a Work request.

Find Work starters that fit your saved balance

The receipt client checks your spendable balance and returns starters that fit individually. If any fall outside your balance, the result shows the closest one and the credit gap. You can preview every brief for free. Final usage can be higher. Use the path to your existing key file. Review the suggested effort, acceptance checks and available reference downloads in each row. Use prepareArgs to save a draft.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --shortlist-work

To compare starters before funding, enter a planned starting balance in TESI credits. This example uses 0.001 credits and reads the public catalog.

python3 -I tesi-receipt.py --shortlist-work --budget-credits 0.001

Describe what you want back and how you’ll check it. The builder prepares JSON in this page. When ready, submit it to POST /api/v1/agents/work with your bearer key.

Save a Work starter from your terminal

Use the Python receipt client to load a starter from the public offer and save work.json with a new request ID. This uses no key or credits. Choose csv, docs, merge-scope, webhook, delivery-check, reconcile, or ui-prototype.

python3 -I tesi-receipt.py --file work.json --prepare-work csv

Have an existing local project folder? Pack its UTF-8 source files offline (refusing secrets, binaries and symlinks) into a ready-to-quote work.json, then extract delivered files from a saved reply:

python3 -I tesi-receipt.py --file work.json --pack-project ./src --prompt "Add daily CSV export and unit tests"
python3 -I tesi-receipt.py --extract-files ./delivered --reply-file reply.md

Review the file, then use the funded Work command when ready.

Run Work with a funded key

Put your saved request and the Python client in the same folder as tesi-purchase. Use its exact filename in place of work.json. If your key is in TESI_API_KEY, omit --key-file and its path.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --submit --no-checkout --wait 120

This command can spend credits. Use reply to check the result against your brief. Keep the original work.json to recover its reply.

If credits run low, the client reports the balance. This command keeps Checkout separate. Check this request and plan a top-up with the same key.

Run the same request you checked

Save the server check for a non-sensitive draft. This sends the saved JSON to the format checker.

python3 -I tesi-receipt.py --file work.json --server-check > request-check.json

Use the saved check to submit the same request ID and normalized content. This command can spend prepaid credits.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --submit --require-check request-check.json --no-checkout --wait 120
Prepare another Work request

To switch tasks, start a public-docs review beside your saved brief. Preparation is free. Keep the original file for its receipt.

python3 -I tesi-receipt.py --file docs-review.json --prepare-work docs

Copy a saved brief to a new file with its own request ID. Review and edit the copy before submitting it. Keep the original file to recover its reply.

python3 -I tesi-receipt.py --file work-next.json --copy-brief work.json
Check a brief before funding

This command checks the saved request locally. It needs Python and work.json. The result includes the request ID, byte counts and fingerprint.

python3 -I tesi-receipt.py --file work.json --validate

Look up the current starting credit using the saved brief's byte count. Add --key-file ./tesi-purchase/key.json to compare your spendable balance. Work can use more credit as it runs.

python3 -I tesi-receipt.py --file work.json --check-credit

Check up to 20 saved drafts in one read. The command sends only prompt byte counts. Add --key-file ./tesi-purchase/key.json to see which drafts your current balance could start individually.

python3 -I tesi-receipt.py --batch-credit work.json work-next.json
Use curl instead

Load TESI_API_KEY from your secret store before running the command. Use the returned receiptUrl or open the original request file to check a receipt.

printf 'Authorization: Bearer %s\n' "${TESI_API_KEY:?Set TESI_API_KEY in your secret environment}" |
  curl --fail-with-body -sS 'https://toolsenabled.ai/api/v1/agents/work' \
    --header @- --header 'Content-Type: application/json' \
    --data-binary @work.json

Recover a saved reply

Use the original Work or Ask file and the same bearer key. The client checks that the brief matches the receipt before returning it. --wait keeps checking the same receipt through a dropped connection. If the lookup returns recover_original_receipt, repeat the command below later. Honor retryAfterSeconds when present.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --wait 120
Find a request ID or share a reply

Lost a Work request ID? List the five most recent Work receipts for your key. Add --delivery unresolved to show only requests waiting for a saved reply. Use --id with the request ID to read its receipt.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --receipts --mode work --limit 5

Check when TESI recorded the request and saved the reply. The terminal prints UTC timestamps and status without printing the reply.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --metadata-only

Save the original brief, verified reply and receipt together as a new ZIP. Share it through a trusted channel because it contains the full brief and reply.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --wait 120 --reply-bundle work-reply.zip

Check the ZIP offline before using the reply. This compares the included files with the receipt checksums. To check which request it belongs to, add --expect-request-fingerprint with the fingerprint you saved from the original request.

python3 -I tesi-receipt.py --verify-reply-bundle work-reply.zip

Save the exact reply as a UTF-8 file for another tool. The client checks the saved brief and reply checksum before creating the file. Choose a new filename.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --wait 120 --reply-file reply.md

Passing a reply to another agent? Save the export command’s JSON output as reply-receipt.json. Share it with the brief and reply through a trusted channel. The recipient can check all three files offline without a key.

python3 -I tesi-receipt.py --file work.json --reply-file reply.md --verify-reply reply-receipt.json

Find an existing top-up link

Use the same bearer key and replace 1000 with the original amount in cents. This lookup retrieves the link when exactly one matching Checkout is still open.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --recover-topup 1000
Check credits or confirm payment

Check what you can spend and list settled debits with --credits.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --credits

See this key’s settled spending over the last 24 hours. The report includes the exact total, debit count and time window.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --credits --window-hours 24

After payment or a lost top-up response, refresh credits to check the original Checkout. The refresh opens no new Checkout.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --credits --refresh

Plan credit for this request

Check this key and the saved brief before buying more credits. The plan finds an existing receipt or shows spendable credit, credit held for work, and any unfinished top-ups. When more credit is needed, it can identify a pack for the shortfall.

python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file work.json --plan-topup

Questions

Good to know.

How do external software agents pay before using TESI?

Send POST /api/v1/agents/keys with an amountCents value from GET /api/v1/agents. TESI answers HTTP 402 Payment Required with a Stripe Checkout checkoutUrl and sessionId. Complete payment on Stripe, then POST the sessionId to /api/v1/agents/keys. If you prepared Checkout with a purchaseId, add it to the claim so you can recover the same key after an interrupted response. If you already have a promotional code, preview and redeem it at the same endpoint without a card.

Does the Agent API run real TESI Ask and Work?

Yes. Each funded bearer key owns an isolated TESI agent computer and workspace. POST /api/v1/agents/chat (mode ask) and POST /api/v1/agents/work (mode work, with effort control) execute real TESI turns on that computer, metered against your prepaid balance.

What happens when prepaid credits run out or a charge is refunded?

On HTTP 402, reuse the returned top-up for the same key. If its status is paid or pending, reconcile the existing session before offering another purchase. Refunds reduce credit. A fully refunded key is revoked.

How is prepaid usage metered?

See Published TESI Rates in /llms-full.txt for per-token prices. Use balance.usedPico for cumulative settled debits. The usage fields summarize reservations observed on the key, including overlapping requests. Individual request cost is currently unavailable.

More about TESI