From 7a9790fae84b55ac69ac34586a64129316acc721 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 15:01:00 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- README.md | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index be8b2ba..805d028 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-7270b9e4859010d6680bcc92afcd6f7c679d80a2645f65d7097d19ce2e8cdc5a.yml openapi_spec_hash: 5fcbfaedebfea62c17c74437a9728b04 -config_hash: 38a50dff50297c2f735b5e1c83fa0188 +config_hash: 38041c37df28a1c4383718e6d148dd0a diff --git a/README.md b/README.md index 13677b3..0e9425a 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,32 @@ async def main() -> None: asyncio.run(main()) ``` +## Streaming responses + +We provide support for streaming responses using Server Side Events (SSE). + +```python +from opencode_ai import Opencode + +client = Opencode() + +stream = client.event.list() +for events in stream: + print(events) +``` + +The async client uses the exact same interface. + +```python +from opencode_ai import AsyncOpencode + +client = AsyncOpencode() + +stream = await client.event.list() +async for events in stream: + print(events) +``` + ## Using types Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: