Three audio services, available on every project with no setup (user_pays by default).

Plan availability (Free plan): Music generation is Pro-only (blocked on Free). Sound effects count toward a shared 3-uses-per-month audio allowance with text-to-speech (see app-tts). Transcription is not gated. The check uses the paying user's plan (you under owner_pays, the signed-in visitor under user_pays). When a Free payer hits a block, the endpoint returns 403 FORBIDDEN with an upgrade message - handle it in the app's UI. All limits lift on Pro.

To switch a service's billing mode, declare it in a services deploy phase in gipity.yaml so it ships with the app and every deploy reproduces it - e.g. { service: transcribe, billing_mode: owner_pays } (also sound / music). See deploy and app-llm.

Billing modes only govern the deployed app's runtime calls. Direct generation during development - gipity generate sound|music, or gipity service call - always bills the caller (you), whatever the service's billing_mode says. Never flip a service to owner_pays just to generate assets: it's unnecessary, and while flipped the live app accepts anonymous generation on your credits.


Sound Effects

Generate sound effects from text descriptions.

Endpoint

POST /api/<PROJECT_GUID>/services/sound

Request

{
  "text": "thunder rumbling in the distance",
  "duration_seconds": 5,
  "prompt_influence": 0.5
}

Response

{
  "url": "https://media.gipity.ai/med_abc12345.mp3",
  "duration_seconds": 5,
  "credits_used": 2
}

CLI

For one-off sound effects during development (game SFX, UI sounds, voice-like cries), skip the HTTP call and use gipity generate sound - it bills you directly and ignores the service's billing mode. It writes to ./sound.mp3 by default - pass -o <path> to land the clip in your source tree so it deploys.

gipity generate sound "cartoon character saying oof" -o src/assets/sounds/oof.mp3
gipity generate sound "thunder rolling in the distance" --duration 5 -o src/assets/sounds/thunder.mp3

Music Generation

Generate music from text prompts - instrumental tracks, or full songs singing lyrics you supply.

Endpoint

POST /api/<PROJECT_GUID>/services/music

Request

{
  "prompt": "upbeat lo-fi hip hop beat with piano and soft drums",
  "duration_seconds": 30,
  "instrumental": true
}

Lyrics example - a real song with your words, not a description of one:

{
  "prompt": "1985 old-school hip hop, TR-808 drums, funk bassline, confident female MC",
  "lyrics": "[Verse]\nThese exact words get sung\n[Hook]\nAnd this hook comes back around",
  "duration_seconds": 120
}

Size duration_seconds to the lyric (roughly 10s per short section); too-short durations squeeze the delivery.

Response

{
  "url": "https://media.gipity.ai/med_abc12345.mp3",
  "duration_seconds": 30,
  "model": "music-v1",
  "credits_used": 3
}

Picking a model

GET /api/<PROJECT_GUID>/services/music/models lists what's available:

{
  "data": {
    "models": [
      { "id": "music-v1", "label": "Studio", "description": "Fast, polished songs and loops.", "max_duration_s": 600, "supports_lyrics": true }
    ],
    "default_model": "music-v1"
  }
}

Use the id as the model value on the generate call. For a model picker in the UI, render label + description and send the chosen id. supports_lyrics says whether the model can sing exact lyrics. Models differ in sound and cost; the platform handles where each one runs.

CLI

For one-off music during development (saves the clip to a local file), skip the HTTP call and use gipity generate music. It writes to ./music.mp3 by default - pass -o <path> to land the clip in your source tree so it deploys.

gipity generate music "chill lo-fi beat for studying" -o src/assets/audio/lofi.mp3
gipity generate music "epic orchestral battle theme" --duration 60 -o src/assets/audio/theme.mp3
gipity generate music "80s synth-pop, female vocals" --lyrics-file lyrics.txt --duration 120 -o song.mp3
gipity service call music/models --get   # list available models

Audio Transcription

Transcribe audio files to text, with word-level timestamps and optional speaker diarization.

Video or a file over 100MB? The cap is on the audio you send here, not on what you start from. Extract the audio first with ffmpeg in the sandbox (gipity sandbox run) - e.g. ffmpeg -i input.mp4 -vn -ac 1 -ar 16000 -b:a 64k audio.mp3 turns hours of video into a few MB - then send that audio to this endpoint. The sandbox accepts inputs up to several GB, so the original file size is never the constraint.

Endpoint

POST /api/<PROJECT_GUID>/services/transcribe (multipart/form-data)

Request

Send as multipart/form-data:

From the CLI

Transcribe a file while you work with gipity service call and --form, which sends the multipart upload this endpoint needs (curl -F style: field=@path attaches a file, field=value sends a text field):

gipity service call transcribe --form audio=@interview.mp3
gipity service call transcribe --form audio=@interview.mp3 --form language=en --form diarize=true --field text

Use --form, not --file: --file embeds the file in a JSON body (the shape image and vision services take), which this endpoint rejects.

Response

{
  "text": "Hello, this is a transcription test.",
  "words": [{ "text": "Hello", "start": 0.0, "end": 0.5, "type": "word" }],
  "language": "en",
  "duration_seconds": 12.5,
  "provider": "elevenlabs",
  "credits_used": 5
}

Client Code Examples

Use the client SDK (auto-injected into every deployed page). Gipity.service finds this instance's API, handles the app token, sends the signed-in user's session for user_pays, and throws on non-2xx with err.status set. Don't hand-roll fetch against a hardcoded a.gipity.ai (see app-llm).

// Sound effect
const sound = await Gipity.service('sound', { text: 'door creaking open slowly' });
new Audio(sound.url).play();

// Music
const music = await Gipity.service('music', { prompt: 'calm ambient piano', duration_seconds: 60 });
new Audio(music.url).play();

Transcription is a multipart upload, which Gipity.service (JSON only) can't send, so use fetch with the API base read off the SDK tag, an app token, and credentials: 'include' (under user_pays the payer comes from the session cookie; without it a signed-in user still gets 401):

const sdk = document.querySelector('script[data-api-base]');
const apiBase = sdk.dataset.apiBase, app = sdk.dataset.app;   // never hardcode a.gipity.ai
const { data: { token } } = await (await fetch(`${apiBase}/api/token`, {
  method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ app })
})).json();

const formData = new FormData();
formData.append('audio', fileInput.files[0]);
formData.append('diarize', 'true');
const transRes = await fetch(`${apiBase}/api/${app}/services/transcribe`, {
  method: 'POST',
  headers: { 'X-App-Token': token },
  credentials: 'include',
  body: formData
});
const transcript = await transRes.json();   // flat body: { text, words, ... }, or { error } on failure
console.log(transcript.text);

Limits