fix: Unexpected response received: Status 200 Content-Type video/mp4#363
Conversation
Adding support for accepting video/mp4 in addition to application/octet-stream Content-Type
when generating videos.
In effect this change fixes the following Error:
```
File "/Users/istratev/.../video.py", line 13, in get_content
resp = await open_router.video_generation.get_video_content_async(job_id=job_id, index=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/istratev/.../.venv/lib/python3.12/site-packages/openrouter/video_generation.py", line 970, in get_video_content_async
raise errors.OpenRouterDefaultError(
openrouter.errors.openrouterdefaulterror.OpenRouterDefaultError: Unexpected response received: Status 200 Content-Type video/mp4. Body: ...
```
There was a problem hiding this comment.
Perry's Review
Adds the video/mp4 mime type to the Accept header and response-handler chain so the SDK does not throw when the server returns that content type instead of application/octet-stream.
Verdict: 💬 Comments / questions
Details
Risk: 🟢 Low — purely additive response-handler fix, correct sync/async parity, no breaking changes
CI: all passing ✅
Findings (see inline comment for full context):
- 🟡
src/openrouter/video_generation.py:772— direct edit to a Speakeasy-generated file; will be reverted on the next codegen run
Security: no concerns
Test coverage: no tests accompany the change; acceptable for an integration-dependent server-behaviour fix
Unresolved threads: none
Scope: first review (full)
Review: tier=trivial · model=claude-sonnet-latest · score=0.1
There was a problem hiding this comment.
[suggestion] video_generation.py — this file is Speakeasy-generated (DO NOT EDIT); a direct edit will be reverted on the next speakeasy run
Details
Why: The file header reads """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" and the repo CONTRIBUTING.md states "we do not accept direct changes or pull requests" and "fixes will be included in the next generation of the generated code." The .speakeasy/out.openapi.yaml spec only declares application/octet-stream as the 200 response media type for GET /videos/{jobId}/content (line 31700). When speakeasy run is run again, it will regenerate this file from the spec and overwrite both the Accept header change and the video/mp4 match-response block.
The correct approach is one of:
- Update
.speakeasy/out.openapi.yamlto addvideo/mp4as a valid 200 response content type alongsideapplication/octet-stream, then re-runspeakeasy runto regenerate the SDK. This produces a verified fix that survives future codegen runs. - Open an issue/overlay in the upstream OpenRouter API spec (
.speakeasy/in.openapi.yaml) and apply the fix via a Speakeasy overlay, letting the SDK regenerate from source.
The fix logic itself is correct — Accept header update plus symmetric match_response checks on both sync and async variants — so the fix needs a codegen-compatible home, not code changes.
Prompt for agents
In `.speakeasy/out.openapi.yaml` at around line 31700 (the `listVideosContent` endpoint's 200 response), add `video/mp4` as a second accepted content type alongside `application/octet-stream`. Then run `speakeasy run` (or equivalent) to regenerate `src/openrouter/video_generation.py` from the updated spec. Do NOT edit `video_generation.py` directly — it is auto-generated and direct edits will be overwritten on the next regeneration cycle.
Reviewed at d9de7a9

Adding support for accepting video/mp4 in addition to application/octet-stream Content-Type when generating videos.
In effect this change fixes the following Error: