From ff1bf315ed0d23e2ffdf268d79456a69f93b4405 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2026 19:01:48 +0200 Subject: [PATCH] docs(www): hide Console Usage API documentation (#51358) Co-authored-by: vimtor <36263538+vimtor@users.noreply.github.com> --- .../www/src/docs/content/console/byok.mdx | 3 +- .../www/src/docs/content/console/usage.mdx | 146 ------------------ services/www/src/docs/lib/navigation.ts | 1 - 3 files changed, 1 insertion(+), 149 deletions(-) delete mode 100644 services/www/src/docs/content/console/usage.mdx diff --git a/services/www/src/docs/content/console/byok.mdx b/services/www/src/docs/content/console/byok.mdx index 60aa60251f1..f364e0b430e 100644 --- a/services/www/src/docs/content/console/byok.mdx +++ b/services/www/src/docs/content/console/byok.mdx @@ -128,5 +128,4 @@ workspace with `/connect`, and `/models` lists their enabled models. ## Usage and limits The provider bills you for the tokens. Console records every request and, using the pricing configured on the model, -counts it toward workspace and member monthly limits. In [usage exports](/console/usage), BYOK rows have -`billing_source` set to `byok` and a zero `cost_micro_cents`. +counts it toward workspace and member monthly limits. diff --git a/services/www/src/docs/content/console/usage.mdx b/services/www/src/docs/content/console/usage.mdx deleted file mode 100644 index ca6b385406a..00000000000 --- a/services/www/src/docs/content/console/usage.mdx +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: "Usage API" -description: "Export usage records as CSV for a workspace, member, service account, or model." ---- - -Export usage records as CSV for a workspace, member, service account, or model. Use the versioned endpoint in scripts, -reporting jobs, and billing integrations. - -## Quick start - -Create a service account API key in the [Console](https://opencode.ai/console). This endpoint accepts service account -keys only; user session tokens are rejected. - -```bash -export CONSOLE_URL="https://opencode.ai/console" -export SERVICE_API_KEY="oc_sk_..." -``` - -Export the last seven days of workspace usage: - -```bash -curl --fail-with-body --get \ - "${CONSOLE_URL}/api/v1/usage/export" \ - --header "Authorization: Bearer ${SERVICE_API_KEY}" \ - --header "Accept: text/csv" \ - --data-urlencode "scope=organization" \ - --data-urlencode "range=7d" \ - --output "usage-organization-7d.csv" -``` - -A successful request writes `usage-organization-7d.csv`. Remove `--output` to print the CSV in your terminal instead. - -## Endpoint and scopes - -```text -GET /api/v1/usage/export -``` - -Every request requires `scope` and `range`. Supported ranges are `24h`, `7d`, and `30d`. They start at midnight UTC -rather than being rolling windows. The full range is returned as a single streamed CSV file, regardless of size. - -| Scope | Additional parameters | Result | -| ----------------- | ---------------------- | ---------------------------------------- | -| `organization` | None | All usage in the workspace. | -| `member` | `user_email` | Usage attributed to one member. | -| `service_account` | `service_account_id` | Usage attributed to one service account. | -| `model` | `provider` and `model` | Usage for one provider and model pair. | - - - Member, service account, and model filters are mutually exclusive. Extra filters return HTTP 400 instead of being - silently ignored. - - -## Export examples - -One member: - -```bash -curl --fail-with-body --get \ - "${CONSOLE_URL}/api/v1/usage/export" \ - --header "Authorization: Bearer ${SERVICE_API_KEY}" \ - --header "Accept: text/csv" \ - --data-urlencode "scope=member" \ - --data-urlencode "range=24h" \ - --data-urlencode "user_email=alice@example.com" \ - --output "usage-member-24h.csv" -``` - -One service account: - -```bash -curl --fail-with-body --get \ - "${CONSOLE_URL}/api/v1/usage/export" \ - --header "Authorization: Bearer ${SERVICE_API_KEY}" \ - --header "Accept: text/csv" \ - --data-urlencode "scope=service_account" \ - --data-urlencode "range=30d" \ - --data-urlencode "service_account_id=svcacct_..." \ - --output "usage-service-account-30d.csv" -``` - -One provider and model: - -```bash -curl --fail-with-body --get \ - "${CONSOLE_URL}/api/v1/usage/export" \ - --header "Authorization: Bearer ${SERVICE_API_KEY}" \ - --header "Accept: text/csv" \ - --data-urlencode "scope=model" \ - --data-urlencode "range=7d" \ - --data-urlencode "provider=anthropic" \ - --data-urlencode "model=claude-sonnet-4-5" \ - --output "usage-model-7d.csv" -``` - -Provider is the provider catalog key, such as `anthropic`, `deepseek`, or `opencode`. A valid filter with no matching -records still returns HTTP 200 with a header-only CSV file. - -## CSV response - -Results are newest first. Empty optional values are blank cells. `cost_micro_cents` is the amount charged by Console -in microcents, where 100,000,000 equals one dollar. Managed-inference usage carries its charge; free, BYOK, and -unclassified legacy usage have a zero charge. - -Organization and member exports include [Websearch](/console/websearch) charges. Search rows identify `web-search` in -the `service` column and leave provider, model, and token fields blank. Model and provider filters select inference -records only. - -
- -| Field | Description | -| ------------------------- | -------------------------------------------------------------------------------------------------------- | -| `id` | Unique record ID. New service records use a `service:` prefix; inference and historical IDs are numeric. | -| `user_email` | Current email of the member that generated the usage, when applicable. | -| `service_account_name` | Current name of the service account that generated the usage, when applicable. | -| `app` | Client app title, or its referrer when no title was reported. | -| `provider` | Provider catalog key, such as `openai`, `anthropic`, `deepseek`, or `opencode`. | -| `model` | Model identifier reported for the request. | -| `input_tokens` | Number of input tokens consumed. | -| `output_tokens` | Number of output tokens generated. | -| `reasoning_tokens` | Number of reasoning tokens reported by the provider. | -| `cache_read_tokens` | Number of input tokens read from the provider cache. | -| `cache_write_5m_tokens` | Number of tokens written to a five-minute cache. | -| `cache_write_1h_tokens` | Number of tokens written to a one-hour cache. | -| `reasoning_mode` | Reasoning mode used, such as `effort`, `adaptive`, `budget`, or `disabled`. | -| `reasoning_effort` | Provider-specific reasoning effort value, when supplied. | -| `reasoning_budget_tokens` | Requested reasoning-token budget, when supplied. | -| `reasoning_source` | Source from which the reasoning configuration was derived. | -| `billing_source` | How the request was funded, such as `managed-inference`, `credit`, `byok`, or `free`. | -| `cost_micro_cents` | Amount charged by Console in microcents. Divide by 100,000,000 to convert to USD. | -| `created_at` | When the usage was recorded, as an ISO 8601 UTC timestamp. | -| `service` | Service identifier, currently `web-search`. Blank for model requests. | -| `quantity` | Number of billable operations represented by the record; normally one. | - -
- -## Errors - -| Status | Meaning | -| ------ | ------------------------------------------------------------------------------------ | -| `400` | Missing parameters, invalid values, or filters that do not match the selected scope. | -| `401` | Missing, invalid, expired, or revoked service API key. | -| `403` | The authenticated service account is not allowed to read usage. | - -Curl uses `--fail-with-body` in these examples so authentication and validation failures produce a non-zero exit code -while preserving any error response. diff --git a/services/www/src/docs/lib/navigation.ts b/services/www/src/docs/lib/navigation.ts index 31557189148..24f0561b339 100644 --- a/services/www/src/docs/lib/navigation.ts +++ b/services/www/src/docs/lib/navigation.ts @@ -146,7 +146,6 @@ export const docsSections: DocsSection[] = [ items: [ { title: "Inference", slug: "console/inference" }, { title: "BYOK", slug: "console/byok" }, - { title: "Usage", slug: "console/usage" }, { title: "Budgets", slug: "console/budgets" }, ], },