AI workflow API. 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. Write the graph here or in the console.
The graph
Each node is one model call. A {{nodes.x.output}} reference makes a node wait for another; nodes with no dependency between them run at the same time.
{ "inputs": ["article"], "nodes": [ { "id": "summary", "model": "claude-haiku-5-5", "prompt": "Summarize in three sentences:\n\n{{inputs.article}}", "max_tokens": 300 }, { "id": "title", "model": "claude-sonnet-5-5", "system": "You write headlines.", "prompt": "Write one headline for this summary:\n\n{{nodes.summary.output}}", "max_tokens": 40 }, { "id": "spanish", "model": "gpt-5.5", "prompt": "Translate to Spanish:\n\n{{nodes.summary.output}}", "if": "{{inputs.article}}" } ], "outputs": { "headline": "{{nodes.title.output}}", "summary": "{{nodes.summary.output}}", "summary_es": "{{nodes.spanish.output}}" }}- summaryclaude-haiku-5-5first · max_tokens 300
- titleclaude-sonnet-5-5after summary · max_tokens 40
- spanishgpt-5.5after summary · conditional
Each node: a normal request to its model, at the per-token price on the model page.
Each run: the steps summed, plus $0.005. No monthly fee.
A failed run: only the steps that completed bill. The run answers with the error and the steps it got through.
Create, run, poll
curl https://api.relayswitch.io/v1/workflows \ -H "Authorization: Bearer $RELAYSWITCH_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "summarize-and-title", "graph": '"$(cat graph.json)"' }'curl https://api.relayswitch.io/v1/workflows/WORKFLOW_ID/runs \ -H "Authorization: Bearer $RELAYSWITCH_KEY" \ -H "Content-Type: application/json" \ -d '{ "key_id": "KEY_ID", "inputs": { "article": "..." } }'curl https://api.relayswitch.io/v1/workflows/WORKFLOW_ID/runs/RUN_ID \ -H "Authorization: Bearer $RELAYSWITCH_KEY"The run call answers 202 with run_id. The poll answers with status, steps (each with its status and charge_usd), outputs and the total. The console's Workflows page runs the same graph from a form and lists every run.
Questions
Graphs, billing, branching.
Write the graph, run it from the console
One request, every step priced, no monthly fee.