Skip to content

refactor(api-proxy): read the image from a buffered call - #49

Draft
rickstaa wants to merge 1 commit into
mainfrom
rs/api-proxy-buffered
Draft

refactor(api-proxy): read the image from a buffered call#49
rickstaa wants to merge 1 commit into
mainfrom
rs/api-proxy-buffered

Conversation

@rickstaa

Copy link
Copy Markdown
Member

Blocked on livepeer/livepeer-python-gateway#51 and #52 landing in ja/live-runner. The example pins that branch, so no pyproject.toml change is needed; mark ready and merge once both are in.

One bounded call returning a 120 KB image has nothing to stream. stream=True was there because call_runner's buffered path assumed a JSON object and raised on image/jpeg. With #51 the body arrives in result.content, so the async with / aiter_bytes() block collapses to one line.

One thing worth knowing: the buffered path bounds the whole request with call_runner's 5s default, which streaming did not (open_stream sets sock_read=None). Dropping stream=True without a timeout fails after ~5s with failed to reach endpoint and no mention of a timeout, so the call passes timeout=180.

The nginx Accept pin stays. It is not a workaround for the SDK bug: the runner advertises an image at a fixed price, so the response format is its choice, and the pin still holds for callers that are not this SDK or are on an older pin.

Tested

End to end on the paid path against the stacked SDK branch (#51 + #52), with the pin in place: a real Hugging Face call returned a 1024x1024 image/jpeg (56313 bytes) into result.content. The temporary SDK pin used for that run was reverted before committing.

Closes #47

One bounded call returning a 120 KB image has nothing to stream:
stream=True was there because call_runner's buffered path assumed a
JSON object and raised on image/jpeg. With that fixed upstream the
async with / aiter_bytes block collapses into result.content.

The buffered path bounds the whole request, which streaming did not,
so the call now passes a timeout the model can actually meet.

The nginx Accept pin stays: the runner advertises an image at a fixed
price, so the format is its choice, not a caller's.

Closes #47

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api-proxy: drop stream=True once call_runner returns raw bytes

1 participant