An open-source, faster Devin alternative
TypeScript
Document usage date query formats
Igor Zalutski689e6c44aee6
diff --git a/docs/api-reference/usage/get-sandbox-usage.mdx b/docs/api-reference/usage/get-sandbox-usage.mdxindex aa259f03..1f90397d 100644--- a/docs/api-reference/usage/get-sandbox-usage.mdx+++ b/docs/api-reference/usage/get-sandbox-usage.mdx@@ -21,11 +21,13 @@ resident memory consumed by the sandbox process, sampled every 60s.</ParamField><ParamField query="from" type="string">- RFC3339 lower bound. Default: now minus 1 hour.+ Lower bound. Accepts either an ISO date (`2026-05-27`, interpreted+ as UTC midnight) or an RFC3339 timestamp. Default: now minus 1 hour.</ParamField><ParamField query="to" type="string">- RFC3339 upper bound. Default: now. Window must be ≤ 30 days.+ Upper bound. Same accepted formats as `from`. Default: now. Window+ must be ≤ 30 days.</ParamField>## Responsediff --git a/docs/api-reference/usage/get-usage.mdx b/docs/api-reference/usage/get-usage.mdxindex 9a1f5edc..e627e90b 100644--- a/docs/api-reference/usage/get-usage.mdx+++ b/docs/api-reference/usage/get-usage.mdx@@ -38,12 +38,14 @@ billing pipeline uses, so the numbers here match the invoice.</ParamField><ParamField query="from" type="string">- RFC3339 inclusive lower bound. Default: now minus 30 days. Max- window: 90 days.+ Inclusive lower bound. Accepts either an ISO date (`2026-05-27`,+ interpreted as UTC midnight) or an RFC3339 timestamp. Default: now+ minus 30 days. Max window: 90 days.</ParamField><ParamField query="to" type="string">- RFC3339 exclusive upper bound. Default: now.+ Exclusive upper bound. Same accepted formats as `from`. Default:+ now.</ParamField><ParamField query="filter[tag:<key>]" type="string">diff --git a/docs/reference/typescript-sdk.mdx b/docs/reference/typescript-sdk.mdxindex e2516f3a..754fc8df 100644--- a/docs/reference/typescript-sdk.mdx+++ b/docs/reference/typescript-sdk.mdx@@ -266,8 +266,8 @@ const tags = new Tags("https://app.opencomputer.dev", process.env.OPENCOMPUTER_A### `usage.forSandbox(sandboxId, opts?): Promise<SandboxUsageResponse>`Return 1-minute allocated and used memory points for one sandbox.-`from` and `to` are optional RFC3339 timestamps; default window is the-last hour.+`from` and `to` accept ISO dates (`YYYY-MM-DD`) or RFC3339+timestamps; default window is the last hour.```typescriptconst r = await usage.forSandbox("sb-abc123", {@@ -280,7 +280,7 @@ console.log(r.totals.memoryAllocatedGbSeconds, r.totals.memoryUsedGbSeconds);### `usage.bySandbox(opts?): Promise<UsageBySandboxResponse>`-Rank sandboxes by usage. Supports RFC3339 `from` / `to`,+Rank sandboxes by usage. Supports ISO date or RFC3339 `from` / `to`,`filter`, `sort`, `limit`, and `cursor`.```typescriptdiff --git a/docs/reference/typescript-sdk/usage.mdx b/docs/reference/typescript-sdk/usage.mdxindex f3234bab..ecda0738 100644--- a/docs/reference/typescript-sdk/usage.mdx+++ b/docs/reference/typescript-sdk/usage.mdx@@ -34,11 +34,13 @@ Return 1-minute memory points plus envelope totals for one sandbox.</ParamField><ParamField body="from" type="string">- RFC3339 lower bound. Default: now minus 1 hour.+ ISO date (`YYYY-MM-DD`) or RFC3339 lower bound. Default: now minus+ 1 hour.</ParamField><ParamField body="to" type="string">- RFC3339 upper bound. Default: now. Window must be at most 30 days.+ ISO date (`YYYY-MM-DD`) or RFC3339 upper bound. Default: now.+ Window must be at most 30 days.</ParamField>**Returns:** `Promise<SandboxUsageResponse>`@@ -67,11 +69,13 @@ for (const point of r.points) {Rank sandboxes by usage for an organization. [HTTP API ->](/api-reference/usage/get-usage)<ParamField body="from" type="string">- RFC3339 lower bound. Default: now minus 30 days.+ ISO date (`YYYY-MM-DD`) or RFC3339 lower bound. Default: now minus+ 30 days.</ParamField><ParamField body="to" type="string">- RFC3339 upper bound. Default: now. Window must be at most 90 days.+ ISO date (`YYYY-MM-DD`) or RFC3339 upper bound. Default: now.+ Window must be at most 90 days.</ParamField><ParamField body="filter" type="Record<string, string>">@@ -130,11 +134,13 @@ Group usage by the value of one tag key. Tag keys may contain `:`.</ParamField><ParamField body="from" type="string">- RFC3339 lower bound. Default: now minus 30 days.+ ISO date (`YYYY-MM-DD`) or RFC3339 lower bound. Default: now minus+ 30 days.</ParamField><ParamField body="to" type="string">- RFC3339 upper bound. Default: now. Window must be at most 90 days.+ ISO date (`YYYY-MM-DD`) or RFC3339 upper bound. Default: now.+ Window must be at most 90 days.</ParamField><ParamField body="sort" type="string">diff --git a/docs/sandboxes/usage.mdx b/docs/sandboxes/usage.mdxindex 3de08476..88004b19 100644--- a/docs/sandboxes/usage.mdx+++ b/docs/sandboxes/usage.mdx@@ -94,7 +94,8 @@ falls out of `points[]` directly: `allocatedMemoryMb` is the step,GET /api/sandboxes/sb-abc/usage?from=2026-05-27T00:00:00Z&to=2026-05-27T01:00:00Z```-Path carries the sandbox ID. `from` and `to` are optional RFC3339+Path carries the sandbox ID. `from` and `to` are optional and accept+ISO dates (`YYYY-MM-DD`, interpreted as UTC midnight) or RFC3339timestamps; omit them for the last hour. Max window is **30 days**.Full param reference: the[API page](/api-reference/usage/get-sandbox-usage).diff --git a/sdks/python/opencomputer/usage.py b/sdks/python/opencomputer/usage.pyindex a696d79f..71e5ab94 100644--- a/sdks/python/opencomputer/usage.py+++ b/sdks/python/opencomputer/usage.py@@ -100,7 +100,9 @@ class SandboxUsageTotals:@dataclassclass SandboxUsageResponse:"""Response for ``GET /sandboxes/:id/usage``. Default window is- last 1 hour; max 30 days (server returns 400 beyond that)."""+ last 1 hour; max 30 days (server returns 400 beyond that).+ ``from_`` and ``to`` accept ISO dates (``YYYY-MM-DD``) or RFC3339+ timestamps."""sandbox_id: strfrom_: strdiff --git a/sdks/typescript/src/usage.ts b/sdks/typescript/src/usage.tsindex b1ca329e..bb57e154 100644--- a/sdks/typescript/src/usage.ts+++ b/sdks/typescript/src/usage.ts@@ -72,8 +72,8 @@ export interface UsageFilterMap {}export interface UsageQueryOpts {- from?: string; // RFC3339; default: now - 30d- to?: string;+ from?: string; // ISO date (YYYY-MM-DD) or RFC3339; default: now - 30d+ to?: string; // ISO date (YYYY-MM-DD) or RFC3339filter?: UsageFilterMap;sort?: "-memoryGbSeconds" | "-diskOverageGbSeconds";limit?: number;