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

# Estimate State Compression

> Estimate the time and cost of a state-compression job before submitting it.

Use this tool to size a compression run up front. It creates no job, spends
no credits, and needs no stored circuit -- only the qubit count and the
parameters planned for the real submission.

When to Use:
    - Call this before ``compress_circuit_with_state_compression`` when the
      user asks how long compression will take or what it will cost.
    - Call this to compare candidate qubit counts before committing to one.

Constraints:
    - The estimate is a projection from the qubit count, not a measurement of
      the specific circuit, so actual runtime varies with circuit structure.
    - This tool is read-only and never creates a compression job.

Notes:
    - Report the estimate in seconds and credits, and state plainly that it
      is an estimate rather than a quote.

Args:
    user: Authenticated user resolved from the API key.
    data: Qubit count and compression parameters to estimate.

Returns:
    The estimated time and cost with an explanatory context string.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json post /ai/estimate_state_compression
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.5.0
servers: []
security: []
paths:
  /ai/estimate_state_compression:
    post:
      summary: Estimate State Compression
      description: >-
        Estimate the time and cost of a state-compression job before submitting
        it.


        Use this tool to size a compression run up front. It creates no job,
        spends

        no credits, and needs no stored circuit -- only the qubit count and the

        parameters planned for the real submission.


        When to Use:
            - Call this before ``compress_circuit_with_state_compression`` when the
              user asks how long compression will take or what it will cost.
            - Call this to compare candidate qubit counts before committing to one.

        Constraints:
            - The estimate is a projection from the qubit count, not a measurement of
              the specific circuit, so actual runtime varies with circuit structure.
            - This tool is read-only and never creates a compression job.

        Notes:
            - Report the estimate in seconds and credits, and state plainly that it
              is an estimate rather than a quote.

        Args:
            user: Authenticated user resolved from the API key.
            data: Qubit count and compression parameters to estimate.

        Returns:
            The estimated time and cost with an explanatory context string.
      operationId: estimate_state_compression
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContextStateCompressionEstimatesSubmitModel'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextEstimatesModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    ContextStateCompressionEstimatesSubmitModel:
      properties:
        num_qubits:
          type: integer
          minimum: 1
          title: Num Qubits
          description: Number of qubits in the circuit to compress.
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
          description: >-
            Compression parameters planned for the real submission, mirroring
            the `parameters` field of `compress_circuit_with_state_compression`.
      type: object
      required:
        - num_qubits
      title: ContextStateCompressionEstimatesSubmitModel
      description: |-
        Define payload for estimating a state-compression job.

        Attributes:
            num_qubits: Qubit count of the circuit to be compressed.
            parameters: Compression parameters matching those planned for the real
                submission.
      examples:
        - num_qubits: 20
          parameters:
            max_bond_dimension: 64
    ContextEstimatesModel:
      properties:
        estimated_time:
          type: number
          title: Estimated Time
        estimated_cost:
          type: number
          title: Estimated Cost
        context:
          type: string
          title: Context
      type: object
      required:
        - estimated_time
        - estimated_cost
        - context
      title: ContextEstimatesModel
      description: |-
        Represent a pre-submission time and cost estimate.

        Attributes:
            estimated_time: Estimated wall-clock computation time in seconds.
            estimated_cost: Estimated cost in Haiqu credits.
            context: Summary of what the estimate covers and how to act on it.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````