Cost-shield foundation for AI workloads: OpenAI + Anthropic Batch APIs, live/batch urgency router, shared embedding cache.
pip install matrx-batch==0.2.158 Copy PIP instructions
matrx-batch sits one notch above matrx-utils in the dependency graph and is consumed by matrx-rag (embedding cache) and matrx-ai (urgency router, future). It MUST NOT import from aidream/ or from any other matrx-* sibling — every cross-boundary dependency comes in via matrx_batch.configure(...).
import matrx_batch from openai import AsyncOpenAI from anthropic import AsyncAnthropic matrx_batch.configure( openai_client=AsyncOpenAI(api_key=settings.OPENAI_API_KEY), anthropic_client=AsyncAnthropic(api_key=settings.ANTHROPIC_API_KEY), pool_factory=lambda: get_async_pg_pool(), cost_check=_aidream_budget_precheck, ) # Wire the cache into matrx-rag's embed() funnel import matrx_rag matrx_rag.configure(embedding_cache=matrx_batch.get_embedding_cache()) Usage (consumer) from matrx_batch import BatchRouter, BatchableJob router = BatchRouter() receipt = await router.submit( BatchableJob( kind="chat", provider="anthropic", urgency="auto", payload={"model": "claude-haiku-4-5", "messages": [...]}, estimated_tokens_in=8200, ) ) See also CLAUDE.md — package rules and injection-point contract. matrx_batch/embedding_cache.py — chunk-level embedding reuse. matrx_batch/router.py — urgency routing decisions. Key dates PyPI data Data sourced directly from PyPI's database. Released: Oct 20, 2026 Latest release 1 maintainer PyPI data Data sourced directly from PyPI's database. armanisadeghi Credits Author: Matrx
All 2 files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
All 2 files in this release have been uploaded with provenance metadata.
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.




