DevelopersSlices

Slices

A slice is a small container machine with a fixed CPU, RAM and disk size. It starts from an image and is billed by the hour. You run commands in it, stream their output, read and write its files, read its logs and publish ports over HTTPS. A durable slice stays up until you delete it and restarts on its own after a failure; a short-lived one ends after a timeout you set. Persistent volumes give it disk that outlives it.

Slices are available to every team. If creating slices is switched off for a while, a create answers 503 unavailable: try again later.

Slices are for work that needs a clean machine on demand: build and test boxes, background workers, scripting, previews, tools an agent drives. For a web app with deploys, domains and databases use apps.

Quickstart#

export API=https://console.hostwolf.net/api/v1
hw() { curl -sS -H "Authorization: Bearer $HOSTWOLF_TOKEN" -H "Content-Type: application/json" "$@"; }

# sizes with their prices, and the images you can start from
hw $API/hostwolf/slices/sizes | jq
hw $API/hostwolf/slices/images | jq

# start a slice (without "confirm": true nothing is created and the answer quotes the price)
hw -X POST $API/hostwolf/slices -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name": "build-box", "size": "small", "image": "python312", "confirm": true}'

# run a command in it
hw -X POST $API/hostwolf/slices/$SLICE/exec -d '{"cmd": ["python3", "--version"]}'

# delete it: billing stops at once
hw -X DELETE $API/hostwolf/slices/$SLICE -H "Idempotency-Key: $(uuidgen)"

The same with the CLI:

hostwolf apps slices sizes
hostwolf apps slices create --size small --image python312 --name build-box          # shows the price
hostwolf apps slices create --size small --image python312 --name build-box --confirm
hostwolf apps slices exec build-box -- python3 --version
hostwolf apps slices delete build-box --confirm

And with the SDK:

import { HostwolfApps } from '@hostwolf/apps-sdk';
const hw = new HostwolfApps({ token: process.env.HOSTWOLF_TOKEN! });

const sizes = await hw.slices.sizes();                    // read the price first
const slice = await hw.slices.create({ size: 'small', image: 'python312', name: 'build-box' }, { confirm: true });
const out = await hw.slices.run(slice.id, { cmd: ['python3', '--version'] });   // waits for as long as the command runs
console.log(out.stdout);
await hw.slices.delete(slice.id, { confirm: true });

Creating, deleting and changing limits need a token with the Write ability and a team owner or admin. Reads work with a read token.

Sizes and prices#

SizeAPI namevCPURAMDiskPer monthPer hour
small0.5x5120.5512 MiB2 GiB$2.42$0.003316
compact1x5121512 MiB2 GiB$3.33$0.004562
medium1x102411 GiB4 GiB$4.49$0.006151
large2x204822 GiB8 GiB$8.65$0.011850
xlarge2x409624 GiB16 GiB$9.62$0.013179

compact is the same memory as small with a full vCPU, so it costs more than small and less than medium (which has twice the memory for the same vCPU). Wherever a size is given, the name or the API name works.

The price follows the larger of the memory and the CPU the size takes. The monthly price is billed by the hour: the hourly price is the monthly price divided by 730, and partial hours are charged exactly, down to the second. The prices are in USD. GET /hostwolf/slices/sizes always has the current prices; prefer it over this table. Slices: from $5.00/month. While you have any slice running you pay at least $5.00/month ($0.00685 an hour), prorated by the hour; more slices share that minimum. In an hour in which your slices cost less than the minimum for the time at least one of them ran, the difference is added as one line, Slices minimum. GET /hostwolf/slices/sizes also returns team_minimum_monthly, team_minimum_hourly, from_monthly and a ready-made pricing_note. Your team may be limited to some sizes (see workspaces and limits).

The disk of a size is a hard quota: a write past it fails with "no space left on device". Its content is wiped when the slice is deleted. For data that must outlive a slice use a volume.

Limits#

Slices per team5
Volumes attached to one slice5
Volume size1 to 500 GB each, 2000 GiB per team in all
exec timeout1 to 3600 seconds
exec standard input1 MiB
One file written with PUT .../files64 MiB
Items in one files import or export1000
Usage summary range93 days
Open live streams200 in total and 20 per team

