Skip to main content
Use Usage for billing-aligned usage queries and per-sandbox time-series drilldowns. Use Tags to set and read sandbox tags used by the usage aggregator.
Preview: Usage and tag APIs are new. Endpoints, response fields, and SDK method names may change before GA; temporary inaccuracies or rough edges are possible while the surface settles.
The apiUrl may include or omit /api; both https://app.opencomputer.dev and https://app.opencomputer.dev/api work.

usage.forSandbox(sandboxId, opts?)

Return 1-minute memory points plus envelope totals for one sandbox. HTTP API ->
sandboxId
string
required
Sandbox ID.
from
string
ISO date (YYYY-MM-DD) or RFC3339 lower bound. Default: now minus 1 hour.
to
string
ISO date (YYYY-MM-DD) or RFC3339 upper bound. Default: now. Window must be at most 30 days.
Returns: Promise<SandboxUsageResponse>

usage.bySandbox(opts?)

Rank sandboxes by usage for an organization. HTTP API ->
from
string
ISO date (YYYY-MM-DD) or RFC3339 lower bound. Default: now minus 30 days.
to
string
ISO date (YYYY-MM-DD) or RFC3339 upper bound. Default: now. Window must be at most 90 days.
filter
Record<string, string>
Tag filters. Keys are dimensions such as "tag:team". Values are exact tag values, comma-separated OR values, or "" to match sandboxes without that tag key.
sort
string
"-memoryGbSeconds" (default) or "-diskOverageGbSeconds".
limit
number
Max rows per page. Default 50, max 500.
cursor
string
Cursor returned by the previous page’s nextCursor.
Returns: Promise<UsageBySandboxResponse>

usage.byTag(tagKey, opts?)

Group usage by the value of one tag key. Tag keys may contain :. HTTP API ->
tagKey
string
required
Tag key to group by, for example "team" or "team:subsystem".
filter
Record<string, string>
Optional tag filters applied before grouping.
from
string
ISO date (YYYY-MM-DD) or RFC3339 lower bound. Default: now minus 30 days.
to
string
ISO date (YYYY-MM-DD) or RFC3339 upper bound. Default: now. Window must be at most 90 days.
sort
string
"-memoryGbSeconds" (default) or "-diskOverageGbSeconds".
limit
number
Max rows per page. Default 50, max 500.
cursor
string
Cursor returned by the previous page’s nextCursor.
Returns: Promise<UsageByTagResponse>

tags.set(sandboxId, tags)

Replace the full tag set for a sandbox. Partial updates are not supported: read, modify, then write the full map. HTTP API ->
sandboxId
string
required
Sandbox ID.
tags
Record<string, string>
required
Flat tag map. {} clears all tags.
Returns: Promise<{ tags: Record<string, string>; tagsLastUpdatedAt: string | null }>

tags.get(sandboxId)

Read the current tag set for a sandbox. HTTP API -> Returns: Promise<{ tags: Record<string, string>; tagsLastUpdatedAt: string | null }>

tags.listKeys()

List tag keys seen in the organization, with counts for tagged sandboxes and distinct values. HTTP API -> Returns: Promise<TagKeyInfo[]>

Units

All *GbSeconds fields are GiB-seconds. For example, a sandbox provisioned at 4096 MiB for one minute reports 240 memoryAllocatedGbSeconds. memoryAllocatedGbSeconds is billing-aligned provisioned memory. memoryUsedGbSeconds is measured resident memory from the worker collector, so it can lag by a few minutes after a sandbox starts.

Types