OpenRelay Files API

Input and result files for the Batch API (JSONL, up to 200 MB and 50,000 records). Served by the inference endpoint (inference.openrelay.inc).

OpenAPI Specification

openrelay-files-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  description: 'The OpenRelay control-plane REST API. Deploy GPU VMs and inference clusters, manage organizations and billing, and automate your infrastructure. All requests are authenticated with an API key (`vl_…`) unless noted otherwise.

    '
  title: OpenRelay Account Files API
  version: 0.1.0
servers:
- description: Production
  url: https://api.openrelay.inc
- description: Beta
  url: https://api.beta.openrelay.inc
- description: Local development
  url: http://localhost:8083
tags:
- description: 'Input and result files for the Batch API (JSONL, up to 200 MB and 50,000 records). Served by the inference endpoint (inference.openrelay.inc).

    '
  name: Files
paths:
  /v1/files:
    servers:
    - description: Production
      url: https://inference.openrelay.inc
    - description: Beta
      url: https://inference.beta.openrelay.inc
    post:
      description: 'Send multipart/form-data with a `file` part (the JSONL bytes, up to 200 MB and 50,000 records) and a `purpose` field set to `batch`. Each line is one request object; the returned file id goes in `input_file_id` when creating a batch.

        '
      operationId: uploadFile
      requestBody:
        content:
          multipart/form-data:
            schema:
              properties:
                file:
                  description: The JSONL file contents.
                  format: binary
                  type: string
                purpose:
                  enum:
                  - batch
                  type: string
              required:
              - file
              - purpose
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileObject'
          description: OK
        '400':
          $ref: '#/components/responses/InferenceBadRequest'
        '401':
          $ref: '#/components/responses/InferenceUnauthorized'
        '404':
          $ref: '#/components/responses/InferenceNotFound'
        '413':
          $ref: '#/components/responses/InferenceTooLarge'
        '429':
          $ref: '#/components/responses/InferenceRateLimited'
      security:
      - apiKey: []
      summary: Upload a JSONL input file for the Batch API
      tags:
      - Files
      x-openrelay-mcp:
        exclude: true
  /v1/files/presign:
    servers:
    - description: Production
      url: https://inference.openrelay.inc
    - description: Beta
      url: https://inference.beta.openrelay.inc
    post:
      description: 'For browser clients that upload the file straight to storage instead of through the API: returns a file id and a signed PUT URL (valid 15 minutes). After the PUT succeeds, register the file with the complete call. CLI and SDK clients should use the plain upload instead.

        '
      operationId: presignFileUpload
      requestBody:
        content:
          application/json:
            schema:
              properties:
                bytes:
                  description: Exact size of the upcoming upload in bytes (max 200 MB).
                  format: int64
                  type: integer
                filename:
                  description: Display name; not persisted.
                  type: string
              required:
              - bytes
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PresignUploadResponse'
          description: OK
        '400':
          $ref: '#/components/responses/InferenceBadRequest'
        '401':
          $ref: '#/components/responses/InferenceUnauthorized'
        '404':
          $ref: '#/components/responses/InferenceNotFound'
      security:
      - apiKey: []
      summary: Mint a signed URL for a direct JSONL upload
      tags:
      - Files
      x-openrelay-cli:
        hidden: true
      x-openrelay-mcp:
        exclude: true
  /v1/files/{id}:
    servers:
    - description: Production
      url: https://inference.openrelay.inc
    - description: Beta
      url: https://inference.beta.openrelay.inc
    get:
      operationId: getFile
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileObject'
          description: OK
        '401':
          $ref: '#/components/responses/InferenceUnauthorized'
        '404':
          $ref: '#/components/responses/InferenceNotFound'
      security:
      - apiKey: []
      summary: Get a file's metadata
      tags:
      - Files
  /v1/files/{id}/complete:
    servers:
    - description: Production
      url: https://inference.openrelay.inc
    - description: Beta
      url: https://inference.beta.openrelay.inc
    post:
      description: 'Validates the uploaded object (size, line count) and registers it as a batch input file. Idempotent; completing an already-registered id returns the existing file.

        '
      operationId: completeFileUpload
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileObject'
          description: OK
        '400':
          $ref: '#/components/responses/InferenceBadRequest'
        '401':
          $ref: '#/components/responses/InferenceUnauthorized'
        '404':
          $ref: '#/components/responses/InferenceNotFound'
      security:
      - apiKey: []
      summary: Register a presigned upload after the PUT succeeds
      tags:
      - Files
      x-openrelay-cli:
        hidden: true
      x-openrelay-mcp:
        exclude: true
  /v1/files/{id}/content:
    servers:
    - description: Production
      url: https://inference.openrelay.inc
    - description: Beta
      url: https://inference.beta.openrelay.inc
    get:
      description: 'Streams the file bytes. Use it to fetch batch results: the batch object''s output_file_id (successful records) and error_file_id (failed records) each point at a JSONL file of `{custom_id, response | error}` lines.

        '
      operationId: getFileContent
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/octet-stream:
              schema:
                format: binary
                type: string
          description: The file's raw JSONL bytes
        '401':
          $ref: '#/components/responses/InferenceUnauthorized'
        '404':
          $ref: '#/components/responses/InferenceNotFound'
      security:
      - apiKey: []
      summary: Download a file's raw JSONL content
      tags:
      - Files
      x-openrelay-mcp:
        exclude: true
components:
  responses:
    InferenceNotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceError'
      description: Not found (also returned when the organization does not have Batch API access)
    InferenceBadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceError'
      description: The request is invalid
    InferenceRateLimited:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceError'
      description: Too many concurrent uploads; retry shortly
    InferenceUnauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceError'
      description: Missing or invalid API key
    InferenceTooLarge:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceError'
      description: The upload exceeds the 200 MB limit
  schemas:
    PresignUploadResponse:
      description: A minted file id and a signed URL for a direct browser upload.
      properties:
        expires_at:
          description: Unix timestamp (seconds) the signed URL stops working.
          format: int64
          type: integer
        file_id:
          description: File id to register with the complete call after the PUT succeeds.
          type: string
        put_url:
          description: Signed URL; PUT the raw JSONL bytes to it.
          type: string
      required:
      - file_id
      - put_url
      - expires_at
      type: object
    InferenceError:
      description: Error shape returned by the inference endpoint (OpenAI-compatible).
      properties:
        error:
          properties:
            code:
              description: Machine code for the specific failure.
              type: string
            message:
              description: Human-readable explanation.
              type: string
            type:
              description: Error class, e.g. invalid_request_error.
              type: string
          required:
          - message
          - type
          type: object
      required:
      - error
      type: object
    FileObject:
      description: A file stored for the Batch API (OpenAI-compatible).
      properties:
        bytes:
          description: File size in bytes.
          format: int64
          type: integer
        created_at:
          description: Unix timestamp (seconds).
          format: int64
          type: integer
        expires_at:
          description: Unix timestamp (seconds); files are retained for 30 days.
          format: int64
          type: integer
        filename:
          type: string
        id:
          description: File id (file-…). Pass it as input_file_id when creating a batch.
          type: string
        object:
          enum:
          - file
          type: string
        purpose:
          description: '"batch" for inputs, "batch_output" / "batch_error" for result files.'
          type: string
      required:
      - id
      - object
      - bytes
      - created_at
      - filename
      - purpose
      type: object
  securitySchemes:
    apiKey:
      description: 'OpenRelay API key. Send it as `Authorization: Bearer vl_…`.'
      scheme: bearer
      type: http