Create Batch
Start processing an uploaded input file at /v1/batches
Overview
Creates a batch over a file uploaded withpurpose: batch and returns it in validating. Poll GET /v1/batches/{batch_id} until status is terminal. Every line must target /v1/chat/completions and name the same model, custom_id must be unique within the file, and stream: true is rejected. Completed requests are billed at half the model’s synchronous rate; see the Batch guide for the full contract.Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
Which file to process and how long to keep its results.
Start a batch over an uploaded input file.
Id of a file uploaded with purpose: batch.
"file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f"
Must be /v1/chat/completions; every input line must use the same url.
/v1/chat/completions "/v1/chat/completions"
Must be 24h. Requests not finished by then are expired, and the completed ones are still returned.
24h "24h"
Up to 16 string pairs to tag the batch. Keys up to 64 characters, values up to 512.
Expiry policy for the output and error files. Defaults to 30 days.
Response
The new batch, in validating.
A batch and where it is in its lifecycle.
Batch identifier, batch_ prefixed.
"batch_5f4e3d2c-1b0a-4f9e-8d7c-6b5a4f3e2d1c"
Object type, always batch.
"batch"
The endpoint every line targets. Always /v1/chat/completions.
"/v1/chat/completions"
The file the batch reads its requests from.
"file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f"
Always 24h. Requests still queued when the window closes are written to the error file as batch_expired.
"24h"
The key-value pairs you attached at creation, or null.
Unix timestamp (seconds) for when the batch was created.
1780000000
Lifecycle state. completed, failed, expired, and cancelled are terminal. expired and cancelled batches still expose partial output.
validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled "in_progress"
File holding one BatchOutputLine per request the model answered. Set once the batch is terminal; null before that and when nothing completed.
null
File holding one BatchErrorLine per request that never got a model response. Set once the batch is terminal; null before that and when nothing failed.
null
Unix timestamp (seconds) for when processing started. null until it happens.
1780000012
Unix timestamp (seconds) for when output files started being written. null until it happens.
null
Unix timestamp (seconds) for when the batch completed. null until it happens.
null
Unix timestamp (seconds) for when the batch failed. null until it happens.
null
Unix timestamp (seconds) for when the batch expired. null until it happens.
null
Unix timestamp (seconds) for when the completion window closes. null until it happens.
1780086400
Unix timestamp (seconds) for when cancellation was requested. null until it happens.
null
Unix timestamp (seconds) for when cancellation finished. null until it happens.
null
Progress counters. Advance while the batch is in_progress; final once it is terminal.
Why the batch failed validation, or null.
null
Token totals so far, or null before any request has completed.
The model the batch runs on, once validation has read it from the input file.
"morph-glm53flash"