LangChain integration for the Tunova music generation API (Suno-powered songs for AI agents)
Project description
langchain-tunova
LangChain integration for Tunova — an API that turns a text prompt into a complete, ready-to-listen song. This package gives your LangChain agents a music generation tool.
Agent-friendly billing: songs are billed only on successful renders — failed generations auto-refund, so autonomous retries are safe. 10 tokens per song, and every account starts with 50 free tokens (no card required).
Installation
pip install langchain-tunova
Setup
Get an API key at tunova.ai and export it:
export TUNOVA_API_KEY="your-api-key"
(Or pass api_key="..." to the tool constructor.)
Usage
Direct invocation:
from langchain_tunova import TunovaMusicGenerationTool
tool = TunovaMusicGenerationTool()
print(tool.invoke({"prompt": "an upbeat synthwave track about road trips"}))
# Generated "Neon Highway" (192s): https://cdn.tunova.ai/...mp3
With an agent:
from langchain.agents import create_agent
from langchain_tunova import TunovaMusicGenerationTool
agent = create_agent(
model="claude-sonnet-4-5",
tools=[TunovaMusicGenerationTool()],
)
result = agent.invoke(
{"messages": [("user", "Make me a chill instrumental lofi track for studying.")]}
)
print(result["messages"][-1].content)
Generation takes a few minutes; the tool polls the job and returns the song title, duration, and audio URL. If a render fails, the tool tells the agent that the tokens were auto-refunded — so the agent can simply retry, at no cost.
Tool reference
| Tool name | tunova_generate_song |
| Arguments | prompt: str, make_instrumental: bool = False |
| Returns | Generated "<title>" (<duration>s): <audio_url> or an error string |
| Auth | TUNOVA_API_KEY env var or api_key= constructor arg |
| Async | Supported (await tool.ainvoke(...)) |
License
MIT © 2026 Tunova
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_tunova-0.1.0.tar.gz.
File metadata
- Download URL: langchain_tunova-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e96f67176d8058d3045ca2a5cbd474bca89a61e5b0d8914d498b3c2bb34a3523
|
|
| MD5 |
7d09ea4f2e582e30dcac46b310a0aa06
|
|
| BLAKE2b-256 |
34e29e29edac9af7b6523b0fd7363217ca910131ad8040be9a0778ffffde67ba
|
File details
Details for the file langchain_tunova-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_tunova-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
331e830e00c42636988ecb9db467169c543792c3ff91e9bc28e40d8b14dcadab
|
|
| MD5 |
6b0412eb693d7e543f84c8fed3a925df
|
|
| BLAKE2b-256 |
e71bf95701e660375824d7bbcf96db07e04041f175e019ecc54d7b15683b7155
|