Skip to main content

UdioAPI — Python SDK for AI Music Generation

Official Python helper for udioapi.pro — generate AI music (Suno / Udio / MiniMax) from one REST API.

Get a free API key · SDK docs · API docs · Pricing · llms.txt

PyPI License: MIT Python 3.9+


What this repo does

A small, zero-dependency Python SDK that:

  1. Calls POST /api/v2/generate to start a track
  2. Polls GET /api/v2/feed?workId=... every few seconds until both clips finish

That is the whole first version on purpose. Extend, cover art, WAV, and MiniMax can land later — the public contract is documented at udioapi.pro/llms.txt.

This project is a third-party API client. It is not affiliated with Udio.com or Suno.

Get an API key

  1. Open https://udioapi.pro
  2. Create a free account (no credit card required)
  3. Copy the key from the dashboard
export UDIOAPI_API_KEY="YOUR_API_KEY"

Or paste into generate.py as API_KEY = "...". Never commit a real key.

Install

pip install udioapi

Python 3.9+. No third-party runtime dependencies.

Quick start

pip install udioapi
export UDIOAPI_API_KEY="YOUR_API_KEY"
python3 -c "from udioapi import UdioClient; print(UdioClient)"

Or clone and use the CLI helper:

git clone https://github.com/UdioAPI/udioapi.git
cd udioapi
python3 generate.py

Inspiration mode (describe the song in plain language):

python3 generate.py --prompt "an upbeat pop song about summer vacation, catchy chorus, 120 bpm"

Custom mode (lyrics + style + title):

python3 generate.py \
  --lyrics "Verse 1: Walking down the street, feeling so free
Chorus: Summer dreams are calling me" \
  --style "pop, upbeat, electronic" \
  --title "Summer Dreams"

Poll an existing task:

python3 generate.py --work-id gen2xxxxxxxx

Typical run: start task → print workId → poll every 8 seconds (text → first clip → All generated successfully.) → print audio_url for each clip.

Use it as a library

from udioapi import UdioClient

client = UdioClient(api_key="YOUR_API_KEY")

work_id = client.generate(
    gpt_description_prompt="A warm lo-fi beat for late-night coding",
    model="chirp-v5-5",
)
print("workId:", work_id)

result = client.wait(work_id)
for clip in result["data"]["response_data"]:
    print(clip.get("title"), clip.get("audio_url"))

Custom lyrics:

work_id = client.generate(
    prompt="Verse 1: City lights in the rearview\nChorus: Keep the radio on",
    style="indie pop, nostalgic",
    title="Rearview",
    model="chirp-v5-5",
)

Models

Model Notes
chirp-v3-5 Default on the API if you omit model
chirp-v4-0 Higher quality
chirp-v4-5 / chirp-v4-5-plus Longer style / lyric limits
chirp-v5 / chirp-v5-5 Latest; duration (10–360s) works in custom mode on v5-5

See current credit cost and plan limits on udioapi.pro/pricing.

How polling works

Generation is async. POST /v2/generate returns a public workId. Keep calling GET /v2/feed?workId=... every 5–10 seconds.

Stage How to read /v2/feed
Lyrics status=text
First clip status=first
Both clips done status=first and extra_message="All generated successfully."
Failed non-empty fail_message (moderation / policy)

Only public task IDs from generate are valid for feed. Do not invent ids.

API surface used here

Action Method URL
Generate POST https://udioapi.pro/api/v2/generate
Status GET https://udioapi.pro/api/v2/feed?workId=...

Auth: Authorization: Bearer YOUR_API_KEY

Full endpoint list (extend, cover, timestamped lyrics, WAV, MiniMax, credits, webhooks): docs · machine-readable index: llms.txt

Layout

udioapi/
  generate.py          # CLI: generate + poll
  udioapi/client.py    # UdioClient
  .env.example         # UDIOAPI_API_KEY=YOUR_API_KEY
  README.md
  LICENSE

Disclaimer

udioapi.pro is an independent music-generation API with its own accounts, billing, and terms. This repository is a client for that API. It is not an official Udio or Suno product.

Keep API keys on your machine. Do not put them in browser code or in this repo.

License

MIT. See LICENSE.

Metadata

Release files for udioapi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for udioapi 0.1.0
File Size Uploaded Provenance Actions
udioapi-0.1.0.tar.gz 6.9 kB Without provenance Details for udioapi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for udioapi 0.1.0
File Interpreter ABI Platform Actions
udioapi-0.1.0-py3-none-any.whl Python 3 none any Details for udioapi-0.1.0-py3-none-any.whl

Total release size: 13.7 kB

Release files / udioapi-0.1.0.tar.gz

Download URL udioapi-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0ffd0b4845f0957d87d3c7fb442f4f8455b3a28a01057e4ebc60a345bbc1dfeb
BLAKE2b-256 checksum
How to use checksums
cf351de01ae55b93acdb316e34631441915850af5a41c7a80c7cdb43326f1023
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / udioapi-0.1.0-py3-none-any.whl

Download URL udioapi-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6787496cf275cf2ea18eb4a6c9c05ffcb354c57b60e8228b3a492d79f1d3ee8c
BLAKE2b-256 checksum
How to use checksums
9a3599e75cacf00bf7f9c7bb7b0f0cb7d4d52b6797bb8cff3c3077952192ff49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for udioapi 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page