Skip to content

feat(python-sdk): add OpenRouter audio output and music generation (#465)#478

Merged
santoshkumarradha merged 1 commit intodev/add-videofrom
feat/465-audio-music
Apr 18, 2026
Merged

feat(python-sdk): add OpenRouter audio output and music generation (#465)#478
santoshkumarradha merged 1 commit intodev/add-videofrom
feat/465-audio-music

Conversation

@santoshkumarradha
Copy link
Copy Markdown
Member

Summary

  • Implement OpenRouterProvider.generate_audio() with SSE streaming: parses choices[0].delta.audio.data base64 chunks and transcript text from OpenRouter chat completions API
  • Add generate_music() to MediaProvider ABC (raises NotImplementedError by default) and implement in OpenRouterProvider using same SSE pattern with music-capable models (e.g. google/lyria-3-pro)
  • Add ai_generate_music() convenience method to AgentAI mixin and Agent class
  • Update OpenRouterProvider.supported_modalities to ["image", "audio", "music"]

Test plan

  • 18 new tests in test_openrouter_audio.py covering SSE parsing, chunk concatenation, transcript extraction, model prefix stripping, format/voice validation, error handling, ABC default behavior, modality checks, and AgentAI delegation
  • Updated existing test_openrouter_audio_is_not_supported to test_openrouter_audio_requires_api_key
  • Full test suite passes (0 failures)
  • ruff check and ruff format clean

)

Implement SSE streaming audio via OpenRouter chat completions API and
add music generation capability to the MediaProvider ABC and
OpenRouterProvider.
@santoshkumarradha santoshkumarradha requested review from a team and AbirAbbas as code owners April 18, 2026 10:01
@github-actions
Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
Python 7.9 KB -13% 0.33 µs -6%

✓ No regressions detected

@github-actions
Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 86%, aggregate ≥ 88%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.30% 87.30% → +0.00 pp 🟡
sdk-go 90.70% 90.70% → +0.00 pp 🟢
sdk-python 93.63% 93.63% ↑ +0.00 pp 🟢
sdk-typescript 92.56% 92.56% → +0.00 pp 🟢
web-ui 90.02% 90.01% ↑ +0.01 pp 🟢
aggregate 89.02% 89.01% ↑ +0.01 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions
Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@santoshkumarradha santoshkumarradha merged commit 4e208c7 into dev/add-video Apr 18, 2026
24 checks passed
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