Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Groq Groq python Batches Create

From Leeroopedia
Knowledge Sources
Domains Batch_Processing
Last Updated 2026-02-15 16:00 GMT

Overview

Concrete tool for creating batch processing jobs provided by the Groq Python SDK.

Description

The Batches.create() method POSTs to /openai/v1/batches to initiate asynchronous batch processing. It returns a BatchCreateResponse with the batch id and status.

Usage

Access via client.batches.create(). Provide the input_file_id, endpoint, and completion_window.

Code Reference

Source Location

  • Repository: groq-python
  • File: src/groq/resources/batches.py
  • Lines: L50-107 (sync), L215-272 (async)

Signature

class Batches(SyncAPIResource):
    def create(
        self,
        *,
        completion_window: str,
        endpoint: Literal["/v1/chat/completions"],
        input_file_id: str,
        metadata: Optional[Dict[str, str]] | Omit = omit,
    ) -> BatchCreateResponse:

Import

from groq import Groq
# Access via: client.batches.create(...)

I/O Contract

Inputs

Name Type Required Description
input_file_id str Yes File ID from upload step
endpoint Literal["/v1/chat/completions"] Yes Target API endpoint
completion_window str Yes Processing timeframe ("24h" to "7d")
metadata Optional[Dict[str, str]] No Custom key-value metadata

Outputs

Name Type Description
(return) BatchCreateResponse Object with id, status, input_file_id, created_at, request_counts

Usage Examples

batch = client.batches.create(
    input_file_id=file_response.id,
    endpoint="/v1/chat/completions",
    completion_window="24h",
)
print(f"Batch ID: {batch.id}")
print(f"Status: {batch.status}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment