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

# Get what a job and its run were charged

> Ledger view of what the job, and the whole run it belongs to (the root
job plus every job it spawned), were actually charged. Unlike
`GET /jobs/{id}/price`, nothing here falls back to an estimate:
`charged_cents` is money that moved, `estimated_cents` is a quote, and
`held_cents` is credits set aside for work still running. All amounts
are integer credits (1 credit = 1 cent), in fields named `*_cents`.
Pass a root or child job id.




## OpenAPI

````yaml /openapi.yaml get /jobs/{id}/cost
openapi: 3.1.0
info:
  title: varg API
  version: 2.0.0
  description: |
    Unified REST API for AI media generation at `api.varg.ai/v2`.

    One API key, ~80 models across 8 providers, async jobs, stable output URLs
    on `s3.varg.ai`, files with lineage, and transparent credit billing
    (1 credit = 1 cent = $0.01).

    **The async job pattern:** every generation request returns `202 Accepted`
    with a job object (`status: queued`). Poll `GET /jobs/{id}` until the job
    reaches a terminal status (`completed`, `failed`, or `cancelled`), then read
    `output.outputs[0].url`. Alternatively, set `options.webhook_url` in the
    request to receive an HMAC-signed callback when the job finishes.
servers:
  - url: https://api.varg.ai/v2
security:
  - bearerAuth: []
tags:
  - name: Generation
    description: >-
      Create generation jobs (image, video, speech, music, transcription,
      ffmpeg, render, pipeline)
  - name: Tools
    description: Discover tools, their schemas, and call any tool generically
  - name: Jobs
    description: Poll and manage job lifecycle
  - name: Files
    description: Upload, import, probe, and manage files
  - name: Folders
    description: Group files into folders and file generated output automatically
  - name: Lineage
    description: Resolve which job produced a file
  - name: Presets
    description: Browse and apply reusable parameter values — voices, styles
  - name: Templates
    description: Browse, publish, use and render community templates
  - name: Pricing
    description: Estimate costs and browse the price catalog
  - name: Billing
    description: Balance, usage, and transaction history
  - name: Analytics
    description: >-
      Spend, runs and files over time — summaries, time series, breakdowns,
      activity
  - name: Account
    description: Identity and API key management
paths:
  /jobs/{id}/cost:
    get:
      tags:
        - Jobs
      summary: Get what a job and its run were charged
      description: |
        Ledger view of what the job, and the whole run it belongs to (the root
        job plus every job it spawned), were actually charged. Unlike
        `GET /jobs/{id}/price`, nothing here falls back to an estimate:
        `charged_cents` is money that moved, `estimated_cents` is a quote, and
        `held_cents` is credits set aside for work still running. All amounts
        are integer credits (1 credit = 1 cent), in fields named `*_cents`.
        Pass a root or child job id.
      operationId: getJobCost
      parameters:
        - $ref: '#/components/parameters/JobId'
      responses:
        '200':
          description: Run cost
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunCostResponse'
              examples:
                settled:
                  value:
                    data:
                      job_id: job_a1b2c3d4e5f6
                      run_id: job_a1b2c3d4e5f6
                      is_root: true
                      charged_cents: 12
                      run_charged_cents: 12
                      run_held_cents: 0
                      settled: true
                      attribution:
                        source:
                          key: api
                          label: API
                        member:
                          key: user_1
                          label: Alex
                        api_key:
                          key: key_1
                          label: Alex (varg_a1b2...c3d4)
                      jobs:
                        - job_id: job_a1b2c3d4e5f6
                          parent_job_id: null
                          is_root: true
                          tool:
                            key: video
                            label: Video
                          model:
                            key: kling_v3
                            label: Kling v3
                          status:
                            key: completed
                            label: Completed
                          created_at: '2026-07-01T10:00:00Z'
                          completed_at: '2026-07-01T10:02:10Z'
                          estimated_cents: 12
                          charged_cents: 12
                          held_cents: 0
                          charges:
                            - id: txn_abc123
                              posted_at: '2026-07-01T10:02:10Z'
                              amount_cents: 12
                              billed_units:
                                seconds: 5
                    meta:
                      definition_version: '1'
                      data_as_of: '2026-07-01T10:05:00Z'
                      money_unit: cent
                      time_basis: lifetime
                      attribution_scope: full
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/JobNotFound'
        '503':
          description: Cost reporting is not available (billing database not configured)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    JobId:
      name: id
      in: path
      required: true
      schema:
        type: string
        pattern: ^job_
      example: job_a1b2c3d4e5f6
  schemas:
    RunCostResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/RunCostData'
        meta:
          type: object
          properties:
            definition_version:
              type: string
            data_as_of:
              type: string
              format: date-time
            money_unit:
              type: string
              enum:
                - cent
              description: Amounts are integer credits, in `*_cents` fields
            time_basis:
              type: string
              enum:
                - posted_at
                - lifetime
                - created_at
            attribution_scope:
              type: string
              enum:
                - full
                - self
              description: '`self` means identity fields show only your own values'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: model_not_found
            message:
              type: string
              example: 'Unknown model: flux-shnell'
            details: {}
    RunCostData:
      type: object
      properties:
        job_id:
          type: string
        run_id:
          type: string
          description: Id of the root job of the run
        is_root:
          type: boolean
        charged_cents:
          type: integer
          description: Ledger charges for this job alone
        run_charged_cents:
          type: integer
          description: Ledger charges for the whole run
        run_held_cents:
          type: integer
          description: Credits still held for the run's unfinished work
        settled:
          type: boolean
          description: True when every job in the run has finished and nothing is held
        attribution:
          type:
            - object
            - 'null'
          properties:
            source:
              $ref: '#/components/schemas/RunCostDimension'
            member:
              $ref: '#/components/schemas/RunCostDimension'
            api_key:
              $ref: '#/components/schemas/RunCostDimension'
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/RunCostJob'
    RunCostDimension:
      type: object
      description: A value with a human-readable label.
      required:
        - key
        - label
      properties:
        key:
          type: string
        label:
          type: string
        kind:
          type: string
          enum:
            - member
            - api_key
        avatar_url:
          type:
            - string
            - 'null'
        owner_label:
          type:
            - string
            - 'null'
    RunCostJob:
      type: object
      properties:
        job_id:
          type: string
        parent_job_id:
          type:
            - string
            - 'null'
        is_root:
          type: boolean
        tool:
          $ref: '#/components/schemas/RunCostDimension'
        model:
          $ref: '#/components/schemas/RunCostDimension'
        status:
          $ref: '#/components/schemas/RunCostDimension'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        estimated_cents:
          type:
            - integer
            - 'null'
        charged_cents:
          type: integer
          description: Ledger charges for this job
        held_cents:
          type: integer
          description: Credits still held for this job
        charges:
          type: array
          items:
            $ref: '#/components/schemas/RunCostCharge'
    RunCostCharge:
      type: object
      properties:
        id:
          type: string
          description: Ledger transaction id
        posted_at:
          type: string
          format: date-time
        amount_cents:
          type: integer
        billed_units:
          type:
            - object
            - 'null'
          additionalProperties: true
  responses:
    Unauthorized:
      description: Missing or invalid API key / JWT
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized:
              value:
                error:
                  code: unauthorized
                  message: Invalid or missing API key or JWT
    JobNotFound:
      description: Unknown job (or not owned by the caller)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        varg API key (`varg_...`). Get one at [app.varg.ai](https://app.varg.ai)
        or run `bunx vargai login`. App sessions may alternatively send a
        Supabase JWT.

````

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