relay
A unified, provider-agnostic Python library for submitting, managing, and downloading results from large-scale LLM batch prediction jobs across Anthropic, OpenAI, Google, and XAI.
Installation
# Minimal
pip install relay
# All providers + full feature set
pip install relay[all]
# Individual providers
pip install relay[anthropic]
pip install relay[openai]
pip install relay[google]
pip install relay[xai]
Quickstart
import asyncio
from relay import BatchClient, BatchRequest, BatchConfig, Message
requests = [
BatchRequest(id=f"req-{i}", messages=[Message(role="user", content=f"Summarize: {text}")])
for i, text in enumerate(my_texts)
]
config = BatchConfig(provider="anthropic", model="claude-opus-4-5")
async def main():
async with BatchClient() as client:
job = await client.submit(requests, config)
results = await client.wait_and_download(job.id)
return results
results = asyncio.run(main())
Features
- Provider-agnostic API — switch providers with a single config change
- Resilient job state — jobs survive process crashes; state is persisted to SQLite
- Smart caching — identical
(prompt, model, params)tuples are never sent twice - Cost estimation — token count and cost estimate before every submission
- Budget controls — configurable warn, confirm, and hard-limit thresholds
- Fan-out — send the same request to multiple providers simultaneously
- Multiple export formats — JSONL, CSV, Parquet, HuggingFace Dataset
- Terminal dashboard — live TUI for monitoring jobs, costs, and cache
- Web dashboard — lightweight FastAPI UI for remote monitoring
- Observability — Prometheus, OpenTelemetry, and JSONL metrics exporters
Provider Compatibility
| Provider | Model family | Batch API | Streaming | Fan-out |
|---|---|---|---|---|
| Anthropic | Claude 3/4 | Yes | No | Yes |
| OpenAI | GPT-4o, o-series | Yes | No | Yes |
| Gemini 1.5/2.0 | Yes | No | Yes | |
| XAI | Grok | Yes | No | Yes |
CLI
# Submit a batch job
relay submit requests.jsonl --provider anthropic --model claude-opus-4-5
# Submit and wait for results
relay run requests.jsonl --provider openai --model gpt-4o --output results.jsonl
# Dry-run cost estimate
relay estimate requests.jsonl --provider anthropic --model claude-opus-4-5
# List and monitor jobs
relay jobs list
relay jobs status <job-id>
# Export results
relay export <job-id> --format parquet --output results/
# Cache management
relay cache stats
relay cache vacuum
# Spending report
relay costs today
Documentation
See the spec.md for the full technical specification and API reference.
Metadata
Release files for relay-llm 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| relay_llm-0.3.0.tar.gz | 156.5 kB | Without provenance | Details for relay_llm-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| relay_llm-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for relay_llm-0.3.0-py3-none-any.whl |
Total release size: 320.1 kB
Release files / relay_llm-0.3.0.tar.gz
| Download URL | relay_llm-0.3.0.tar.gz |
|---|---|
| Size | 156.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53ac3fb6a6e25282ac09538f77436836ef6f514890eacb83d05eb13eb9cfd68f
|
|
BLAKE2b-256 checksum How to use checksums |
8265c9ea474b067934a3099e742f000515f883a304fe395d2355c03a588b6673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.4
|
Release files / relay_llm-0.3.0-py3-none-any.whl
| Download URL | relay_llm-0.3.0-py3-none-any.whl |
|---|---|
| Size | 163.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a58586b87d3f266c41d2df1aa3ffa26b26d5423db95013b700565d60d29f4558
|
|
BLAKE2b-256 checksum How to use checksums |
43ee5923bca54f11bc03b5fc0910fee5ff4ca4a5e9a07e43f6d7015799f196bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.4
|
Security for relay-llm 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.