# Music Generation

> Generate a song from a description, or re-sing a track you already have, as an asynchronous job billed per track.

- Canonical: https://tchavi.com/en/docs/music-generation

---


<Endpoint method="POST" path="/v1/music/generations" />

Music generation runs asynchronously: the endpoint returns a `202` with a job `id` immediately, and the track renders in the background. Poll `GET /v1/jobs/:id` (see [Async Jobs](/en/docs/jobs)) until `status` becomes `completed` or `failed`. The SDK's `createAndWait(...)` helper does both in one call.

**Billing is flat, per track.** A model either made the file or it did not, and five minutes costs what thirty seconds costs — there is no duration parameter and nothing to reconcile afterwards. If a job fails after billing, the charged credits are refunded in full.

| Model                 | What it does                                               | Credits per track |
| --------------------- | ---------------------------------------------------------- | ----------------- |
| `minimax-music-2.6`   | Writes and performs a song from a description, up to 5 min | 329.242           |
| `minimax-music-cover` | Re-sings a track you supply, in a style you describe       | 658.484           |

## Generate a song

```bash
curl https://tchavi.com/api/v1/music/generations \
  -H "Authorization: Bearer $TCHAVI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-music-2.6",
    "prompt": "Afrobeats mid-tempo, guitare highlife et basse ronde, refrain joyeux"
  }'
```

```json
{
  "id": "0f3c…",
  "object": "music.generation",
  "status": "pending",
  "model": "minimax-music-2.6",
  "created_at": "2026-11-04T22:41:07.812Z",
  "tchavi": {
    "credits_used": 329.242,
    "credits_remaining": 4821.5
  }
}
```

Then poll `GET /v1/jobs/0f3c…` until it completes. A finished music job answers with `output.audio_url` — not `video_url`, which a video job uses — and carries no `duration` or `resolution`, because music has neither to choose.

## Cover an existing track

`minimax-music-cover` keeps the melody and changes everything around it — genre, voice, instruments, arrangement. It **requires** `source_audio_url`, a publicly reachable MP3 or WAV; a request without one is refused before you are charged.

```bash
curl https://tchavi.com/api/v1/music/generations \
  -H "Authorization: Bearer $TCHAVI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-music-cover",
    "prompt": "Version acoustique douce, voix féminine, guitare nylon",
    "source_audio_url": "https://example.com/ma-maquette.mp3"
  }'
```

## Parameters

| Field              | Type    | Notes                                                                           |
| ------------------ | ------- | ------------------------------------------------------------------------------- |
| `model`            | string  | Required.                                                                       |
| `prompt`           | string  | Required. The style and mood you want. Max 2 000 characters.                    |
| `lyrics`           | string  | The words to sing. Omit and a generator writes its own. Max 5 000 characters.   |
| `instrumental`     | boolean | No vocals at all. Generators only, and never together with `lyrics`.            |
| `source_audio_url` | string  | The track to re-sing. Required by `minimax-music-cover`, refused by generators. |

Three combinations are refused before any charge, because each one is a request the model could not honour: a cover without `source_audio_url`, a `source_audio_url` sent to a generator, and `instrumental` together with `lyrics` — one asks for no voice while the other supplies the words.

## With the SDK

```ts
import Tchavi from '@tchavi/sdk';

const client = new Tchavi({ apiKey: process.env.TCHAVI_API_KEY });

// Submit and poll in one call.
const job = await client.music.generations.createAndWait({
  model: 'minimax-music-2.6',
  prompt: 'Afrobeats mid-tempo, guitare highlife, refrain joyeux',
});

console.log(job.status, job.output?.audio_url);
```

## What you cannot control

You do not choose the length — the model decides, up to five minutes — and you cannot ask for a specific voice. Nobody can guarantee a generated track is free of resemblance to existing music, and covering a recording you do not own may infringe its rights: the model does not check, and neither do we.

