> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage and cost

> Metered usage and its cost for a billing period: meters, totals (rated,
not yet rated, credit, due) with a projection for the current month, a
daily breakdown, and the most expensive sandboxes and templates.
Dashboard sessions of any role; API keys with the `usage:read` scope.




## OpenAPI

````yaml /compute/api-reference/anona-openapi.yaml get /v1/usage
openapi: 3.0.3
info:
  title: Anona Compute API (Anona routes)
  version: 0.1.0
  description: >
    Routes the Anona Compute gateway serves next to the E2B-compatible API:

    live-view viewer tokens, SSH certificates, network policy, the credential

    vault, usage and billing, webhooks and telemetry export, thumbnails, preview
    links,

    public ports, pause when idle, template builds, and API key management.


    Written from the gateway handlers
    (`gateway/internal/stream/token/handlers.go`,

    `gateway/internal/sshca/handler.go`,
    `gateway/internal/handlers/apikeys/apikeys.go`)

    and checked against a running gateway by
    `docs-site/scripts/verify_openapi.py`.
servers:
  - url: https://api.compute.anonalabs.com
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Live view
  - name: SSH
  - name: Sandbox access
  - name: Templates
  - name: Network
  - name: Credential vault
  - name: Usage and billing
  - name: Webhooks and telemetry
  - name: API keys
  - name: Service
paths:
  /v1/usage:
    get:
      tags:
        - Usage and billing
      summary: Usage and cost
      description: |
        Metered usage and its cost for a billing period: meters, totals (rated,
        not yet rated, credit, due) with a projection for the current month, a
        daily breakdown, and the most expensive sandboxes and templates.
        Dashboard sessions of any role; API keys with the `usage:read` scope.
      operationId: getUsage
      parameters:
        - name: period
          in: query
          schema:
            type: string
            pattern: ^(current|\d{4}-\d{2})$
            default: current
      responses:
        '200':
          description: The usage document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Usage'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    Usage:
      type: object
      required:
        - tenant
        - period
        - availablePeriods
        - meters
        - totals
        - daily
        - sandboxes
        - sandboxCount
        - templates
      properties:
        tenant:
          $ref: '#/components/schemas/Tenant'
        period:
          type: object
          required:
            - key
            - start
            - end
            - asOf
            - current
          properties:
            key:
              type: string
              example: 2026-10
            start:
              type: string
              format: date-time
            end:
              type: string
              format: date-time
            asOf:
              type: string
              format: date-time
            ratedThrough:
              type: string
              format: date-time
            current:
              type: boolean
        availablePeriods:
          type: array
          items:
            type: string
        meters:
          type: array
          items:
            type: object
            required:
              - meter
              - unit
              - quantity
              - unitPriceUsd
              - amountUsd
            properties:
              meter:
                type: string
                example: vcpu_hours
              unit:
                type: string
              quantity:
                type: number
              unitPriceUsd:
                type: number
              ratedUsd:
                type: number
              pendingUsd:
                type: number
              amountUsd:
                type: number
        totals:
          type: object
          required:
            - ratedUsd
            - pendingUsd
            - amountUsd
            - creditUsd
            - dueUsd
          properties:
            ratedUsd:
              type: number
            pendingUsd:
              type: number
            amountUsd:
              type: number
            creditUsd:
              type: number
            dueUsd:
              type: number
            projectedUsd:
              type: number
        daily:
          type: array
          items:
            type: object
        sandboxes:
          type: array
          items:
            type: object
        sandboxCount:
          type: integer
        templates:
          type: array
          items:
            type: object
        lifecycle:
          type: object
    Tenant:
      type: object
      required:
        - id
        - slug
        - planId
      properties:
        id:
          type: string
        slug:
          type: string
        name:
          type: string
        planId:
          type: string
        planName:
          type: string
        billingModel:
          type: string
        status:
          type: string
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: The HTTP status code.
        message:
          type: string
        error_code:
          type: string
          description: >-
            Machine-readable reason, on some errors (for example
            `invalid_request`).
  responses:
    BadRequest:
      description: The request body is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: No valid API key or session.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key's scopes or the caller's role do not allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: An Anona Compute API key (`e2b_` followed by lowercase hex).
    BearerAuth:
      type: http
      scheme: bearer
      description: 'The same API key, sent as `Authorization: Bearer e2b_...`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.