compute
What runs on NoClick for you now: your machines (with the conversations on each), every agent's sandbox that's up, and your live sandboxes, each with its price an hour.
running = noclick.compute(user_filter="all")
per_hour = sum(c.usd_per_hour or 0 for c in running if c.status == "running")function compute(options?: ReadOptions): Promise<ComputeItem[]>Your machines (any status, with the conversations on each), every agent's sandbox up now and every live Sandbox,
each with its price an hour. Each part needs its area's scope (machines, agents, sandboxes); a key with only
some gets those. Your own computers aren't in it.
Which users the read covers (user_id query), instead of acting as one (user).
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Each machine or sandbox: its kind, status, size, price an hour and what runs on it.
/**
* Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
* `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
*/
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;ComputeItem
interface ComputeItemA machine, an agent's sandbox or a sandbox, as it runs now.
| kind | "machine" | "agent_sandbox" | "sandbox" |
|
| id | string | Its id (an agent's sandbox: its name). |
| name | string | null | The machine's name, the agent's, or a sandbox's image. |
| status | string | null | |
| userId | string | null | |
| region | string | null | |
| cpu | number | null | |
| memoryGb | number | null | |
| startedAt | Date | null | |
| usdPerHour | number | null | What an hour of it costs (a machine: its month's price over 730 hours). |
| usdPerMonth | number | null | A machine's price a month. |
| spentUsdToday | number | null | What an agent's sandbox charged since midnight UTC. |
| running | ComputeRun[] | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };ComputeRun
interface ComputeRunA conversation running on a machine or in an agent's sandbox.
| agentId | string | null | |
| agentName | string | null | |
| conversation | string | null | The agent's conversation (as |
| harness | string | null | |
| state | string |
|