> ## 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.

# Estimate a price without creating a job

> Send the same body you would send to a generation endpoint and get the
price back. Also accepts a batch format with an `items` array where each
item carries `tool`, `model`, and `params`.




## OpenAPI

````yaml /openapi.yaml post /estimate
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: Lineage
    description: Resolve which job produced a file
  - name: Pricing
    description: Estimate costs and browse the price catalog
  - name: Billing
    description: Balance, usage, and transaction history
  - name: Account
    description: Identity and API key management
paths:
  /estimate:
    post:
      tags:
        - Pricing
      summary: Estimate a price without creating a job
      description: |
        Send the same body you would send to a generation endpoint and get the
        price back. Also accepts a batch format with an `items` array where each
        item carries `tool`, `model`, and `params`.
      operationId: estimatePrice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - model
                  properties:
                    model:
                      type: string
                    tool:
                      type: string
                  additionalProperties: true
                  title: Single
                - type: object
                  required:
                    - items
                  properties:
                    items:
                      type: array
                      items:
                        type: object
                        properties:
                          tool:
                            type: string
                          capability:
                            type: string
                          model:
                            type: string
                          params:
                            type: object
                  title: Batch
            examples:
              single:
                summary: Single estimate
                value:
                  model: kling_v3
                  prompt: cat jumping over a fence
                  duration: 5
              batch:
                summary: Batch estimate
                value:
                  items:
                    - tool: image
                      model: flux_schnell
                      params:
                        aspect_ratio: '16:9'
                    - tool: video
                      model: kling_v3
                      params:
                        duration: 5
      responses:
        '200':
          description: Estimate
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    title: Single
                    properties:
                      valid:
                        type: boolean
                      model:
                        type: string
                      tool:
                        type: string
                      pricing:
                        type: object
                        properties:
                          provider_cost_cents:
                            type:
                              - integer
                              - 'null'
                          user_price_cents:
                            type:
                              - integer
                              - 'null'
                          markup_percent:
                            type: number
                          pricing_id:
                            type:
                              - string
                              - 'null'
                  - type: object
                    title: Batch
                    properties:
                      items:
                        type: array
                        items:
                          type: object
                          properties:
                            capability:
                              type: string
                            model:
                              type: string
                            credits:
                              type: integer
                            billing:
                              type: string
                            provider:
                              type: string
                      total_credits:
                        type: integer
        '404':
          $ref: '#/components/responses/ModelNotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '503':
          $ref: '#/components/responses/NoPricing'
components:
  responses:
    ModelNotFound:
      description: Unknown model or tool
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            model:
              value:
                error:
                  code: model_not_found
                  message: 'Unknown model: flux-shnell'
    ValidationError:
      description: Request body failed validation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid:
              value:
                error:
                  code: invalid_request
                  message: 'Body validation failed (text: Required)'
    NoPricing:
      description: No active pricing rule for this model
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: model_not_found
            message:
              type: string
              example: 'Unknown model: flux-shnell'
            details: {}
  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.

````