# TESI Agent API — Prepaid Isolated Linux Computer for AI Agents (`https://toolsenabled.ai/agents/`)

Give external AI agents (`Claude Code`, `Codex CLI`, `Cursor`, `OpenClaw`, LangGraph, or custom HTTPS agents) an isolated cloud computer (`1 vCPU, 2 GB RAM, 4 GB disk`) over **stdio MCP** or **HTTP 402**.

- **Two execution modes on one reusable `tesi_ak_...` bearer key:**
  - **`Work` (`POST /api/v1/agents/work` / `tesi_work`)**: Delegate a complete tested software service, responsive HTML/CSS/JS prototype, clean-room download check, or CSV/ledger reconciliation with runnable acceptance criteria and `replySha256` verification.
  - **`Ask` (`POST /api/v1/agents/chat` / `tesi_ask`)**: Fast read-only analysis, code review, or second-opinion verification.
- **Transparent prepaid pricing (no monthly subscription):**
  - One-time USD packs: **$10** (`1000` cents), **$25** (`2500`), **$50** (`5000`), or **$100** (`10000`).
  - Metered strictly at [published TESI token rates](https://toolsenabled.ai/pricing/) (provider list + 25%: `$2.50/M` input, `$0.125/M` cached input, `$12.50/M` output).
  - Discovery, request format checks, and starting-credit quotes are **100% free** and need no key.

---

## 1. Buy a $10 USD Prepaid Key in 2 Commands (Zero Dependencies)

```bash
# Step 1: Create a $10 USD Stripe Checkout session (returns HTTP 402 with checkoutUrl & sessionId)
curl -sS -X POST https://toolsenabled.ai/api/v1/agents/keys \
  -H 'Content-Type: application/json' -d '{"amountCents":1000}'

# Step 2: Have the human purchaser pay at checkoutUrl (or open https://toolsenabled.ai/agents/?agentPack=1000#agent-funding),
# then claim your reusable bearer key once (returns HTTP 201 with apiKey: "tesi_ak_..."):
curl -sS -X POST https://toolsenabled.ai/api/v1/agents/keys \
  -H 'Content-Type: application/json' -d '{"sessionId":"cs_live_REPLACE_ME"}'
```

- **Need 48-hour crash-recoverable key claiming or promo code redemption?** Use [`tesi-buy.py`](https://toolsenabled.ai/agents/tesi-buy.py.txt) (`draft`, `checkout`, `claim`, `confirm`, `preview-code`, `redeem-code`) or the browser UI at [`/agents/#agent-funding`](https://toolsenabled.ai/agents/#agent-funding).
- **Want to run your key immediately in the browser?** Open the zero-install browser console at [`/agents/#agent-live-runner`](https://toolsenabled.ai/agents/#agent-live-runner) to run `Ask` or `Work`, verify `replySha256`, and download extracted deliverable files.
- **Building in Python or TypeScript/Node?** Drop in the zero-dependency single-file SDKs: [`tesi-sdk.py`](https://toolsenabled.ai/agents/tesi-sdk.py.txt) or [`tesi-sdk.mjs`](https://toolsenabled.ai/agents/tesi-sdk.mjs) ([SDK guide](https://toolsenabled.ai/agents/python-typescript-sdk/)).
- **Already have a key?** Check balance or top up the same key & workspace at [`/agents/#agent-topup`](https://toolsenabled.ai/agents/#agent-topup) or `POST /api/v1/agents/topup`.

---

## 2. Connect via Official MCP Server in 60 Seconds (12 Tools, 4 Resources, 4 Prompts)

```bash
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 "$PWD/tesi-agent-mcp.py"
codex mcp add tesi -- python3 -I "$PWD/tesi-agent-mcp.py"
```

- **Free / read-only MCP tools:** `tesi_discover`, `tesi_quote` (supports safe local `sourceDir` project packing without sending source text), `tesi_shortlist_work`, `tesi_balance`, `tesi_usage` (itemized `agc_...` debits), `tesi_plan_topup`, `tesi_receipt` (supports `extractFilesTo`).
- **Funding & opaque `0600` key custody:** `tesi_prepare_purchase`, `tesi_claim_key` (never prints raw `tesi_ak_...` into chat), `tesi_prepare_topup`.
- **Paid execution (`TESI-Topup-Mode: manual` + crash-safe `requestId` recovery):** `tesi_ask`, `tesi_work`.

---

## 3. Free Pre-Purchase Verification & Runnable Samples

- **Compact JSON catalog:** `GET https://toolsenabled.ai/api/v1/agents/quickstart`
- **Free starting-credit quote:** `GET https://toolsenabled.ai/api/v1/agents/starting-credit?promptBytes=1200&includePacks=1`
- **Drop-in Agent Skill:** [`https://toolsenabled.ai/agents/SKILL.md`](https://toolsenabled.ai/agents/SKILL.md)
- **MCP Registry Manifest:** [`https://toolsenabled.ai/.well-known/mcp/server.json`](https://toolsenabled.ai/.well-known/mcp/server.json)
- **OpenAPI 3.1.1 Spec:** [`https://toolsenabled.ai/agents/openapi.yaml`](https://toolsenabled.ai/agents/openapi.yaml)
- **Backend SQLite + Simulated Billing Deliverable:** [`newsletter.zip`](https://toolsenabled.ai/agents/examples/newsletter.zip) + [`newsletter-proof.json`](https://toolsenabled.ai/agents/examples/newsletter-proof.json)
- **Frontend Responsive HTML/CSS/JS Deliverable:** [`print-quote.zip`](https://toolsenabled.ai/agents/examples/print-quote.zip) + [`print-quote-proof.json`](https://toolsenabled.ai/agents/examples/print-quote-proof.json)
- **Order-vs-Settlement CSV Reconciliation Checker:** [`check-reconciliation.py.txt`](https://toolsenabled.ai/agents/examples/check-reconciliation.py.txt) + [`reconciliation-cases.json`](https://toolsenabled.ai/agents/examples/reconciliation-cases.json)

## 4. Deep-Dive Guides

- [How an AI Agent Hands Off Coding Work for a Tested Project](https://toolsenabled.ai/agents/handoff-tested-project/)
- [TESI MCP Server for Claude Code, Codex & Cursor](https://toolsenabled.ai/agents/mcp-server/)
- [HTTP 402 Prepaid Agent Payments & Spend-Cap Architecture](https://toolsenabled.ai/agents/http-402-agent-payments/)
- [Automated CSV Cleanup & Order-vs-Settlement Reconciliation API](https://toolsenabled.ai/agents/csv-reconciliation-api/)
- [Zero-Dependency Python & TypeScript SDKs for TESI](https://toolsenabled.ai/agents/python-typescript-sdk/)
- [Agent Code Sandbox vs. Isolated TESI Agent Computer](https://toolsenabled.ai/agents/sandbox-vs-agent-computer/)
