Sync and async Python SDK for the Pantheon stream-proxy service.
Project description
ai-stream-proxy-sdk
Python SDK for the Pantheon stream-proxy service with aligned sync and async APIs.
Sync
from ai_stream_proxy import StreamProxyClient
with StreamProxyClient(server_url="http://127.0.0.1:3000") as client:
client.create_stream(
stream_id="example-sync",
message_id="msg-sync",
content_type="claude-code-stream-json+include-partial-messages",
)
with client.new_stream(stream_id="example-sync") as stream:
stream.enqueue(b'{"type":"thread.started","thread_id":"thread-1"}\n')
Async
import asyncio
from ai_stream_proxy import AsyncStreamProxyClient
async def main() -> None:
async with AsyncStreamProxyClient(server_url="http://127.0.0.1:3000") as client:
await client.create_stream(
stream_id="example-async",
message_id="msg-async",
content_type="codex-stream-json",
)
async with client.new_stream(stream_id="example-async") as stream:
stream.enqueue(b'{"type":"thread.started","thread_id":"thread-1"}\n')
asyncio.run(main())
Delayed Stop Signal
If another service should send the terminal stop signal later, disable auto-finish on context exit:
async with client.new_stream(
stream_id="example-async",
auto_finish_on_exit=False,
) as stream:
stream.enqueue(b"chunk")
await stream.close_without_stop()
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
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_sdk-0.2.0.tar.gz.
File metadata
- Download URL: ai_stream_proxy_sdk-0.2.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b313f22f22f9a6388abe79456090547196da60e767c6af563ed953145951e42
|
|
| MD5 |
9bae5700cb7dbdd4e2532cdf993225f5
|
|
| BLAKE2b-256 |
8edf547a7ed47ce66326514b33525d002a5ff310d6dab15e213727f59eed193d
|
File details
Details for the file ai_stream_proxy_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_stream_proxy_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3418e07101b50cf9f15aad07929958f186664f1f2c756e360cb7bffb839a2f9c
|
|
| MD5 |
e01eb816a9993374cdbfd783c89b3b68
|
|
| BLAKE2b-256 |
12f3d45196c5a5b5f3e0adf871672775812e42f6567b2a5ffac990f65a21ea1b
|