Uhmbrella AIMD - client SDK and CLI for the Uhmbrella AI music detection API.
Project description
Uhmbrella AIMD API – CLI and HTTP reference
This document describes how to use the uhmbrella-api Python package via:
- The CLI command:
uhmbrella-api - The equivalent raw HTTP API calls (for curl or backend use)
It only covers behaviour that exists in the current cli.py.
Default base URL:
https://api.uhmbrella.io
You can override this with:
--api-base https://your-api-host- or environment variable
UHM_API_BASE
All public endpoints require:
x-api-key: YOUR_API_KEY
You can supply the API key either as a CLI flag or via environment variable.
0. Authentication and globals
CLI
You can pass the API key directly:
uhmbrella-api --api-key YOUR_API_KEY usage
Or set an environment variable:
export UHM_API_KEY="YOUR_API_KEY"
uhmbrella-api usage
The CLI understands the following global options:
--api-key- API key for auth (or setUHM_API_KEY)--api-base- override the API base URL
These flags can appear anywhere in the command. For example, all of these are equivalent:
uhmbrella-api --api-key KEY usage
uhmbrella-api usage --api-key KEY
uhmbrella-api usage --api-key=KEY
The CLI normalises the arguments before parsing.
1. Check usage
Shows current quota and usage for the API key.
CLI
uhmbrella-api usage --api-key YOUR_API_KEY
HTTP
curl "https://api.uhmbrella.io/usage" -H "x-api-key: YOUR_API_KEY"
The response is a JSON object similar to:
{
"user_id": "test_user",
"plan_name": "trial_100min",
"quota_seconds": 6000,
"used_seconds": 765,
"remaining_seconds": 5235
}
2. Synchronous scan
The scan command uploads audio for immediate analysis.
Behaviour:
- If
--inputpoints to a single file, the CLI callsPOST /v1/analyze. - If
--inputpoints to a directory, the CLI callsPOST /v1/analyze-batchfor up to 40 files. - Results are written as JSON files in the chosen output directory.
During upload, a tqdm progress bar shows bytes sent.
2.1 Single file
Results are saved as <output-dir>/<filename>.analysis.json.
CLI
uhmbrella-api scan --input "/path/to/audio.mp3" --output-dir "./uhm_results" --api-key YOUR_API_KEY
Key options:
--input- path to an audio file--output-dir- directory to write JSON results (default./uhm_results)
HTTP
curl -X POST "https://api.uhmbrella.io/v1/analyze" -H "x-api-key: YOUR_API_KEY" -F "file=@/path/to/audio.mp3"
The HTTP response is a single analysis object that includes:
- predicted class percentages
- segments and segmentsVox arrays
- audio length and billed seconds
- usage details for the API key
2.2 Small folder (up to 40 files)
If the input is a folder, the CLI will:
- collect audio files based on patterns
- upload them in a batch to
/v1/analyze-batch - write one JSON result per file
If more than 40 files are found, the CLI exits with an error and asks you to use jobs create instead.
CLI
uhmbrella-api scan --input "./audio_folder" --output-dir "./uhm_results" --recursive --api-key YOUR_API_KEY
Options:
--input- directory containing audio files--output-dir- directory to write JSON results--recursive- recurse into subdirectories--patterns- override patterns, for example:--patterns "*.wav" "*.flac"
Default patterns are:
*.mp3 *.wav *.flac *.m4a
HTTP
curl -X POST "https://api.uhmbrella.io/v1/analyze-batch" -H "x-api-key: YOUR_API_KEY" -F "files=@/path/to/track1.wav" -F "files=@/path/to/track2.mp3"
The response contains:
results- list of per file analysis objectsusage- updated usage summary
Each result item has the same shape as a single file analysis.
3. Create async job
For larger sets of files, the CLI supports async jobs via the /v1/jobs endpoint. Files are uploaded once and processed in the background.
CLI
uhmbrella-api jobs create --input "./audio_folder" --recursive --api-key YOUR_API_KEY
Options:
--input- file or directory--recursive- recurse into directories when--inputis a folder--patterns- override default file patterns
Example with custom patterns:
uhmbrella-api jobs create --input "./audio_folder" --recursive --patterns "*.wav" "*.flac" --api-key YOUR_API_KEY
The CLI prints the JSON response and, if possible, a convenient reminder of follow up commands, for example:
[JOB CREATED]
{
"job_id": "7f3f696c-8052-43f8-a5c5-08b3767b030e",
"status": "queued",
"total_files": 123,
...
}
You can now run:
uhmbrella-api jobs status --job-id 7f3f696c-8052-43f8-a5c5-08b3767b030e
uhmbrella-api jobs results --job-id 7f3f696c-8052-43f8-a5c5-08b3767b030e --output-dir ./results
Uploads use tqdm to show total bytes sent.
HTTP
curl -X POST "https://api.uhmbrella.io/v1/jobs" -H "x-api-key: YOUR_API_KEY" -F "files=@/path/to/track1.wav" -F "files=@/path/to/track2.wav"
The HTTP response includes at least:
job_idstatustotal_files- fields relating to billed and remaining seconds
4. Job status
Check the status and progress of a previously created job.
CLI
uhmbrella-api jobs status --job-id JOB_ID --api-key YOUR_API_KEY
The CLI prints the JSON returned by the API.
HTTP
curl "https://api.uhmbrella.io/v1/jobs/JOB_ID/status" -H "x-api-key: YOUR_API_KEY"
The response includes fields such as:
job_idstatus(for example queued, processing, done, error, cancelling, cancelled)total_files- counts per status
- quota and usage information
5. Job results
Fetch per file results for a job. The CLI can either print the full JSON or write individual result files to disk.
CLI
uhmbrella-api jobs results --job-id JOB_ID --output-dir "./results" --api-key YOUR_API_KEY
Behaviour:
- Always prints a summary to stdout:
job_idstatusresults_count
- If
--output-diris omitted:- prints the full raw JSON to stdout and exits.
- If
--output-diris provided:- creates the directory if needed
- for each item in
results:- if
status == "done", writes<filename>.analysis.json - otherwise, writes
<filename>.error.json
- if
This lets you separate successful analyses from errors.
HTTP
curl "https://api.uhmbrella.io/v1/jobs/JOB_ID/results" -H "x-api-key: YOUR_API_KEY"
The response JSON includes:
- overall
job_idandstatus results: a list where each item contains:filenamestatus- possibly
error result(same shape as/v1/analyze) when status is done
6. Cancel job
Request cooperative cancellation of a long running job. The worker finishes the current file then stops.
CLI
uhmbrella-api jobs cancel --job-id JOB_ID --api-key YOUR_API_KEY
The CLI prints the JSON response from the API.
HTTP
curl -X POST "https://api.uhmbrella.io/v1/jobs/JOB_ID/cancel" -H "x-api-key: YOUR_API_KEY"
Typical responses:
If cancellation is accepted:
{
"job_id": "JOB_ID",
"status": "cancelling"
}
If the job has already finished or been cancelled, you get its current status instead, for example:
{
"job_id": "JOB_ID",
"status": "done"
}
or
{
"job_id": "JOB_ID",
"status": "cancelled"
}
7. Environment helper
The env subcommand prints OS specific commands for setting your API key in the environment.
CLI
uhmbrella-api env --api-key YOUR_API_KEY
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 uhmbrella_api-0.1.6.tar.gz.
File metadata
- Download URL: uhmbrella_api-0.1.6.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78d2f9fcd0ddc2c89347eaaa363337d6a543dc647e768245065a961323d980bf
|
|
| MD5 |
510b94745b9b26134f9fb6197666ee01
|
|
| BLAKE2b-256 |
eb68c44885c9677dbe5923c507bb8e092f2444b50bc0515ae42eb4d16fe57ea7
|
File details
Details for the file uhmbrella_api-0.1.6-py3-none-any.whl.
File metadata
- Download URL: uhmbrella_api-0.1.6-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
250af74a97618323647b2e7f0d934ec10871ea19ee567fa1ab266fc89a00e882
|
|
| MD5 |
bdbcc6863bc0037b303de5f84eb3b02b
|
|
| BLAKE2b-256 |
df0b33cee86a2a834c6819757a7f0dc9f0cbcdc4f1dc7c2584f22bdee31f2555
|