Skip to content
OpenRelay is in early access, and the /v1 API is stable. New capabilities ship in the changelog.
Skip to Content
API ReferenceInferenceAsync

Cancel an async job

Stop starting the job's requests. Requests already running finish and are charged; the rest end cancelled at no charge. A job that has not started ends cancelled at once; a running one answers cancelling until its in-flight requests finish.

Required permission

Requires the async.write permission. See Permissions for the roles and API key permissions that include it.

Command line

The orl CLI wraps this endpoint:

orl async job cancel <id>
POST
/v1/async/jobs/{id}/cancel

Authorization

apiKey
headerAuthorizationBearer <token>

OpenRelay API key. Send it as Authorization: Bearer or_… (legacy vl_… keys still work).

Path Parameters

id*string

Response Body

The job, cancelled or cancelling.

application/json
  1. response

An async job.

id*string

The job id (ajob_...).

object*"async.job"
Value in"async.job"
completion_window*string
Value in"1h""24h"
status*string
Value in"queued""running""cancelling""completed""cancelled""failed"
created_at*integer

Unix seconds.

Formatint64
started_at*integer

When the first request began running; null until then.

Formatint64
completed_at*integer

When the job ended; null while it is live.

Formatint64
deadline_at*integer

created_at plus the window. A request not started by then expires.

Formatint64
request_counts*

A job's requests by outcome; total minus the outcomes have not finished.

usage*
cost_nano_usd*integer

Billed so far, in nanodollars (1e-9 USD).

Formatint64
input_file_id*string

The job's input: the uploaded file, or the file its inline requests were stored as.

output_file_id*string

Always null today: a finished job leaves no output file. Read the results from GET /v1/async/jobs/{id}/results.

error_file_id*string

Always null today: a finished job leaves no error file. Read the failed results from GET /v1/async/jobs/{id}/results with status=failed.

metadata*
rejected_count?integer

Only on the create answer, how many lines the create rejected.

Formatint64
rejected_records?array<>

Only on the create answer, and only when the create rejected lines: the first 100 rejected lines, in input order.

Itemsitems <= 100
rejected_records_file_id?string

Only on the create answer, and only when the create rejected lines: the file holding every rejected line.

Example Request
curl -X POST 'https://inference.openrelay.inc/v1/async/jobs/string/cancel'
Example Response
{  "id": "string",  "object": "async.job",  "completion_window": "1h",  "status": "queued",  "created_at": 0,  "started_at": 0,  "completed_at": 0,  "deadline_at": 0,  "request_counts": {    "total": 0,    "completed": 0,    "failed": 0,    "expired": 0,    "cancelled": 0  },  "usage": {    "input_tokens": 0,    "cached_input_tokens": 0,    "output_tokens": 0  },  "cost_nano_usd": 0,  "input_file_id": "string",  "output_file_id": "string",  "error_file_id": "string",  "metadata": {    "property1": "string",    "property2": "string"  },  "rejected_count": 0,  "rejected_records": [    {      "line": 0,      "custom_id": "string",      "code": "invalid_json",      "message": "string"    }  ],  "rejected_records_file_id": "string"}