---
name: prori-tools
description: Use Prori's paid gateway for data, scraping, search, and social endpoints when the user's existing tools, MCP servers, or API keys do not cover the task.
version: 0.1.0
---

# Prori Tools

For Claude Code, Codex, Cursor, OpenClaw, and other AI agents. Prori's catalog covers thousands of data, scraping, search, and social endpoints; only enabled endpoints can run. Runs spend the user's Prori credits. Website: https://prori.ai. API base: https://api.bnbot.ai/api/v1/tools.

## Setup

1. The user creates an API key in the console at https://prori.ai/app/api. Full keys are shown once, when created.
2. The key is stored as the environment variable `PRORI_API_KEY` (shell profile, `.env` outside version control, or the agent's secret store).
3. If `PRORI_API_KEY` is missing, stop and ask the user to create a key at https://prori.ai/app/api and set it. Do not ask them to paste it into the chat.

Never print, log, or paste the credential, request it in chat, or use shell tracing / curl verbose output that could expose it. Every gateway example sends `Authorization: Bearer $PRORI_API_KEY`.

```bash
curl -sS "https://api.bnbot.ai/api/v1/tools/balance" -H "Authorization: Bearer $PRORI_API_KEY"
```

## When to use

Follow the user's explicit tool choice first, then prefer their own dedicated tools, MCP servers, CLIs, and API keys. Use this gateway for gaps such as structured web data, scraping, search, or social data. Do not silently switch to paid Prori runs when an existing tool covers the task. Discover before building a scraper or declaring data unavailable, but obtain any required spending approval before running.

## Core workflow

1. **Discover** with `POST /discover`: `query`, optional `limit` (1–20, default 8), and optional `category`. Results are runnable and include relevance `score` and minimum starting price `credits.from`; this is not a quote for the whole request.

```bash
curl -sS "https://api.bnbot.ai/api/v1/tools/discover" \
  -H "Authorization: Bearer $PRORI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"search reddit posts","limit":5}'
```

2. **Inspect** a returned provider/endpoint pair. Create `inspect-request.json` with `{"provider":"<from discover>","endpoint":"<from discover>"}`, replacing both placeholders. Read `inputSchema` (`body`, `queryParams`, `pathParams`, `bodyType`), then add an `input` object containing only schema-supported fields and inspect again for a quote on the intended input. Input is a flat object forwarded unchanged; do not invent wrapper fields. Check `quote.supported`, `quote.credits`, `quote.usd`, `quote.exact`, `balance`, and `dailyLimit` before execution. A null schema is not permission to guess: consult the returned `docUrl` and `notes`.

```bash
curl -sS "https://api.bnbot.ai/api/v1/tools/inspect" \
  -H "Authorization: Bearer $PRORI_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @inspect-request.json
```

3. **Run** after checking cost and authorization. Create `run-request.json` with the inspected `provider`, `endpoint`, and `input`, plus `waitSeconds` (0–55, default 25). Generate and retain one idempotency key per logical call; it must match `[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}`. Reuse the exact key and body for retries, including `waitSeconds`; they never charge twice. Generate a new key only for a new logical call.

```bash
# Generate once; retain this value and run-request.json for retries.
PRORI_IDEMPOTENCY_KEY="$(uuidgen)"
curl -sS "https://api.bnbot.ai/api/v1/tools/run" \
  -H "Authorization: Bearer $PRORI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $PRORI_IDEMPOTENCY_KEY" \
  --data-binary @run-request.json -o run.json
```

HTTP 200 means terminal, not necessarily successful; 202 means still running. Read `runId` and `status` from the response. A client timeout does not mean the run stopped: recover with the same idempotency key/body instead of creating another run.

4. **Poll** `GET /runs/{runId}` until terminal. Set `PRORI_RUN_ID` to the returned `runId`. Wait 3–5 seconds between reads, back off for long runs, and honor `retry_after` / `Retry-After`. Each read refreshes upstream status and settlement. Review errors and report the final `credits.charged`.

```bash
curl -sS "https://api.bnbot.ai/api/v1/tools/runs/$PRORI_RUN_ID" \
  -H "Authorization: Bearer $PRORI_API_KEY" -o run.json
# Optional cancellation; a finished run returns 409 run_not_stoppable.
curl -sS -X POST "https://api.bnbot.ai/api/v1/tools/runs/$PRORI_RUN_ID/stop" \
  -H "Authorization: Bearer $PRORI_API_KEY"
curl -sS "https://api.bnbot.ai/api/v1/tools/runs?limit=10" -H "Authorization: Bearer $PRORI_API_KEY"
curl -sS "https://api.bnbot.ai/api/v1/tools/balance" -H "Authorization: Bearer $PRORI_API_KEY"
```

`GET /runs?limit=1..100` lists recent runs without output. Public catalog routes need no authentication: `GET /stats`, `GET /categories`, and `GET /endpoints?q=&category=&provider=&runnable=true&cursor=&limit=` (limit 1–50, default 24; cursor is opaque).

## Cost control

- **100 credits = $1.** The gateway reserves `quote.credits` before running, settles at actual cost rounded up to the configured credit precision, and refunds the difference. Settlement never exceeds the reservation. `quote.exact=false` means an upper bound, not the final charge.
- Begin with one query/term/URL and small schema-supported limits such as `maxItems` or `limit`. Limits can apply per query or term: three terms with a limit of ten may produce thirty billable results. Inspect again after input changes.
- Confirm with the user before a quote above **100 credits ($1)** or a batch/loop of many runs, unless that exact spending scope is already authorized. State the per-run and total maximum; honor any smaller user budget.
- Check both balance and `dailyLimit`. Daily limits reset at UTC midnight and can be set per account and per API key in the console; active reservations count until settled/refunded. Top-ups do not lift the daily cap. A null `limitCredits` / `remainingCredits` means unlimited, not zero.
- Upstream HTTP errors (400+) and `FAILED`, `BLOCKED`, `STOPPED`, or `TIMED_OUT` runs are fully refunded. If upstream submission is uncertain after a network break, the gateway does not resubmit and compensates after 15 minutes; do not create a replacement run while its outcome is unknown.
- Report each run's `credits.charged`, plus reserved/refunded amounts when relevant. Do not report the quote as the actual charge.

## Run statuses

| Status | Agent action |
| --- | --- |
| `READY`, `RUNNING` | Nonterminal: keep polling with backoff. |
| `COMPLETED` | Terminal: inspect `providerHttpStatus`, `error`, and `providerError` before claiming success. |
| `FAILED`, `BLOCKED`, `STOPPED`, `TIMED_OUT` | Terminal: stop polling, explain the outcome, and check the full refund. |

Large output (>1 MB) may have `output=null` and a presigned `outputUrl`. Download to a local file before `outputUrlExpiresIn` seconds elapse; re-GET the run for a fresh link. Do not send the Prori bearer credential to the output URL. If `outputTruncated` is true, retrieve the run's output rather than assuming a stored preview is complete. Keep large results in files and summarize them for the user.

## Errors

Gateway errors normally use `{"detail":{"error":{"type":"…","message":"…"}}}` with extra fields inside `error`. Authentication errors may use a plain `detail`; validation errors (422) use `{"detail":[…]}`. Read the message before retrying.

| HTTP / type | Action |
| --- | --- |
| 401 | The key is missing, mistyped or revoked. Ask the user to check `PRORI_API_KEY` or create a new key at https://prori.ai/app/api; never expose it. |
| 402 `insufficient_credits` | Stop. Explain `required_credits` versus `current_credits` and give the user `topup_url`; do not retry until funded. |
| 429 `rate_limited` / `too_many_active_runs` | Wait `retry_after` seconds (or `Retry-After`), then retry; retain the same run key/body. |
| 429 `daily_credit_limit_exceeded` | Stop until `resets_at` (UTC). Tell the user; topping up cannot lift this cap, but they can raise a key's limit at https://prori.ai/app/api. |
| 400 `price_unsupported` | Change the input exactly as `message` directs (for example, set `maxItems`), then inspect again. If pricing cannot be bounded, choose another endpoint. |
| 400 `invalid_input` / 422 | Fix input using `inputSchema` and validation details, then inspect again. |
| 400 `invalid_endpoint` / `invalid_category` / `invalid_cursor` / `invalid_idempotency_key` | Correct the malformed value using catalog results or the documented key format. |
| 403 `endpoint_not_enabled` / 404 `endpoint_not_found` | Discover another runnable endpoint. |
| 404 `run_not_found` | Check the returned run ID and authenticated user; do not automatically submit again. |
| 409 `idempotency_conflict` | A different body needs a new key only if it is a new intended call; inspect the existing `run_id` to avoid duplicate work. |
| 409 `run_not_stoppable` | Read the run's final status; do not keep sending stop requests. |
| 413 `input_too_large` | Reduce input below 256 KB, then inspect again. |
| 501 `route_not_available` | This route is not implemented; choose another runnable endpoint. |
| Other 5xx / 503 | Tell the user and retry later with bounded backoff; preserve the same run key/body. Persistent `gateway_not_configured` needs operator action. |

## Rules for agents

1. Prefer the user's own tools, MCP servers, and keys; explain when Prori credits will be spent.
2. Inspect every new endpoint and re-quote the actual input before running; never invent endpoints or fields.
3. Get approval above 100 credits ($1) or before many runs in a loop, unless that spending scope is already authorized.
4. Start small, account for per-term limits, and prefer cheaper, healthier suitable endpoints when reliability information is available.
5. Keep one idempotency key per logical call and reuse the identical body on retries.
6. Poll with backoff, respect `retry_after`, and stop polling terminal runs.
7. Do not retry insufficient credit or daily-limit errors until their blocking condition is resolved.
8. Check provider errors even on `COMPLETED` and report each run's actual `credits.charged`.
9. Never expose credentials in chat, logs, source files, or downloaded-output requests.
10. Save large outputs to local files, refresh expired output links, and summarize results with file locations.
