OP Inference
API reference

Run a tool

POST
/v1/tools/runs

Start a tool run. It answers 202 with the run, which you poll at /v1/tools/runs/{id}. The input is checked against the tool before anything is reserved.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Your API key, sent as Authorization: Bearer <key>.

Header Parameters

Idempotency-Key?string

Any string you choose. A retry with the same key and body returns the first result instead of running again. The same key with a different body is a 409 idempotency_conflict.

Request Body

application/json
  1. body
tool*string

The tool id, such as exa/search.

input*

The tool's input, as its page lists it.

Response Body

The run, accepted.

application/json
  1. response
id*string
object*string
tool*string
status*string
Value in"queued""processing""succeeded""failed""canceled"
outcome?"no_match"

Set on a succeeded run that found nothing. Billed like any other answer.

Value in"no_match"
output?array<>

The result, as signed links like a job's output.

error?
usage?
created_at*string
Formatdate-time
completed_at?string
Formatdate-time
curl -X POST "https://example.com/v1/tools/runs" \  -H "Authorization: Bearer $OP_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "tool": "string",    "input": {}  }'
{  "id": "string",  "object": "tool.run",  "tool": "string",  "status": "queued",  "outcome": "no_match",  "output": [    {      "url": "string",      "url_expires_at": "2019-08-24T14:15:22Z",      "type": "string",      "bytes": 0    }  ],  "error": {    "code": "string",    "kind": "string",    "scope": "string",    "message": "string"  },  "usage": {    "units": {      "property1": 0,      "property2": 0    },    "cost": {      "billing_usd": 0,      "cost_source": "string",      "cost_status": "string",      "price_version": "string"    }  },  "created_at": "2019-08-24T14:15:22Z",  "completed_at": "2019-08-24T14:15:22Z"}