Workflows

A JSON graph of model calls, run with one request.

Name the inputs, list the nodes, template each prompt from the inputs and earlier outputs. Run it, poll it, read every step and its charge.

Create a workflow

The graph

graph.json
1{
2 "inputs": ["draft"],
3 "nodes": [
4 {
5 "id": "summary",
6 "model": "glm-5.3-flash-uncensored",
7 "prompt": "Summarize in three sentences:\n\n{{inputs.draft}}",
8 "max_tokens": 300
9 },
10 {
11 "id": "title",
12 "model": "glm-5.3-uncensored",
13 "system": "You write headlines.",
14 "prompt": "Write one headline for this summary:\n\n{{nodes.summary.output}}",
15 "max_tokens": 40
16 },
17 {
18 "id": "spanish",
19 "model": "glm-5.3-flash-uncensored",
20 "prompt": "Translate to Spanish:\n\n{{nodes.summary.output}}",
21 "if": "{{inputs.draft}}"
22 }
23 ],
24 "outputs": {
25 "headline": "{{nodes.title.output}}",
26 "summary": "{{nodes.summary.output}}",
27 "summary_es": "{{nodes.spanish.output}}"
28 }
29}
  • inputs names what a run takes. {{inputs.draft}} puts it in a prompt.
  • Each node is one model call: id, model, prompt, an optional system, max_tokens and if. {{nodes.summary.output}} makes a node wait for another.
  • outputs is what the run returns, assembled from the same templates. Nodes with no dependency between them run at the same time.

How a run bills

Each step
a normal request to its model, at the per-token price on the model page
Per run
the steps summed, plus $0.005
no monthly fee
On failure
only the steps that completed bill; the run answers with the error and the steps it got through

Create, run, poll

create
1curl https://api.uncensoredllm.ai/v1/workflows \
2 -H "Authorization: Bearer sk-ullm-live-…" \
3 -H "Content-Type: application/json" \
4 -d '{ "name": "summarize-and-title", "graph": '"$(cat graph.json)"' }'
run
1curl https://api.uncensoredllm.ai/v1/workflows/WORKFLOW_ID/runs \
2 -H "Authorization: Bearer sk-ullm-live-…" \
3 -H "Content-Type: application/json" \
4 -d '{ "key_id": "KEY_ID", "inputs": { "draft": "..." } }'
poll
1curl https://api.uncensoredllm.ai/v1/workflows/WORKFLOW_ID/runs/RUN_ID \
2 -H "Authorization: Bearer sk-ullm-live-…"

The run call answers 202 with run_id. The poll answers with status, steps (each with its status and charge_usd), outputs, charge_usd and fee_usd.

An n8n alternative for model chains

Visual automation tools are built for wiring many services together, and the model call is one node among hundreds. When the whole job is model calls, the editor, the server and the per-execution plan are overhead. A workflow here is the JSON above, versioned with your code, run by one request, with one charge that lists every step. Need a tool call in the middle? An agent with a webhook skill does that; a workflow is for the model-only chain.

Questions

One request that runs several model calls in order. You describe the chain as a JSON graph: named inputs, nodes that each call a model with a templated prompt, and outputs assembled from the node results. The run walks the graph, calls each node and returns every step with its output and its charge.

Each node bills as a normal request to its model, at that model's per-token price. The run's charge is the sum of those steps plus $0.005. A failed run bills only the steps that completed. There is no monthly fee for workflows.

A node with an if template runs only when the template renders to a non-empty string; its output is empty otherwise. Nodes that reference each other run in dependency order, and nodes that do not depend on each other run side by side. Loops are not allowed.

For the model-chain part, yes. n8n and similar tools draw a graph of hundreds of integrations in a visual editor and run it on their server or yours. A workflow here is only model calls, written as JSON and run on the gateway, with one bill for the whole chain. If the job is "call these models in this order", it is the shorter path; if it needs a CRM step in the middle, give an agent a skill instead.

Any chat model on this catalog, by id, and different nodes can use different models. A fast build for the bulk step and a stronger one for the final pass is the common shape.

The run call answers 202 with a run id. GET the run until status is done or error; the answer carries the outputs, each step with its status and charge, and the total. A key_id names which of your keys the run bills to.

Write the graph, run it from the console.