Skip to main content

Method

Creates a batch prediction job for processing multiple requests asynchronously. Batch jobs are ideal for high-volume, non-latency-sensitive workloads.
string
required
The model to use for the batch job. Example: gemini-2.0-flash-001
BatchJobSource
required
The source of the batch job data:
CreateBatchJobConfig
Configuration options for the batch job

Response

string
The resource name of the batch job
JobState
Current state of the batch job:
  • JOB_STATE_QUEUED: Job is queued
  • JOB_STATE_PENDING: Job is pending
  • JOB_STATE_RUNNING: Job is running
  • JOB_STATE_SUCCEEDED: Job completed successfully
  • JOB_STATE_FAILED: Job failed
  • JOB_STATE_CANCELLED: Job was cancelled
string
Timestamp when the job was created
string
Timestamp when the job started processing
string
Timestamp when the job completed
string
The model being used for the batch job
BatchJobDestination
Destination information for the output
object
Statistics about completed requests (Vertex AI only)

Usage

Create Batch Job from GCS (Vertex AI)

Create Batch Job from File (Gemini API)

With Inline Requests (Gemini API)

Monitor Job Progress

BigQuery Input/Output (Vertex AI)

Input Format

For file-based inputs (GCS or Files API), use JSONL format with one request per line:

Notes

  • Batch jobs process requests asynchronously and may take minutes to hours
  • Gemini API has lower quotas than Vertex AI for batch processing
  • Results are written to the specified destination upon completion
  • Monitor job status using batches.get
  • You can cancel running jobs using batches.cancel

See Also