Skip to main content
Cancel a run when you no longer need its result. A run is one submitted task; the API calls it an execution. Cancelling stops work that has not started. It does not stop a model call that is already running, and it does not return the platform fee. Read what cancelling stops and what you still pay before you rely on it. Goal: Stop a run that has not finished. You are done when: the response status is cancelled, or a fresh status check shows that the run already reached a final status.

Which runs you can cancel

You can cancel a run whose status is queued, running, or progress. A run that is already completed, failed, cancelled, or expired has a final status and cannot be cancelled; the API answers invalid_state.

What cancelling stops and what you still pay

  1. What is free. For a live run, cancelling before the model call starts means no model usage is billed for that run.
  2. What is charged and when. Millwork charges the platform fee when it accepts a live run, not when the run completes.
  3. What is not returned. A run you cancel keeps its platform fee and still counts toward your quota. Your quota is the number of runs your organization may submit per calendar month (UTC), and how many may run at once. A model call that was already running is not stopped. It finishes, and its model usage cost can continue until it does.
  4. The one exception. When Millwork itself fails a run before any model attempt starts, because no model could serve it, the output check was unavailable, or the selected model was not ready, Millwork returns the platform fee and the quota count automatically. You do not need to ask. This never applies to a run you cancel.
  5. See Model access and billing for the full rules.
This diagram shows what a cancellation changes for a live run whose model call has already started.

Before you begin

Set MILLWORK_API_URL and MILLWORK_API_KEY as shown in Make your first API call.
1

Set the run ID

Use a run created by Run a model.
2

Send the cancellation

3

Read the response

Expected result: status is cancelled. cancelled_by names who cancelled the run.

If it fails

Do not keep sending cancellation requests. A second request cannot stop more than the first one did.

What this confirms

Millwork records cancelled as the run’s final status and produces a receipt. It does not produce a result. It does not stop a model call already in progress. It does not return the platform fee or the quota count. Read the receipt to see what ran before the cancellation: Results and receipts.