Skip to content

fix(video): migrate higgsfield_video to api.higgsfield.ai - #958

Open
HappyFeet07 wants to merge 1 commit into
OpenMontageInc:mainfrom
HappyFeet07:fix/higgsfield-api-migration
Open

HappyFeet07 wants to merge 1 commit into
OpenMontageInc:mainfrom
HappyFeet07:fix/higgsfield-api-migration

Conversation

@HappyFeet07

Copy link
Copy Markdown

Summary

higgsfield_video still targeted the deprecated platform.higgsfield.ai host with Bearer auth, so it could not generate anything with valid keys. This moves it to the current https://api.higgsfield.ai contract described in #957, and fixes the cost estimate and request validation along the way.

Related issue

Closes #957

Changes

  • Host and auth: https://api.higgsfield.ai/<model path>/<text-to-video|image-to-video> with Authorization: Key <key>:<secret>. No model / task body fields.

  • Response parsing: reads request_id and status_url from the submit response, compares status case-insensitively (queued | in_progress | completed | failed | nsfw | canceled), and takes the output from video.url. Errors now include the request_id, so a charged job can be found later.

  • Routes only verified models. I checked endpoints with the free POST /estimate/... call:

    • seedance_2.0 → bytedance/seedance-2.0 (200)
    • kling_3.0 → kling-video/v3.0/pro (200)
    • I could not find endpoints for seedance_2.0_fast, veo_3.1, sora_2, wan_2.5 or soul_cinema; every path I tried returned 404 or 423.

    Those models now fail before any request is sent, so no money can be spent on an unknown route. The schema enum is unchanged; routes can be added to _MODEL_ROUTES once their endpoints are confirmed.

  • Validation before submit, using the limits the estimate endpoint enforces:

    • duration: 4–15 s for Seedance, 3–15 s for Kling (the old 5/10/15 enum blocked valid lengths such as 3 s and 6 s)
    • aspect ratio, per model
    • resolution: Seedance only; Kling Pro is fixed at 1080p
    • image_url is required for image-to-video
  • New inputs:

    • generate_audio (default true). Sent as generate_audio to Seedance and as sound: on|off to Kling. Kling's default is sound on, so before this change there was no way to get a silent clip for scoring in post.
    • resolution, Seedance only (default 720p).
  • Cost: uses Higgsfield's published per-second self-serve rates (Kling 3.0 Pro 1080p $0.0962/s; Seedance 2.0 $0.0804–$0.8907/s by resolution) instead of the stale per-clip table. That table quoted Kling at $0.10 per 5 s, about 3× under the real price.

  • Polling window raised from about 6 to about 10 minutes.

Testing

  • New tests/tools/test_higgsfield_video.py (no network; requests is faked). It covers:
    • exact URL, headers and payload for Kling text-to-video and Seedance image-to-video
    • lowercase and uppercase status handling, and video.url download
    • terminal failure reporting
    • fail-closed cases with zero network calls: unroutable model, duration below and above each model's range, bad aspect ratio and resolution, missing image_url
    • accepted duration bounds at both ends
    • cost math
  • tests/tools/test_provider_model_defaults.py still passes.
  • make test-contracts: 1515 passed, 9 skipped.
  • Full pytest tests/: no new failures compared with main. The 9 failures that remain also fail on main in my environment (local FFmpeg build missing some encoders), and none of them touch this tool.
  • Payloads built by the tool for Kling text-to-video, Seedance text-to-video and Kling image-to-video all return 200 from the free POST /estimate endpoint.
  • Live run: Kling 3.0 Pro text-to-video, 3 s, 9:16, generate_audio: false. It completed in about 110 s and produced a 1080×1920, 3.04 s file with no audio stream. Cost about $0.29, matching the estimate.

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable.
  • I updated docs/README if behavior or usage changed. (The usage notes live in the tool's schema descriptions and install_instructions; no README change needed.)
  • No unrelated files (build artifacts, local config) are included in the diff.

🤖 Generated with Claude Code

…eInc#957)

The tool still targeted the deprecated platform.higgsfield.ai host with
Bearer auth, so every submit failed with 401 for valid keys.

- Use https://api.higgsfield.ai with one endpoint per model and
  Authorization: Key <key>:<secret>
- Read request_id/status_url from the submit response, compare status
  case-insensitively and take the output from video.url
- Route only models with a verified endpoint (seedance_2.0, kling_3.0
  Pro); other models fail before any request is sent
- Validate duration, aspect ratio and resolution per model before submit
- Add generate_audio (maps to generate_audio / sound) and resolution
- Price from Higgsfield's published per-second rates instead of the
  stale per-clip table (kling_3.0 was under-quoted about 3x)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

higgsfield_video: targets deprecated platform.higgsfield.ai with Bearer auth; returns 401 for valid keys

1 participant