fix: Unexpected response received: Status 200 Content-Type video/mp4 by ivo-stratev-frontierteams · Pull Request #363 · OpenRouterTeam/python-sdk · GitHub
Skip to content

fix: Unexpected response received: Status 200 Content-Type video/mp4#363

Open
ivo-stratev-frontierteams wants to merge 1 commit into
OpenRouterTeam:mainfrom
ivo-stratev-frontierteams:fix/video_generation_content_type_video_mp4
Open

fix: Unexpected response received: Status 200 Content-Type video/mp4#363
ivo-stratev-frontierteams wants to merge 1 commit into
OpenRouterTeam:mainfrom
ivo-stratev-frontierteams:fix/video_generation_content_type_video_mp4

Conversation

@ivo-stratev-frontierteams

Copy link
Copy Markdown

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: ...

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: ...

```
@ivo-stratev-frontierteams

Copy link
Copy Markdown
Author

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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:

  1. Update .speakeasy/out.openapi.yaml to add video/mp4 as a valid 200 response content type alongside application/octet-stream, then re-run speakeasy run to regenerate the SDK. This produces a verified fix that survives future codegen runs.
  2. 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

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.

1 participant