Files

Upload a JSONL input file for the Batch API

Changed on

Uploads a JSONL file of batch requests and returns its file object: the file id, size in bytes, purpose, and an expiry time 30 days after the upload. 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 with the BatchRequestRecord shape (including the optional openrelay.tool_config extension on chat bodies); the returned file id goes in input_file_id when creating a batch. The upload checks only that the file is JSONL. Its records are checked when a batch is created from it, which rejects the invalid ones and runs the rest.

Requires the batch.write permission. See Permissions for the roles and API key permissions that include it.

post/v1/files

Request

  • Base URL
    https://inference.openrelay.inc
  • URL
    https://inference.openrelay.inc/v1/files
  • Auth
    HTTP bearer

Request body multipart/form-data

filestring binary required

The JSONL file contents.

purpose'batch' required

Response

OK

bytesinteger required

File size in bytes.

created_atinteger required

Unix timestamp (seconds).

expires_atinteger

Unix timestamp (seconds); files are retained for 30 days.

filenamestring required
idstring required

File id (file-…). Pass it as input_file_id when creating a batch.

object'file' required
purposestring required

"batch" for inputs, "batch_output" / "batch_error" for result files, and "batch_rejections" for the records a batch create rejected (one BatchRecordRejection per line).

Changes

    • info

      added the non-success response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status