Client SDK for ai-stream-proxy.
Project description
Usage
import asyncio
if __name__ == '__main__':
from ai_stream_proxy import StreamProxyClient
async def main():
client = StreamProxyClient(
server_url="http://127.0.0.1:3000",
httpx_async_client_options={'proxy': 'http://127.0.0.1:7890'}
)
await client.delete_stream(stream_id='test')
await client.create_stream(
stream_id='test',
message_id='haha',
content_type='claude-code-stream-json+include-partial-messages'
)
async with client.new_stream(stream_id="test") as stream:
with open('some-claude-code-output.jsonl', 'r') as f:
while True:
chunk = f.read(4096)
if not chunk:
break
stream.enqueue(chunk.encode('utf-8'))
stream.finish(abort=False, reason="Finish")
await client.wait_for_current_streams()
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
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-0.1.2.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_stream_proxy-0.1.2.tar.gz.
File metadata
- Download URL: ai_stream_proxy-0.1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2891539b7d4cf5b0f0c0c736ce0b03c07a0475f07cb792b067d48ca05872135e
|
|
| MD5 |
25c6104a0d47544dad3dc34ea52186a7
|
|
| BLAKE2b-256 |
22a1939243e794c30399f17098cbf5434606ac50aede832cc2def9fa21498829
|
File details
Details for the file ai_stream_proxy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ai_stream_proxy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae92007ea9a39b302a55d12921d9d0a0c0b42ecf6ae99298566781db41345a6e
|
|
| MD5 |
c85ed1de2aed4f3b48e488fd17a8d320
|
|
| BLAKE2b-256 |
1cf54eae3e1306ab9540c8770a66d2e79c50a63cfa2bd457e2439ed3d72afb37
|