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

# show charges

> Shows charges per instance, including GPU, storage, and bandwidth. For invoice/payment records (Stripe top-ups, transfers, payouts), use [show invoices](/api-reference/billing/show-invoices) instead.

CLI: `vastai show invoices-v1 --charges`



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/v0/charges/
openapi: 3.1.0
info:
  title: Vast.ai API
  description: >-
    Vast.ai REST API for managing GPU cloud instances, machine operations, and
    AI/ML workflows.


    ## AI Agent Quick-Start


    Install the CLI skill for your agent (Claude Code, Cursor, Windsurf, etc.):
      npx skills add vast-ai/vast-cli

    CLI reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai/SKILL.md

    SDK reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai_sdk/SKILL.md


    ## Auth

    All endpoints require `Authorization: Bearer $VAST_API_KEY`.

    Get your key at: https://cloud.vast.ai/manage-keys/


    ## Key Quirks

    - `gpu_ram` in CLI = GB; in REST API = MB (CLI auto-converts)

    - SSH keys must be registered BEFORE creating an instance (VM: no recovery;
    Docker: can add post-create)

    - `onstart` field is limited to 4048 characters -- gzip+base64 for longer
    scripts

    - `POST /api/v0/asks/{id}/` (create instance) returns `new_contract` as the
    instance ID, not `id`

    - Poll trap: if `actual_status` becomes `exited`, `unknown`, or `offline` it
    will never reach `running` -- destroy and retry
  version: 1.0.0
  contact:
    name: Vast.ai Support
    url: https://discord.gg/vast
servers:
  - url: https://console.vast.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/v0/charges/:
    get:
      tags:
        - Billing
      summary: show charges
      description: >-
        Shows charges per instance, including GPU, storage, and bandwidth. For
        invoice/payment records (Stripe top-ups, transfers, payouts), use [show
        invoices](/api-reference/billing/show-invoices) instead.


        CLI: `vastai show invoices-v1 --charges`
      parameters:
        - name: select_filters
          in: query
          required: true
          description: >
            **`day`** (required). Date range in unix seconds (UTC). Operators:
            `gte`, `lte`.


            **`type`** (optional). Filter by contract type: `instance`,
            `volume`, `serverless`. Operator: `in`.


            **Examples**:

            ```json

            // All charges in January 2026

            {"day":{"gte":1767225600,"lte":1769903999}}


            // Only instance charges

            {"day":{"gte":1767225600,"lte":1769903999},"type":{"in":["instance"]}}


            // Volumes and serverless only

            {"day":{"gte":1767225600,"lte":1769903999},"type":{"in":["volume","serverless"]}}

            ```
          schema:
            type: string
        - name: format
          in: query
          required: false
          description: >
            - `table` (default) flat list of per-contract rows with `type:
            "instance"` or `"volume"`.

            - `tree` serverless contracts are collapsed under
            endpoint/workergroup wrappers with `type: "serverless"` and `source:
            "endpoint-<id>"` / `"workergroup-<id>"`. Regular instances and
            volumes are unchanged.
          schema:
            type: string
            enum:
              - table
              - tree
            default: table
            example: table
        - name: latest_first
          in: query
          required: false
          description: Sort by most recent charges first.
          schema:
            type: boolean
            default: true
            example: true
        - name: limit
          in: query
          required: false
          description: Max results per page. Server maximum 500.
          schema:
            type: integer
            minimum: 1
            default: 100
            example: 20
        - name: after_token
          in: query
          required: false
          description: >-
            Pass the `next_token` value from the previous response to fetch the
            next page of results. When the response returns `next_token: null`,
            there are no more pages.
          schema:
            type: string
            example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzNDU2Nzh9fQ==
      responses:
        '200':
          description: Paginated per-instance charge results
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  count:
                    type: integer
                    description: Number of contracts returned in this page.
                    example: 2
                  total:
                    type: integer
                    description: Total number of contracts matching the filters.
                    example: 14
                  next_token:
                    type: string
                    nullable: true
                    description: >-
                      Pagination cursor for the next page. `null` when no more
                      pages.
                    example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzNDU2Nzh9fQ==
                  results:
                    type: array
                    description: List of per-contract charge entries.
                    items:
                      type: object
                      properties:
                        start:
                          type: integer
                          description: Contract start time (unix seconds UTC).
                          example: 1730419200
                        end:
                          type: integer
                          description: Contract end time (unix seconds UTC).
                          example: 1730678400
                        type:
                          type: string
                          description: >-
                            Contract type. `instance` or `volume` in table
                            format, or `serverless` (wrapper) in tree format.
                          example: instance
                        source:
                          type: string
                          description: >-
                            Identifier in the form `{type}-{id}`. For
                            tree-format serverless wrappers, uses
                            `endpoint-<id>` or `workergroup-<id>`.
                          example: instance-12345678
                        description:
                          type: string
                          example: Instance 12345678 Charges - 4 days
                        amount:
                          type: number
                          format: float
                          description: >-
                            Total charge for this contract (rounded to 3
                            decimals).
                          example: 38.421
                        metadata:
                          type: object
                          description: >-
                            Optional instance metadata. Keys present only when
                            non-null on the contract.
                          properties:
                            template_id:
                              type: integer
                              example: 101
                            label:
                              type: string
                              example: my-training-job
                            endpoint_id:
                              type: integer
                              example: 19392
                            workergroup_id:
                              type: integer
                              example: 25355
                        items:
                          type: array
                          description: >-
                            Per-charge-type breakdown (`gpu`, `disk`, `bwd`,
                            `bwu`). Empty for tree-format wrappers above the
                            contract level.
                          items:
                            type: object
                            properties:
                              start:
                                type: integer
                                example: 1730419200
                              end:
                                type: integer
                                example: 1730678400
                              type:
                                type: string
                                enum:
                                  - gpu
                                  - disk
                                  - bwd
                                  - bwu
                                example: gpu
                              source:
                                type: string
                                nullable: true
                                example: null
                              description:
                                type: string
                                example: 96.000 hours at $0.389/hour
                              amount:
                                type: number
                                format: float
                                example: 37.344
                              metadata:
                                type: object
                                example: {}
                              items:
                                type: array
                                example: []
        '400':
          description: >
            Invalid request. Returned when the required `day.gte` / `day.lte`
            filters are missing, or when the supplied `after_token` cannot be
            decoded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_date_range:
                  summary: Missing required `day` range
                  value:
                    success: false
                    msg: >-
                      Must provide both 'day' gte and lte filters for instance
                      charges
                invalid_pagination_token:
                  summary: Bad `after_token`
                  value:
                    success: false
                    error: invalid_token
                    msg: Invalid pagination token
        '401':
          description: >-
            Unauthorized. May be returned in framework-level authentication
            failure cases.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden. Returned when no `Authorization` header is provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: This action requires login.
        '404':
          description: >-
            Not Found. Returned when the supplied API key does not match any
            user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: Invalid user key
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      security:
        - BearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        msg:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key must be provided in the Authorization header

````