Skip to content

feat(music): ElevenLabs Music v2.5, estimated per requested second - #721

Merged
VickyXAI merged 2 commits into
mainfrom
feat/elevenlabs-music-v2.5
Dec 4, 2026
Merged

VickyXAI merged 2 commits into
mainfrom
feat/elevenlabs-music-v2.5

Conversation

@VickyXAI

@VickyXAI VickyXAI commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds elevenlabs/music-v2.5 to the OpenClaw music provider and to the proxy's music price table.

Live facts (checked 2026-12-03)

  • blockrun.ai catalog: billing_mode: per_second, per_second: 0.0025, transaction_fee: 0.001, supports_lyrics: false.
  • api.blockrun.ai: per_second 0.0025, transaction_fee 0.
  • Unpaid 402 at duration_seconds: 60: Base 151000 micro, Solana 150000.
  • A request with lyrics gets a 400 before the 402. Arc does not serve the model.

Changes

  • src/proxy.ts:
    • MUSIC_PER_SECOND_PRICING sits next to the per-track table.
    • estimateMusicCost(model, durationSeconds) returns 0.0025 × d. d is 30 s when omitted, which is the gateway's default. A value the gateway would refuse is estimated at 240 s, never shorter. As before, estimates carry no fee, which matches the account rail.
    • MUSIC_MODEL_IDS includes per-second ids.
  • How the account-rail estimate uses it: the /v1/audio/generations handler publishes estimateMusicCost(...) via publishDispatchCost. withSpendPolicy checks that figure against the per-request, hourly, daily and session limits before the call. It books the same figure when the gateway reports no settled charge, and it is also the telemetry fallback in settledMediaCostUsd. The handler now reads duration_seconds from the body, so EL is checked and booked at its per-duration price. Without this, EL would hit the unknown-id fallback.
  • Unknown ids: an unknown id is now estimated at the dearest possible track, which is EL at 240 s ($0.60). The legacy minimax/music-2.5 became an explicit alias of 2.5+, so it keeps $0.199 instead of jumping to $0.60.
  • src/index.ts: the OpenClaw music provider offers the id. It is not filtered per chain, the same as Lyria today. On Arc, or with lyrics, the gateway answers 400 before any payment.

Tests

  • src/index.music-provider.test.ts: per-length estimates, default 30 s, the refused-value ceiling, the alias, and the unknown fallback.
  • New src/proxy.music-per-second.test.ts: an account-rail spend-window test through the proxy, with a $0.10 per-request cap.
    • 20 s books $0.05 and the default books $0.075.
    • 60 s ($0.15) is refused before the upstream call.
    • 40 s passes.

npm test: 148 files, 1601 passed and 1 skipped. typecheck, lint and prettier --check (on changed files) are clean. Run on Node 24.22.

Not done: no release, CHANGELOG or version bump. Those are written in the release PR in this repo.

Summary by CodeRabbit

  • New Features
    • Added ElevenLabs Music v2.5 to the available music generation models. Requests can specify a track duration; when omitted, billing estimates use a 30-second default.
    • Lyrics are not supported for ElevenLabs Music v2.5 and are omitted from requests to that model.
  • Improvements
    • Music cost estimates now account for per-second pricing and track duration. Requests estimated above the per-request spending limit are rejected before being sent for generation. Unknown models use the highest known maximum track price for estimates.

elevenlabs/music-v2.5 is live on blockrun.ai (Base: $0.0025 x
duration_seconds + $0.001), sol.blockrun.ai and api.blockrun.ai
($0.0025/s, no fee); not on Arc; no lyrics (400 before the 402).

- proxy.ts: MUSIC_PER_SECOND_PRICING next to the per-track table;
  estimateMusicCost(model, durationSeconds) = 0.0025 x d (30 s when
  omitted, the gateway default; a value the gateway would refuse is
  estimated at 240 s). The audio route reads duration_seconds from the
  body, so the account rail's spend window checks and books the
  per-duration price instead of the unknown-id fallback.
- An unknown id is estimated at the dearest possible track, now
  ElevenLabs at 240 s ($0.60); the legacy minimax/music-2.5 is an
  alias of 2.5+ and keeps $0.199.
- index.ts: the OpenClaw music provider offers the id.
- Tests: estimates per length, the alias, the unknown fallback, and an
  account-rail spend-window test through the proxy.
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The music provider list now includes ElevenLabs Music v2.5. Music cost estimates account for requested duration, and audio generation uses those estimates when publishing dispatch costs and applying account-rail limits.

Changes: Music pricing and generation

Layer / File(s) Summary
Music model catalog and pricing
src/types.ts, src/index.ts, src/proxy.ts, src/index.music-provider.test.ts
The provider list includes ElevenLabs Music v2.5 and declares that it does not support lyrics. Cost estimation normalizes duration, applies per-second pricing, preserves flat-rate pricing, resolves the legacy MiniMax ID, and uses the highest known maximum price for unknown IDs. Tests cover pricing behavior and model capabilities.
Generation estimate and account-rail checks
src/proxy.ts, src/proxy.music-per-second.test.ts
Audio generation passes duration_seconds to the estimator. Integration tests check booked spending and verify that requests over the cap do not reach upstream.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant AudioGenerationHandler
  participant estimateMusicCost
  participant AccountRail
  participant UpstreamServer
  AudioGenerationHandler->>estimateMusicCost: duration_seconds
  estimateMusicCost-->>AudioGenerationHandler: estimated cost
  AudioGenerationHandler->>AccountRail: check estimated cost against cap
  alt request is within cap
    AccountRail-->>AudioGenerationHandler: allow request
    AudioGenerationHandler->>UpstreamServer: submit generation request
  else request exceeds cap
    AccountRail-->>AudioGenerationHandler: reject request
  end
Loading

Possibly related PRs

Suggested reviewers: 0xcheetah1

Merge Risk: Minimal · up to 1c122

This adds ElevenLabs Music v2.5 with duration-based cost estimates used for spend-limit checks. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: adding ElevenLabs Music v2.5 to the music provider and proxy, with cost estimation per requested second. The changeset matches this. The title follows the conventional…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: adding ElevenLabs Music v2.5 to the music provider and proxy, with cost estimation per requested second. The changeset matches this. The title follows the conventional commit format and is 66 characters long.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 67edcd3 and 1c12204.

Files selected for processing: 3

  • src/index.music-provider.test.ts
  • src/index.ts
  • src/types.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Review follow-up on #721. The provider-wide supportsLyrics: true covered
elevenlabs/music-v2.5, which the gateway refuses lyrics for (400 before
the 402). OpenClaw's MusicGenerationModeCapabilities has
supportsLyricsByModel, and its request normaliser drops lyrics for a
model mapped to false (reported as an ignored override), so the provider
now maps EL to false. Local type gains the field; test pins it.
@VickyXAI
VickyXAI merged commit f6f4209 into main Dec 4, 2026
5 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