Repository navigation
Description
Summary
Add a TextToMusic tool that turns a text prompt into a music clip, the way TextToSpeech turns text into a voice and TextToSFX (#1227) turns text into a sound effect. The desktop's video-editing skill mixes any WAV placed on an audio lane, so a background-music track is the remaining audio piece for agent-made videos.
The clip is generated behind the gateway's POST /v1/audio/music, shipped in gateway v0.54.0 (inference-gateway/inference-gateway#680), and reached through the SDK's CreateMusic(ctx, provider, CreateMusicRequest) ([]byte, error) from sdk v1.38.0. First model elevenlabs/music_v2_5. The CLI holds no provider key. Depends on #1260 (SDK bump to v1.38.0).
Shape
- Tool name
TextToMusic, gated bytext_to_music.enabled(default false, tool hidden when false), mirroringtext_to_speechandtext_to_sfx. - Inputs:
prompt(text),seconds(optional, maps toduration_seconds; omitted lets the model pick),instrumental(optional bool),output_path(bare file name, same rule asTextToSpeech). The request always setsresponse_format: wav. - Output:
path,prompt,duration_seconds, the same shapeTextToSpeechandTextToSFXreport. - Config, top-level
text_to_music::enabled,model(gatewayprovider/modelid, defaultelevenlabs/music_v2_5),output_dir(default~/.infer/tmp/music),require_approval.INFER_TEXT_TO_MUSIC_*overrides come free from the reflective env loader. - Domain: a
MusicServiceport ininternal/agent/domain/media.gonext toSpeechService, error-only signature. Gateway implementationinternal/agent/infrastructure/music_service.gofollowingspeech_service.go. Wired ininternal/container/container.goandinternal/agent/tools/registry.go; counterfeiter line added tomocks:generate. Reuses the sharedoutput_pathhelper introduced by [FEATURE] TextToSFX tool for text-to-sound-effect generation #1227.
Follow-up in inference-gateway/desktop once the tool exists: allow TextToMusic in the video-editing skill and let the agent add a music lane (inference-gateway/desktop#251).
Acceptance Criteria
-
TextToMusicis registered withprompt,seconds,instrumentalandoutput_pathinputs and is hidden unlesstext_to_music.enabledis true. - The tool calls the gateway through the
MusicServiceport; the infrastructure implementation usessdk.Client.CreateMusicand writes a WAV intotext_to_music.output_dir. -
output_pathrejects directories, absolute paths and..through the helper shared withTextToSpeech. - A provider error, or a gateway without the endpoint, produces a one-line error naming the model; a failed call leaves no partial file.
- Unit tests cover argument validation and the result shape with a fake service; an infrastructure test uses
sdkmocks.FakeClient. - One integration test in
tests/integrationruns the tool against the mock gateway. If the mock gateway does not serve/v1/audio/music, the PR says so and files the gap against inference-gateway/tokenless. -
docs/tools-reference.md,docs/configuration-reference.mdanddocs/directory-structure.mdlist the tool andtext_to_music.enabled,model,output_dir,require_approval; a[DOCS]ticket is filed against inference-gateway/docs with the PR.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
chore(deps): bump inference-gateway/sdk to v1.38.0 (#1262)
edenreich commentedon Sep 22, 2026
@infer Can you work on this? use /ponytail:ponytail /go /go-concurrency /domain-driven-design
inference-gateway-maintainer commentedon Sep 22, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1265
✅ Infer Result: Success
All done. Updating the final todo and closing out:
All work is complete. Final summary:
Implemented the
TextToMusictool - PR #1265 (ready for review, branchfix/issue-1261, commitsc1b550d+1d569ec).What changed
internal/agent/tools/text_to_music.go):TextToMusicwithprompt(required),seconds(optional, maps toduration_seconds),instrumental(optional bool) andoutput_path(bare file name, sharedresolveMediaOutputPathrule rejecting directories, absolute paths and..- extracted fromTextToSpeechToolin a behavior-preserving refactor since [FEATURE] TextToSFX tool for text-to-sound-effect generation #1227 has not landed). Requests always useresponse_format: wav; the result reportspath,prompt,duration_seconds. Failures surface as one-line failed results naming the model; a failed call removes the timestamped target or leaves the caller-named target untouched.internal/agent/domain/media.go): error-onlyMusicService.Compose(ctx, prompt, outPath, seconds, instrumental)port next to the speech port.internal/agent/infrastructure/music_service.go): gateway implementation usingsdk.Client.CreateMusicwithCreateMusicRequestResponseFormatWav, writing the WAV intotext_to_music.output_dir.text_to_music:block -enabled(default false, tool hidden),model(defaultelevenlabs/music_v2_5),output_dir(default~/.infer/tmp/music),require_approval;modelshape is validated (provider/model), andINFER_TEXT_TO_MUSIC_*overrides come from the reflective env loader.NewRegistrycallers, prompts default description, and counterfeiterFakeMusicService(added tomocks:generate).Testing and docs
sdkmocks.FakeClient; config tests. Fixed the last failing case (invalidoutput_pathnow reports a failed result without calling the service); fixed agocyclonolint gap inConfig.Validatecaught by the pre-commit gate.tests/integration/text_to_music_test.go): runs the tool through the agent against the mock gateway. The tokenless mock gateway does not serve/v1/audio/music, so the test pins the failure path (one-line error namingelevenlabs/music_v2_5, run completes, no partial file) - gap filed as [FEATURE] Mock gateway: serve POST /v1/audio/music tokenless#59.docs/tools-reference.md,docs/configuration-reference.mdanddocs/directory-structure.mdupdated;[DOCS]ticket filed as [DOCS] TextToMusic tool and text_to_music configuration docs#719.Follow-ups
POST /v1/audio/music[DOCS]ticket mirroring the docs changeTextToMusicin the video-editing skill with amusiclaneBoard item for #1261 is on the org Roadmap in QA. The pre-commit gate (mod tidy, mocks, fmt, imports, golangci-lint, markdownlint) passed on both commits; PR #1265 is marked ready for review.
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 23m 35sTokens: 13,667,997 in · 77,702 out · 13,745,699 total (128 requests)
Tool calls: 178 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Sep 23, 2026
🎉 This issue has been resolved in version 0.206.0 🎉
The release is available on:
Your semantic-release bot 📦🚀