Skip to main content

Client SDK for ai-stream-proxy.

Project description

ai-stream-proxy-sdk

Import name stays ai_stream_proxy.

Install

uv sync

Test

uv run pytest

Build

uv build

Publish

uv publish --token <pypi-token>

Sync usage

from ai_stream_proxy import StreamProxyClient

client = StreamProxyClient(server_url="http://127.0.0.1:3000")

client.create_stream(
    stream_id="test",
    message_id="message-1",
    content_type="claude-code-stream-json+include-partial-messages",
)

with client.new_stream(stream_id="test") as stream:
    stream.enqueue(b'{"type":"chunk"}\n')
    stream.finish(abort=False, reason="done")

message = client.get_stream_message(stream_id="test")
client.delete_stream(stream_id="test")
client.close()

Async usage

import asyncio

from ai_stream_proxy import AsyncStreamProxyClient


async def main() -> None:
    client = AsyncStreamProxyClient(server_url="http://127.0.0.1:3000")

    await client.create_stream(
        stream_id="test",
        message_id="message-1",
        content_type="claude-code-stream-json+include-partial-messages",
    )

    async with client.new_stream(stream_id="test") as stream:
        stream.enqueue(b'{"type":"chunk"}\n')
        stream.finish(abort=False, reason="done")

    message = await client.get_stream_message(stream_id="test")
    await client.delete_stream(stream_id="test")
    await client.aclose()


asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_stream_proxy_sdk-0.2.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_stream_proxy_sdk-0.2.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ai_stream_proxy_sdk-0.2.3.tar.gz.

File metadata

  • Download URL: ai_stream_proxy_sdk-0.2.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for ai_stream_proxy_sdk-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d3f6cef63e9d91565c5ed77875af429036358a36909d89898883c1b96084272d
MD5 547e691ab56de58317a83da7dc2f8742
BLAKE2b-256 713a640c7b15b651a6a93e054997ab63a00968057bb7036a3f3fb84b97be7247

See more details on using hashes here.

File details

Details for the file ai_stream_proxy_sdk-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_stream_proxy_sdk-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1419bd403401a20fc37eba8651ca5fd9aa79d211e759155adad1538a3f8517c2
MD5 f21304a3076899c5a89b0e0b02d13bf1
BLAKE2b-256 4678f4190320bc15d50154004df9bdf20736dff882b9e80af2584f6b11d1ed6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page