> ## Documentation Index
> Fetch the complete documentation index at: https://docs.musicgpt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lyrics Generator

> This endpoint takes a natural language prompt (e.g., a theme, vibe, or idea) and generates original lyrics based on it. If the prompt has been used before, a variation may be returned. It also estimates the credit cost of generation.

## Endpoint

```http theme={null}
GET /v1/prompt_to_lyrics
```

***

## Request Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `prompt` | `String` | ✅ Yes | The theme or idea you'd like lyrics generated for. |
| | | | e.g., "A hopeful song about starting over" |

> **Note:** The prompt must be between 1 and 1000 characters.

***

## Sample Request

### cURL

```bash theme={null}
curl -G "https://api.musicgpt.com/api/public/v1/prompt_to_lyrics" \
  --data-urlencode "prompt=A hopeful song about starting over" \
  -H "Authorization: <API_KEY>" \
  -H "accept: application/json"
```

### Python

```python theme={null}
import requests

url = "https://api.musicgpt.com/api/public/v1/prompt_to_lyrics"

querystring = {"prompt":"<input_prompt>"}

headers = {"Authorization": "<API KEY>"}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
```

***

## Sample Response

### Success (200 OK)

```json theme={null}
{
  "success": true,
  "title": null,
  "task_id": "0caa0bc2-d05a-414a-a730-a78e8e7f0b31",
  "lyrics": "[Verse 1]\nYou left ...",
  "music_style": null,
  "conversion_id": null,
  "message": "Lyrics Generated Successfully",
  "credit_estimate": 0.005
}
```

***

## Use Case Examples

* "A romantic song under the stars"
* "A pop song about achieving your dreams"
* "Grunge-style lyrics reflecting heartbreak"

***

## Output

Generated lyrics are returned directly in the `lyrics` field of the response.
They may be multi-paragraph and suited for use with vocal synthesis or songwriting tools.

***

The `/prompt_to_lyrics` endpoint is ideal for songwriting, music composition tools, or creative text generation workflows.


## OpenAPI

````yaml GET /v1/prompt_to_lyrics
openapi: 3.1.0
info:
  title: Musicgpt API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.musicgpt.com/api/public
    description: Production server
security: []
paths:
  /v1/prompt_to_lyrics:
    get:
      summary: Convert Prompt to Lyrics
      description: >-
        This endpoint takes a natural language prompt (e.g., a theme, vibe, or
        idea) and generates original lyrics based on it. If the prompt has been
        used before, a variation may be returned. It also estimates the credit
        cost of generation.
      parameters:
        - name: prompt
          in: query
          required: true
          description: The theme or idea you'd like lyrics generated for.
          schema:
            type: string
            minLength: 1
            maxLength: 1000
            example: A hopeful song about starting over
      responses:
        '200':
          description: Lyrics generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  task_id:
                    type: string
                  title:
                    type: string
                  music_style:
                    type: string
                  message:
                    type: string
                  lyrics:
                    type: string
                  conversion_id:
                    type: string
                  credit_estimate:
                    type: number
                    format: float
                example:
                  success: true
                  task_id: 0caa0bc2-d05a-414a-a730-a78e8e7f0b31
                  message: Lyrics Generated Successfully
                  title: null
                  music_style: null
                  conversion_id: null
                  lyrics: |-
                    [Verse 1]
                    You left ...
                  credit_estimate: 0.005
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: INSUFFICIENT_CREDITS
                message: ''
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: UNPROCESSABLE_CONTENT
                message: ''
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: INTERNAL_SERVER_ERROR
                message: ''
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.