Audio
Zamiana tekstu na mowę, zamiana mowy na tekst, muzyka, efekty dźwiękowe, zmiana głosu, dubbing i klonowanie głosu — jeden klucz API, każdy dostawca.
Jedna powierzchnia audio obejmuje text-to-speech, transcription, muzykę, efekty dźwiękowe, dubbing, zmianę głosu oraz klonowanie głosu. Główne endpointy są zgodne z OpenAI, podczas gdy bogatsze dodatki — voice settings, speaker diarization, dubbing — są akceptowane wszędzie tam, gdzie obsługuje je dostawca źródłowy.
Najpierw wylistuj dostępne głosy; sklonowane głosy, które utworzysz, pojawiają się na tej samej liście i są używane w ten sam sposób.
Endpoints in this section: /v1/audio/speech, /music, /sound-effects, /transcriptions, /audio-isolation, /voice-changer, /dubbing, /voices, plus /v1/voices/* for cloning.
Zamiana tekstu na mowę
Syntezuj mowę z tekstu. Zwraca nieprzetworzone bajty audio z pasującym typem zawartości (np. audio/mpeg). Formaty PCM i µ-law zawierają nagłówek WAV, dzięki czemu można je odtwarzać w dowolnej przeglądarce.
https://api.airforce/v1/audio/speechmodele TTS
…· live| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | TTS model ID. See /v1/models for IDs with input_modalities containing "text" and output_modalities containing "audio". |
| input | string | Required | Text to synthesise. Long inputs are chunked automatically. |
| voice | string | Required | Voice ID. Use GET /v1/audio/voices to list options. Cloned voices appear here too. |
| response_format | string | Optional | "mp3" (default), "mp3_44100_128", "mp3_44100_192", "pcm_22050", "pcm_24000", "pcm_44100", "ulaw_8000". |
| speed | float | Optional | 0.25 – 4.0. OpenAI-compatible. Some upstream providers ignore this. |
| voice_settings | object | Optional | ElevenLabs-shape: { stability: 0–1, similarity_boost: 0–1, style: 0–1, use_speaker_boost: bool }. |
| language_code | string | Optional | ISO-639-1 hint, e.g. "de", "en", "ja". Improves prosody for multilingual models. |
| seed | integer | Optional | Reproducibility seed where supported. |
Przykład
curl https://api.airforce/v1/audio/speech \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-H "Content-Type: application/json" \
--output speech.mp3 \
-d '{
"model": "elevenlabs-multilingual-v2",
"input": "Willkommen bei Airforce.",
"voice": "21m00Tcm4TlvDq8ikWAM",
"response_format": "mp3_44100_128",
"voice_settings": {"stability": 0.6, "similarity_boost": 0.8}
}'Lista głosów
Zwraca każdy głos, który możesz przekazać jako parametr „głos” w połączeniach TTS / lektorskich / audiobookach. Sklonowane głosy również są tutaj zwracane, gdy ich status jest aktywny.
https://api.airforce/v1/audio/voicescurl https://api.airforce/v1/audio/voices \
-H "Authorization: Bearer sk-air-YOUR_API_KEY"Kształt odpowiedzi
| Parameter | Type | Required | Description |
|---|---|---|---|
| voices[] | array | Optional | List of voice descriptors. |
| voices[].voice_id | string | Optional | Provider-native voice identifier — the field is voice_id (not id). Pass this value as "voice". |
| voices[].name | string | Optional | Human-readable name. |
| voices[].description | string | Optional | Short description, when the upstream exposes one. |
| voices[].category | string | Optional | "premade" | "cloned" | "professional". |
| voices[].preview_url | string | Optional | Short audio sample, when the upstream exposes one. |
| voices[].labels | object | Optional | Free-form metadata: gender, language, accent, age, use case. |
| live | boolean | Optional | true when the catalog came from a live upstream call; false when served from the built-in premade fallback. |
{
"voices": [
{
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"name": "Roger - Laid-Back, Casual, Resonant",
"description": "Easy going and perfect for casual conversations.",
"preview_url": "https://.../58ee3ff5.mp3",
"category": "premade",
"labels": {"accent": "american", "gender": "male", "language": "en", "use_case": "conversational"}
}
],
"live": true
}Generowanie muzyki
Generuj pełne utwory muzyczne z podpowiedzi tekstowej. Zwraca dźwięk binarny.
https://api.airforce/v1/audio/musicTen endpoint obsługuje natywne modele muzyczne (np. music-v1). Modele Suno (suno-*) nie są tutaj dostępne i zwracają provider_not_supported — wywołaj je zamiast tego przez endpoint /v1/images/generations (zobacz dokumentację Media).
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Music model ID, e.g. "music-v1". |
| prompt | string | Required | Style / mood / structure description. |
| duration_seconds | integer | Optional | Track length. Range depends on the model (typically 15–120 s). |
| response_format | string | Optional | "mp3" (default) or provider-native. |
| instrumental | boolean | Optional | When true, suppresses vocals. |
| style | string | Optional | Optional genre tag list, e.g. "EDM, bass, dark". |
curl https://api.airforce/v1/audio/music \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-H "Content-Type: application/json" \
--output track.mp3 \
-d '{
"model": "music-v1",
"prompt": "Lofi hip-hop beat with soft piano and rain",
"duration_seconds": 60,
"instrumental": true
}'Efekty dźwiękowe
Krótkie efekty dźwiękowe z podpowiedzi tekstowej. Taki sam kształt jak muzyka, tylko krótszy czas trwania.
https://api.airforce/v1/audio/sound-effects| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | SFX model ID. |
| prompt | string | Required | Effect description, e.g. "thunder rumble fading into rain". |
| duration_seconds | integer | Optional | Length, typically 0.5–22 s. |
| response_format | string | Optional | "mp3" (default). |
curl https://api.airforce/v1/audio/sound-effects \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-H "Content-Type: application/json" \
--output thunder.mp3 \
-d '{
"model": "sfx-v1",
"prompt": "Distant thunder rolling, then rain",
"duration_seconds": 8
}'Transkrypcje (zamiana mowy na tekst)
Przesyłanie wieloczęściowe pliku audio. Zwraca transkrybowany tekst.
https://api.airforce/v1/audio/transcriptionsModele transkrypcji
…· live| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Transcription model ID. See the live list below for valid IDs. |
| file | binary | Required | Audio file. Supports mp3, wav, m4a, flac, ogg, webm. |
| language_code | string | Optional | ISO-639-1 language hint (also accepted as "language"). Auto-detected when omitted. |
| diarize | boolean | Optional | Separate speakers. When true, each word carries a speaker_id. |
| num_speakers | integer | Optional | Expected speaker count, used together with diarize. |
| tag_audio_events | boolean | Optional | Mark non-speech events (laughter, silence, music) in the output. |
| timestamps_granularity | string | Optional | "word" (default) or "character". |
| additional_formats | string | Optional | Request extra rendered outputs (e.g. srt / vtt) alongside the JSON. |
curl https://api.airforce/v1/audio/transcriptions \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "[email protected]" \
-F "model=elevenlabs-scribe" \
-F "language_code=de" \
-F "diarize=true"Kształt odpowiedzi
{
"language_code": "deu",
"language_probability": 0.98,
"text": "Willkommen zum Meeting...",
"words": [
{"text": "Willkommen", "start": 0.0, "end": 0.62, "type": "word", "logprob": -0.08, "speaker_id": "speaker_0"},
{"text": " ", "start": 0.62, "end": 0.62, "type": "spacing", "logprob": 0.0}
],
"audio_duration_secs": 412.5,
"transcription_id": "tx_01HXY..."
}Odpowiedź ma natywny kształt dostawcy źródłowego (ElevenLabs Scribe), a nie OpenAI Whisper: tokeny są zwracane jako płaska tablica words[] (każdy z polem type o wartości word/spacing oraz logprob), a nie segments[]. Czas trwania to audio_duration_secs, a language_code jest w formacie ISO-639-3 (np. eng, deu). Pole speaker_id dla poszczególnych słów jest obecne tylko wtedy, gdy przekażesz diarize=true.
Izolacja dźwięku
Usuń szum tła z klipu, zachowując głos pierwszego planu. Przesyłanie wieloczęściowe zwraca dźwięk.
https://api.airforce/v1/audio/audio-isolation| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Isolation model ID. |
| file | binary | Required | Input audio. |
curl https://api.airforce/v1/audio/audio-isolation \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "model=isolation-v1" \
-F "[email protected]" \
--output clean.mp3Zmieniacz głosu (zamiana mowy na mowę)
Weź mowę wejściową i wyrenderuj ją ponownie innym głosem, zachowując czas i fleksję.
https://api.airforce/v1/audio/voice-changer| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Voice-change model ID. |
| voice | string | Required | Target voice ID. Same catalog as TTS. |
| file | binary | Required | Input audio. |
| voice_settings | object | Optional | Optional ElevenLabs-shape settings (stability, similarity_boost, …). |
curl https://api.airforce/v1/audio/voice-changer \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "model=voice-changer-v1" \
-F "voice=21m00Tcm4TlvDq8ikWAM" \
-F "[email protected]" \
--output transformed.mp3Dubbingowanie
Asynchroniczny dubbing na jeden język docelowy. Natychmiast zwraca dubbing_id; odpytuj status, aż przyjmie wartość "dubbed", a następnie pobierz zdubbingowane audio dla tego języka.
1. Create job
https://api.airforce/v1/audio/dubbing| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Dubbing model ID. |
| file | binary | Required | Source audio or video (mp3, wav, m4a, mp4 — audio is extracted automatically). Alternatively pass source_url. |
| target_lang | string | Required | Target language code (ISO-639-1). One language per job — repeating the field does not add languages. |
| source_lang | string | Optional | Source language. "auto" or omit for auto-detect. |
| num_speakers | integer | Optional | Hint for diarization. Auto when omitted. |
| drop_background_audio | boolean | Optional | Remove background music / noise from the dub. |
| watermark | boolean | Optional | Add an audible watermark to the output. |
curl https://api.airforce/v1/audio/dubbing \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "model=dubbing-v1" \
-F "[email protected]" \
-F "target_lang=de" \
-F "source_lang=en"{
"dubbing_id": "abc123def456",
"expected_duration_sec": 42.5
}2. Poll status
https://api.airforce/v1/audio/dubbing/:dubbing_idStatus jest przekazywany od dostawcy dosłownie. status ma wartość "dubbing" w trakcie działania i "dubbed" po zakończeniu (nie "completed"). Języki znajdują się w target_languages (nie w available_languages), a pole progress nie istnieje.
{
"dubbing_id": "abc123def456",
"status": "dubbed",
"source_language": "en",
"target_languages": ["de"],
"media_metadata": {"duration": 42.5, "content_type": "video/mp4"},
"name": "english.mp4",
"created_at": "2026-05-06T22:30:00Z",
"editable": false,
"error": null
}3. Download per language
https://api.airforce/v1/audio/dubbing/:dubbing_id/audio/:langcurl https://api.airforce/v1/audio/dubbing/abc123def456/audio/de \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
--output german.mp3Klonowanie głosu
Klonuj głos z krótkich próbek audio i używaj go ponownie w każdym punkcie końcowym mowy. Klonowanie głosu wymaga wyraźnej zgody — pobierz aktualny tekst zgody, zaszyfruj go i prześlij skrót wraz ze swoimi próbkami.
1. Fetch consent text
https://api.airforce/v1/voices/consent-text{
"text": "I confirm that the voice samples I am uploading are either my own voice or a voice I have explicit permission to clone…",
"hash": "9f4b0c8d2e…"
}2. Create the clone
https://api.airforce/v1/voices/clone| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Public voice name shown in the library. |
| description | string | Optional | Optional free-text description. |
| consent_hash | string | Required | SHA-256 of the consent paragraph. Fetch the current text via GET /v1/voices/consent-text and pass its hash field. |
| files | binary | Required | 1–25 audio samples. Repeat the form field per file. Total ≤ 200 MB. 30 s – 3 min per clip works best. |
curl https://api.airforce/v1/voices/clone \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "name=My voice" \
-F "description=Calm, conversational" \
-F "consent_hash=9f4b0c8d2e..." \
-F "[email protected]" \
-F "[email protected]"{
"voice_id": "voice_01HXY...",
"name": "My voice",
"status": "active",
"created_at": "2026-05-06T22:30:00Z"
}Uwaga na nazwy pól: odpowiedź tworzenia zwraca nowy głos jako voice_id, natomiast GET /v1/voices/library wymienia klony pod provider_voice_id. Oba zawierają ten sam identyfikator — wartość, którą przekazujesz jako voice.
3. List your library
https://api.airforce/v1/voices/librarycurl https://api.airforce/v1/voices/library \
-H "Authorization: Bearer sk-air-YOUR_API_KEY"| Parameter | Type | Required | Description |
|---|---|---|---|
| voices[].provider_voice_id | string | Optional | Pass as "voice" on TTS / voice-changer endpoints. |
| voices[].status | string | Optional | "active" | "errored" | "deleting". |
| voices[].provider | string | Optional | Upstream that hosts the clone. |
| voices[].last_error | string | Optional | Set when status is "errored". |
4. Update / delete
https://api.airforce/v1/voices/clone/:idhttps://api.airforce/v1/voices/clone/:idPATCH accepts name and description in a JSON body. DELETE removes the voice both locally and at the upstream provider.
Notatki
- Odpowiedzi audio są zwracane jako surowe bajty z właściwym
Content-Type. Formaty PCM / µ-law są opakowane w minimalny nagłówek WAV, dzięki czemu nadają się do odtwarzania w przeglądarce bez zmian. - Endpointy multipart (transkrypcje, izolacja, voice-changer, dubbing, klonowanie) akceptują do 200 MB na żądanie.
- Identyfikatory głosów działają między dostawcami: sklonowany głos ElevenLabs można przekazać bezpośrednio do
/v1/audio/voice-changer. - Koszt jest naliczany za znak (TTS), za sekundę (music / SFX / dubbing / voice-changer) lub za minutę audio (transkrypcja) i jest odejmowany z Twojego salda. Endpointy audio nie wysyłają nagłówka odpowiedzi
X-Cost-Cents— śledź wydatki w logu użycia w swoim panelu.