Quickstart for Musicgen pipelines
Get started with the uncensored text API for music pipelines in minutes. This guide covers authentication, basic requests, streaming, and structured output using the standard OpenAI-compatible endpoints.
Base URL and Authentication
All requests target the base URLhttps://api.musicgen.cc/v1. Authenticate by passing your API key in the Authorization header. You can generate a key instantly via Continue with Google or email on the Get API key page. The key is shown immediately after creation. Use the model ID uncensored for all completions. This model is an open-weight LLM tuned for minimal refusals on lawful adult, fictional, and controversial topics. It is not GPT, Claude, or any other vendor model. Prompts are not used for training. A single active key is allowed per account; generating a new one replaces the old. Keep your key secure, as it controls your prepaid credit.
Basic Chat Completion
Send a standard chat completion request toPOST /v1/chat/completions. This endpoint handles prompt writing, script generation, and metadata extraction. The model supports a 100,000-token context window (prompt + completion combined). If you do not set max_tokens, the response can run to the end of the 100,000-token window. Parameters like temperature, top_p, and stop are supported for controlling creativity. Streaming is available via Server-Sent Events. Errors and refusals do not consume credit. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Credit is prepaid and never expires.
Python SDK Example
Use the official OpenAI Python SDK to interact with the API. Set the base URL to our endpoint and provide your API key. Theuncensored model ID ensures you are using our specific open-weight model. You can pass messages in the standard format. This approach is ideal for backend services processing lyrics or generating metadata for music tracks. The SDK handles JSON serialization and request signing automatically. Ensure your environment has the necessary dependencies installed. This method is reliable for batch processing or integrating text generation into larger music pipelines. It abstracts away the HTTP details while maintaining full control over parameters like temperature and top-p.
Node SDK Example
For Node.js environments, the OpenAI SDK works seamlessly with our API. Configure the base URL and API key in your client initialization. Use theuncensored model ID to access the uncensored LLM. This setup is perfect for serverless functions or real-time web applications generating text for music tools. The SDK supports async/await patterns for clean code. You can stream responses or get full completions. This flexibility allows developers to choose the best approach for their application architecture. Whether you are building a CLI tool or a web service, the Node SDK provides a familiar interface. Remember to handle errors appropriately, as network issues or invalid keys will raise exceptions.
Streaming Responses
Token usage is provided in the final chunk of the stream. This allows you to track consumption accurately in real-time. Streaming is useful for generating long lyrics or scripts where immediate output is preferred. Use thestream: true parameter in your request. The API returns Server-Sent Events (SSE) with incremental updates. Each chunk contains part of the response. The last chunk includes the complete token counts for the request. This feature is essential for building responsive UIs that display text as it is generated. It reduces perceived latency for users waiting for creative content. Ensure your client handles SSE properly to avoid memory leaks.
Limits, Errors, and Context
Rate limits are 300 requests per minute and 8 concurrent requests per key. The maximum request body size is 8 MB. If you receive a 401 error, your API key is invalid or expired. A 402 error indicates insufficient credit; top up using crypto (USDT on TRC20 or USDC on Base). A 429 error means you have exceeded the rate limit. The context window is 100,000 tokens total. Ifmax_tokens is not set, the response can run to the end of the 100,000-token window. Errors do not consume credit. Refusals for unlawful content (like minor sexual content) are free. Credit is charged only for successful token usage. No subscription fees apply. Prepaid credit never expires.cURL
curl https://api.musicgen.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.musicgen.cc/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.musicgen.cc/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);Streaming
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)API specifications
The numbers below are the real limits of this API, not marketing. Compare them with what your app needs.
| Feature | Support |
|---|---|
| Protocol | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Model ID | uncensored |
| API key | Bearer token in the Authorization header |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.musicgen.cc/v1 |
| Streaming | Yes — server-sent events; the last chunk carries token usage |
| Completion length | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| JSON mode | JSON object mode via response_format json_object |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Max context | 100,000 tokens, input and output combined |
| Tools / tool calls | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Rate limit | 300/min per key |
| Parallel requests | up to 8 in parallel per key |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Max body | up to 8 MB per request |
| Token prices | $0.15 per 1M input tokens · $0.50 per 1M output tokens |
| Billing | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Free trial | $0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Volume bonus | +5% from $50, +10% from $100, +15% from $200 |
| Subscription | paid credit never expires, no subscription |
| Account | sign in with Google or with e-mail + password |
| Content policy | uncensored for adults; the only hard rule: no sexual content involving minors |
| Key management | one active key per account; a new key replaces the old one |
Errors and what to do
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| Status | Type | Reason |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | sexual content involving minors — refused, not billed |
404 | not_found | unknown endpoint |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | model busy — retry in a few seconds |
Questions and answers
What is the context window size?
The context window is 100,000 tokens, including both the prompt and the completion. There is no separate output cap, and if max_tokens is not specified, the response can run to the end of the window.
How do I top up credit?
Top up by crypto (USDT on TRC20, USDC on Base). Minimum amount is $20, maximum is $500. You receive a 5% bonus for $50+ and 10% for $100+.
Is there a free trial?
Yes, new users get $0.50 of trial credit valid for 7 days. Claim this credit with one click on your API key page. No card is needed. The trial is limited to one per person.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.