Add MiniMax H3 video v2 support - #854
Conversation
Performance
✓ No regressions detected |
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
e79ba90 to
ce8ee63
Compare
AbirAbbas
left a comment
There was a problem hiding this comment.
Picked this up since it had been quiet for a few days. I tested it rather than just reading the diff — ran the V2 lifecycle against a local mock server, and replayed the legacy V1 video and music calls against both this branch and main to diff the outgoing requests. The preservation claim holds: legacy request construction is byte-identical to main.
Two things needed fixing before this could land, and I've pushed a commit for both:
Pricing was wrong in a way that matters. Global rates were $0.02/sec for reference video and $0.03 per additional image; MiniMax publishes $0.13/sec and $0.04. Because cost_usd flows into AgentField's usage tracking, that under-reports real spend rather than just being a cosmetic metadata error. The fixture asserted $0.72 where the correct math gives $0.95. I corrected the constants for both regions and made _estimate_h3_cost_usd pick its rate from the task's actual resolution instead of assuming 2K.
768P was rejected. The official V2 schema's resolution enum is ["768P", "2K"], but _build_h3_request hard-required 2K, so a valid 768P request failed locally. Now both are accepted and both are advertised in the metadata, with 768P pricing filled in for both regions.
I also dropped expired from the status enum (official statuses end at cancelled), added validation for task_type — it was previously unvalidated, so filter.task_type=bogus sailed through to the server — and added a regression test locking the legacy music request shape, since that preservation guarantee was only proven by my throwaway probe and needed to be protected in the suite while the three MiniMax PRs get reconciled.
Worth flagging for the other two: #852 and #853 conflict with each other in supported_modalities and the shared video test. This one is textually clean against both, so it goes first.
…886) PR #854 promoted content/ratio/callback_url/aigc_watermark to named parameters of MiniMaxProvider.generate_video and rejected all four for non-H3 models. Before that, the last three fell through **kwargs into the v1 request body and were forwarded verbatim — callback_url and aigc_watermark are documented v1 fields — so existing Hailuo callers now raise ValueError. Forward ratio/callback_url/aigc_watermark verbatim on the v1 path again, matching v0.1.123 byte-for-byte. Keep the guard for content only: structured content is a v2 request shape that never worked against v1, so the client-side error stays. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Reason: Refresh MiniMax video support for the H3 v2 API and current pricing metadata.
Checks:
uvx --from ruff==0.15.22 ruff check sdk/python/agentfield/media_providers.py sdk/python/tests/test_minimax_video.pyuv run --frozen --extra dev python -m pytest tests/test_minimax_video.py tests/test_media_providers.py tests/test_media_integration.py -q --no-covpython -m py_compile sdk/python/agentfield/media_providers.py sdk/python/tests/test_minimax_video.pygit diff --check