components:
  schemas:
    HealthLiveResponse:
      properties:
        live:
          type: boolean
        message:
          example: live
          type: string
        object:
          example: health.response
          type: string
      required:
      - object
      - message
      - live
      type: object
    HealthReadyResponse:
      properties:
        message:
          example: ready
          type: string
        object:
          example: health.response
          type: string
        ready:
          type: boolean
      required:
      - object
      - message
      - ready
      type: object
    ImageUsage:
      properties:
        images_size_mb:
          format: double
          type: number
      required:
      - images_size_mb
      type: object
    LicenseInfo:
      properties:
        content:
          type: string
        name:
          type: string
        path:
          type: string
        sha:
          type: string
        size:
          format: uint64
          type: integer
        type:
          type: string
        url:
          type: string
      required:
      - name
      - path
      - sha
      - size
      - url
      - type
      - content
      type: object
    ManifestInfo:
      properties:
        manifest_file:
          type: string
        repository_override:
          type: string
      required:
      - manifest_file
      - repository_override
      type: object
    ModelCard:
      properties:
        created:
          format: uint64
          type: integer
        id:
          type: string
        object:
          example: model
          type: string
        owned_by:
          example: nvidia
          type: string
      required:
      - id
      - object
      type: object
    ModelsResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/ModelCard'
          type: array
        object:
          example: list
          type: string
      required:
      - object
      - data
      type: object
    NimErrorResponse:
      properties:
        detail:
          oneOf:
          - type: string
          - type: object
          - items:
              additionalProperties: true
              properties:
                ctx:
                  type: object
                input: {}
                loc:
                  items:
                    oneOf:
                    - type: string
                    - type: integer
                  type: array
                msg:
                  type: string
                type:
                  type: string
              required:
              - type
              - loc
              - msg
              type: object
            type: array
        message:
          type: string
        object:
          example: error
          type: string
        type:
          type: string
      required:
      - object
      - message
      - type
      type: object
    NimMetadata:
      properties:
        assetInfo:
          items:
            type: string
          type: array
        backend:
          example: rust
          type: string
        licenseInfo:
          $ref: '#/components/schemas/LicenseInfo'
        modelInfo:
          items:
            $ref: '#/components/schemas/NimModelInfo'
          type: array
        repository_override:
          type: string
        selectedModelProfileId:
          type: string
        version:
          type: string
      required:
      - version
      - modelInfo
      - assetInfo
      - licenseInfo
      - repository_override
      - selectedModelProfileId
      - backend
      type: object
    NimModelInfo:
      properties:
        modelUrl:
          type: string
        shortName:
          type: string
      required:
      - modelUrl
      - shortName
      type: object
    OcrBoundingBox:
      properties:
        points:
          items:
            $ref: '#/components/schemas/OcrPoint2D'
          type: array
      required:
      - points
      type: object
    OcrImageInput:
      properties:
        type:
          const: image_url
          default: image_url
          enum:
          - image_url
          example: image_url
          type: string
        url:
          description: >-
            Image data URL containing base64-encoded JPEG, JPG, or PNG bytes. JPEG
            input enables batched image decoding and is recommended for
            performance-sensitive workloads. See the
            [performance guidance](performance.html#ocr-jpeg-performance).
          example: data:image/png;base64,iVBORw0KGgo=
          pattern: ^data:image/(jpeg|jpg|png);base64,
          type: string
      required:
      - url
      type: object
    OcrPoint2D:
      properties:
        x:
          format: float
          type: number
        y:
          format: float
          type: number
      required:
      - x
      - y
      type: object
    OcrRequest:
      properties:
        input:
          items:
            $ref: '#/components/schemas/OcrImageInput'
          minItems: 1
          type: array
        merge_levels:
          anyOf:
          - items:
              enum:
              - word
              - sentence
              - paragraph
              type: string
            type: array
          - type: 'null'
      required:
      - input
      type: object
    OcrResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/OcrResponseItem'
          type: array
        model:
          type: string
        usage:
          $ref: '#/components/schemas/ImageUsage'
      required:
      - model
      - data
      - usage
      type: object
    OcrResponseItem:
      properties:
        index:
          type: integer
        text_detections:
          items:
            $ref: '#/components/schemas/OcrTextDetection'
          type: array
      required:
      - index
      - text_detections
      type: object
    OcrTextDetection:
      properties:
        bounding_box:
          $ref: '#/components/schemas/OcrBoundingBox'
        text_prediction:
          $ref: '#/components/schemas/OcrTextPrediction'
      required:
      - text_prediction
      - bounding_box
      type: object
    OcrTextPrediction:
      properties:
        confidence:
          format: float
          type: number
        text:
          type: string
      required:
      - text
      type: object
    VersionInfo:
      properties:
        api:
          example: 1.0.0
          type: string
        release:
          type: string
      required:
      - release
      - api
      type: object
info:
  description: OpenAPI contract for the Rust-native Nemotron OCR HTTP server.
  title: Nemotron OCR Server
  version: 1.0.0
openapi: 3.1.0
paths:
  /v1/health/live:
    get:
      operationId: healthLive
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthLiveResponse'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Service unavailable
      summary: Check liveness
  /v1/health/ready:
    get:
      operationId: healthReady
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthReadyResponse'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Service unavailable
      summary: Check readiness
  /v1/license:
    get:
      operationId: getLicense
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseInfo'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: Get license metadata and content
  /v1/manifest:
    get:
      operationId: getManifest
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManifestInfo'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: Get model manifest wrapper
  /v1/metadata:
    get:
      operationId: getMetadata
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimMetadata'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: Get NIM metadata
  /v1/metrics:
    get:
      operationId: getMetrics
      responses:
        '200':
          content:
            text/plain:
              schema:
                type: string
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: Get Prometheus metrics
  /v1/models:
    get:
      operationId: listModels
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelsResponse'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: List served models
  /v1/ocr:
    post:
      operationId: ocrTextDetections
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OcrRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OcrResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Bad request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Payload too large
        '415':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Unsupported media type
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Unprocessable entity
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Service unavailable
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Gateway timeout
      summary: Run OCR inference
  /v1/version:
    get:
      operationId: getVersion
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionInfo'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Not found
        '405':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Method not allowed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NimErrorResponse'
          description: Internal server error
      summary: Get NIM release and API version
servers:
- url: http://localhost:8000
