For coding agents
This page gives a coding agent what it needs to build with the Audio Decisions API: what the API does, one complete request and response, and the rules that code most often gets wrong. Point your agent to this page before it writes code that calls the API.
Set up your agent
Add this to your project’s agent instructions, such as CLAUDE.md or AGENTS.md:
What the API does
- A request sends one audio file and your questions about it, written in plain language. All the questions in a request are answered in one model inference.
- Each answer is numbers, not text. A
noul,choiceorscoreanswer gives probabilities that estimate the share of human raters who would give each answer. Aspananswer gives the times where an event may occur. There is no transcript, reply or explanation, so the calling code makes the decision. - The API is HTTP only, with one file per request. To evaluate many recordings, send one request per file. To evaluate live audio, send short clips as they are captured.
Make a request
A request is a multipart/form-data POST to https://api.cloud.hume.ai/v0/decisions/file, with the API key in the X-Hume-Api-Key header and two parts, sent in this order:
request: a JSON object withquestions, each keyed by an ID you choose, and an optionalcontextstring that describes the recording.file: one audio file, MP3 or WAV.
The response keys each answer by the ID of its question. It also carries the run_id of the model run, and received, which holds the input tokens the request is billed:
Question types
Each question’s type names its primitive, which sets the criteria it takes and the fields of its answer. One request can mix types.
Rules for calling code
Questions
- Ask each question for one judgment a listener could make from the audio, and combine the answers in code. For a broad decision such as “Did the agent handle the call well?”, ask about the agent’s tone, the caller’s frustration and whether the caller asks to cancel, then combine those answers. If a person listening to the audio would find a question hard to answer, the model is likely to find it hard too.
- List the possible answers instead of asking an open question. Answers are probabilities over the options you give, or time spans. To find why someone called, ask a
choicequestion that lists the reasons. - Give every
choicequestion a neutral option and an option for audio that fits none of the others. Add “neutral” to emotions such as angry, fearful and sad, “unsure” to yes and no, and “none of these” to any list that might not cover every recording. - Make
choiceoptions distinct categories, not narrow number ranges. Ask for “slow”, “normal” or “fast” rather than ranges of words per minute. - Expect
spananswers to be most reliable for vocal bursts and sound events, such as laughs, sighs, coughs or a phone ringing. For other events, such as a word being spoken, check the spans against audio where you know the answer before relying on them. - Do not ask questions that need musical understanding, such as where the chorus starts. See Questions the model does not answer well.
- Send the same questions in the same order for every recording you compare. An answer can change when other questions in the request are added, removed or reordered, so a threshold holds only for the request it was set on.
- Put the text a question depends on in
context, such as a script or the requested speaking style. Every question in a request shares onecontext, so questions that need different context go in separate requests. - Name the speaker a question is about, such as “the agent” or “the caller”, and describe each speaker in
context.
Answers
- A probability is the estimated share of raters, not the model’s certainty. A
noulof 0.5 means raters would split, and anoulof 0.6 means 60% would answer yes, not “somewhat yes”. - Read
scorelevels throughlegend. Level indices start at 0, so on a scale labeled “Not at all”, “2”, “3”, “4”, “Extremely”, index 1 is the level labeled “2”.scoreis the mean level index, not a label. - Choose thresholds from labeled audio. The API sets no threshold. Compare answers with the known answers for recordings of the kind you will judge.
- Send each request once. The same request with the same file returns the same answers, so averaging repeats adds nothing. Answers can change when the model is updated.
- Store each answer with its
run_idand the questions that produced it. The run endpoints return a run’s status and request, but not its answers.
Audio
- Send the whole conversation as one file, and name the speaker each question is about. To judge one person apart from the others, send that person’s audio as its own file. The model hears audio as one channel at 16 kHz and does not hear which side or channel a sound comes from.
- Send 5 seconds to 5 minutes of audio, in a request body of at most 25,000,000 bytes. Shorter audio is rejected with
audio_too_shortand longer audio withaudio_too_long. Split long recordings into one request per part, and convert large WAV files to 16 kHz mono, since a higher sample rate or a second channel does not improve answers. See Limits. - Skip silent or nearly silent files. The model can answer silence with high confidence.
Requests and errors
- Keep the API key on a server you control. To use the API from a browser, relay the audio through your server.
- Send only documented fields. Requests are validated strictly and an unrecognized field is rejected. In responses, ignore unrecognized fields, and treat an answer with an unrecognized
typeas unknown rather than as an error. - Branch on the error’s
code, and on the status when there is nocode. The gateway’s401,429and404for a path or method the API does not serve carry nocode. - Retry
429and503after the seconds in theRetry-Afterheader, and retry500. Both SDKs do this, retrying a request twice. Fix a400,413or415before resending, since the same request fails again. The rate limit is 60 requests per minute, shared by every API key in the organization. See Errors.