batch api.md

For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs; this page is available as Markdown.

Batch API

Parasail's batch API is a direct drop-in replacement for OpenAI's batch API. The same documentation, guides, and client libraries apply.

Base URL

https://api.parasail.io/v1

Client setup

from openai import OpenAI

client = OpenAI(
    base_url="https://api.parasail.io/v1",
    api_key="<PARASAIL_API_KEY>",
)

Key differences from OpenAI

OpenAI API reference

Batch helper library

Parasail provides a Python batch helper library that simplifies batch submission and monitoring:

pip install openai-batch

See the openai-batch GitHub repository and batch full guide for details.

Batch file format

The batch input file is a JSONL file where each line is a request. The format is 100% compatible with OpenAI. See Batch file format.

Batch priority

Batches have a default priority of 0. Set a higher priority by passing the PARASAIL_PRIORITY metadata key when creating the batch.

from openai_batch import Batch

with Batch() as batch:
    for i in range(100):
        batch.add_to_batch(
            model="NousResearch/DeepHermes-3-Mistral-24B-Preview",
            messages=[{"role": "user", "content": f"Prompt #{i}"}],
        )

batch.submit(metadata={"PARASAIL_PRIORITY": "1"})

Use priority sparingly for urgent jobs. Standard jobs should omit this metadata and use the default priority.