OP Inference
Workflows

Your own workflows

Save your own workflow definitions, run them under @me/, and manage them from the console or the API.

A workflow is a JSON document that chains model calls: each step's output can feed the next, and a choice step picks the next step with a condition. You can save your own workflows and run them the same way you run ours. Yours are named @me/<slug>, are visible only to your organization, and can never take the name of one of ours.

Write a definition

A definition uses the op.workflow/1 format, the same format our own workflows use. This one asks a model for a summary and then a title for it:

{
  "schema": "op.workflow/1",
  "slug": "summary-with-title",
  "version": 1,
  "title": "Summary with a title",
  "description": "Summarizes a text, then writes a short title for the summary.",
  "input_schema": {
    "type": "object",
    "properties": { "text": { "type": "string", "minLength": 1, "maxLength": 20000 } },
    "required": ["text"],
    "additionalProperties": false
  },
  "limits": { "max_cost_usd": "0.05" },
  "steps": [
    {
      "id": "summary",
      "type": "model",
      "model": "openai/gpt-oss-120b",
      "input": {
        "messages": [{ "role": "user", "content": "Summarize in three sentences:\n\n{{input.text}}" }],
        "max_tokens": 400
      },
      "next": "title"
    },
    {
      "id": "title",
      "type": "model",
      "model": "openai/gpt-oss-120b",
      "input": {
        "messages": [{ "role": "user", "content": "Write a title of at most eight words for:\n\n{{steps.summary.output.text}}" }],
        "max_tokens": 400
      },
      "end": true
    }
  ],
  "output": { "summary": "{{steps.summary.output.text}}", "title": "{{steps.title.output.text}}" }
}

This example is an illustration, not recorded output.

A saved definition is checked against the live model catalog. Your workflows have tighter limits than ours:

LimitValue
Steps in one definition20
Size of one definition64 KiB
Stored versions, across all your slugs50, retired versions included, deleted ones not
Slugs created over the life of your organization500
Nested comprehensions in one when condition2
Time to evaluate one when condition0.1 seconds, a configured deadline rather than a speed; a condition that runs longer fails the run with invalid_request
Saves, retires and deletes30 a minute

Save it

In the console, open Workflows, choose New workflow and paste the definition. Or use the management API with a workflow management key, which you create on the API keys page by choosing Workflow management. That key can only manage workflows. It cannot run them or call any model, so keep your inference key for running.

curl https://api.opinference.com/v1/me/workflows/summary-with-title/versions \
  -H "Authorization: Bearer $OP_WORKFLOWS_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @summary-with-title.json

A saved version never changes. To change a workflow, save the next version: its version must be one more than the last one you saved for that slug, even if that one was deleted. Version numbers are never reused.

RouteWhat it does
GET /v1/me/workflowsLists your workflows and their versions
GET /v1/me/workflows/{slug}Lists one workflow's versions
GET /v1/me/workflows/{slug}/versions/{n}Returns one version, with its definition exactly as saved
POST /v1/me/workflows/{slug}/versionsSaves the body as the next version and returns it with its hash
POST /v1/me/workflows/{slug}/versions/{n}/retireStops new runs of that version. Runs already started finish
DELETE /v1/me/workflows/{slug}/versions/{n}Deletes one version and frees its place in your 50
DELETE /v1/me/workflows/{slug}Deletes every version of the workflow

A refused save stores nothing, and its message names the field or step and the rule it broke.

Edit it as a graph

The console's workflow editor shows the definition as a graph beside the JSON. Each step is a box, and each way the run can move from one step to another is a line: the next step in the list, a next, each choice case with its condition, the default, and each parallel branch and where it joins. The graph and the JSON are one draft. An edit in either one shows in the other, and only Save version stores one.

To connect two steps, drag from a handle at the bottom of one box to another box. A run only moves forward, so a line must go to a later step in the same list. A line to the same step, an earlier step or a step in another branch is refused, and the editor says why.

Every edit can also be made from the keyboard. Choose a step in the Selected step list, then use the fields below it to rename the step, change its model, input or output, set where it goes next, add a step after it or delete it. A list that chooses where a step goes offers only the steps it may go to. Renaming a step also renames every reference to it, such as {{steps.summary.output.text}}. A step that another step goes to cannot be deleted until nothing goes to it. Deleting a step does not check whether a later step reads its output; saving does, and names the step that still reads it. Deleting a parallel step deletes the steps in its branches too.

The layout comes from the order of the steps. You can drag a box to see the graph more clearly, but its place is not saved, and the saved version is the JSON and nothing more. If the JSON does not parse, or names a step twice, the graph says what is wrong and offers no edits until the JSON is fixed.

Describe it

The console's workflow editor can draft a definition from a description. Open Describe it above the graph, say what the workflow should do, paste an inference key and choose Draft it. The console calls the workflow-draft task with that key, sending your description and the ids of the models in our catalog, and puts the answer in the editor in place of what was there. Undo draft puts the previous text back, until you edit the draft or draft again.

The draft is not saved. The console runs the same checks a save runs and says whether the draft passes them, or names the field or step it would be refused at, so you can fix it before you save.

The key is used for this one call and is not stored. It must be an active inference key of your organization with no scopes; a workflow management key cannot call tasks. The call is billed as a task call to the key's workspace, the same as if you had made it yourself, and the console names that workspace beside the draft. A draft that takes longer than 90 seconds is abandoned, and may still be billed.

For example, the description "Summarize a text, then write a title for the summary" might give a definition much like the one under Write a definition. That is an illustration: a draft is written by a model, and two drafts of one description can differ.

Run it

A saved version becomes runnable within about 70 seconds (a target, not a measurement). Run it with your inference key:

curl https://api.opinference.com/v1/workflows/@me/summary-with-title/runs \
  -H "Authorization: Bearer $OP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"text": "..."}}'

POST /v1/workflows/@me/{slug}/runs runs your newest version that is not retired, and POST /v1/workflows/@me/{slug}/versions/{n}/runs runs version n. GET /v1/workflows lists your workflows with an @me/ prefix beside ours. A workflow of another organization answers 404, the same as one that does not exist.

Each step is billed as the call it makes, as if you had made it yourself, under your key's budget and policy. If a model your workflow uses leaves the catalog, a new run answers 404 no_endpoint_available, and a run already going fails at that step without charging for it. Save a new version that uses another model.

A @preset/ name in one of your steps resolves against your organization's presets.