Requests are rate limited per token (changes, commands and reads each have their own limit); a 429 carries Retry-After. Your team can also have only a limited number of commands that wait, and long polls, open at once; beyond it the answer is 429 too_many_inflight: repeat after a few seconds. No request is held longer than 20 seconds: a longer command answers 202 and you poll it. Two creates of your team at the same moment are taken one after the other; if the second has to wait too long it answers 429 busy: repeat it.

Workspaces#

A workspace is a named group of slices inside your team, for example one per project or per environment. Slices and volumes belong to a workspace (default unless you give workspace: lowercase letters, digits and hyphens, 1 to 40 characters). GET /hostwolf/slices lists one workspace at a time. Each workspace has its own limits.

Create a slice#

POST /hostwolf/slices

Field
sizeRequired: small, compact, medium, large or xlarge (or the API name).
imageRequired: an image from GET /hostwolf/slices/images: debian12, python312 or node22. See images.
nameOptional. Up to 63 letters, digits, spaces, dots, dashes and underscores.
workspaceOptional: which workspace it belongs to. Default default.
classOptional pool. Teams run in standard, which is the default.
durableOptional. A durable slice (the default) stays up until deleted and restarts after a failure. false together with timeout_s makes a short-lived slice.
timeout_sShort-lived slices: end the slice after this many seconds (expires_at).
idle_timeout_sEnd it after this many seconds without a command or request.
orphan_after_sEnd it this many seconds after the last request made with your token went away.
retain_sKeep its logs and files readable this many seconds after it ended.
cmdOptional array: the command the slice runs. The image's own when left out.
cwd, envOptional working directory and environment variables.
labelsOptional object of labels (key: value); GET /hostwolf/slices can filter on them.
filesOptional array of files written before the command starts: path (under /workspace) and one of content_b64 or url (HTTPS), optional sha256 and mode.
volumesOptional array of {id, path}: your free volumes, each mounted at a path under /workspace (up to 5).
exposeOptional array of {port}: ports published over HTTPS, see endpoints on the slice.
egressOptional outbound network. Slices have no outbound network access at the moment: the only mode accepted is {"mode": "off"}, which is also the default. Bring files in with files and the files calls instead.
logOptional caps for the command's log: max_bytes, rate_bytes_s.
max_wait_msHow long the create may wait for a machine before it answers starting.
confirmRequired: true means you accept the quoted price.
expected_monthly_priceOptional: the monthly price you saw. A higher price is refused before anything starts.

Without confirm: true nothing is created. The answer is 422 with confirm_required and a quote (monthly and hourly price, and the team minimum), the same call a CLI makes before it asks you to add --confirm.

Send an Idempotency-Key on every change (any 1 to 255 visible characters, a UUID works). A retry with the same key and the same request returns the first answer, so a dropped connection never starts two slices.

The first start can take a few minutes#

When no machine is ready for your slice, one is made ready first. The answer is then 503 with error: "starting" and retry_after_s. This is not a failure and nothing is billed yet: repeat the same request (same Idempotency-Key) after that many seconds. The CLI and the SDK do this for you (--wait, waitMs); the MCP tool returns state: starting and the key to call again with. Later starts are usually quick.

The slice object#

A slice is starting while it comes up, then running. The other states are stopped, suspended (see below), deleting, deleted and failed. exit says why and when it ended (reason, exit_code). endpoints lists each published port with its url and route_token, which clients send with their requests. price has the monthly and hourly price. Billing starts at started_at and stops at ended_at.

List and filter#

GET /hostwolf/slices?workspace=ci&state=running&labels[env]=prod&limit=100 returns {data, next_cursor}. Every labels[name]=value must match. Deleted slices are left out unless you ask with state=deleted or include_deleted=true. While next_cursor is present, pass it as cursor to get the next page (limit is at most 500).

hostwolf apps slices list --workspace ci --state running --label env=prod

Run commands#

POST /hostwolf/slices/{id}/exec (the same route is also /execs)

