> For the complete documentation index, see [llms.txt](https://bountyv.gitbook.io/vdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bountyv.gitbook.io/vdocs/youtube-tools-api/music-lyria.md).

# Lyria (text-to-music)

Generate an instrumental or scored track from a text prompt with Google Lyria 3. **Synchronous** — the finished audio comes back in one call.

```
POST /api/v1/music/lyria
```

We store the track in durable public storage and return a permanent URL, so there's nothing to poll and no signed link to refresh.

## Authentication

```
Authorization: Bearer sk_live_...
```

Requires the **`youtube`** product on your account.

## Request

**Content-Type:** `application/json`

| Field    | Type   | Required | Default                  | Description                                                                       |
| -------- | ------ | -------- | ------------------------ | --------------------------------------------------------------------------------- |
| `prompt` | string | ✅        | —                        | What to generate — genre, BPM, mood, instrumentation, structure tags              |
| `model`  | string | —        | `"lyria-3-clip-preview"` | `"lyria-3-clip-preview"` (\~30s, mp3) or `"lyria-3-pro-preview"` (full song, wav) |

## Response

```json
{
  "audio_url": "https://.../uploads/api-uploads/<you>/song/abc123.mp3",
  "mime": "audio/mpeg",
  "text": "<instrumental>",
  "charged_cents": 30,
  "balance_cents": 4970
}
```

| Field           | Type           | Description                                                                              |
| --------------- | -------------- | ---------------------------------------------------------------------------------------- |
| `audio_url`     | string         | Durable public URL to the track — not time-limited                                       |
| `mime`          | string         | `audio/mpeg` for clip, `audio/wav` for pro                                               |
| `text`          | string \| null | Any lyric/description text the model returned; `<instrumental>` when there are no vocals |
| `charged_cents` | integer        | Amount deducted (also the V-Token count)                                                 |
| `balance_cents` | integer        | Remaining balance                                                                        |

## Example

```bash
curl -X POST https://substance-api.com/api/v1/music/lyria \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt": "calm lo-fi piano, 70bpm, rainy night, soft vinyl crackle"}'
```

Pair it with [Lyric Video](/vdocs/youtube-tools-api/lyric-video.md) or [Music Short](/vdocs/youtube-tools-api/music-short.md) to turn the track into a finished video.

## Errors

| Status | When                                                                             |
| ------ | -------------------------------------------------------------------------------- |
| `400`  | Missing `prompt`                                                                 |
| `401`  | Missing/invalid API key                                                          |
| `402`  | Insufficient credits                                                             |
| `403`  | `youtube` product not enabled                                                    |
| `502`  | Generation failed upstream — **not billed** (the charge only happens on success) |

See [Errors](/vdocs/errors.md) for the general format.

## Pricing

$0.30 per clip. Billed on success only — a failed generation is never charged. See [Credits & pricing](/vdocs/account/credits.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bountyv.gitbook.io/vdocs/youtube-tools-api/music-lyria.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
