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

# Get AI usage

> Proxied AI usage of every sandbox of the wallet in scope.



## OpenAPI

````yaml openapi/boat-v1.yaml GET /ai-usage
openapi: 3.1.0
info:
  title: Boat Public API v1
  version: 1.0.0
  description: >
    Public JSON API for creating, operating, prompting, observing, and exposing
    sandboxes from backend services, CI jobs, hosted workers, and Boat
    automation products.


    The v1 reference intentionally documents the developer integration surface
    only. Dashboard billing actions are not part of v1.
servers:
  - url: https://boat.dev/api/v1
security:
  - BoatBearerAuth: []
tags:
  - name: Boat
    description: >-
      Unified Boat account, setup, lifecycle, prompting, event history, desktop
      access, and SSH operations.
paths:
  /ai-usage:
    get:
      tags:
        - Boat
      summary: Get AI usage
      description: >-
        Proxied AI usage, per sandbox and in total, per UTC day, credential and
        model. Without `profile`, the usage charged to the wallet in scope. With
        `profile`, the requests made with that profile's credentials, whoever
        pays; only its managers can read it. Needs an API key with
        `account.read`.
      operationId: getAiUsage
      parameters:
        - name: days
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 365
            default: 30
          description: Days of history, today included.
        - name: profile
          in: query
          schema:
            type: string
          description: >-
            A credential profile id. Counts that profile's requests instead of a
            wallet's.
        - $ref: '#/components/parameters/OrgId'
        - $ref: '#/components/parameters/OrgHeader'
      responses:
        '200':
          description: The usage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountAiUsageResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    OrgId:
      name: org
      in: query
      required: false
      schema:
        type: string
      description: >-
        Billing wallet for this request: an organization you belong to, by id
        (`team_…`) or by name as `GET /orgs` lists it (case-insensitive), or
        `personal`. Omitted, the account's active wallet applies (`PATCH
        /orgs/active`; personal until set). Two organizations sharing the name
        answer `409 ambiguous_org` and need the id. Sandboxes and snapshots stay
        creator-private. On `/environments` routes, only this query parameter
        selects the organization's shared environments; the `X-Boat-Org` header
        and the active wallet do not apply there. Members read them, owners and
        admins change them.
    OrgHeader:
      name: X-Boat-Org
      in: header
      required: false
      schema:
        type: string
      description: Same as the `org` query parameter. Query wins when both are set.
  schemas:
    AccountAiUsageResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessBase'
        - type: object
          required:
            - accountId
            - profileId
            - since
            - sandboxes
            - usage
            - totals
            - dollars
          properties:
            accountId:
              type:
                - string
                - 'null'
              description: The wallet the usage is charged to. Null with `profile`.
            profileId:
              type:
                - string
                - 'null'
              description: >-
                The credential profile whose requests are counted. Null without
                `profile`.
            since:
              type: string
              format: date
              description: First UTC day included.
            sandboxes:
              type: array
              items:
                $ref: '#/components/schemas/SandboxAiUsage'
            usage:
              type: array
              items:
                $ref: '#/components/schemas/AiUsageRow'
            totals:
              $ref: '#/components/schemas/AiUsageTotals'
            dollars:
              type: number
    SuccessBase:
      type: object
      required:
        - ok
        - type
      properties:
        ok:
          type: boolean
          examples:
            - true
        type:
          type: string
          description: Stable success envelope discriminator added by v1.
    SandboxAiUsage:
      type: object
      required:
        - sandboxId
        - name
        - blocked
        - usage
        - totals
        - dollars
      properties:
        sandboxId:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        blocked:
          type: boolean
        usage:
          type: array
          items:
            $ref: '#/components/schemas/AiUsageRow'
        totals:
          $ref: '#/components/schemas/AiUsageTotals'
        dollars:
          type: number
          description: Request charge for the period, at the price per 1,000 requests.
    AiUsageRow:
      allOf:
        - type: object
          required:
            - day
            - credential
            - model
          properties:
            day:
              type: string
              format: date
              description: UTC day.
            credential:
              type: string
              description: >-
                The credential used: a `CredentialId`, or `custom:<NAME>` for a
                custom API.
            model:
              type: string
              description: The model the provider reported, or empty.
        - $ref: '#/components/schemas/AiUsageTotals'
    AiUsageTotals:
      type: object
      required:
        - requests
        - errors
        - inputTokens
        - outputTokens
        - cacheReadTokens
        - cacheWriteTokens
      description: Token counts are the numbers the provider reports in its replies.
      properties:
        requests:
          type: integer
        errors:
          type: integer
          description: >-
            Requests the provider answered with an HTTP error, or did not
            answer.
        inputTokens:
          type: integer
        outputTokens:
          type: integer
        cacheReadTokens:
          type: integer
        cacheWriteTokens:
          type: integer
    ErrorEnvelope:
      type: object
      required:
        - ok
        - type
        - status
        - code
        - message
        - error
        - requestId
      properties:
        ok:
          type: boolean
          examples:
            - false
        type:
          type: string
          examples:
            - sandbox.error
        status:
          type: integer
          examples:
            - 409
        code:
          type: string
          examples:
            - provider_not_configured
        message:
          type: string
          examples:
            - Prompting is locked until Codex is configured on the Agents page.
        requestId:
          type: string
          examples:
            - req_01HX...
        error:
          type: object
          required:
            - code
            - message
            - status
          properties:
            code:
              type: string
            message:
              type: string
            status:
              type: integer
            details:
              type: object
              additionalProperties: true
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            unauthorized:
              value:
                ok: false
                type: sandbox.error
                status: 401
                code: unauthorized
                message: Unauthorized
                error:
                  code: unauthorized
                  message: Unauthorized
                  status: 401
                requestId: req_01HX...
  securitySchemes:
    BoatBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sandbox_api_key
      description: >-
        Boat bearer token in the form `boat_...`. Service API keys authenticate
        sandbox operations.

````

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