We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Music widget

Music widget code: prompts, models and keeping costs predictable

Music generation costs more per request than a chat message. Here is how to choose a model, guide visitor prompts and set limits so your music widget stays within budget.

Published:

A music clip is one of the more expensive things a public widget can generate, so it pays to think about cost before you embed the code:

<script src="https://api14.com/widget.js" data-widget="YOUR_WIDGET_ID" async></script>

The code itself never changes. Everything below is a setting in your dashboard that you can adjust at any time.

Know the price per clip

Open the widget in Widgets and look at the model picker: it shows the price of each music model. Some providers report the final cost of a clip only after it is generated, so run a handful of test prompts in the preview and check the result in Usage. That gives you a realistic cost per clip for your own prompts.

When two models sound similar for your use case, the lighter one is usually the better default for a public widget.

Guide the prompts

Visitors write better prompts when you show them how. Use the placeholder for a concrete example, such as "Relaxed jazz piano, slow tempo, background music". Clear prompts get usable clips on the first try, which means fewer retries and lower spend.

Put limits in layers

No single limit has to be perfect when several work together:

LayerWhat it capsWhere
API keyDaily spend, requests per minute and allowed models for everything the widget doesAPI keys, chosen in the widget editor
WidgetDaily spend of this widgetWidget editor
AccountDaily spend of all widgets togetherSettings, Widget controls
VisitorRequests per visitor per minute and per dayFixed rate, plus Settings, Widget controls
BalanceEverythingBilling

Every widget runs under one of your API keys. The key list in the editor ends with Create new API key, which makes it easy to give the music widget its own key and its own budget, separate from your API integrations.

Watch the first week

  • Usage can group requests by widget or by site.
  • The widget list shows today's spend and requests for each widget.
  • Failure emails tell you when a limit is reached or the balance runs out.

Adjust the limits once you know your real traffic. It is easier to raise a cap than to explain a surprise bill.

Compare music and audio models in the catalog and see how billing works on pricing.