Catalog PyPI
PACKAGE EXPLORERView in registry

aimarket-streaming

PyPI

SSE/WS streaming + per-chunk billing with micro-receipts

Versions collected1
Direct dependencies2From release 2.0.1
Last observed21 Oct, 11:15 UTC

README

Version 2.0.1 documentation

aimarket-streaming

Documentation

DocumentDescription
User guideInstall, configure, verify plugin is loaded
User casesPersonas and cross-plugin workflows
SDK integrationCode 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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
2.0.116 Oct 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
alexar76/aimarket-plugins

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:15 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:3849933364f1f38317159ed8698605329f11bfa5cbfd95942194f00cacc37a4a