Text to Music API documentation
Generate a song or instrumental track from a text description of the style, mood, or scene.
Endpoints
| Contract item | Value |
|---|---|
| Capability | text-to-music |
| Submit | POST https://vidmage.ai/api/v1/text-to-music/submit |
| Query | POST https://vidmage.ai/api/v1/text-to-music/query |
| Task identifier | taskId |
| Result field | audioUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: AI Text to Music API for Musical Briefs
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
description | string | Yes | Not specified | Describe the music style / mood / scene in plain text (1-400 chars). Minimum characters: 1Maximum characters: 400 |
title | string | No | Not specified | Song title (0-80 chars). Auto-generated if empty. Maximum characters: 80 |
makeInstrumental | boolean | No | false | Generate instrumental music without vocals. |
Example request
{
"description": "ambient electronic music for a calm evening",
"makeInstrumental": false
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/text-to-music/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"description":"ambient electronic music for a calm evening","makeInstrumental":false}'
# -> { "success": true, "taskId": "...", "creditsConsumed": ... }Task results and recovery
URL of the generated music track. Read audioUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/text-to-music/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "audioUrl": "https://..." } }Submission and task queries report the available task and usage information. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| Per request | 50 credits / request | — |
A fixed credit charge applies to this API request.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
