Loom: LLM Batch Processing Made Easy

Published:

Loom: LLM Batch Processing Made Easy

In my daily work, I often need to process whole datasets with LLMs. This required my to always write the same code again. Many LLM providers like Google or OpenAI have special batch APIs, that reduce the token cost by 50%, but these was always too complicated to use. Therefore, I created Loom. Loom is a Python command line tool that makes batch processing easy.

I use Loom all the time in my daily work and it saved me so much time.

Feature overview

  • Multi-Provider Integration: Supports processing LLM jobs across OpenAI, Anthropic, Google (Gemini), and OpenRouter.
  • Two execution modes
    • Batch Mode (Default): Submits datasets asynchronously to provider batch APIs to save costs
    • Sequential Mode: Processes prompts in real-time using a concurrent worker pool and writes the output immediately.
  • Data Handling & Output: Uses CSV as input and output formats.
  • Transparent Compression: Natively handles gzip-compressed input files (.json.gz, .csv.gz) and outputs uncompressed results.
  • On-Disk Caching: Sequential mode utilizes an automatic, on-disk response cache to prevent redundant API calls and save money.
  • Native Token Counting: Features a loom tokens command that leverages official provider APIs to concurrently estimate input tokens before running large jobs.
  • Available as a python package on PyPi.

Links