Music recognition for AI agents: three ways to connect AudD
How an AI agent can identify songs with AudD, and which way in fits: the MCP server (hosted at mcp.audd.io, or local in the AudD CLI), a recognition tool you write with the HTTP API or an SDK, or prepaid requests for an agent with no AudD account at api.audd.io/agent/recognize. Plus the docs agents can read and the spending limits.
You can use our API to let your AI agents identify music: the song in a short clip, all the tracks in an hours-long mix, or the songs played on a radio station. There are three ways to connect an agent, and the method you choose depends upon where it runs and who pays for the requests. If the agent works with your AudD account in an MCP client, connect our MCP server. If you’re building your own app, give the model a tool of its own: your server calls our API or one of our SDKs with your token. And if the agent has no AudD account at all, it can register by itself, buy prepaid requests, and send the audio to https://api.audd.io/agent/recognize.
What an agent can do with music recognition
Our API has a method for each of these jobs. The standard endpoint allows identifying music in audio, just like Shazam: the agent sends a short clip, and we send back the song. For long files, we have a separate endpoint that accepts large audio and video files (even hours-long mixes or days-long recordings) and recognizes all the tracks in them; we count the requests to it as 1 request per 12 seconds of audio, so the agent should always set a limit. And for radio stations and other live streams, you send us the URLs of the streams, and we send you the recognition results in real time.
1. The MCP server
If you use an MCP client, like Claude, ChatGPT, Cursor, or VS Code, you can let your AI agents work with your AudD account by using our MCP server at https://mcp.audd.io. You can ask the agent how many requests you have left this billing cycle, or what the song in a link is. It can also put your API token in a project and get a payment link ready when you want a bigger plan.
When a client connects, you’ll sign in through dashboard.audd.io and approve the scopes it asked for. You can untick the ones you don’t want to give: if the agent only has to tell you how many requests you have left, usage:read is enough. Every recognition is counted as a request on your plan, the same as when you call the API yourself.
The server can only send a song to our API by URL. If you send many requests, ask the agent to get the token with get_api_token once and call the API or an SDK directly: it’s more efficient and more reliable than sending each of them through the MCP server.
Our command-line tool also works as an MCP server. When your client starts audd mcp, the agent can recognize files from your computer, scan long recordings, and manage your streams. If the agent can run shell commands, it can also use the CLI itself: when its output is piped, every command prints JSON and exits with a documented code (see the AudD CLI guide for AI agents). audd agent-setup writes short instructions that teach a coding agent when and how to use audd.
You can find the setup for each client in Connect Claude, Cursor, or another MCP client, and the caveats for the agent in Agent notes: the AudD MCP servers.
2. A tool you write with our API or an SDK
If you’re building your own app or agent, you can give the model a tool of its own. You describe the tool to the model, and when the model calls it, your server sends the URL to our API. The token stays on your server, and you decide what the model gets back and how much one call can spend.
Our API is small: you send a URL or a file, and we send back the artist, the title, the album, the release date, the label, and a song_link. There are eleven official SDKs that wrap it. These are the things to get right in the tool:
Please check that the model gave you an http:// or https:// URL, since our Python and Node.js SDKs read any other string as the path of a local file and upload that file. If the server has successfully processed the request, but there are no matches, the result field is null: it’s a normal answer, not an error. Set a limit on every enterprise call, and cap it on your server, since the model can send any number. And keep the token on the server: the model only needs a small result, not the raw response.
We’ve written the complete code for the Claude and OpenAI APIs: see Give an LLM a music recognition tool.
3. Prepaid requests for an agent with no account
We wanted to make it as simple as possible: the agent registers with one request, buys prepaid requests, and sends us the audio with its own key. You’ll be able to use our API without an AudD account or an email. You can find the full reference at audd.io/auth.md, and the steps in Agent notes: prepaid requests without an AudD account.
There are two ways for the agent to pay for the requests: it can pay the HTTP 402 payment challenge itself, with the Machine Payments Protocol (MPP), or it can send its user a checkout link. The checkout link opens a Stripe payment page, where the user can pay by card or any other payment method Stripe offers in their country. They don’t have to have an AudD account in order to pay. Buying spends real money: the agent should pay only with a payment method, and up to an amount, that its user has authorized.
Registration is free, but there are no free requests: the balance starts at 0. The requests are sold in packs of 1,000 for $5.00, and you can buy from 1 to 100 packs in one purchase. There is no subscription. The requests will be kept for 12 months after the last purchase, and then they expire.
The agent sends the audio to https://api.audd.io/agent/recognize, with its key in the Authorization: Bearer agt_… header. The parameters and the response are those of our standard endpoint, and only the first 12 seconds of the audio are analyzed. Basically, we charge one credit for each answer, a match or a no-match; the exact wording is the “Charge rule” in auth.md. Agent keys work only at this endpoint, so to scan long files or monitor streams, the user needs an AudD account.
If the user has an AudD account, you don’t need any of this: send the api_token from the Dashboard in all the requests to https://api.audd.io/, or connect our MCP server. New accounts get a free trial of 300 requests where available, usable for 14 days, and the plans are on the pricing page.
What our docs give agents
All the pages on docs.audd.io have markdown versions: add .md to the URL, like https://docs.audd.io/streams.md. The index of the docs is at https://docs.audd.io/llms.txt, and the guides on this site are listed at https://audd.io/resources/llms.txt. Both MCP servers can also return the docs as markdown. There are three files written for agents: skill.md is a self-contained guide with the first call, the response shape, and the common mistakes; AGENTS.md is for coding agents that add AudD to a project; and auth.md is for agents without an account. A request to the agent recognition endpoint without a key answers 401, with a Link header that points to auth.md, so an agent can find it by itself.
Spending limits and safety
When you send a long recording to the enterprise endpoint, our servers think of it as a bunch of 12-second audio chunks, and every chunk counts as a request. So every enterprise call should have a limit: the upper bound for the number of chunks the server will recognize. The CLI needs --limit with --enterprise, and the local MCP server’s recognize_enterprise needs limit. If you start audd mcp with --max-requests N, the agent can’t spend more than N requests in the session. And if you need a hard monthly cap on requests, email [email protected] and we’ll set one on your account.
The payment tools of the MCP server never charge anything by themselves. They create a link to a Stripe payment page, and the payment only happens if you open the link and approve it in your browser.
Please don’t ask users to paste API tokens into the chat. The SDKs and the CLI read the token from the AUDD_API_TOKEN environment variable, and the MCP server gives the agent only the scopes you granted. Please be careful when the same agent can also read untrusted content, such as web pages or uploaded files. Text in them can ask the agent to call these tools (this is called prompt injection), so keep the confirmation on for the token and payment tools. And just in case: a cancelled request might still consume requests.
Which one to use
- If you chat with an assistant in an MCP client and you have an AudD account, use our MCP server.
- If the files are on your computer, use
audd mcp, the local server in our CLI. It can also scan long recordings and manage your streams. - If the agent can run shell commands, it can use the CLI itself.
- If you’re building an app and your server pays for the requests, write a tool with one of our SDKs.
- If nobody has an AudD account and the agent should pay for its own requests, use prepaid requests.
- If you need long files or streams, you’ll need an account: you can get one at dashboard.audd.io.
Related
Reading this as an AI agent? The raw Markdown is at articles/music-recognition-for-ai-agents.md, and the full index is /resources/llms.txt.
