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

# Stubs



## OpenAPI

````yaml /api-reference/openapi/controlplane.openapi.json post /stubs
openapi: 3.0.0
info:
  title: levers9 controlplane API
  version: 1.0.0
  description: >-
    REST view of the levers9 controlplane gRPC service, served by the
    controlplane on port 1994. Authenticate with `Authorization: Bearer
    <token>`.
servers:
  - url: https://levers9.uselevers.com
    description: local controlplane
  - url: https://api.uselevers.com
    description: hosted
security:
  - bearer: []
tags:
  - name: ControlPlaneService
paths:
  /stubs:
    post:
      tags:
        - ControlPlaneService
      summary: Stubs
      operationId: ControlPlaneService_GetOrCreateStub
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/controlplaneGetOrCreateStubRequest'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controlplaneGetOrCreateStubResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    controlplaneGetOrCreateStubRequest:
      type: object
      properties:
        objectId:
          type: string
        imageId:
          type: string
        stubType:
          type: string
        name:
          type: string
        pythonVersion:
          type: string
        cpu:
          type: string
          format: int64
        memory:
          type: string
          format: int64
        gpu:
          type: string
        handler:
          type: string
        retries:
          type: integer
          format: int64
        timeout:
          type: string
          format: int64
        keepWarmSeconds:
          type: number
          format: float
        workers:
          type: integer
          format: int64
        maxPendingTasks:
          type: integer
          format: int64
        volumes:
          type: array
          items:
            $ref: '#/components/schemas/controlplaneVolume'
        forceCreate:
          type: boolean
        onStart:
          type: string
        callbackUrl:
          type: string
        authorized:
          type: boolean
        secrets:
          type: array
          items:
            $ref: '#/components/schemas/controlplaneSecretVar'
        autoscaler:
          $ref: '#/components/schemas/controlplaneAutoscaler'
        taskPolicy:
          $ref: '#/components/schemas/controlplaneTaskPolicy'
        concurrentRequests:
          type: integer
          format: int64
        extra:
          type: string
        checkpointEnabled:
          type: boolean
        gpuCount:
          type: integer
          format: int64
        onDeploy:
          type: string
        onDeployStubId:
          type: string
        entrypoint:
          type: array
          items:
            type: string
        ports:
          type: array
          items:
            type: integer
            format: int64
        env:
          type: array
          items:
            type: string
        appName:
          type: string
        pricing:
          $ref: '#/components/schemas/typesPricingPolicy'
        inputs:
          $ref: '#/components/schemas/controlplaneSchema'
        outputs:
          $ref: '#/components/schemas/controlplaneSchema'
        tcp:
          type: boolean
        blockNetwork:
          type: boolean
        allowList:
          type: array
          items:
            type: string
        dockerEnabled:
          type: boolean
        pool:
          $ref: '#/components/schemas/controlplanePoolConfig'
        isService:
          type: boolean
        serving:
          $ref: '#/components/schemas/controlplaneServingConfig'
        disks:
          type: array
          items:
            $ref: '#/components/schemas/controlplaneDurableDisk'
        allowMarketplace:
          type: boolean
        checkpointTrigger:
          $ref: '#/components/schemas/typesCheckpointTrigger'
        hostname:
          type: string
          description: Hostname to set inside the container.
        persistentRoot:
          $ref: '#/components/schemas/controlplanePersistentRoot'
    controlplaneGetOrCreateStubResponse:
      type: object
      properties:
        ok:
          type: boolean
        stubId:
          type: string
        errMsg:
          type: string
        warnMsg:
          type: string
        capacityStatus:
          type: string
          description: >-
            Capacity verdict for the requested GPU types, computed at stub
            creation:

            "available", "low", or "none". Empty when no check applies (CPU-only

            workloads, private-pool-only stubs, or pool-selector-bound stubs).
        unsupportedGpus:
          type: array
          items:
            type: string
          description: GPU types from the request that no serverless pool supports.
        matchedPrivatePool:
          type: string
          description: >-
            Name of an existing ready private pool in the workspace that
            satisfies

            the GPU request. Set instead of capacity_status "none" so clients
            can

            re-issue stub creation targeting this pool.
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    controlplaneVolume:
      type: object
      properties:
        id:
          type: string
        mountPath:
          type: string
        config:
          $ref: '#/components/schemas/typesMountPointConfig'
    controlplaneSecretVar:
      type: object
      properties:
        name:
          type: string
    controlplaneAutoscaler:
      type: object
      properties:
        type:
          type: string
        maxContainers:
          type: integer
          format: int64
        tasksPerContainer:
          type: integer
          format: int64
        minContainers:
          type: integer
          format: int64
    controlplaneTaskPolicy:
      type: object
      properties:
        timeout:
          type: string
          format: int64
        maxRetries:
          type: integer
          format: int64
        ttl:
          type: integer
          format: int64
    typesPricingPolicy:
      type: object
      properties:
        maxInFlight:
          type: string
          format: int64
        costModel:
          type: string
        costPerTask:
          type: number
          format: double
        costPerTaskDurationMs:
          type: number
          format: double
    controlplaneSchema:
      type: object
      properties:
        fields:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/controlplaneSchemaField'
    controlplanePoolConfig:
      type: object
      properties:
        name:
          type: string
        gpu:
          type: array
          items:
            type: string
        nodes:
          type: integer
          format: int64
        ttl:
          type: string
        maxSpend:
          type: number
          format: double
        providers:
          type: array
          items:
            type: string
        regions:
          type: array
          items:
            type: string
        minReliability:
          type: number
          format: double
        selector:
          type: string
        mode:
          type: string
        transport:
          type: string
        fallback:
          type: string
        priority:
          type: integer
          format: int32
        offerId:
          type: string
        containerRuntime:
          type: string
          description: Runtime for workers in this pool.
    controlplaneServingConfig:
      type: object
      properties:
        appKind:
          type: string
        servingProtocol:
          type: string
        llm:
          $ref: '#/components/schemas/controlplaneLLMConfig'
        database:
          $ref: '#/components/schemas/controlplaneDatabaseServingConfig'
    controlplaneDurableDisk:
      type: object
      properties:
        name:
          type: string
        size:
          type: string
        mountPath:
          type: string
        filesystem:
          type: string
        driver:
          type: string
        readOnly:
          type: boolean
        sourceSnapshotId:
          type: string
          description: Snapshot used to initialize a disk with no snapshot history.
    typesCheckpointTrigger:
      type: object
      properties:
        type:
          type: string
        httpPath:
          type: string
        httpPort:
          type: integer
          format: int64
        timeoutSeconds:
          type: integer
          format: int64
        intervalSeconds:
          type: integer
          format: int64
    controlplanePersistentRoot:
      type: object
      properties:
        size:
          type: string
        sourceSnapshotId:
          type: string
          description: Snapshot used to initialize the root with no snapshot history.
        name:
          type: string
          description: >-
            Disk name backing the root. Disk snapshot history is keyed by this
            name

            within the workspace, so each machine wanting its own root lineage
            must

            use a distinct name (e.g. the machine id). Defaults to "root".
      description: >-
        A durable machine-root disk. The container's entire root filesystem
        delta

        lives on a qcow-backed volume mounted at "/", so disk snapshots capture
        the

        whole machine state. Shorthand for a DurableDisk with mount_path "/" and

        the qcow driver.
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    typesMountPointConfig:
      type: object
      properties:
        bucketName:
          type: string
        accessKey:
          type: string
        secretKey:
          type: string
        endpointUrl:
          type: string
        region:
          type: string
        readOnly:
          type: boolean
        forcePathStyle:
          type: boolean
    controlplaneSchemaField:
      type: object
      properties:
        type:
          type: string
        fields:
          $ref: '#/components/schemas/controlplaneSchema'
    controlplaneLLMConfig:
      type: object
      properties:
        modelId:
          type: string
        engine:
          type: string
        servedModelName:
          type: string
        contextLength:
          type: string
          format: int64
        tokenizer:
          type: string
        metricsPath:
          type: string
        sloTier:
          type: string
    controlplaneDatabaseServingConfig:
      type: object
      properties:
        kind:
          type: string
        port:
          type: integer
          format: int64
        readinessProbe:
          type: string
        connectionEnvName:
          type: string
        credentialSecretNames:
          type: array
          items:
            type: string
        durabilityMode:
          type: string
        usernameSecretName:
          type: string
        passwordSecretName:
          type: string
        databaseSecretName:
          type: string
        connectionUrlSecretName:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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