Openwork Inference API

The Inference API from Openwork — 1 operation(s) for inference.

OpenAPI Specification

openwork-inference-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Den Admin Inference API
  description: 'OpenAPI spec for the Den control plane API.


    Authentication:

    - Use `Authorization: Bearer <session-token>` for user-authenticated routes that require a Den session.

    - Use `x-api-key: <den-api-key>` for API-key-authenticated routes that accept organization API keys.

    - Public routes like health and documentation do not require authentication.


    Swagger tip: use the security schemes in the Authorize dialog to set either `bearerAuth` or `denApiKey` before trying protected endpoints.'
  version: dev
servers:
- url: https://api.openworklabs.com
tags:
- name: Inference
paths:
  /v1/inference:
    get:
      operationId: getV1Inference
      tags:
      - Inference
      summary: Get inference settings
      description: Returns OpenWork Models enablement and limit context for the active organization.
      responses:
        '200':
          description: Inference settings returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceStatusResponse'
        '401':
          description: The caller must be signed in to read inference settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
    patch:
      operationId: patchV1Inference
      tags:
      - Inference
      summary: Update inference settings
      description: Enables or disables OpenWork Models for the active organization.
      responses:
        '200':
          description: Inference settings updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceStatusResponse'
        '400':
          description: The inference settings request was invalid.
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/InvalidRequestError'
                - $ref: '#/components/schemas/InferenceProviderMissingError'
        '401':
          description: The caller must be signed in to update inference settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Only workspace owners can update inference settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                tier:
                  type: string
                  enum:
                  - tier1
                  - tier2
              required:
              - enabled
components:
  schemas:
    InvalidRequestError:
      type: object
      properties:
        error:
          type: string
          const: invalid_request
        details:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  anyOf:
                  - type: string
                  - type: number
            required:
            - message
            additionalProperties: {}
      required:
      - error
      - details
    ForbiddenError:
      type: object
      properties:
        error:
          type: string
          enum:
          - forbidden
          - reauth
        reason:
          type: string
        message:
          type: string
      required:
      - error
    InferenceStatus:
      type: object
      properties:
        enabled:
          type: boolean
        tier:
          type: string
          enum:
          - tier1
          - tier2
        memberCount:
          type: number
        proxyBaseUrl:
          type: string
        upstreamProviderConfigured:
          type: boolean
        subscribed:
          type: boolean
        buckets:
          type: array
          items:
            type: object
            properties:
              windowType:
                type: string
                enum:
                - five_hour
                - weekly
                - monthly
              windowStartAt:
                type: string
              windowEndAt:
                type: string
              limitAmount:
                type: number
              usedAmount:
                type: number
            required:
            - windowType
            - windowStartAt
            - windowEndAt
            - limitAmount
            - usedAmount
      required:
      - enabled
      - tier
      - memberCount
      - proxyBaseUrl
      - upstreamProviderConfigured
      - buckets
    InferenceStatusResponse:
      type: object
      properties:
        inference:
          $ref: '#/components/schemas/InferenceStatus'
      required:
      - inference
    InferenceProviderMissingError:
      type: object
      properties:
        error:
          type: string
          const: openrouter_management_api_key_missing
        message:
          type: string
      required:
      - error
      - message
    UnauthorizedError:
      type: object
      properties:
        error:
          type: string
          const: unauthorized
      required:
      - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: session-token
      description: 'Session token passed as `Authorization: Bearer <session-token>` for user-authenticated Den routes.'
    denApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Organization API key passed as the `x-api-key` header for API-key-authenticated Den routes.