Price a request without running it

POSThttps://api.mozartai.com/v1/estimates

Prices a request without running it: the credits it needs, the balance now and the balance after.

Cost
Free
Rate limit
Read
MCP tool
estimate_cost
CLI (coming soon)
mozart estimate

When to use: The cost is unclear: a song, cover, stems or mastering, or several of them. Pass operation, count as the number of calls (one POST /v1/songs call is one press) and, as known, model; for stems, stem_mode and the song length in duration_seconds. Tell the user the price before a large spend.

When not to use: For the balance alone, use GET /v1/credits. To check one exact request, you can also send that request itself as a dry run.

Side effects: None; safe to repeat. The price is a quote: the real call can still be refused, for example by a daily limit.

Authentication

Send your API key as Authorization: Bearer <key>. The key needs these scopes:

  • account:read

Request body

  • operationenumRequired
    Show 9 values
    • songs.create
    • covers.create
    • stems.create
    • midi.create
    • masters.create
    • lyrics.create
    • coverArt.create
    • inpaints.create
    • stems.generate
  • modelenumOptional
    Allowed values
    • hans-2
    • hans-2-cover
  • duration_secondsnumberOptionalgreater than 0

    For stems.create: the length of the audio to split, priced per started minute. For inpaints.create: the length of the source song, which is the length billed. For songs.create and covers.create: only for a model whose max_duration_seconds is a number; a model that picks its own length refuses it, as songs.create does. Covers never take a length, so covers.create refuses it.

  • countintegerOptionalDefaults to 11 to 10
  • barsconstantOptional

    For stems.generate only: the loop length in bars.

    Allowed values
    • 8
    • 16
    • 32
    • 64
  • bpmintegerOptional60 to 200

    For stems.generate only: the tempo of the loop.

  • stem_modeenumOptional

    For stems.create only: the split to price. Defaults to fourStem, as stems.create does.

    Allowed values
    • twoStem
    • fourStem

Response 200

Success.

  • credits_requirednumberRequired
  • balancenumberRequired

    The credits available now: the balance minus credits held by jobs that have not finished, the same number as available in the credits read.

  • balance_afternumberRequired

Response headers

  • x-request-idThe id of this request; quote it when asking for help.
  • x-mozart-api-versionThe API version that answered.
  • x-ratelimit-limitRequests allowed in the current window for this caller.
  • x-ratelimit-remainingRequests left in the current window.
  • x-ratelimit-resetWhen the window resets, in Unix seconds.
  • idempotent-replayedtrue when this answer is the stored answer to an earlier call with the same idempotency key; the work was not done again.

Errors

What to do: PUBLIC_API_RATE_LIMITED: wait retry_after_seconds, then call again. PUBLIC_API_MODEL_NOT_AVAILABLE: pick a model from GET /v1/models.

StatusTypeMeaning
400invalid_requestThe request is malformed or an input is invalid.
401authenticationThe key or token is missing, invalid or revoked.
402insufficient_creditsThe account has too few credits for this call. A REST key also needs an API plan (Starter, Build, Scale or Growth) or API credits; with neither, every call is refused with PUBLIC_API_CREDITS_REQUIRED. payment_required: The account's plan does not include this; it needs an upgrade.
403permissionThe caller may not do this: a missing scope, a Mozart CLI sign-in whose account is below Pro, or access not enabled.
404not_foundThe resource or route does not exist for this caller.
409conflictThe request conflicts with the current state, or an idempotency key was reused with a different body.
422content_refusedThe input was refused by content screening.
429rate_limitedToo many requests; retry after Retry-After seconds. limit_reached: A daily, concurrent or total limit was reached.
500internalMozart failed to answer; retry later.
503provider_unavailableA generation provider is unavailable; retry later. service_unavailable: A Mozart check the request needs, such as content screening, is temporarily unavailable; retry after retry_after_seconds.