A simple command-line tool to run batch completions against the OpenAI API.
This tool can be used to submit batch jobs to the OpenAI API and to notify you when they are completed. In more detail, this tool:
- Uploads the batch file to the API
- Submits the batch job
- Periodically checks in to test for job completion
- Downloads the completion and error files (default:
JOBID_output.jsonl
andJOBID_error.jsonl
) - Emails you to notify completion (see email configuration below)
- Cleans up the uploaded batch file
Requires Python 3.8+.
$ pip install git+https://github.com/zhudotexe/oaibatch.git@main
You must set the OPENAI_API_KEY
environment variable.
To control the organization requests are made in, use the OPENAI_ORG_ID
environment variable.
# submit a batch job
$ oaibatch my_jsonl_batch_file.jsonl
# list ongoing batch jobs
$ oaibatch list
# cancel a batch job
$ oaibatch cancel <job_id>
# view a list of all commands
$ oaibatch --help
To configure oaibatch
to send emails on completion, your system must set up the mail
command. By default,
oaibatch
will use mail
to send the results of the batch job to the current user, and attach the input and generated
files.
-
-i
interactive mode, estimate cost and ask -
-q
no emails - configure email recipient
- configure output files
- configure completion check rate