Create batch
Run the requests in an uploaded file asynchronously at the model's batch price, within 24 hours. Every line must use the same model. Creating the batch checks each line, then reserves the most the batch can cost from the balance. When the batch finishes it is charged once, for the requests that completed. Failed and cancelled requests are not charged. Without Idempotency-Key, each request creates a new batch, which is how the official OpenAI SDK calls it.
ApiKeyAuthAuthorization<token>Idempotency-Key?stringRetrying with the same key returns the batch it first created instead of creating another.
length <= 255application/json- body
completion_window*"24h""24h"endpoint*stringThe endpoint every line of the file calls. Each line's url must match it.
"/v1/chat/completions""/v1/responses""/v1/embeddings"input_file_id*stringThe id of a file uploaded with purpose set to batch.
metadata?Up to 16 string pairs, returned on the batch. Keys are at most 64 characters.
properties <= 16The created batch, or the batch this Idempotency-Key created before
application/json- response
completed_at?integerUnix seconds.
completion_window*stringcreated_at*integerUnix seconds.
endpoint*stringerror_file_id?stringRead it with GET /v1/files/{file_id}/content.
errors?Present when the batch could not start. Nothing is charged for such a batch.
expires_at?integerUnix seconds. Set once the provider accepts the batch.
failed_at?integerUnix seconds.
id*stringinput_file_id*stringmetadata*object*"batch""batch"output_file_id?stringRead it with GET /v1/files/{file_id}/content.
request_counts*completed, failed, and cancelled stay 0 until the batch is settled.
status*stringfinalizing covers the provider's own finalizing step and the time OhMyGPT takes to settle the batch after the provider finishes. Results and final counts appear after it.
"validating""in_progress""finalizing""completed""failed""expired""cancelling""cancelled"curl -X POST 'https://api.ohmygpt.com/v1/batches' \ -H 'Content-Type: application/json' \ -d '{ "completion_window": "24h", "endpoint": "/v1/chat/completions", "input_file_id": "string"}'{ "completed_at": 0, "completion_window": "string", "created_at": 0, "endpoint": "string", "error_file_id": "string", "errors": { "data": [ { "code": "string", "message": "string" } ], "object": "list" }, "expires_at": 0, "failed_at": 0, "id": "string", "input_file_id": "string", "metadata": { "property1": "string", "property2": "string" }, "object": "batch", "output_file_id": "string", "request_counts": { "cancelled": 0, "completed": 0, "failed": 0, "total": 0 }, "status": "validating"}Still stuck? Live chat · [email protected] · Telegram group