{"cmd": ["sh", "-c", "ls | wc -l"], "cwd": "/workspace", "env": {"A": "1"}, "timeout_s": 60, "stdin": "optional text", "wait": true, "max_output_bytes": 1048576}

cmd is an argument list, not a shell line: use ["sh", "-c", "..."] for pipes and redirects. The slice must be running. Keep the working directory and your files under /workspace.

With wait true (the default) the answer holds for up to 20 seconds:

  • A command that finished answers 200 with {id, state: "exited", exit_code, reason, stdout, stderr, truncated, duration_ms}. reason is exit, timeout, oom, killed or error. A command that exits non-zero is still a 200: read exit_code. stdout_b64 and stderr_b64 carry the exact bytes; stdout and stderr are text with invalid bytes replaced.
  • A longer command answers 202 with state: "running" and its id. timeout_s (at most 3600) is how long it may run.

With wait false the answer is 202 at once.

Follow an asynchronous command with its exe_... id:

Call
GET /hostwolf/slices/execs/{id}?wait_ms=20000The command's state and, once it ended, its output. wait_ms (at most 20000) holds the answer until it ends.
GET /hostwolf/slices/execs/{id}/output?since=0Output as it is produced: {entries, next_seq, eof}. Pass the last next_seq as since until eof is true.
POST /hostwolf/slices/execs/{id}/signal{"signal": "TERM"}: TERM, KILL, INT or HUP.
hostwolf apps slices exec build-box --cwd /workspace -- sh -c 'ls | wc -l'     # waits for the end, however long
hostwolf apps slices execs start build-box -- sh -c './long-job.sh'              # prints exe_...
hostwolf apps slices execs output exe_0f3c2a9d8e7b --follow
hostwolf apps slices execs signal exe_0f3c2a9d8e7b --signal TERM
const started = await hw.slices.startExec(slice.id, { cmd: ['sh', '-c', './long-job.sh'], timeout_s: 1800 });
for await (const e of hw.slices.follow({ exec: started.id })) process.stdout.write(Buffer.from(e.data_b64, 'base64'));
const done = await hw.slices.waitExec(started.id);

Repeating a start with the same Idempotency-Key returns the same command instead of running it twice.

Live streams#

To watch commands or logs as they happen, ask for a ticket and open the WebSocket it names.

