Grow a Loom with the API
A Loom is a tree of Nodes that you grow from one prompt. Use it to compare the texts that a Base model writes, and to continue the ones you choose. Set ACS_API_BASE and ACS_API_KEY first, as Set up shows. To grow one in the browser, use the App's Loom page.
The root Node holds the prompt. A Branch makes one or more child Nodes under a Node. Each child is one Completion of the text on the path from the root to its parent. The API runs each Branch in the background, so it finishes when no client is connected.
Make a Loom
-
Send the prompt:
curl "$ACS_API_BASE/looms" \ -H "Authorization: Bearer $ACS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "The sky is"}'The API answers the Loom with its root Node, which is
completed. -
Put the Loom's
idin the shell variableLOOM_ID, and the root'sidinNODE_ID.
Branch under a Node
-
Ask for two child Nodes under the root, each with at most 2 tokens and the log probability of each token:
curl "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID/branch" \ -H "Authorization: Bearer $ACS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "llama-8b", "max_tokens": 2, "n": 2, "logprobs": 1}'The API answers the new Nodes. They are
queuedand have no text yet. -
Follow the new Nodes until they end. Follow a Branch shows the two ways.
A Branch takes these fields. Each one has the type, the range, and the default of the same field of POST /v1/completions, except the default of max_tokens:
| Field | Default | What it does |
|---|---|---|
model | none, required | The model that writes the new Nodes. |
n | 1 | How many child Nodes to make, from 1 to 128. |
max_tokens | 16 | The most tokens of each new Node, from 1 to 32,000. A Branch generates at most 32,000 tokens in all: n × max_tokens. |
temperature | 1 | The sampling temperature. |
logprobs | null | The number of top tokens whose log probabilities each Node returns for each of its tokens. |
seed | a new one | Node i of the Branch, from 0, samples with seed + i. |
top_p, top_k, min_p, presence_penalty, frequency_penalty, repetition_penalty, stop | as in Completions | How to sample each token, and where the text stops. |
blue_noise | false | Pick each Node's tokens with blue noise, on a model that takes it (Blue noise sampling). |
apply_steering_vectors | none | Steer each new Node with these Steering vectors (Steer the new Nodes). |
first_token | none | Start each new Node with a text that you choose, such as another token of a Node (Start the new Nodes with a token). |
Request fields says what each sampling field does. Without a seed, the API draws one from 0 to 2,147,483,647 for the Branch. With n Nodes, the last Node samples with seed + n - 1. That number must be at most 9,007,199,254,740,991, the largest integer that JSON and JavaScript hold exactly.
The API checks the Branch when you make it, and makes no Node when it refuses one:
- 400
invalid_requestfor a field that the table does not list. - 400 for a value that Completions refuses, such as a
top_pof 0 (Strict validation). - 400 with
paramset tomax_tokensfor a Branch of more than 32,000 tokens in all, such as 128 Nodes of 251 tokens. - 400 with
paramset toapply_steering_vectorsfor Steering vectors that the model or the Branch cannot take (Steer the new Nodes). - 400 with
paramset tofirst_tokenfor a first token whose log probability the named Node cannot give (Start the new Nodes with a token). - 400
model_not_foundfor a model that the API does not serve. - 409 when the Node is
queued,running, orfailed. Branch only under acompletedorcancelledNode. - 429
budget_exceededwhen your tokens cannot hold one Node. - 429
spend_capwhile new GPU work is paused (Spend limit).
Each Node takes its own Hold when it runs, and its prompt is the whole text of its path. Holds of background work says what that costs.
Steer the new Nodes
Send apply_steering_vectors in a Branch to steer each of its Nodes. The field takes the Steering vectors that POST /v1/completions takes, with the same fields, on the same models (Steering vector fields). The API sends the vectors to Inference once for each Node, so a Branch can steer more than one Node.
This Branch grows two Nodes, and adds 2 times a vector at Layer 1 while the model writes each one. The vector is [1, 2, 3] and then 4093 zeros, encoded as Encode a Steering vector writes it:
curl "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID/branch" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "llama-8b", "n": 2, "max_tokens": 2, "apply_steering_vectors": [{"activations": {"data": "KLUv/WAAP6UAAGgAAIA/AAAAQAAAQEAAAQDwnwdf", "dtype": "float32", "original_dtype": "torch.float32", "shape": [1, 4096], "compression": "zstd"}, "layer_indices": [1], "scale": 2}]}'Each new Node keeps the vectors in its request, as you sent them, and each read of the Loom answers them again. An encoded vector makes each read smaller. A Branch with a Node's request under the same parent steers the new Node the same way (Sample a Node again).
The API refuses these with 400 and param set to apply_steering_vectors, and makes no Node:
- A Layer that the model does not have, or a vector that does not have the model's hidden size.
- Vectors that
POST /v1/completionsrefuses for the same model andmax_tokens(Requests that the API refuses). - More than 131,072 numbers kept in all: the numbers of the vectors'
activations×n. One vector ofllama-405b, with 16,384 numbers, fits 8 Nodes, and one ofllama-8bfits 32. To steer more Nodes, or with more numbers, send Completions (Steer many prompts and choices).
Start the new Nodes with a token
Send first_token in a Branch to start each new Node with a text that you choose. Use it to try another token at a place in a Node, such as one from its top_logprobs.
-
Split the Node before the token (Change the tree). The Node keeps the text before the token. A new Node under it, the tail, starts with the token.
-
Branch under the Node, and name the token that you want and the tail:
curl "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID/branch" \ -H "Authorization: Bearer $ACS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "llama-8b", "max_tokens": 16, "logprobs": 5, "first_token": {"token": " grey", "node_id": "01a12e70-97cc-74a1-bb2d-c199187442ef"}}'NODE_IDis the Node that you split, andnode_idis theidof the tail.
The API puts token after the text of the path, and the model continues after it. The text of each new Node starts with token. max_tokens counts the tokens that the model generates after it.
With node_id and logprobs, the first token of each new Node has a log probability and top_logprobs. The API copies them from the first place of the Node that node_id names. It does not ask the model for them again. The named Node must therefore have grown from the same text, on the same model, with the same Steering vectors. Without node_id, the first token's log probability is null.
The model reads the path and token through its tokenizer, as it does for every Branch. The API sends text, not token ids, so it does not check that the model reads token as one token. After a split inside a word, the tokenizer can join token with the text before it.
The API refuses these with 400 and param set to first_token, and makes no Node:
- An empty
token. - A
node_idthat is not a child of the Node that the Branch grows under. - A
node_idof a Node with no log probabilities, or whosetop_logprobsat its first place do not havetoken. - A
node_idof a Node that ran on another model, or with other Steering vectors. - A
node_idof a Node whose earlier text was edited after it ran.
A node_id that names no Node of the Loom gets 404. To start the Nodes without a log probability, leave out node_id.
Sample a Node again
Each child Node keeps its request: the Branch fields that it ran with, its own seed and its first_token included. To sample a Node again, send its request as a Branch under the same parent. With the same seed, the new Node gets the same tokens, but vLLM can still change a token now and then when it batches requests.
The root's request is null, and so is the request of a Node that you wrote as a sibling or a new root. A Node whose fields no longer read as Branch fields has none either. A Node that ran before a range narrowed keeps the value that it ran with, such as a min_p of 2. A Branch with that value gets 400 invalid_request.
Follow a Branch
-
Read the Loom:
curl "$ACS_API_BASE/looms/$LOOM_ID" \ -H "Authorization: Bearer $ACS_API_KEY" -
Read it again until each Node of the Branch is
completed,failed, orcancelled.
When both new Nodes are completed, the Loom shows their text.
The root comes first. Each Node comes after its parent and before its next sibling, and siblings come in the order they were made. A Node's text is only its own part. The text of a path is the text of its Nodes from the root down. A Branch under a new Node continues "The sky is" and that Node's text.
The model samples each Node on its own, so with a temperature above 0 the two Nodes have different texts. The first Branch also names the Loom: its title is now the first line of the text that the Branch grows from, here the root.
Each Node also answers when and how it was made:
| Field | What it holds |
|---|---|
created_at | The time at which the API made the Node, in UTC to the millisecond, such as 2026-11-03T09:30:00.123+00:00. A Node from a Loom file keeps the time in the file (Export and import a Loom). |
press_id | The press that made the Node. Each Branch through the API is a press of its own, so its Nodes share one press_id. A press in the App sends one Branch for each Lane, and the Nodes of all those Branches share one press_id. A tail keeps the press_id of the Node that the split cut. null for a Node that no Branch made, such as the root, and for a Node that a Branch made before the API kept presses. |
lane | The letter of the App's Lane that made the Node, from A to F. A Node from a Run all in the old platform's Compare has the letter of its Column there, A for the first. A tail keeps the lane of the Node that the split cut. null for a Node that a Branch through the API made. |
from_split | true for a tail, the Node that a split made (Change the tree). |
A Node from the old platform keeps the time at which the old platform made it, and the run that made it there as its press_id.
A Node is in one of these states:
status | Meaning |
|---|---|
queued | The Node waits to run. |
running | Inference writes the Node. text holds the tokens so far, and grows. |
completed | The text is complete. With logprobs in the Branch, logprobs is set. |
failed | The Completion failed. text holds the tokens before the failure, and error says why. |
cancelled | You stopped the Node while it grew. text holds the tokens it grew. |
A Node can wait queued while other Nodes run. Looms in Limits says how many Nodes run at once.
Follow a Loom as a stream
To get each change as it happens instead of reading the Loom again, open the Loom's stream:
curl -N "$ACS_API_BASE/looms/$LOOM_ID/stream" \
-H "Authorization: Bearer $ACS_API_KEY"The stream is Server-Sent Events. Each event is one line that holds data: and a Node object, the same object that a read of the Loom shows:
- First the API sends each Node of the Loom, in the order of a read.
- Then, while a Node is
queuedorrunning, the API reads the Loom every 250 ms and sends each Node whosestatusortextchanged. A running Node'stextis its whole text so far. data: [DONE]ends the stream when no Node isqueuedorrunning.
When the Branch above has ended, the stream sends the three Nodes of Follow a Branch and data: [DONE] at once.
A stream sees each Branch that starts before the stream ends, also a Branch that another client starts. Open the stream again for a Branch that starts after it ended. If a read of the Loom fails after the stream started, the last event before [DONE] is the error object.
Change the tree
You can write a Loom's text yourself. Each change answers the whole Loom.
| Change | Route | Body |
|---|---|---|
| Edit a Node | POST /v1/looms/{loom_id}/nodes/{node_id} | {"text": "..."} |
| Split a Node | POST /v1/looms/{loom_id}/nodes/{node_id}/split | {"offset": 5}, or with "text" |
| Add a sibling | POST /v1/looms/{loom_id}/nodes/{node_id}/sibling | {"text": "..."} |
| Add a child | POST /v1/looms/{loom_id}/nodes/{node_id}/child | {"text": "..."} |
| Set a new root | POST /v1/looms/{loom_id}/root | {"text": "..."} |
The API stores each CRLF and each other CR in your text as LF.
An edit rewrites the Node's text and drops its log probabilities. The same text changes nothing. The Nodes under the edited Node do not change, but the text of their paths does.
A split cuts the Node at offset characters, counted in Unicode code points. An offset past the end cuts at the end. The Node keeps the text before the cut. A new child gets the text after it, and the Node's children move under that child, so every path keeps its text.
- A split of the Node's own text gives each half the log probabilities of the whole tokens on its side. A token across the cut leaves the new child none.
- With
text, the API cuts that edited text instead, and neither half keeps log probabilities. - The new child's
requesthasseed: null, because part of a sample cannot be sampled again. - The new child, the tail, has
from_split:true, as no Branch made it. It keeps thepress_idand thelaneof the Node that you split, which keeps them too.
A sibling is a Node that you write under the same parent as this Node. A root has no sibling. A child is a Node that you write under this Node, after its other children. A Branch under the child continues the text of the path to it. A new root replaces the whole tree with one root, your text.
To keep more than one opening text in a Loom, make the Loom with an empty prompt. Then write each opening text as a child of the root. A Branch under the root itself continues from nothing, as a Completion with an empty prompt does.
For example, split a Node after its first 7 characters:
-
Put the id of the Node to split in
NODE_ID, such as the first new Node of Follow a Branch. -
Split it:
curl "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID/split" \ -H "Authorization: Bearer $ACS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"offset": 7}'
For a Node " crying," of the tokens " crying" and ",", the Node keeps " crying" and the log probability of that token. Its new child holds "," and the log probability of ",".
The API answers 409 and changes nothing in these cases:
- An edit or a split of a
failedNode, whose text is what came before the failure, or a child under one. - A change while a Node that the change touches is
queuedorrunning. For an edit, a split, or a child, that is a Node under the changed Node. For a sibling, it is a Node under the parent. For a new root, it is any Node of the Loom. Stop the Branch, or wait until it ends. - A sibling of the root. A root has no sibling.
- A Branch, a split, a sibling, or a child that would give the Loom more Nodes than it holds (Looms in Limits). The message says how many more Nodes fit.
Stop a Branch
Stop every Node of the Loom that is queued or running:
curl -X POST "$ACS_API_BASE/looms/$LOOM_ID/cancel" \
-H "Authorization: Bearer $ACS_API_KEY"The API answers the Loom. Each Node that grew is now cancelled:
- A running Node keeps the text it grew, and you pay for those tokens, as for a stream that you close.
- A queued Node never runs and holds no tokens.
A stop when no Node grows changes nothing. A stopped Node's text is final, so you can grow a Branch under it. A Branch that you grow at once first waits for the API to save the Node's last tokens.
Read a failed Node
A Node fails when its Completion fails after you made the Branch. The Node's status is then failed, its text holds the tokens that came before the failure, and its error is the error object. The error is what POST /v1/completions answers for the same request, without a request_id.
| Cause | error |
|---|---|
| Your tokens cannot hold the Node when it runs. | code budget_exceeded, and the Node does not reach Inference. |
The text of the path and max_tokens are longer than the model's context. | code context_length_exceeded |
| Inference refuses a value, or fails. | message says why. |
| The API key that made the Branch was revoked, or your access is suspended. | code invalid_api_key, and the Node does not reach Inference |
The error's param names a field of the Branch, or is null. A Branch has no prompt field, so a path that is too long has param: null.
To continue after a failure, grow a new Branch under the failed Node's parent. A failed Node takes no Branch, edit, or split, but you can delete it.
List your Looms
curl "$ACS_API_BASE/looms" \
-H "Authorization: Bearer $ACS_API_KEY"The API answers your newest 100 Looms, each with its title and prompt, without its Nodes.
A Loom that came over from the old platform has from_v1: loom for one of its Looms, workbench for one of its Workbench sessions. A Loom that you made here has null.
Pinned Looms come first, newest pin first. The other Looms follow by their last change, newest first. Each change of a Loom moves it to the top of the unpinned Looms. A Branch, an edit, a split, a sibling, a child, a new root, a deleted Node, and a rename each change it. A pin and a Favorite do not.
A Loom's title is empty until its first Branch names it after the first line of the text that the Branch grows from, cut to 40 characters. That text is the texts of the path, joined. For a Loom whose root is empty, its first line starts in the Node after the root.
Rename or pin a Loom
Send a new title, pinned, or both:
curl "$ACS_API_BASE/looms/$LOOM_ID" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Skies", "pinned": true}'The API answers the Loom with its Nodes, with "title": "Skies" and "pinned": true.
- The API trims the title and keeps its first 120 characters. An empty title leaves the Loom untitled, so its next Branch names it again.
pinned: trueputs the Loom above the unpinned ones, andpinned: falseunpins it. A pin does not change the Loom's last change, so an unpinned Loom goes back to its place.
Count the App's Branches for a key
A Loom is a playground in the App's Playground. Send api_key_id to count the Branches that you make there for one of your API keys:
curl "$ACS_API_BASE/looms/$LOOM_ID" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"api_key_id": "01a12e70-8d1f-7c2a-9b3e-5f6a7b8c9d0e"}'The API answers the Loom, with the key's id in api_key_id. Usage then counts those Branches for that key, with the client label App.
- The id is the
idof one of your own keys that is not revoked, expired, or paused. The id of any other key, or of no key, gets 404. A text that is not an id gets 400. "api_key_id": nulltakes the key off. The App's Branches are then counted for no key.- The key changes only where your usage is counted. The Branches spend your tokens a month either way.
- A Branch that you send to
/v1is counted for the key that sent it, whateverapi_key_idis. - The API counts each Node when it runs. When the key is revoked, expired, or paused later, the Nodes that run after that still run, and are counted for no key. The Loom keeps
api_key_id, so you can see which key it had.
Mark a Favorite
Mark a Node that you want to find again as a Favorite:
curl "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID/favorite" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"favorite": true}'The API answers the Loom, and that Node has "favorite": true in each read of the Loom. Send {"favorite": false} to take the mark off. The mark changes no text, works while the Node grows, and does not change the Loom's last change. A deleted Node takes its mark with it.
Delete a Node or a Loom
-
Put the id of the Node to delete in
NODE_ID. -
Delete the Node and every Node under it:
curl -X DELETE "$ACS_API_BASE/looms/$LOOM_ID/nodes/$NODE_ID" \ -H "Authorization: Bearer $ACS_API_KEY"The API answers the Loom without them.
To delete the whole Loom, send:
curl -X DELETE "$ACS_API_BASE/looms/$LOOM_ID" \
-H "Authorization: Bearer $ACS_API_KEY"{
"id": "01a124ae-b6ad-7b4b-84cf-e62cb48d9f79",
"object": "loom",
"deleted": true
}You cannot undo a delete. A deleted Node or Loom is gone for you at once: no read, list, or Branch finds it.
The API refuses with 409:
- A delete of the root Node. Delete the Loom instead.
- A delete while a Node to delete is
queuedorrunning. Delete it when its Branch ends.
Export and import a Loom
-
Download a Loom as a file:
curl "$ACS_API_BASE/looms/$LOOM_ID/export" \ -H "Authorization: Bearer $ACS_API_KEY" -o loom.json -
Make a new Loom from the file. Send it to
POST /v1/looms/importwith the import command at the end of this section, with-d @loom.jsonin place of its-d '...'body.
The file has the shape of the Loom export of the old platform (version 2), so a file from either one imports into the other. It holds the Loom's title, the model and last_generation_config of its last Branch, and each Node, each parent before its children. A Node in the file has these fields:
id,parent_id,text, andstatus.position, its place among its siblings.logprobs, one entry for each token, withtoken,logprob, and the likeliest tokens intop.generation_config, the Branch fields it ran with. It also holds the markstext_modifiedafter an edit andcontext_modifiedwhen a Node above it changed. A part of a split sample hasslice_offsetandslice_end.generation_id, the Node'spress_id, andlane, the letter of its Lane.from_split,truefor a tail.created_at, the time at which it was made.error, for a failed Node.
You can also write a file yourself. This one makes a Loom of two Nodes:
curl "$ACS_API_BASE/looms/import" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"loom": {"title": "Skies"}, "nodes": [{"id": "a", "parent_id": null, "text": "The sky is"}, {"id": "b", "parent_id": "a", "text": " blue"}]}'The API answers the new Loom. It reads the file by these rules:
- Each Node gets a new id, and siblings keep the order of their
position. In a file that this API exported, the new ids keep the order of the file's ids. Nodes with onecreated_atthen keep their order in History. - Each press gets a new id. The Nodes with one
generation_idin the file share onepress_idin the new Loom, and no other Loom has it. - A Node without
from_splitis a tail when its parent has the samegeneration_id. The old platform keeps its run on both halves of a split. A Node is also a tail when itsgeneration_confighas Branch fields and aslice_offsetabove 0. A tail'srequesthas noseed, as after a split. - A Node without a
statusiscompleted. - A Node keeps its
created_atwhen it is an ISO 8601 time with its offset, such as2026-11-03T09:30:00.123+00:00. The time must be on a day of the calendar, from the year 1, and in the past. Any other Node gets the time of the import. - A Node whose parent is not in the file goes under the file's root when the file has one root. Otherwise it becomes a root, so a Loom can have more than one root.
- A Node whose parents lead back to itself becomes a root.
- The API trims the file's title and cuts it to 120 characters. A file without a title gets
Imported loom. - A file of more Nodes than a Loom holds, or with two Nodes of the same
id, gets 400.
If the API restarts while a Node runs, the Node runs again later. When the API restarts says how.
The API reference lists every field of each Loom route.