Skip to content
ACS Infra

API reference

The API's OpenAPI document makes these pages, so they change when the API does. Each page lists a route's fields and answers, and its playground sends the request.

RouteWhat it does
GET /v1/modelsList the Base models.
GET /v1/models/{model_id}Read one Base model.
GET /v1/models/{model_id}/statusSay whether a model is Warm.
GET /v1/quotaRead your tokens this month and how many are left.
POST /v1/tokenizeTurn a text into token ids, and count them.
POST /v1/detokenizeTurn token ids into text.
POST /v1/completionsCreate a Completion.
POST /v1/completion-jobsQueue a Job.
GET /v1/completion-jobs/{job_id}Read a Job.
GET /v1/completion-jobs/{job_id}/resultFetch the result of a Job.
POST /v1/completion-jobs/{job_id}/cancelCancel a Job.
POST /v1/harvestQueue a harvest Job of Activations.
GET /v1/harvestList your harvest Jobs, newest first.
GET /v1/harvest/{job_id}Read a harvest Job and its files, and wait for its status to change.
DELETE /v1/harvest/{job_id}Cancel a harvest Job.
GET /v1/loomsList your Looms, pinned first.
POST /v1/loomsCreate a Loom.
POST /v1/looms/importMake a Loom from a file.
GET /v1/looms/{loom_id}Read a Loom.
POST /v1/looms/{loom_id}Rename or pin a Loom, or choose the API key that the App's Branches count for.
GET /v1/looms/{loom_id}/exportDownload a Loom as a file.
GET /v1/looms/{loom_id}/streamFollow a Loom as Server-Sent Events.
POST /v1/looms/{loom_id}/cancelStop the Loom's growing Nodes.
POST /v1/looms/{loom_id}/rootReplace the tree with a new root.
DELETE /v1/looms/{loom_id}Delete a Loom.
POST /v1/looms/{loom_id}/nodes/{node_id}Edit a Node.
POST /v1/looms/{loom_id}/nodes/{node_id}/splitSplit a Node at an offset.
POST /v1/looms/{loom_id}/nodes/{node_id}/siblingWrite a Node beside a Node.
POST /v1/looms/{loom_id}/nodes/{node_id}/childWrite a Node under a Node.
POST /v1/looms/{loom_id}/nodes/{node_id}/favoriteMark a Node as a Favorite, or take the mark off.
POST /v1/looms/{loom_id}/nodes/{node_id}/branchBranch from a Node of a Loom.
DELETE /v1/looms/{loom_id}/nodes/{node_id}Delete a Node and the Nodes under it.
GET /healthCheck that the API answers.
POST /v1/chat/completionsRefuse every chat request with 400 and a message that names POST /v1/completions.

Client labels

The API counts each Completion under a client label, so that you can split your usage by the script or tool that sent it. The label is the request's X-Title header, the header that OpenRouter reads. Without X-Title, it is the first product of the request's User-Agent, such as python-requests/2.32.3, OpenAI/Python, or curl/8.7.1, without its comments. A request with neither header has no label. The App's requests count as App.

The API trims the label, makes each run of spaces one space, and keeps its first 64 characters (Limits). It never refuses a request for its label. The API stores only the label, and keeps it as long as it keeps the Completion's usage.

This curl command names its request nightly-eval:

curl "$ACS_API_BASE/completions" \
  -H "Authorization: Bearer $ACS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Title: nightly-eval" \
  -d '{"model": "llama-8b", "prompt": "The sky is", "max_tokens": 5}'

This Python program names each request of its client nightly-eval:

import os

from openai import OpenAI

client = OpenAI(
    base_url=os.environ["ACS_API_BASE"],
    api_key=os.environ["ACS_API_KEY"],
    default_headers={"X-Title": "nightly-eval"},
)

completion = client.completions.create(model="llama-8b", prompt="The sky is", max_tokens=5)
print(completion.choices[0].text)

GET /v1/quota with group_by=client adds clients to its answer: this UTC month's Completions under each label, the most tokens first. The App's Usage page shows the same split for the days, key, and model that you choose (Read your usage).

curl "$ACS_API_BASE/quota?group_by=client" \
  -H "Authorization: Bearer $ACS_API_KEY"

On this page