Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/api/src/opendirector_api/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
from opendirector.domain.capability_messages import english_capability_message, missing_tool_model_message

ENGLISH_BY_CODE = {
'higgsfield_model': 'Choose MAGI-2 with the official Higgsfield Open API address.',
'higgsfield_key': 'Enter your Higgsfield Open KEY_ID:KEY_SECRET.',
'higgsfield_output': 'MAGI-2 supports 1080p and whole-second durations from 4 to 30 seconds.',
'higgsfield_parameters': 'Choose an aspect ratio and audio option supported by MAGI-2.',
'higgsfield_mode': 'MAGI-2 supports first/last frames and reference media.',
'higgsfield_image': 'Use valid JPEG, PNG, WebP, or GIF images, each smaller than 30 MB.',
'higgsfield_format': 'Use MP4 video and WAV audio references. Convert MOV to MP4 and MP3 to WAV before uploading.',
'higgsfield_media_size': 'Each reference video must be at most 200 MB; each audio file at most 15 MB.',
'higgsfield_duration': 'Each reference video or audio clip must be 2–30 seconds. The total for each media type cannot exceed 30 seconds.',
'higgsfield_reference_count': 'MAGI-2 accepts up to 10 images, 5 videos, and 5 audio references.',
'higgsfield_reference_changed': 'A reference asset changed. Review the inputs before submitting again.',
'higgsfield_frames': 'Each frame slot accepts one image. A last frame requires a first frame.',
'higgsfield_references': 'Reference mode requires at least one image, video, or audio clip. Check the reference roles.',
'higgsfield_prompt': 'MAGI-2 prompts allow up to 15,000 characters. Text-to-video requires a prompt.',
"desktop_auth_required": "The desktop connection has expired. Reopen the application.",
'prompt_optimization_empty': 'Enter a prompt to optimize.',
'prompt_optimization_refs': 'Prompt references changed. Try again.',
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/opendirector_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AssetSource(Model):

class ModelConnection(Model):
connectionType: Literal['api', 'self_hosted'] = 'api'
protocol: Literal['openai', 'volcengine', 'bigmodel_video', 'kling_video', 'minimax_video_v2', 'vllm_omni', 'vllm_omni_segmentation', 'vllm_omni_music', 'vllm_omni_depth', 'vllm_omni_score'] | None = None
protocol: Literal['openai', 'volcengine', 'higgsfield_open', 'bigmodel_video', 'kling_video', 'minimax_video_v2', 'vllm_omni', 'vllm_omni_segmentation', 'vllm_omni_music', 'vllm_omni_depth', 'vllm_omni_score'] | None = None
authMode: Literal['none', 'bearer'] | None = None
proxyMode: Literal['system', 'direct'] | None = None
capabilityAutoCheck: bool | None = Field(default=None, strict=True, exclude_if=lambda value: value is None)
Expand Down
4 changes: 4 additions & 0 deletions docs/development/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ Local visible-Chrome test: upload `IMG_8066.HEIC` through the system file picker

`browser-image` also supplies the pixel dimensions for cropping, masks and image editing, so this patch does not impose a 2048-pixel limit on that shared route. A bounded display rendition must be separate from editing inputs. The first full-resolution PNG transfer remains about 14 MB. Other platforms, HDR accuracy and the full Python suite were not revalidated.

MAGI-2 protocol checks use `python -m pytest tests/test_higgsfield_open.py -q`. For its bilingual browser workflow, start `python tests/browser/higgsfield_server.py --port 8504`, run Vite with `OPENDIRECTOR_API_URL=http://127.0.0.1:8504 npm run dev -- --port 5504`, and run `node tests/browser/higgsfield_open.mjs`. The fixture creates an isolated temporary project directory and uses the actual upload/generation adapter with mocked HTTP. It checks all three routes, mixed media, output adoption, reload and MP3 rejection. Screenshots and a JSON receipt are written to `output/playwright/higgsfield` or `CREATION_SCREENSHOTS`.

MAGI-2 协议测试命令为 `python -m pytest tests/test_higgsfield_open.py -q`。双语浏览器检查使用上述独立服务和命令,验证真实适配器发送的请求与工程保存结果,供应商 HTTP 由模拟服务代替。检查不调用真实模型,不证明账户权限、计费或生成质量。真实验收需另行记录实际提交、查询、下载、采用和远端任务编号,不保存密钥。

Kling 4.0 protocol and bilingual workflow checks:

```sh
Expand Down
50 changes: 50 additions & 0 deletions docs/guides/higgsfield-magi-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# MAGI-2 through Higgsfield Open

[中文](higgsfield-magi-2.zh-CN.md)

## Account connection

Open **Settings → Model connections → Video → Add service**, choose **Higgsfield Open**, and keep `https://api.higgsfield.ai`. Enter your Higgsfield Open credentials as `KEY_ID:KEY_SECRET`, enable `sand/magi-2`, and save. Select this model in the generation picker.

The model list and output specifications are built-in declarations. Loading or saving them does not test account access or submit a generation. Generating requires model access and sufficient API credits.

## Inputs and output

One connection supports three inputs in both the canvas and Agent:

| Input | Selection |
| --- | --- |
| Text | Enter a prompt with no media references. |
| First/last frames | Choose first/last-frame mode and select a first image, optionally a last image. |
| References | Choose reference mode and attach images, video, audio, or a mixture. A single ordinary image remains a reference. Audio may be used on its own. |

Text-to-video requires a prompt. A prompt is optional with media. The final prompt, including connected text, allows up to 15,000 characters; excessive input is rejected without truncation.

| Reference | Formats | Maximum count | Size per file | Duration |
| --- | --- | --- | --- | --- |
| Image | JPEG, PNG, WebP, GIF | 10 | Smaller than 30 MB | — |
| Video | MP4 | 5 | 200 MB | 2–30 seconds each; 30 seconds total |
| Audio | WAV | 5 | 15 MB | 2–30 seconds each; 30 seconds total |

Convert MOV to MP4 and MP3 to WAV before attaching them. OpenDirector uploads the original accepted bytes through Higgsfield's upload service. Credentials are only sent to the official API.

Output is 1080p, with an integer duration of 4–30 seconds. New nodes default to 5 seconds, 16:9 and generated audio enabled. The available ratios are 21:9, 16:9, 4:3, 1:1, 3:4 and 9:16, including for first/last frames. Generated audio can be disabled. Saved supported choices are preserved.

## Tasks and results

Accepted jobs retain their inputs and parameters. Completed files are downloaded, checked and registered as project assets and result candidates. Adoption follows existing version and lock checks, preserving newer edits. Generated files have the existing 50 MB download and recovery-cache limit.

Recover an interrupted original task to continue submission, querying, downloading or saving. The private recovery cache preserves the exact submitted body, uploaded URLs and a fixed `Idempotency-Key`, which identifies one intended generation. Replaying that request uses the same remote generation. A damaged cache stops recovery before another submission.

An unknown submission can only be replayed with the original API Key ID. If you change it, restore the original connection before recovering that task; a different account has a separate idempotency history.

Remote cancellation is available while the request is queued. A cancellation request and confirmed remote cancellation are tracked separately. If generation has started, Higgsfield rejects cancellation; stopping local work does not stop remote processing or confirm a refund.

## API references

- [Text-to-video](https://open.higgsfield.ai/models/sand/magi-2/text-to-video/api-reference)
- [Image-to-video](https://open.higgsfield.ai/models/sand/magi-2/image-to-video/api-reference)
- [Reference-to-video](https://open.higgsfield.ai/models/sand/magi-2/reference-to-video/api-reference)
- [File uploads](https://docs.higgsfield.ai/docs/concepts/file-uploads)
- [Request lifecycle](https://docs.higgsfield.ai/docs/concepts/requests)
- [Idempotent requests](https://docs.higgsfield.ai/docs/concepts/idempotency)
50 changes: 50 additions & 0 deletions docs/guides/higgsfield-magi-2.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Higgsfield Open MAGI-2 视频生成

[English](higgsfield-magi-2.md)

## 账户连接

打开**设置 → 模型接入 → 视频 → 添加服务**,选择 **Higgsfield Open**,保留地址 `https://api.higgsfield.ai`。按照 `KEY_ID:KEY_SECRET` 格式填写 Higgsfield Open 凭据,勾选 `sand/magi-2` 并保存,然后在生成面板中选择该模型。

模型列表与输出规格来自内置声明。加载和保存配置不会验证账户权限,也不会发起生成请求。生成需要账户具备模型权限和足够的 API 额度。

## 输入与输出

画布与 Agent 通过同一个连接支持以下输入:

| 输入 | 选择方式 |
| --- | --- |
| 文本 | 填写提示词,不连接媒体参考。 |
| 首尾帧 | 选择首尾帧模式,指定首帧图片,可选填尾帧图片。 |
| 参考素材 | 选择参考模式,连接图片、视频、音频或混合素材。普通图片参考保持参考用途;音频可以单独使用。 |

纯文本生成必须填写提示词,携带媒体时可以省略提示词。最终提示词包含所连接的文本内容,最多 15,000 个字符;超限会明确拒绝,不截断输入。

| 参考类型 | 格式 | 数量上限 | 单个文件大小 | 时长 |
| --- | --- | --- | --- | --- |
| 图片 | JPEG、PNG、WebP、GIF | 10 张 | 小于 30 MB | — |
| 视频 | MP4 | 5 段 | 不超过 200 MB | 每段 2–30 秒,视频总计不超过 30 秒 |
| 音频 | WAV | 5 段 | 不超过 15 MB | 每段 2–30 秒,音频总计不超过 30 秒 |

MOV 请先转换为 MP4,MP3 请先转换为 WAV,再添加参考。OpenDirector 通过 Higgsfield 上传服务发送已接受文件的原始内容。账户凭据仅发送给官方 API。

输出为 1080p,时长支持 4–30 秒的整数。新节点默认 5 秒、16:9,并开启生成音频。比例支持 21:9、16:9、4:3、1:1、3:4 和 9:16,首尾帧模式也可以选择比例。可以关闭生成音频,已保存且受支持的参数会继续保留。

## 任务与结果

任务接受后保存固定的输入和参数。完成的视频会被下载、检查,并登记为工程素材和结果候选。采用结果时执行现有版本与锁定检查,保留之后修改的内容。生成文件沿用现有 50 MB 下载与恢复缓存上限。

中断后恢复原任务,可以继续提交、查询、下载或保存。私有恢复缓存记录首次提交的完整请求、素材地址和固定的 `Idempotency-Key`。该标识表示一次明确的生成操作,重复发送相同请求会继续使用同一个远端任务。缓存损坏时停止恢复,不重新提交生成。

提交结果不明时,恢复提交需要原 API Key ID。更换该标识后,请恢复原连接再恢复任务;不同账户分别记录重复请求标识。

远端任务排队时可以申请取消。系统分别记录取消请求和远端取消确认。开始执行后 Higgsfield 会拒绝取消;停止本地工作不能停止远端执行,也不能确认退款。

## 官方接口资料

- [文字生成视频](https://open.higgsfield.ai/models/sand/magi-2/text-to-video/api-reference)
- [图片生成视频](https://open.higgsfield.ai/models/sand/magi-2/image-to-video/api-reference)
- [参考素材生成视频](https://open.higgsfield.ai/models/sand/magi-2/reference-to-video/api-reference)
- [文件上传](https://docs.higgsfield.ai/docs/concepts/file-uploads)
- [请求生命周期](https://docs.higgsfield.ai/docs/concepts/requests)
- [重复请求处理](https://docs.higgsfield.ai/docs/concepts/idempotency)
2 changes: 2 additions & 0 deletions docs/guides/video-model-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Protocol references: [create task](https://platform.minimax.cn/docs/api-referenc

## Providers and per-model settings

Higgsfield Open supports `sand/magi-2` through one video connection: text, first/last frames and mixed image/video/audio references. Output is 1080p at 4–30 seconds with optional generated audio. See the [MAGI-2 guide](higgsfield-magi-2.md) for setup, input limits and recovery.

Kling 4.0 uses the separate `kling_video` protocol and picks the official submit path for text, first/last frames and image references, sharing the existing task query, recovery and result-adoption flow. Its fixed capabilities are published by the backend. `kling-4.0` supports 720P / 1080P, 3–30 seconds and first/last frames; `kling-4.0-flash` supports 720P, 3–20 seconds and a first frame, without a last frame. Both models support image references and native audio, and do not accept custom pixel sizes. Setup and input limits are in the [English guide](kling-video.md) and the [Chinese guide](kling-video.zh-CN.md).

MiniMax official video offers four models; adding a service selects all of them by default, and they become active after saving. Editing an existing service keeps the previous selection. Standard H3 supports 768P / 2K and 4–15 seconds; Highspeed and Lite support 480P / 768P and 4–15 seconds; Max supports 480P / 768P and 5–15 seconds. Output tiers and durations are validated per model by the backend.
Expand Down
2 changes: 2 additions & 0 deletions docs/guides/video-model-capabilities.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@

## 提供商与逐模型设置

Higgsfield Open 通过同一个视频连接支持 `sand/magi-2`:文本、首尾帧和图片、视频、音频混合参考。输出为 1080p,时长支持 4–30 秒,可以关闭生成音频。接入、输入限制与恢复说明见 [MAGI-2 指南](higgsfield-magi-2.zh-CN.md)。

可灵 4.0 使用独立的 `kling_video` 协议,按文生、首尾帧和图片参考选择对应官方提交路径,共用现有任务查询、恢复和结果采用流程。固定能力由后端发布。`kling-4.0` 支持 720P / 1080P、3–30 秒及首尾帧;`kling-4.0-flash` 支持 720P、3–20 秒和首帧,不支持尾帧。两个型号均支持图片参考与原生音频,不填写自定义像素尺寸。接入与输入限制见[中文指南](kling-video.zh-CN.md)和[English guide](kling-video.md)。

MiniMax 官方视频提供四个型号,新增服务时默认全部勾选,保存后才启用;编辑已有服务时保留原有勾选。标准 H3 支持 768P / 2K、4—15 秒;Highspeed 和 Lite 支持 480P / 768P、4—15 秒;Max 支持 480P / 768P、5—15 秒。各型号的输出档位与时长由后端分别校验。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def _parameters(self, spec, config, node, records):
'video': {'duration': 5, 'ratio': 'adaptive', 'generate_audio': True},
'audio': {'speaker': 'zh_female_vv_uranus_bigtts', 'audio_params': {'format': 'mp3', 'sample_rate': 24000}}}[spec.kind]
intent = spec.parameters.model_dump(exclude_none=True)
if spec.kind == 'video' and config['protocol'] == 'higgsfield_open':
from opendirector.domain.higgsfield import parameters as magi2_parameters
return magi2_parameters(config, intent, node['videoMode'],
any(records[key]['kind'] == 'image' for key in node['referenceIds']))
if spec.kind == 'video' and config['protocol'] == 'bigmodel_video':
from opendirector.domain.bigmodel_video import cogvideo_parameters
return {**cogvideo_parameters(config, intent), 'watermark': not self.settings.get()['removeWatermark']}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def recovery(self, task, directory):
if (details.get('stage') == 'submit' and details.get('httpStatus') in {400, 401, 402, 403, 404, 413, 422, 429}
and details.get('category') not in {'submission_unknown', 'local', 'protocol'}):
return 'retry' # An explicit continuation may create a new attempt.
if task.get('protocol') == 'higgsfield_open':
submission = cache.submission()
if submission:
return 'remote' if submission.get('remote') else 'submit'
return 'review'


Expand Down Expand Up @@ -147,7 +151,10 @@ async def result_ready(suffix, url):
stage = 'poll' if task.get('externalTaskId') else 'submit'
task['phase'] = stage
await save() # Mark submission before entering any provider call.
if hasattr(self.provider, 'resume_result'):
if task.get('protocol') == 'higgsfield_open':
suffix, data = await self.provider.generate(config, task, submitted,
result_ready=result_ready, recovery_cache=cache)
elif hasattr(self.provider, 'resume_result'):
suffix, data = await self.provider.generate(config, task, submitted, result_ready=result_ready)
else:
suffix, data = await self.provider.generate(config, task, submitted)
Expand Down Expand Up @@ -180,7 +187,10 @@ async def result_ready(suffix, url):
cancel_config = config or self.configs.resolve(task['modelConfigId'], task['kind'])
if cancel_config['url'] != task['baseURL'] or cancel_config['modelId'] != task['model'] or task.get('protocol') and cancel_config.get('protocol') != task['protocol']:
raise ProjectError('原模型配置已变化,供应商取消未确认。', 409)
await self.provider.cancel(cancel_config, task["externalTaskId"])
if task.get('protocol') == 'higgsfield_open':
await self.provider.cancel(cancel_config, task["externalTaskId"], recovery_cache=cache)
else:
await self.provider.cancel(cancel_config, task["externalTaskId"])
task["error"] = "已请求取消供应商任务,实际取消与费用以服务控制台为准。"
except (ProjectError, OSError) as failure:
task["error"] = "本地已停止,供应商取消未确认,请在控制台核对任务。"
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/opendirector/domain/creation/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ def command_fingerprint(command: Command) -> str:
'bigmodel_video_model', 'bigmodel_video_output', 'bigmodel_video_image',
'bigmodel_video_frames', 'bigmodel_video_prompt', 'bigmodel_video_cancel',
'kling_model', 'kling_mode', 'kling_image', 'kling_frames', 'kling_prompt', 'kling_aspect', 'kling_output', 'kling_cancel',
'higgsfield_model', 'higgsfield_key', 'higgsfield_output', 'higgsfield_parameters', 'higgsfield_mode',
'higgsfield_image', 'higgsfield_format', 'higgsfield_media_size', 'higgsfield_duration',
'higgsfield_reference_count', 'higgsfield_reference_changed', 'higgsfield_frames', 'higgsfield_references', 'higgsfield_prompt',
'capability_unavailable', 'capability_paused', 'capability_connection_changed',
'capability_unsupported', 'preview_expired', 'storage_unavailable', 'submission_unknown', 'provider_error',
'moss_speech_text', 'moss_speech_voice', 'moss_speech_reference', 'moss_prompt_limit',
Expand Down
Loading
Loading