Batch.Jobs

April 27, 2026 ยท View on GitHub

Overview

Available Operations

list

Get a list of batch jobs for your organization and user.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.batch.jobs.list(page=0, page_size=100, created_by_me=False, order_by="-created")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
pageOptional[int]:heavy_minus_sign:N/A
page_sizeOptional[int]:heavy_minus_sign:N/A
modelOptionalNullable[str]:heavy_minus_sign:N/A
agent_idOptionalNullable[str]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:N/A
created_afterdate:heavy_minus_sign:N/A
created_by_meOptional[bool]:heavy_minus_sign:N/A
statusList[models.BatchJobStatus]:heavy_minus_sign:N/A
order_byOptional[models.OrderBy]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ListBatchJobsResponse

Errors

Error TypeStatus CodeContent Type
errors.SDKError4XX, 5XX*/*

create

Create a new batch job, it will be queued for processing.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.batch.jobs.create(endpoint="/v1/moderations", model="mistral-small-latest", timeout_hours=24)

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescriptionExample
endpointmodels.APIEndpoint:heavy_check_mark:N/A
input_filesList[str]:heavy_minus_sign:A list of .jsonl files for batch inference.
Each line must be a JSON object with a body field containing the request payload:
json<br/>{"custom_id": "0", "body": {"max_tokens": 100, "messages": [{"role": "user", "content": "What is the best French cheese?"}]}}<br/>{"custom_id": "1", "body": {"max_tokens": 100, "messages": [{"role": "user", "content": "What is the best French wine?"}]}}<br/>
requestsList[models.BatchRequest]:heavy_minus_sign:N/A
modelOptionalNullable[str]:heavy_minus_sign:The model to be used for batch inference.Example 1: mistral-small-latest
Example 2: mistral-medium-latest
agent_idOptionalNullable[str]:heavy_minus_sign:In case you want to use a specific agent from the deprecated agents api for batch inference, you can specify the agent ID here.
metadataDict[str, str]:heavy_minus_sign:The metadata of your choice to be associated with the batch inference job.
timeout_hoursOptional[int]:heavy_minus_sign:The timeout in hours for the batch inference job.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.BatchJob

Errors

Error TypeStatus CodeContent Type
errors.SDKError4XX, 5XX*/*

get

Get a batch job details by its UUID.

Args: inline: If True, return results inline in the response.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.batch.jobs.get(job_id="4017dc9f-b629-42f4-9700-8c681b9e7f0f")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
job_idstr:heavy_check_mark:N/A
inlineOptionalNullable[bool]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.BatchJob

Errors

Error TypeStatus CodeContent Type
errors.SDKError4XX, 5XX*/*

delete

Request the deletion of a batch job.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.batch.jobs.delete(job_id="d9e71426-5791-49ad-b8d1-cf0d90d1b7d0")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
job_idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.DeleteBatchJobResponse

Errors

Error TypeStatus CodeContent Type
errors.SDKError4XX, 5XX*/*

cancel

Request the cancellation of a batch job.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.batch.jobs.cancel(job_id="4fb29d1c-535b-4f0a-a1cb-2167f86da569")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
job_idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.BatchJob

Errors

Error TypeStatus CodeContent Type
errors.SDKError4XX, 5XX*/*