POST /hostwolf/slices/{id}/tickets with {"purpose": "exec"} (all commands of the slice, the default), {"purpose": "exec:exe_..."} (one command) or {"purpose": "logs"} (the slice's log) answers 201 with {ticket, url, expires_at}. The ticket is the credential: open url right away (wss://stream.hostwolf.net/v1/stream/<ticket>). It is valid for about a minute and for one connection. The slice must be running (otherwise 409). A logs ticket needs only a read token. If streaming is temporarily unavailable the answer is 503 unavailable: read the log or poll the command instead. The number of open streams is limited (see limits); beyond it a new connection is refused, so close streams you no longer need.

hostwolf apps slices tickets build-box --purpose logs

For plain reading without a WebSocket, poll the output and log pages as above.

Files#

Call
GET /hostwolf/slices/{id}/files?path=/workspace/app.pyThe file's bytes.
PUT /hostwolf/slices/{id}/files?path=/workspace/app.py&mode=0644The request body is the file's bytes (up to 64 MiB). Creates or replaces it.
GET /hostwolf/slices/{id}/files/list?path=/workspace&recursive=trueThe entries of a directory (default /workspace).
POST /hostwolf/slices/{id}/files/import{items: [{path, url, sha256?}]}: downloads each HTTPS url to its path, checked against sha256 when given.
POST /hostwolf/slices/{id}/files/export{items: [{path, put_url}]}: uploads each file to a presigned HTTPS put_url that you made with your own storage key.

Files can only be read and written under /workspace: any other path is refused with 400 forbidden_path ("Files can only be read and written under /workspace."). Import and export take up to 1000 items. The answer is 200 with imported and failed (or uploaded and failed): every item answers on its own, so check failed.

hostwolf apps slices files put build-box /workspace/app.py ./app.py --mode 0644
hostwolf apps slices files get build-box /workspace/app.py --output app.py
hostwolf apps slices files list build-box /workspace --recursive
hostwolf apps slices files import build-box --item /workspace/data.csv=https://example.com/data.csv --sha256 /workspace/data.csv=<hex>
hostwolf apps slices files export build-box --item /workspace/out.tar=https://bucket.example.com/out.tar?X-Amz-Signature=...

Paths are absolute and under /workspace. Anything that is not on a volume is lost when the slice is deleted.

Logs#

GET /hostwolf/slices/{id}/logs?since=0 returns structured pages {entries, next_seq, eof, truncated}. Each entry has seq, stream (stdout or stderr), data_b64 and at. Read on with since set to the last next_seq until eof is true. ?format=text returns the whole log as plain text instead.

hostwolf apps slices logs build-box --follow
hostwolf apps slices logs build-box --since 120
hostwolf apps slices logs build-box --text

Published ports and route tokens#

Each port in expose gets an HTTPS url and a route_token (also shown as access_token) that clients send with their requests. To replace the tokens, for example after one leaked, call POST /hostwolf/slices/{id}/route-tokens/rotate with an optional {"port": 8080} (all ports when left out). The answer has the endpoints with their new tokens; the old tokens stop working at once.

hostwolf apps slices route-tokens rotate build-box --port 8080 --confirm

Images#

A slice starts from one of the images in GET /hostwolf/slices/images: debian12 (Debian 12), python312 (Python 3.12) and node22 (Node.js 22). Importing images of your own and building images from a Dockerfile are not available. To bring code or data into a slice, write it under /workspace with files or the files calls.

Volumes#

A volume is persistent storage that exists apart from any slice. Create one, attach it when you create a slice, and the data stays when the slice is deleted or replaced.

Call
GET /hostwolf/slice-volumesYour volumes with their state (ready, attached).
POST /hostwolf/slice-volumes{name?, size_gb, workspace?, fast_writes?, confirm: true}. Without confirm the answer quotes the price. fast_writes turns on fast writes.
GET /hostwolf/slice-volumes/{id}One volume.
PATCH /hostwolf/slice-volumes/{id}{size_gib?, fast_writes?} (at least one). size_gib makes the volume bigger, in place, even while attached (1 to 500 GiB, the same maximum as creating one). The extra space is billed from now, the old size up to now. Answers 200 with the volume; the same size changes nothing. A smaller size is 409 volume_shrink_refused (the body has current_size_gib and requested_size_gib); no credit for the extra is 402 payment_required; the workspace's volume quota is 429 org_quota. A refusal changes nothing.
DELETE /hostwolf/slice-volumes/{id}Deletes it and its data. Refused while it is attached to a slice.
hostwolf apps slices volumes create --name data --size-gb 10 --confirm
hostwolf apps slices volumes grow data --size-gib 25 --confirm
hostwolf apps slices create --size medium --image node22 --volume slv_0f3c2a9d8e7b:/workspace/data --confirm

A volume is billed per GB-month, by the hour, from creation until you delete it, whether or not a slice uses it: $0.0248 per GB-month, rounded up to the cent once for the whole volume (10 GB is $0.25 a month, 100 GB is $2.48). A volume can be attached to one slice at a time. A volume can be made bigger with PATCH /hostwolf/slice-volumes/{id} (see above) but never smaller: a smaller size is refused with 409 volume_shrink_refused. A volume is 1 to 500 GB, and your team can hold up to 2000 GiB of volumes in all. If the machine under a slice fails, the slice is started again on another machine with its volumes re-attached and a fresh disk.

Volume performance with small files#

A volume is made for data and state, not for building software. Work that touches many small files one after the other is much slower on a volume than on the slice's own disk: a single stream (git clone, extracting a tar or npm archive, creating files one by one) manages about 15 to 25 files a second, and parallel writers reach about 100 files a second. Large files are not affected: their throughput is the same as on the slice's disk.

Put node_modules, build output and checkouts on the slice's local disk; keep volumes for data and state (databases, uploads, models).

Fast writes (opt-in)#

Fast writes (write-back cache) is a setting of a volume. It is off by default and it does not change the price. With it on, a write is acknowledged as soon as it is on the machine's own disk and is sent to the volume a moment later, so many small files go through about two to four times faster: on a test machine, creating small files one after the other went from about 24 to about 63 files a second, eight parallel writers from about 118 to about 478, extracting a tree of 3000 files from about 14 to about 28 files a second, and cloning a repository of 1135 files from 60 to 25 seconds.

Files written in the last few seconds can be lost if the server crashes; best for build caches and dependencies. Do not use it for databases or anything you cannot rebuild. A slice is only released from its volume after everything written has been sent, so deleting or restarting a slice never loses data; the risk is a machine that fails while writes are still waiting.

Set it when you create the volume (fast_writes) or change it later with PATCH /hostwolf/slice-volumes/{id}. On a volume that is attached to a slice, the change applies the next time the slice starts: the answer says fast_writes_pending with a fast_writes_note. The CLI is hostwolf apps slices volumes create --fast-writes and hostwolf apps slices volumes update <id> --fast-writes=true|false; the SDK is slices.volumes.update(id, { fastWrites }) and the MCP tool is slices_volumes_update.

Workspaces and limits#

Every workspace has limits that keep one project from using up the whole team's allowance.

GET /hostwolf/slices/workspaces/{workspace}/limits shows them; PUT replaces them (what you leave out falls back to your team's grant):

Field
max_concurrentMost slices at once.
max_cpu_millisMost CPU at once, in thousandths of a core.
max_sizeThe largest size: small, compact, medium, large or xlarge.
classesPools that may be used (standard).
egress_modes, egress_allowed_hostsOutbound network modes and allowed hosts. Outbound network is off for all slices at the moment, so only off can be set.
creates_per_s, execs_per_sRates for creating slices and running commands.
max_volumes, volume_quota_gibHow many volumes and how many GiB of them.
max_spend_usd_per_dayA daily spend cap in USD (null for none).

A value above your team's caps is refused with 422. Only team owners and admins can change limits.

hostwolf apps slices workspaces limits get ci
hostwolf apps slices workspaces limits put ci --max-concurrent 3 --max-size medium --confirm

Events, usage and your bill#

GET /hostwolf/slices/events?after=0&limit=100&types=usage,slice.started is your team's feed, oldest first: usage (what each slice used, per interval), storage.usage, slice.*, build.done, volume.*, image.* and limit events. The answer is {events, next_cursor}; poll with the next_cursor of the last page as after. Use it to reconcile your own records with the bill.

GET /hostwolf/slices/usage/summary?from=2026-11-01T00:00:00Z&to=2026-11-08T00:00:00Z adds up what your slices used in that range (at most 93 days) per workspace: {from, to, group_by, groups: [{workspace, billable_ms, events}]}.

hostwolf apps slices events --after 0 --types usage
hostwolf apps slices usage summary --from 2026-11-01 --to 2026-11-08

Billing#

  • Billing starts when the slice starts and runs by the hour, to the second, until you delete it or it ends. It does not matter whether the slice is idle.
  • A short-lived slice stops billing when it ends; DELETE ends billing at once (ended_at). The final partial hour is charged and nothing after it. Deleting a deleted slice answers its final state again. DELETE can answer state deleting: billing has already ended at ended_at, and the slice and its volume are free again when Hostwolf has finished stopping it.
  • Volumes are billed separately from the slices that use them.
  • Slices and volumes are charged to your account credit or invoice like the other usage on your team.

When the credit runs out#

A team whose account credit runs out and that has no payment method that works is suspended, as with servers. Its slices are stopped (suspended) and compute billing pauses; volumes keep their data and keep billing. Add credit or fix the payment method and the slices start again, with a new empty disk and their volumes re-attached. A suspended team cannot create slices. If the credit is not restored within 3 days of the lapse, the volumes and their data are deleted and cannot be recovered.

What a slice cannot do#

  • Reach the internet: outbound network is off, so a slice cannot send mail, download packages or call other services. Put what it needs under /workspace before it runs.
  • A slice cannot see other customers' machines or your other slices.

Errors#

StatuscodeMeaning
400forbidden_path"Files can only be read and written under /workspace."
401Missing or wrong token.
402insufficient_creditYour account credit cannot cover the order: "Add credit (needs $X)". The answer has needed_usd, balance_usd and top_up_url.
402payment_requiredAdd a card or account credit first.
402spend_capThe workspace reached its daily spend limit (max_spend_usd_per_day).
403Only team owners and admins can change slices; the token needs the Write ability.
404not_offeredSlices are switched off for your team (reads only).
404No such slice, volume or command on your team.
409capacity"Capacity is full in right now. Try again later or pick another region." The answer has region and, when known, regions_with_room. Nothing was started or charged.
409limit5 slices per team.
409suspendedThe account credit ran out.
409volume_in_useThe volume is attached to a slice.
409A ticket needs a running slice.
409conflictThe Idempotency-Key was used with different input.
413A file over 64 MiB.
422confirm_requiredNothing changed: the body has the quote. Send confirm: true.
422Invalid input or a value above your limits; the answer names the field.
429rate_limitedToo many requests for the token: wait Retry-After seconds.
429too_many_inflightYour team already has the most commands that wait, or long polls, open at once: repeat after a few seconds.
429busyAnother create of your team is still running: repeat after a few seconds.
503startingA machine is being made ready. Not a failure: repeat the same request (same Idempotency-Key) after retry_after_s seconds.
503capacityNo machine could be added right now (retry_after_s); try again later.
503unavailableTemporarily unavailable, or creating slices is switched off for a while; also live streaming when it is not open.

SDK, CLI and MCP#

SDKhw.slices: sizes(), images(), list(), listPage(), all(), get(), create(), delete(), volumes.grow(id, sizeGib, { confirm: true }); commands exec(), run(), startExec(), getExec(), execOutput(), signalExec(), waitExec(); logs(), logsText(), follow(), ticket(), rotateRouteTokens(); files getFile(), putFile(), listFiles(), importFiles(), exportFiles(); importImage(), getImage(), deleteImage(), startBuild(), getBuild(), buildLogs(), cancelBuild(); events(), usageSummary(), getLimits(), putLimits(); and hw.slices.volumes.list(), get(), create(), delete()
CLIhostwolf apps slices with sizes, list, create, get, delete, exec, execs (start, get, output, signal), logs, files (list, get, put, import, export), tickets, route-tokens rotate, images (list, get, import, rm), builds (start, get, logs, cancel), events, usage summary, workspaces limits (get, put) and volumes (list, create, get, delete). --confirm is required to create, delete, import, build, rotate tokens or change limits; --json prints the raw answer.
MCPThe slices toolset (?toolsets=slices on the hosted URL, HOSTWOLF_TOOLSETS=slices for the self-run server): slices_sizes, slices_images, slices_list, slices_get, slices_create, slices_delete, slices_volumes_grow, slices_exec, slices_exec_get, slices_exec_output, slices_exec_signal, slices_logs, slices_ticket_create, slices_files_get, slices_files_put, slices_files_list, slices_files_import, slices_files_export, slices_route_tokens_rotate, slices_images_import, slices_images_get, slices_images_delete, slices_builds_start, slices_builds_get, slices_builds_logs, slices_builds_cancel, slices_events, slices_usage_summary, slices_limits_get, slices_limits_put, slices_volumes_list, slices_volumes_get, slices_volumes_create, slices_volumes_delete

Tools that cost money, delete or lock clients out do nothing without confirm: the first answer shows the price or the consequence, and only after the user agrees does the second call go ahead.

The clients also have calls for importing images and building from a Dockerfile (importImage(), startBuild(), images import, builds start, slices_images_import, slices_builds_start and the related get, logs, cancel and delete calls). Those features are not available yet, so leave them out.

Stuck, or missing an endpoint? Tell us at app.hostwolf.net/contact or [email protected].