EN ▾

Uncensored text API for music pipelines

Get API key

Budgeting MusicGen API Costs: A Developer’s Guide

Forecasting expenses for high-volume tasks requires understanding token mechanics. This guide explains how to estimate usage and manage your prepaid credit effectively.

Developer workspace with laptop and crypto coins for API budgeting

Understanding the Pricing Model

Our API operates on a straightforward prepaid model. You purchase credit using cryptocurrency, and the balance is deducted based on actual token consumption. This approach eliminates monthly subscriptions and ensures you only pay for what you use. The base URL for all requests is https://api.musicgen.cc/v1. You interact with a single uncensored open-weight text model identified by the ID "uncensored". This model handles text in and text out, making it suitable for various generative tasks.

The pricing structure distinguishes between input and output tokens. Input tokens, which include your prompt and any system instructions, are charged at $0.15 per million tokens. Output tokens, which represent the model's response, are charged at $0.50 per million tokens. This ratio reflects the higher computational cost of generating text compared to processing it. Understanding this difference is important for accurate budgeting, especially when dealing with long responses.

Errors and refusals do not deduct from your balance. If a request fails due to invalid input or rate limits, you are not charged. This feature protects your budget from unexpected costs during development and testing phases. You can experiment freely without worrying about wasting credits on failed attempts. This makes the service particularly attractive for developers who need to iterate quickly on their prompts.

The prepaid credit never expires, allowing you to top up whenever convenient. There is no monthly fee or subscription required to maintain access. You simply need to ensure your account has sufficient funds to process requests. This flexibility allows you to scale your usage up or down without being locked into a rigid contract. It also simplifies accounting, as costs are directly tied to usage rather than a fixed recurring fee.

Estimating Token Usage

Accurate budgeting starts with estimating token usage. Tokens are the basic unit of measurement for text in large language models. A token can be a word, a part of a word, or a punctuation mark. To estimate costs, you need to know the approximate number of tokens in your prompts and the expected length of the responses. You can use online token counters to get a rough idea of the token count for your input text.

For example, if your prompt contains 1,000 tokens, you can calculate the input cost by multiplying the token count by the input price per million tokens. The formula is (tokens divided by 1,000,000) times $0.15. This gives you the cost for the input portion of the request. You should also estimate the length of the output. If you expect a response of 500 tokens, you calculate the output cost using the output price of $0.50 per million tokens.

It is important to consider the context window, which is 100,000 tokens. This limit includes both the prompt and the completion. If your inputs are long, you may need to manage the context carefully to avoid hitting the limit. Keeping track of the context usage helps you stay within the budget and ensures smooth operation. You can monitor the context window by summing the input and output tokens for each request.

When estimating costs, it is helpful to build in a buffer for variability. Response lengths can vary depending on the prompt and the model's behavior. By adding a small percentage to your estimated token count, you can avoid running out of credit unexpectedly. This buffer acts as a safety net, ensuring that your applications continue to function even if the token count exceeds your initial estimate.

Top-Up and Payment Methods

Top-ups for our API are accepted only in cryptocurrency. You can use USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. These limits help manage transaction fees and ensure efficient processing of payments. You can choose any whole amount within this range to add credit to your account.

Credit from top-ups is added immediately to your balance. You can use the credit for any request, regardless of the model or endpoint. The credit never expires, so you can top up when prices are favorable or when you anticipate high usage. This flexibility allows you to manage your cash flow more effectively. You do not need to worry about losing unused credit due to expiration dates.

There are no credit cards, PayPal accounts, or bank transfers accepted for top-ups. This crypto-only approach reduces friction for international users and avoids currency conversion fees. It also aligns with the decentralized nature of the service. You can purchase crypto from any exchange and transfer it to the provided address to add funds. The process is simple and transparent.

Additionally, new accounts receive $0.50 of trial credit. This allows you to test the API without making a top-up. You can explore the endpoints, check the streaming features, and verify the model's behavior. The trial credit is sufficient for a few test requests, giving you a good sense of the service before committing to a larger purchase. It is a great way to evaluate the API for your specific use case.

Streaming and Real-Time Costs

Our API supports streaming over Server-Sent Events (SSE). This feature allows you to receive responses in real-time as they are generated. Streaming is useful for applications that require immediate feedback, such as chat interfaces or live data visualizations. The usage information is included in the last chunk of the stream, so you can track the token count accurately.

When using streaming, you still pay for the total number of tokens generated. The pricing model does not change based on the delivery method. Whether you receive the response in one chunk or multiple chunks, the cost is calculated based on the total input and output tokens. This ensures consistency in billing, regardless of how you integrate the API into your application.

