Developers

Run AI workflows from your own code.

Send a prompt over REST and Prompt Tornado plans it into steps, routes each step to a model, enforces your spend cap and records the run. Get the result by polling or a signed webhook, run it on a schedule, or call your saved workflows from any MCP client.

Quickstart

Three calls: create a key, start a run, read the result.

1. Create an API key Pro

In the app, open Settings → API Keys and create a key. It starts with pt_live_ and is shown once. Send it as a bearer token.

2. Start a run

The prompt can be compound; you do not split it into steps yourself. The call returns at once with a run ID, and the run continues in the background.

curl -X POST https://prompt-tornado-backend.onrender.com/api/v1/runs \
  -H "Authorization: Bearer $PT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Research our top three competitors and write a one-page comparison"}'

{"run_id": "…", "status": "…", "workflow_id": "…"}

3. Read the result

Poll until the status is terminal, or register a webhook (below) and skip polling. Runs are owner-scoped: someone else's run ID returns 404.

curl https://prompt-tornado-backend.onrender.com/api/v1/runs/$RUN_ID \
  -H "Authorization: Bearer $PT_API_KEY"

{
  "run_id": "…", "workflow_id": "…", "status": "completed", "source": "api",
  "created_at": "…", "completed_at": "…",
  "error": null,
  "steps_completed": 4, "total_steps": 4,
  "usage": { "total_tokens": 0, "total_cost_usd": 0.0 },
  "latency_seconds": 0.0,
  "output": { "text": "…", "image_url": null, "video_url": null, "audio_url": null }
}

Audio comes back as a short-lived signed URL. Rate limits: 30 run creations and 120 reads per minute.

Webhooks: get told when a run finishes

Register an HTTPS endpoint in the app and choose run.completed, run.failed or both. The signing secret is shown once. Each delivery is a JSON POST with the same run shape as the API, plus an X-PT-Event header, and recent deliveries are listed in the app so you can see what was sent.

{
  "event": "run.completed",
  "occurred_at": "…",
  "data": { "run_id": "…", "status": "completed", "usage": { … }, "output": { … } }
}

Verify the X-PT-Signature header before trusting a delivery:

import hmac, hashlib, time

def verify(secret: str, header: str, raw_body: bytes, tolerance=300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    ts, sig = int(parts["t"]), parts["v1"]
    if abs(time.time() - ts) > tolerance:      # reject replays
        return False
    expected = hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, sig)

MCP: your saved workflows as tools Pro

Any MCP client that speaks JSON-RPC over HTTP can list your saved workflows as tools and call them with inputs. The endpoint is POST https://prompt-tornado-backend.onrender.com/mcp, authenticated with the same Authorization: Bearer pt_live_… key, protocol version 2025-06-18. Settings in the app shows the exact configuration and explains each refusal the server can return.

To make a workflow callable, save it from a completed run (or write one in Prompts) and give it variables; the variables become the tool's inputs.

Schedules and inbound triggers Pro

Create a trigger in Settings → Automations, or from a finished run's page. A schedule runs a prompt on a cron cadence. A webhook trigger gives you a URL and a secret so another system (a CRM, a form, a cron service) can start a run:

curl -X POST https://prompt-tornado-backend.onrender.com/triggers/$TRIGGER_ID/invoke \
  -H "X-Trigger-Secret: $TRIGGER_SECRET"

A wrong secret and a disabled trigger both return 401, so a caller cannot probe which triggers exist. Triggered runs go through the same guardrails and spend cap as any other run.

What every run gives you

A spend cap that applies to API runs too

Projected cost is reserved before a run dispatches, on every path a run can start from. See how spend caps work, and their one exception.

Human approval Pro

Turn on output approval and finished runs wait in Needs Action until someone approves or rejects them. Rejected output is not delivered.

A record of every decision

Each step records the model that ran, the candidates it was chosen from and why others were excluded, plus tokens, cost and latency. Download a per-run debug bundle from the run page.

Evidence export Pro

Export one run, or every run in a date range, as a timestamped record of inputs, model decisions, active policies and human-review actions.

Debugging a failed run

Open the run in the app. Every step shows what happened, so you can find the step that failed, was slow or cost more than expected.

What ran, and any fallback

The model the plan chose, the model that actually ran, and whether a fallback was used because the first choice failed.

Why that model

The models considered for the step, which were excluded and by which policy: your own (changeable in Settings) or an operator's.

Cost and time per step

Tokens, cost and latency for each step, so a slow or expensive step stands out.

The error

A stable error code and a plain message, also returned by GET /api/v1/runs/{id} as error.code and error.message. If a policy blocked the run, the app says so and offers to edit the input rather than retry it unchanged.

For the full picture, download the run's debug bundle: the state before and after each step, which model ran and why, schema-validation, redaction and retry signals, latency and cost, as one JSON file you can attach to an issue. You can also replay a run and compare it with an earlier one to see what changed.

Frequently asked

Which plan do I need for the API?
API access, the MCP endpoint, scheduled and webhook triggers, output approval and evidence export are part of Pro. Outbound webhooks and the run record are available on every plan.
Do API runs respect my spend cap?
Yes. Runs started from the API, a schedule or an inbound webhook go through the same path as runs started in the app: input validation, concurrency limits, your plan's prompt limit and your spend cap.
Is there an SDK?
Not yet. A Python SDK and CLI are built but not published, so call the REST API directly, as in the examples on this page.
How do I debug a failing AI workflow?
Open the failed run in the app. Each step shows the model that ran it, any fallback and why, the models that were considered, its cost and latency, and the error code. Download the run's debug bundle for the full per-step state, or replay the run and compare it with an earlier one.
How do I verify a webhook?
Each delivery carries an X-PT-Signature header of the form t=<unix>,v1=<hex>. Recompute HMAC-SHA256 over the timestamp, a dot and the raw request body using your signing secret, compare it to v1, and reject old timestamps to stop replays.

One prompt in. A routed, budgeted run out.

Free tier with 10 runs, no card. API access is part of Pro.