Skip to content
ACS Infra

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

  1. 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.

  2. Put the Loom's id in the shell variable LOOM_ID, and the root's id in NODE_ID.

Branch under a Node

  1. 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 queued and have no text yet.

  2. 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:

FieldDefaultWhat it does
modelnone, requiredThe model that writes the new Nodes.
n1How many child Nodes to make, from 1 to 128.
max_tokens16The most tokens of each new Node, from 1 to 32,000. A Branch generates at most 32,000 tokens in all: n × max_tokens.
temperature1The sampling temperature.
logprobsnullThe number of top tokens whose log probabilities each Node returns for each of its tokens.
seeda new oneNode i of the Branch, from 0, samples with seed + i.
top_p, top_k, min_p, presence_penalty, frequency_penalty, repetition_penalty, stopas in CompletionsHow to sample each token, and where the text stops.
blue_noisefalsePick each Node's tokens with blue noise, on a model that takes it (Blue noise sampling).
apply_steering_vectorsnoneSteer each new Node with these Steering vectors (Steer the new Nodes).
first_tokennoneStart 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_request for a field that the table does not list.
  • 400 for a value that Completions refuses, such as a top_p of 0 (Strict validation).
  • 400 with param set to max_tokens for a Branch of more than 32,000 tokens in all, such as 128 Nodes of 251 tokens.
  • 400 with param set to apply_steering_vectors for Steering vectors that the model or the Branch cannot take (Steer the new Nodes).
  • 400 with param set to first_token for a first token whose log probability the named Node cannot give (Start the new Nodes with a token).
  • 400 model_not_found for a model that the API does not serve.
  • 409 when the Node is queued, running, or failed. Branch only under a completed or cancelled Node.
  • 429 budget_exceeded when your tokens cannot hold one Node.
  • 429 spend_cap while 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/completions refuses for the same model and max_tokens (Requests that the API refuses).
  • More than 131,072 numbers kept in all: the numbers of the vectors' activations × n. One vector of llama-405b, with 16,384 numbers, fits 8 Nodes, and one of llama-8b fits 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.

  1. 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.

  2. 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_ID is the Node that you split, and node_id is the id of 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_id that is not a child of the Node that the Branch grows under.
  • A node_id of a Node with no log probabilities, or whose top_logprobs at its first place do not have token.
  • A node_id of a Node that ran on another model, or with other Steering vectors.
  • A node_id of 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

  1. Read the Loom:

    curl "$ACS_API_BASE/looms/$LOOM_ID" \
      -H "Authorization: Bearer $ACS_API_KEY"
  2. Read it again until each Node of the Branch is completed, failed, or cancelled.

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:

FieldWhat it holds
created_atThe 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_idThe 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.
laneThe 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_splittrue 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:

statusMeaning
queuedThe Node waits to run.
runningInference writes the Node. text holds the tokens so far, and grows.
completedThe text is complete. With logprobs in the Branch, logprobs is set.
failedThe Completion failed. text holds the tokens before the failure, and error says why.
cancelledYou 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:

  1. First the API sends each Node of the Loom, in the order of a read.
  2. Then, while a Node is queued or running, the API reads the Loom every 250 ms and sends each Node whose status or text changed. A running Node's text is its whole text so far.
  3. data: [DONE] ends the stream when no Node is queued or running.

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.

ChangeRouteBody
Edit a NodePOST /v1/looms/{loom_id}/nodes/{node_id}{"text": "..."}
Split a NodePOST /v1/looms/{loom_id}/nodes/{node_id}/split{"offset": 5}, or with "text"
Add a siblingPOST /v1/looms/{loom_id}/nodes/{node_id}/sibling{"text": "..."}
Add a childPOST /v1/looms/{loom_id}/nodes/{node_id}/child{"text": "..."}
Set a new rootPOST /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 request has seed: 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 the press_id and the lane of 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:

  1. Put the id of the Node to split in NODE_ID, such as the first new Node of Follow a Branch.

  2. 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 failed Node, whose text is what came before the failure, or a child under one.
  • A change while a Node that the change touches is queued or running. 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.

Causeerror
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: true puts the Loom above the unpinned ones, and pinned: false unpins 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 id of 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": null takes 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 /v1 is counted for the key that sent it, whatever api_key_id is.
  • 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

  1. Put the id of the Node to delete in NODE_ID.

  2. 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"
Deleted
{
  "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 queued or running. Delete it when its Branch ends.

Export and import a Loom

  1. Download a Loom as a file:

    curl "$ACS_API_BASE/looms/$LOOM_ID/export" \
      -H "Authorization: Bearer $ACS_API_KEY" -o loom.json
  2. Make a new Loom from the file. Send it to POST /v1/looms/import with the import command at the end of this section, with -d @loom.json in 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, and status.
  • position, its place among its siblings.
  • logprobs, one entry for each token, with token, logprob, and the likeliest tokens in top.
  • generation_config, the Branch fields it ran with. It also holds the marks text_modified after an edit and context_modified when a Node above it changed. A part of a split sample has slice_offset and slice_end.
  • generation_id, the Node's press_id, and lane, the letter of its Lane.
  • from_split, true for 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 one created_at then keep their order in History.
  • Each press gets a new id. The Nodes with one generation_id in the file share one press_id in the new Loom, and no other Loom has it.
  • A Node without from_split is a tail when its parent has the same generation_id. The old platform keeps its run on both halves of a split. A Node is also a tail when its generation_config has Branch fields and a slice_offset above 0. A tail's request has no seed, as after a split.
  • A Node without a status is completed.
  • A Node keeps its created_at when it is an ISO 8601 time with its offset, such as 2026-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.

On this page