Creates and executes a batch based on a previously uploaded input file.
Usage
openai_create_batch(
input_file_id,
endpoint,
completion_window = "24h",
metadata = NULL,
api_key = NULL
)Arguments
- input_file_id
The ID of the uploaded file (with purpose
"batch").- endpoint
The endpoint for the batch, e.g.
"/v1/chat/completions"or"/v1/responses".- completion_window
Time frame in which the batch should be processed. Currently only
"24h"is supported by the API.- metadata
Optional named list of metadata key–value pairs.
- api_key
Optional OpenAI API key.
See also
llm_submit_pairs_batch(), llm_download_batch_results()
Other batch backends:
anthropic_create_batch(),
anthropic_download_batch_results(),
anthropic_get_batch(),
anthropic_poll_batch_until_complete(),
build_anthropic_batch_requests(),
build_gemini_batch_requests(),
build_openai_batch_requests(),
gemini_create_batch(),
gemini_download_batch_results(),
gemini_get_batch(),
gemini_poll_batch_until_complete(),
llm_download_batch_results(),
llm_resume_multi_batches(),
llm_submit_pairs_batch(),
llm_submit_pairs_multi_batch(),
openai_download_batch_errors(),
openai_download_batch_output(),
openai_get_batch(),
openai_poll_batch_until_complete(),
openai_upload_batch_file(),
run_anthropic_batch_pipeline(),
run_gemini_batch_pipeline(),
run_openai_batch_pipeline(),
write_openai_batch_file()
Examples
if (FALSE) { # \dontrun{
# Requires OPENAI_API_KEY set in your environment and network access.
file_obj <- openai_upload_batch_file("batch_input.jsonl")
batch_obj <- openai_create_batch(
input_file_id = file_obj$id,
endpoint = "/v1/chat/completions"
)
batch_obj$status
} # }