API Documentation

Integrate AI music generation into your applications

Quick Start

Base URL
https://api.tuneforge.io/api/v1
Authentication Header
Authorization: Bearer tf_your_api_key

All API requests require authentication. Include your API key in the Authorization header.

Authentication

TuneForge uses two authentication methods depending on the endpoint type.

Method 1: API Key (Music Generation & Account)

For music generation and account endpoints, use an API key from your account settings. Include it in the Authorization header:

curl https://api.tuneforge.io/api/v1/account/me \
  -H "Authorization: Bearer tf_your_api_key"

Method 2: Hotkey Signature (Scoring & Analytics)

Scoring endpoints are accessible to any registered neuron (miner or validator) on subnet 234. No user account needed — authenticate with your Bittensor hotkey by signing each request.

Required headers:

HeaderDescription
X-Validator-HotkeyYour ss58 hotkey address
X-Validator-NonceCurrent timestamp in nanoseconds (must be within 300s of server time)
X-Validator-SignatureHex-encoded signature of the message (see below)

Signature message format:

message = "{nonce}.{hotkey}.{method}.{path}.{body_hash}"

# body_hash = SHA-256 hex digest of request body, or "empty" for GET requests
# Example for GET /api/v1/scores/best:
# "1710600000000000000.5H8t4Kqj....GET./api/v1/scores/best.empty"

Python example:

import time, hashlib
import bittensor as bt

wallet = bt.wallet(name="my_coldkey", hotkey="my_hotkey")
hotkey = wallet.hotkey.ss58_address
nonce = str(time.time_ns())
method = "GET"
path = "/api/v1/scores/best"
body_hash = "empty"  # no body for GET requests

message = f"{nonce}.{hotkey}.{method}.{path}.{body_hash}"
signature = wallet.hotkey.sign(message.encode()).hex()

import requests
resp = requests.get(
    f"https://api.tuneforge.io{path}",
    headers={
        "X-Validator-Hotkey": hotkey,
        "X-Validator-Nonce": nonce,
        "X-Validator-Signature": signature,
    },
)
print(resp.json())

Keep your API keys and hotkey files secure. Do not expose them in client-side code, public repositories, or share them with others.

Endpoints

Music Generation

Scoring & Analytics

Every track generated on the TuneForge network is evaluated by validators across 16 scoring dimensions plus 4 penalty multipliers. The score_breakdown object is included in track responses when available, giving full transparency into how each track was scored.

These endpoints use hotkey signature authentication — any registered neuron (miner or validator) on subnet 234 can access them. See the Authentication section for details.

CategoryScorers (weight)
Prompt Adherence (30%)clap (19%), attribute (11%)
Composition (21%)musicality (9%), melody (6%), structural (6%)
Production & Fidelity (16%)production (5%), neural_quality (5%), vocal (4%), quality (2%)
Naturalness & Mix (18%)vocal_lyrics (8%), mix_separation (4%), timbral (3%), learned_mos (3%)
Other (8%)diversity (6%), speed (2%)
Preference (2-20%)preference — auto-scales when trained

The export endpoint includes an audio_url field for each entry. Combine with the base URL to download audio for fine-tuning or analysis.

Penalty multipliers (1.0 = no penalty): duration_penalty, artifact_penalty, fad_penalty, fingerprint_penalty. Final score = composite × all penalties.

Account

Rate Limits

PlanRate Limit
Free60 req/min
Pro300 req/min
Premier1,000 req/min

Rate Limit Headers

Every API response includes headers to help you track your rate limit usage:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per minute
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the rate limit resets

Error Codes

CodeStatusDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request parameters or body
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient credits for this operation
404Not FoundResource not found
429Too Many RequestsRate limit exceeded. Check X-RateLimit headers
500Internal Server ErrorSomething went wrong on our end

All error responses include a JSON body with a detail field describing the error:

{
  "detail": "Insufficient credits. You need 5 credits but have 2 remaining."
}

Code Examples

Full examples showing how to generate music, poll for status, and retrieve the audio URL.

# Generate music
curl -X POST https://api.tuneforge.io/api/v1/music/generate \
  -H "Authorization: Bearer tf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Chill lo-fi hip hop beat with vinyl crackle",
    "genre": "lo-fi",
    "mood": "calm",
    "duration_seconds": 15
  }'

# Check generation status
curl https://api.tuneforge.io/api/v1/music/status/req_abc123def456 \
  -H "Authorization: Bearer tf_your_api_key"

# Download the audio
curl -O https://api.tuneforge.io/api/v1/music/audio/trk_001.wav \
  -H "Authorization: Bearer tf_your_api_key"

Ready to build?

Create your API key and start generating music in minutes.