All posts
Batch inference at scale
Insights 9 min read· Aug 23, 2026· By Engineering

Batch inference at scale

Semaphores, backpressure, and how to run 100K completions overnight.

Batch jobs are the least glamorous LLM workload and often the highest ROI — enrichment, summarization, classification, tagging.

python
sem = asyncio.Semaphore(20)  # 20 concurrent
async def one(item):
    async with sem:
        return await client.chat.completions.create(...)
Cap concurrency, don't retry blindly, log every failure with the input so you can resume.

Build this with TokenRex

TokenRex is an LLM marketplace by Asirex Labs. Choose an enabled model, create a private API key and use the supported endpoint shown in Docs. Check live prices before your first request.