Repository navigation
feat(music): ElevenLabs Music v2.5, estimated per requested second - #721
Conversation
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.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
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.
Adds
elevenlabs/music-v2.5to the OpenClaw music provider and to the proxy's music price table.Live facts (checked 2026-12-03)
billing_mode: per_second,per_second: 0.0025,transaction_fee: 0.001,supports_lyrics: false.per_second 0.0025,transaction_fee 0.duration_seconds: 60: Base 151000 micro, Solana 150000.lyricsgets a 400 before the 402. Arc does not serve the model.Changes
src/proxy.ts:MUSIC_PER_SECOND_PRICINGsits 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_IDSincludes per-second ids./v1/audio/generationshandler publishesestimateMusicCost(...)viapublishDispatchCost.withSpendPolicychecks 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 insettledMediaCostUsd. The handler now readsduration_secondsfrom the body, so EL is checked and booked at its per-duration price. Without this, EL would hit the unknown-id fallback.minimax/music-2.5became 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.src/proxy.music-per-second.test.ts: an account-rail spend-window test through the proxy, with a $0.10 per-request cap.npm test: 148 files, 1601 passed and 1 skipped.typecheck,lintandprettier --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