Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.varg.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Generate music from text descriptions. Currently one model is available via ElevenLabs.
Model IDCredits~Cost
music_v130$0.30

Quick start

import { createVarg } from "vargai/ai"

const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })

const result = await varg.musicModel().generate({
  prompt: "upbeat electronic music, cheerful vibes, 120 bpm",
  duration: 15,
})

console.log(result.audio.url)

Parameters

prompt
string
required
Text description of the music. Include genre, mood, tempo, and instruments for best results.
duration
number
Music duration in seconds. Always set this explicitly — without it, the model defaults to ~60 seconds which may be more than needed.
Always set duration explicitly. Without it, the model generates ~60 seconds of music, which costs the same but may be more than you need.

Prompt examples

PromptGood for
"chill lofi hip hop, relaxing study vibes"Background music, ambient
"epic orchestral cinematic trailer music"Product launches, drama
"upbeat pop, energetic, catchy melody"Social media, TikTok
"acoustic guitar, gentle fingerpicking, warm"Narration background
"dark ambient electronic, mysterious atmosphere"Thriller/tech content
"jazz piano trio, smooth and sophisticated"Interviews, podcasts

Composition example

Add music as a background track in a video:
<Render width={1080} height={1920} fps={30}>
  <Music
    prompt="upbeat electronic music, cheerful vibes"
    model={varg.musicModel()}
    volume={0.3}
    duration={15}
  />
  <Clip duration={5}>
    <Video model={varg.videoModel("kling-v3")} prompt="sunset timelapse" duration={5} />
  </Clip>
  <Clip duration={10}>
    <Video model={varg.videoModel("kling-v3")} prompt="city nightscape" duration={10} />
  </Clip>
</Render>

Pricing

ModelCreditsUSD
music_v130$0.30

Tips

  • Include genre, mood, tempo, and instruments in your prompt for the best results.
  • BPM matters — specify it if you need the music to match a specific pacing (e.g., "120 bpm" for upbeat, "70 bpm" for relaxed).
  • Set volume to 0.2-0.4 when using as background under narration — it shouldn’t compete with speech.

ElevenLabs Speech

Add narration over your music track.