Streaming can also help you manage costs by allowing you to stop the generation early if the response becomes too long. You can implement logic to terminate the stream once a certain token count is reached. This gives you more control over the output length and helps prevent unexpected charges. It is a powerful feature for optimizing resource usage.

You can also use parameters like temperature, top_p, stop sequences, and seeds to influence the generation process. These parameters allow you to fine-tune the model's behavior and reduce the likelihood of generating excessive text. By controlling the output length, you can keep your token usage predictable and within budget. This is particularly useful for applications with strict cost constraints.

When Our API Is Not the Right Choice

While our API is powerful for text generation, it may not be the right choice for every developer. If you need image, audio, video, or OCR capabilities, our service does not offer these features. We focus solely on text in and text out. If your project requires multimodal outputs, you may need to combine our API with other specialized services.

Similarly, if you need embeddings for vector search or fine-tuning for custom model behavior, our API does not support these functions. We provide a hosted, uncensored text model with standard parameters. If you require advanced model customization or embedding generation, you should look for a provider that offers these specific features. Our API is designed for simplicity and reliability in text generation tasks.

Another consideration is the payment method. If you prefer to pay with credit cards, PayPal, or bank transfers, our crypto-only top-up system may not suit your needs. We accept USDT on TRC20 and USDC on Base. If you are not comfortable with cryptocurrency, you may find the top-up process cumbersome. However, if you are already using crypto, this method offers flexibility and speed.

Finally, if you need an SLA guarantee or on-prem deployment, our service may not meet your requirements. We do not claim specific uptime percentages or offer dedicated infrastructure. Our API is a hosted solution accessible via HTTPS. If you need strict reliability guarantees or data sovereignty, you should evaluate other providers. Our API is ideal for developers who prioritize flexibility, uncensored generation, and straightforward pricing.

Addressing Community Concerns

Discussions on Reddit often highlight concerns about AI companies and their practices. For instance, threads on r/Music and r/antiai discuss legal cases involving AI music generators like Suno. Users express frustration over copyright infringement and the scraping of data. While our API is a text model, these discussions reflect a broader trend of scrutiny towards AI services.

Developers are increasingly aware of the legal and ethical implications of using AI. They want to ensure that the services they rely on are transparent and fair. Our API offers an uncensored model, which allows for more creative freedom. However, users should be mindful of the content they generate, especially in commercial applications. The model does not refuse lawful adult or controversial topics, giving you more control over the output.

In threads on r/technology, users discuss the source code of AI tools and the data used for training. This transparency is valued by the community. While we do not disclose our training data, we focus on providing a reliable and efficient text generation service. Users can test the model using the trial credit to see if it meets their needs. The ability to experiment without financial risk is a key benefit.

Overall, the community values services that are straightforward and do not hide costs. Our prepaid model and clear pricing align with these expectations. By understanding the token usage and budgeting accordingly, developers can avoid unexpected charges. This transparency builds trust and encourages long-term usage. It is important to stay informed about the legal market and choose a service that aligns with your values.

Integration and Troubleshooting

Integrating our API into your application is straightforward. You can use the standard OpenAI-compatible endpoints. The base URL is https://api.musicgen.cc/v1. You can send requests to /v1/chat/completions for text generation or /v1/responses for alternative response formats. The /v1/models endpoint allows you to retrieve model information. This compatibility makes it easy to switch between different providers if needed.

Authentication is handled via API keys. You can sign up with Google or email and password. The key is shown immediately after signup, so you can start using the API right away. You can generate new keys if needed, and each key has a limit of 300 requests per minute. This rate limit helps prevent abuse and ensures fair usage for all users.

Errors are returned with specific HTTP status codes. A 401 error indicates an invalid key, while a 402 error means you have no credit. A 429 error signifies that you have hit the rate limit. These codes help you troubleshoot issues quickly. You can implement logic to handle these errors gracefully, such as retrying requests or notifying the user.

Function calling and JSON mode are supported, allowing you to integrate the API with other tools. You can define tools for the model to call, and it will return structured data. This feature is useful for building complex applications that require interaction with external systems. The ability to use JSON mode ensures that the output is machine-readable, making it easier to process and store.

Frequently asked questions

How do I top up my account?

You can top up your account using USDT on TRC20 or USDC on Base. The minimum amount is $20, and the maximum is $500. New accounts receive $0.50 of trial credit.

What happens if I run out of credit?

If you run out of credit, you will receive a 402 error. You can add more credit at any time, as the prepaid credit never expires. Errors and refusals do not consume credit.

Does the API support streaming?

Yes, the API supports streaming over Server-Sent Events (SSE). Usage information is included in the last chunk of the stream. This allows for real-time response delivery.

What is the context window size?

The context window is 100,000 tokens, which includes both the prompt and the completion. This limit applies to the total number of tokens processed in a single request.