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

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# Estimate a run

> Price a run without starting it. The rows are counted, a sample of their texts is measured, and the cost is worked out from that. Nothing is judged and nothing is charged. Takes the same body a run does, a statement or a target with questions.



## OpenAPI

````yaml POST /api/v1/instant-evals/estimate
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/v1/instant-evals/estimate:
    post:
      tags:
        - Instant Evals
      summary: Estimate a run
      description: >-
        Price a run without starting it. The rows are counted, a sample of their
        texts is measured, and the cost is worked out from that. Nothing is
        judged and nothing is charged. Takes the same body a run does, a
        statement or a target with questions.
      operationId: estimateInstantEvalRun
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sql:
                  type: string
                  minLength: 1
                  maxLength: 50000
                  description: >-
                    The LangWatchQL statement to judge. It must project TraceId
                    and at least one eval function column. Send this or target,
                    never both.
                parameters:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: 'null'
                  description: Values for the parameters the statement declares.
                target:
                  type: string
                  enum:
                    - traces
                    - threads
                    - llm_spans
                  description: >-
                    What one judged row is, in place of a statement: a trace, a
                    conversation, or one model call. The statement is written
                    for you from this and the questions, and handed back on the
                    run so you can edit it and resubmit.
                filter:
                  type: string
                  maxLength: 4000
                  description: >-
                    With target: a trace filter, in the language the trace
                    explorer's search bar speaks, narrowing which rows are
                    judged.
                start:
                  type: string
                  format: date-time
                  description: >-
                    With target: the oldest instant to judge, as an ISO 8601
                    timestamp. Defaults to seven days ago.
                end:
                  type: string
                  format: date-time
                  description: 'With target: the newest instant to judge. Defaults to now.'
                questions:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 64
                        description: >-
                          What to call this question. It becomes the statement's
                          output column and the name every judgement is filed
                          under. Defaults to q1, q2 and so on.
                      kind:
                        type: string
                        enum:
                          - boolean
                          - score
                          - category
                        default: boolean
                        description: >-
                          What kind of answer you want: a yes or no, a rating on
                          a scale, or one of a list of options.
                      instructions:
                        type: string
                        minLength: 1
                        maxLength: 2000
                        description: >-
                          The question, in your own words, as you would write it
                          for a human reader.
                      criteria:
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 500
                        minItems: 2
                        maxItems: 2
                        description: >-
                          For a yes or no question: what counts as yes, then
                          what counts as no. Cannot be combined with a
                          threshold.
                      threshold:
                        type: number
                        minimum: 0
                        maximum: 1
                        description: >-
                          For a yes or no question: the probability at or above
                          which the answer counts as yes. Without one the column
                          carries the probability itself and a run draws the
                          line at an even chance.
                      range:
                        type: object
                        properties:
                          min:
                            type: integer
                            description: The lowest level of the scale.
                          max:
                            type: integer
                            description: The highest level of the scale.
                        required:
                          - min
                          - max
                        description: 'For a rating: the two ends of the scale.'
                      options:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              minLength: 1
                              maxLength: 100
                              description: >-
                                What the column holds when this option is the
                                answer.
                            description:
                              type: string
                              minLength: 1
                              maxLength: 500
                              description: What this option means, in your own words.
                          required:
                            - name
                            - description
                        minItems: 2
                        maxItems: 255
                        description: 'For a choice: the options to pick between.'
                    required:
                      - instructions
                  description: >-
                    With target: what to ask of each row. One classification
                    asks them all, which is why a three-question run costs about
                    what a one-question run does.
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: What to call the run. Yours to choose.
                limit:
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 100000
                  description: >-
                    Rows the run may judge. Ten thousand by default on every
                    plan, up to one hundred thousand on a plan that lifts the
                    cap.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  rows:
                    type: integer
                    description: Rows the statement matches, bounded by the run's limit.
                  isRowsCapped:
                    type: boolean
                    description: >-
                      Whether the statement matches more rows than the run may
                      judge.
                  avgTokens:
                    type: integer
                    description: Input tokens one judged row sends, measured from a sample.
                  totalTokens:
                    type: integer
                    description: Input tokens the whole run would send.
                  requests:
                    type: integer
                    description: Classifications the run would make, one per judged row.
                  priceUsd:
                    type: number
                    description: What the run would cost you, in United States dollars.
                  freeBudgetRemainingUsd:
                    type: number
                    description: >-
                      What is left of the free Instant Evals budget, in United
                      States dollars. Only present for an organization without a
                      paid plan.
                required:
                  - rows
                  - isRowsCapped
                  - avgTokens
                  - totalTokens
                  - requests
                  - priceUsd
      security:
        - project_api_key: []
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````