Deployments: Audio

An audio deployment makes music or sound effects for /v1/audio/generations. It is priced for each second of audio that the buyer asks for. For speech, see Speech.

Deployments has the fields that every kind shares, the listing statuses and the lifecycle. This page has what is special to this kind.

Register a deployment

Copy the request, set your provider key and change the names. Every endpoint here takes the provider key as a bearer token.

curl https://router.inference.ai.exchange/v1/provider/models \
  -H "Authorization: Bearer $LIQUID_PROVIDER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "kind": "audio_generation",
      "deployment_name": "sound-gen-1",
      "creator": "acme",
      "precision": "bf16",
      "region": "us-east",
      "max_input_tokens": 4096,
      "output_modalities": [
        {
          "type": "text"
        },
        {
          "type": "audio",
          "modes": [
            "music",
            "sound_effect"
          ],
          "formats": [
            "audio/mpeg"
          ],
          "max_duration_seconds": 60
        }
      ]
    }'
import os
import requests

response = requests.post(
    "https://router.inference.ai.exchange/v1/provider/models",
    headers={"Authorization": f"Bearer {os.environ['LIQUID_PROVIDER_KEY']}"},
    json={
        "kind": "audio_generation",
        "deployment_name": "sound-gen-1",
        "creator": "acme",
        "precision": "bf16",
        "region": "us-east",
        "max_input_tokens": 4096,
        "output_modalities": [
            {
                "type": "text"
            },
            {
                "type": "audio",
                "modes": [
                    "music",
                    "sound_effect"
                ],
                "formats": [
                    "audio/mpeg"
                ],
                "max_duration_seconds": 60
            }
        ]
    },
)
response.raise_for_status()
print(response.json()["status"])
const response = await fetch('https://router.inference.ai.exchange/v1/provider/models', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LIQUID_PROVIDER_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    kind: 'audio_generation',
    deployment_name: 'sound-gen-1',
    creator: 'acme',
    precision: 'bf16',
    region: 'us-east',
    max_input_tokens: 4096,
    output_modalities: [
      {
        type: 'text',
      },
      {
        type: 'audio',
        modes: ['music', 'sound_effect'],
        formats: ['audio/mpeg'],
        max_duration_seconds: 60,
      },
    ],
  }),
})
if (!response.ok) throw new Error(await response.text())
console.log((await response.json()).status)

The answer is 201 with the registration. A new registration is UNLISTED. kind cannot change: a new kind returns 409 kind_changed.

What you declare

Field Meaning
modes music, sound_effect or both. Required: a deployment of this kind lists at least one, and a deployment of another kind lists none.
max_duration_seconds The longest clip that it makes. A request for more seconds does not reach you.
formats Formats it makes. A request for another format does not reach you.

Price a mode

If a sound effect costs more than music, quote a second line with a variant:

{ "billable": "input.audio", "unit": "second", "usd": 0.01 },
{ "billable": "input.audio", "unit": "second", "variant": { "mode": "sound_effect" }, "usd": 0.03 }

The mode must be in modes. A request for a mode that you do not price apart pays the line with no variant.

Quote and serve

Quote an input.audio line. It is the line of a second of audio, the same line as a transcription. Your agent implements Upstream::generate_audio. See Sell audio generation.

Charge

The charge is the rate times the seconds that the buyer asked for, so the cap is exactly the charge. A clip shorter than 90 percent of those seconds, or more metered seconds than were asked for, fails the job and you are not paid.

Next