Skip to content

Add Volcengine Jimeng (即梦 AI) video provider with V4 signing#341

Open
yiyabo wants to merge 2 commits into
calesthio:mainfrom
yiyabo:feat/jimeng-video
Open

Add Volcengine Jimeng (即梦 AI) video provider with V4 signing#341
yiyabo wants to merge 2 commits into
calesthio:mainfrom
yiyabo:feat/jimeng-video

Conversation

@yiyabo

@yiyabo yiyabo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Implements the Jimeng/Volcengine part of #249, as agreed with @xucailiang (who is handling the Kling provider separately).

@calesthio — this is my third provider integration PR (after #240 DashScope, merged; #297 MiniMax Token Plan, in review). This is the first provider in OpenMontage to use Volcengine IAM V4 HMAC-SHA256 request signing instead of Bearer token auth.

What this adds

A new tool jimeng_video that calls the Volcengine visual API (visual.volcengineapi.com) directly with AK/SK credentials, supporting text-to-video and image-to-video via Jimeng 3.0 Pro.

API flow: POST ?Action=CVSync2AsyncSubmitTask → poll POST ?Action=CVSync2AsyncGetResult → download video_url

Authentication

All other OpenMontage providers use Bearer token auth (one API key in a header). Volcengine IAM requires HMAC-SHA256 V4 request signing — each request is individually signed with a derived key (SK → date → region → service → "request"). This is the first provider in OpenMontage to implement V4 signing.

Features

End-to-end tested

Generated a real video with Volcengine IAM credentials:

  • 1920x1088, H.264, 5.04s, 5.1MB
  • ffprobe verified
  • Wall time: 167s

Files

File Description
tools/video/jimeng_video.py New tool (V4 signing + submit/poll/download, 394 lines)
tests/contracts/test_jimeng_video.py 46 contract tests (no AK/SK needed)
.env.example VOLC_ACCESSKEY + VOLC_SECRETKEY
docs/PROVIDERS.md Volcengine Jimeng provider section

Test results

python -m pytest tests/contracts/test_jimeng_video.py -q  # 46 passed
python -m py_compile tools/video/jimeng_video.py tests/contracts/test_jimeng_video.py  # OK

Idempotency keys include all output-affecting fields (prompt, operation, image_url, frames, aspect_ratio, seed). Execution-only fields (output_path, poll_interval_seconds, timeout_seconds) are correctly excluded.

Closes the Jimeng part of #249.

Implements the Jimeng/Volcengine part of issue calesthio#249, as agreed with
@xucailiang (who is handling the Kling provider separately).

Adds a first-class Jimeng video provider that calls the Volcengine
visual API directly (visual.volcengineapi.com) using HMAC-SHA256 V4
request signing with IAM AK/SK credentials. This is the first provider
in OpenMontage to use V4 signing (all others use Bearer token auth).

API flow: POST CVSync2AsyncSubmitTask -> poll CVSync2AsyncGetResult ->
download video_url.

Features:
- Text-to-video and image-to-video (Jimeng 3.0 Pro)
- Configurable frame count (121=5s, 241=10s at 24fps)
- Aspect ratio selection (16:9, 9:16, 1:1, etc.)
- Seed for reproducibility
- Full V4 HMAC-SHA256 request signing (not Bearer token)
- Error handling with Jimeng code 10000 success convention
- API key redaction in error messages (both env vars, no empty-string bug)

Env vars: VOLC_ACCESSKEY + VOLC_SECRETKEY (IAM AK/SK pair).
Idempotency keys include all output-affecting fields.

Files:
- tools/video/jimeng_video.py — new tool (V4 signing + submit/poll/download)
- tests/contracts/test_jimeng_video.py — 46 contract tests (no AK/SK needed)
- .env.example — VOLC_ACCESSKEY + VOLC_SECRETKEY
- docs/PROVIDERS.md — Volcengine Jimeng provider section

End-to-end tested with real Volcengine IAM credentials: generated a
1920x1088 H.264 5.04s video, ffprobe verified.

Test results:
  python -m pytest tests/contracts/test_jimeng_video.py -q  # 46 passed
@yiyabo yiyabo requested a review from calesthio as a code owner July 10, 2026 02:51
Copilot AI review requested due to automatic review settings July 10, 2026 02:51

Copilot AI 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.

Pull request overview

This PR adds a new first-class video generation provider integration for Volcengine Jimeng (即梦 AI) by implementing Volcengine IAM V4 HMAC-SHA256 request signing (AK/SK), with submit→poll→download flow and contract coverage.

Changes:

  • Introduces jimeng_video tool using Volcengine Visual API with V4 signing, supporting text-to-video and image-to-video.
  • Adds contract tests to validate BaseTool compliance without requiring real credentials or network calls.
  • Updates provider documentation and .env.example with Volcengine AK/SK environment variables.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tools/video/jimeng_video.py New Jimeng provider tool: V4 signing, submit/poll/download, output probing, redaction, cost/runtime estimates
tests/contracts/test_jimeng_video.py Contract tests for discovery, schema, idempotency fields, and helper behavior
docs/PROVIDERS.md Adds Volcengine Jimeng provider setup + API notes + pricing note
.env.example Adds VOLC_ACCESSKEY / VOLC_SECRETKEY sample entries

Comment thread tools/video/jimeng_video.py Outdated
"Chinese-language prompt understanding",
]
not_good_for = ["offline generation", "users without Volcengine AK/SK"]
fallback_tools = ["minimax_tokenplan_video", "kling_video", "veo_video"]
Comment on lines +141 to +148
idempotency_key_fields = [
"prompt",
"operation",
"image_url",
"frames",
"aspect_ratio",
"seed",
]
Comment on lines +62 to +65
def test_has_fallbacks(self):
tool = JimengVideo()
assert "minimax_tokenplan_video" in tool.fallback_tools
assert "kling_video" in tool.fallback_tools
minimax_tokenplan_video does not exist in main branch (added in PR calesthio#297,
not yet merged). Use minimax_video which is the existing tool.

Fixes Copilot review comments on fallback_tools reference and
contract test assertion.
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.

3 participants