Lifecycle
Generate
Send a flat JSON body toPOST /v1/run/{model_id}. The model’s
catalog entry defines which fields the body accepts.
202 carries the run ID, the URLs for polling and retrieval, and a
credit estimate.
maximum_reserved_credits is the hold placed against your balance, and
lines itemizes it by meter. queue_position becomes null once the
run starts. Credits and limits covers settlement.
metadata takes arbitrary JSON and external_id takes a string, both of
which tie a run back to a record in your own database. Keys beginning
with protoface_ are reserved and return
error.code: "run.metadata_reserved".
Operation
A model with one operation uses it by default. A model with several operations requiresoperation on the request, and omitting it returns
error.code: "run.operation_required". Naming an operation the model
does not have returns error.code: "run.operation_unsupported".
Idempotency
Use anIdempotency-Key when a request may be retried. Reusing the key
with the same body returns the original run. Reusing it with a different
body returns 409 and error.type: "conflict".
The key is any unique string up to 255 characters, and Protoface
remembers it for 24 hours.
Media inputs
Models that accept images, video, or audio can take:- An
asset_...ID returned byPOST /v1/assetsor a previous run. - A public URL.
- A data URI.
GET /v1/models/{model_id} carries all three.
Models also constrain which inputs travel together. Omitting a field that
another one requires returns error.code: "run.input_role_dependency",
and the catalog states those requirements on role_dependencies. Sending
a combination the model refuses returns
error.code: "run.input_role_conflict". See
Models.
Status
Use the lightweight status endpoint while the run is active. It returnsstatus, progress, queue_position, and error, but not the file.
Poll about once a second, and stop once status reaches completed,
failed, or canceled.
Retrieve a result
Fetch the whole object once the run finishes:outputs is the complete result. Each entry has a modality and a
type of asset, text, or data, with the value on the matching
file, text, or data field. File entries carry an asset_id for
chaining into the next run.
A single file of a given modality is also copied onto image, video,
or audio as a shortcut. Multi-part results, text, and structured data
appear only on outputs.
credits records reserved and charged against the pricing_version
set at creation. created_at to started_at is queue time, and
started_at to completed_at is generation.
A failed run keeps error.code and error.message. An uncharged run
reports charged as 0 and leaves reserved at the original hold.
Cancel
Queued and running runs can be canceled.charged as
0. Canceling after it starts charges the reserved amount. A run that
already completed returns 409 with
error.code: "run.not_cancelable".
List runs and events
Lists return newest first and page withlimit and starting_after,
which takes a run ID. has_more and next_cursor signal another page.
/events returns one run’s ordered history, useful for detailed progress
and for debugging.
sequence. Terminal events (run.completed,
run.failed, run.canceled) carry credits_charged in data, which
makes this the endpoint to reconcile billing against.
