aimarket-streaming
Documentation
| Document | Description |
|---|---|
| User guide | Install, configure, verify plugin is loaded |
| User cases | Personas and cross-plugin workflows |
| SDK integration | Code examples and hook behavior |
SSE/WS streaming + per-chunk billing with micro-receipts. Capability streams tokens. Every N tokens → signed micro-receipt. Consumer can cancel mid-stream — pays only for what was received. Channel balance debited incrementally.
When to Use
- LLM text generation (tokens streamed → billed per 10 tokens)
- Long-running AI tasks where consumer wants partial results
- Budget-sensitive consumers who want to cancel mid-stream
- Audit: every chunk has a signed receipt for compliance
Installation
pip install aimarket-streaming
Example
from aimarket_hub.signing import Signer
from aimarket_streaming.streaming import StreamingBiller
signer = Signer()
biller = StreamingBiller(signer)
session = biller.open_session(
capability_id="text.generate@v1", product_id="prod-gpt",
channel_id="ch_abc123", price_per_token_usd=0.001,
tokens_per_chunk=10
)
async def token_stream():
for word in ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog", ".", "..."]:
yield word # In production: yield actual LLM tokens
import asyncio
async def main():
async for chunk in biller.stream_tokens(session, token_stream()):
print(f"Chunk {chunk['chunk_receipt']['chunk_index']}: "
f"${chunk['cumulative_price_usd']:.6f} "
f"({chunk['cumulative_tokens']} tokens)")
asyncio.run(main())
# Cancel mid-stream — pays only for received
result = biller.cancel_session(session.session_id)
print(f"Cancelled. Total paid: ${result['total_price_usd']:.6f}")
Per-Chunk Billing
price_per_token_usd: 0.001 (0.1 cent per token)tokens_per_chunk: 10 (micro-receipt every 10 tokens)- Each chunk receipt is Ed25519-signed — verifiable audit trail
License
MIT · Maintained by AI-Factory
Metadata
Release files for aimarket-streaming 2.0.1
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 |
|---|---|---|---|---|
| aimarket_streaming-2.0.1.tar.gz | 4.2 kB | Without provenance | Details for aimarket_streaming-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aimarket_streaming-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for aimarket_streaming-2.0.1-py3-none-any.whl |
Total release size: 8.9 kB
Release files / aimarket_streaming-2.0.1.tar.gz
| Download URL | aimarket_streaming-2.0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9dc962adce14c864a8cf994226aada7855c5a39f7cf5465634b968b351ec1d9
|
|
BLAKE2b-256 checksum How to use checksums |
64f066350d115ff43b0cb44fcb74977ef99c46900e2bda786cbc6597ad7cb749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / aimarket_streaming-2.0.1-py3-none-any.whl
| Download URL | aimarket_streaming-2.0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
055b9c27713ff230c22568f0d5ca2afb3c26806d6b28e0fd218044cf8cd0fe70
|
|
BLAKE2b-256 checksum How to use checksums |
6e23fb541c547f98a850ca756277b944ac82ff4441fcdf2cf94fd8e775762dab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for aimarket-streaming 2.0.1
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.