Ir para o conteúdo
API Reference · v1

Build with Audexum.

REST API. Bearer auth. JSON in, WAV/MP3/OGG/Opus out. Streaming and webhooks included.

Autenticação

Gere uma chave de API em Configurações do desenvolvedor. Envie-a como token Bearer em todas as requisições.

http
Authorization: Bearer sk_live_•••••••••••••••••••••••••••••••••

POST/api/synthesize

Gere áudio a partir de texto. Retorna audio/wav por padrão (44.1 kHz, PCM de 16 bits, mono). Use format para MP3/OGG/Opus ou stream=true para streaming em blocos com baixa latência.

curl
# The shortest call there is. No backend named, so you get
# V3 Expressive on the Atlas voice — our most expressive engine.
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world"}' \
  --output hello.wav

# V2 Multilingual, where speed and steps apply and 32 languages are available.
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world",
    "backend": "v2",
    "voice": "M1",
    "lang": "en",
    "speed": 1.05,
    "steps": 8
  }' \
  --output hello.wav

Corpo da requisição

CampoDigitePadrãoObservações
textstringpadrão requiredUp to ~5,000 characters per call.
voiceper tier (see Voice tiers)padrão AtlasVoice ids are tier-specific. The default follows backend.
langen, bg, ko, ja, ar, de, …padrão en33 supported. See /api/voices.
speed0.5–2.0padrão 1.05 (V1 and V3: 1.0)Speaking pace, on every engine except V4. Pitch is kept.
steps4–16padrão 8Diffusion steps. More = higher quality, slower.
formatwav | mp3 | ogg | opuspadrão wavOutput format. Quota is identical across formats.
streambooleanpadrão falseStream chunked WAV. Only format=wav, and V1/V2 only. V3 Expressive returns the whole file and ignores stream.
backendv3 | v2 | v1padrão v3Voice tier. Omit it and you get V3 Expressive. See Voice tiers below.
instructstringpadrão ""V3 only. Natural-language style/emotion, e.g. "warm and slow". Ignored by V1/V2.

Níveis de voz

Escolha um nível com backend. Cada nível tem suas próprias vozes e um multiplicador de créditos por caractere. Enviar uma voz desconhecida para o nível retorna 400.

Omita backend e o nível será inferido: uma voz V2 (F1..F5, M1..M5) mantém você no V2 Multilingual, uma voz V3 seleciona V3 Expressive e não nomear nenhuma oferece V3 Expressive emAtlasnível devoz . Integrações existentes que enviam apenas um nível de voz não são afetadas e mantêm a cobrança no multiplicador desse nível.

backendNívelCustovozes
v1V1 Instant: rápido, pensado primeiro para o inglês1×Veja /api/voices
v2V2 Multilingual: 32 idiomas, incluindo português1.5×F1..F5, M1..M5
v3V3 Expressive: o mais expressivo, com emoção e estilo2×Atlas, Reid, Sage, Kai, Cole, Ivy, Mira, Elle, Nova
curl
# V3 Expressive — most expressive tier, with an optional style prompt
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "We shipped it. Finally.",
    "backend": "v3",
    "voice": "Atlas",
    "instruct": "warm, relieved, unhurried"
  }' \
  --output ultra.wav

Cabeçalhos da resposta

CampoDigitePadrãoObservações
Content-Typestringpadrão —audio/wav · audio/mpeg · audio/ogg · audio/opus
X-Gen-Time-Msintpadrão —Wall-clock generation time, ms.
X-Audio-Duration-Sfloatpadrão —Output audio duration, seconds.
X-RTFfloatpadrão —Audio / generation ratio. >1 = faster than real-time.
X-Formatstringpadrão —Echo of requested format.
X-Stream1padrão —Present when stream=true; body is concatenated WAV chunks.

Formatos de saída (OGG / Opus / MP3)

Adicione "format": "ogg" (ou mp3 / opus) para receber uma resposta transcodificada. A cota é a mesma independentemente do formato. A marca d’água AudioSeal permanece após a codificação em MP3.

curl
# OGG/Opus — smallest file size, best for streaming/web
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello", "voice": "M1", "lang": "en", "format": "ogg"}' \
  --output hello.ogg

# MP3 — maximum compatibility
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello", "voice": "M1", "lang": "en", "format": "mp3"}' \
  --output hello.mp3
python
import requests

r = requests.post(
    "https://audexum.com/api/synthesize",
    headers={"Authorization": "Bearer sk_live_..."},
    json={"text": "Hello world", "voice": "M1", "lang": "en", "format": "ogg"},
)
r.raise_for_status()
with open("hello.ogg", "wb") as f:
    f.write(r.content)
# Content-Type: audio/ogg
formatContent-TypeCodec
wavaudio/wavPCM 16-bit, 44,1 kHz (sem transcodificação)
mp3audio/mpeglibmp3lame VBR ~192 kbps
oggaudio/ogglibopus 96 kbps, 48 kHz
opusaudio/opuslibopus 96 kbps, 48 kHz (contêiner Ogg)

TTS em streaming

Adicione "stream": true para receber áudio à medida que ele é gerado. A resposta é um fluxo de transferência em chunks com arquivos WAV concatenados. Cada chunk é um WAV completo e válido (cabeçalho RIFF de 44 bytes + PCM), portanto você pode começar a reproduzi-lo imediatamente. A cota é reservada para todo o texto desde o início, de forma idêntica a uma chamada sem streaming. O streaming exige format=wav (o padrão).

curl
curl -X POST https://audexum.com/api/synthesize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Sentence one. Sentence two. Sentence three.", "voice": "M1", "lang": "en", "stream": true}' \
  --no-buffer --output - | ffplay -nodisp -i pipe:0
python
import requests

with requests.post(
    "https://audexum.com/api/synthesize",
    headers={"Authorization": "Bearer sk_live_..."},
    json={
        "text": "First sentence. Second sentence. Third one.",
        "voice": "M1",
        "lang": "en",
        "stream": True,
    },
    stream=True,
) as r:
    r.raise_for_status()
    with open("streamed.wav", "wb") as f:
        for chunk in r.iter_content(chunk_size=None):
            f.write(chunk)
# Each yielded chunk is a standalone WAV file (header + PCM).
# Concatenating them produces valid gapless audio.
Observações sobre streaming: o texto é dividido nos limites das frases (~1–3 frases por bloco). O formato deve ser wav. A latência do primeiro bloco é registrada no servidor. O cabeçalho de resposta X-Stream: 1 confirma o modo de streaming.

POST/api/transcribe

Transcreva fala em texto. Envie o áudio como multipart/form-data. Requer uma chave sem restrições (as chaves de widget são limitadas a /api/synthesize). A cobrança é de 200 créditos por minuto de áudio.

curl
curl -X POST https://audexum.com/api/transcribe \
  -H "Authorization: Bearer sk_live_..." \
  -F "[email protected]" \
  -F "timestamps=true"

Campos do formulário

CampoObservações
audioObrigatório. Um arquivo audio/*, de até 25 MB e 600 segundos.
timestampsBooleano opcional. Inclui os tempos de início e fim de cada segmento.
vocabularyOpcional. Até 2000 caracteres de termos do domínio para orientar o reconhecimento.
clean / modeOpcional. Processe a transcrição depois (clean, email, professional, bullets, concise).

Resposta

json
{
  "text": "Full transcript…",
  "duration_s": 12.3,
  "transcribe_ms": 480,
  "segments": [{ "start": 0.0, "end": 3.2, "text": "…" }],
  "raw_text": "…",   // present only when a clean/transform mode was requested
  "mode": "clean"
}

POST/v1/audio/transcriptions

Conversão de fala em texto compatível com OpenAI. Uma ferramenta que permite alterar a URL base da OpenAI pode usar o Audexum definindo-a como https://audexum.com/v1, sem alterações no código. Usa o mesmo mecanismo e a mesma cobrança que /api/transcribe: 200 créditos por minuto de áudio. Envie multipart/form-data.

A autenticação usa a chave Authorization: Bearer sk_live_…. Crie a chave em Configurações do desenvolvedor (é necessário entrar). Use uma chave sk_live_ chave; chaves de widget restritas recebem 403 aqui.

curl
curl https://audexum.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk_live_..." \
  -F [email protected] \
  -F model=whisper-1 \
  -F language=bg \
  -F response_format=json
# {"text": "…"}
python
from openai import OpenAI

client = OpenAI(api_key="sk_live_...", base_url="https://audexum.com/v1")

with open("recording.mp3", "rb") as f:
    result = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
        language="bg",   # optional; omit to auto-detect
    )
print(result.text)

Campos do formulário

CampoDigitePadrãoObservações
filefilepadrão requiredUp to 25 MB and 600 seconds. Content-Type audio/*, video/webm, video/ogg or application/octet-stream (mp3, wav, m4a, ogg, flac, webm).
modelstringpadrão —Accepted and ignored: there is one engine. Send whisper-1.
languageISO 639-1, e.g. bgpadrão autoOptional. Omit it and the language is detected.
response_formatjson | text | verbose_json | srt | vttpadrão jsonAn unknown value falls back to json.
timestamp_granularities[]segment | wordpadrão segmentverbose_json only. word adds a words array (see below).
promptstringpadrão —Accepted and ignored.
temperaturefloatpadrão 0Accepted and ignored.

verbose_json

Segmento início/fim vêm do mecanismo. Os tempos das palavras (timestamp_granularities[]=word) são estimados: a duração de cada segmento é distribuída entre suas palavras conforme o número de caracteres. Eles não são alinhados à força. Cada segmento contém uma palavras chave, vazia a menos que você tenha solicitado palavras.

json
{
  "task": "transcribe",
  "language": "bg",          // echo of the request; "auto" when omitted
  "duration": 12.3,
  "text": "Full transcript…",
  "segments": [
    { "id": 0, "start": 0.0, "end": 3.2, "text": "…", "words": [] }
  ]
}

Não compatível

  • POST /v1/audio/translations retorna 405.
  • Transcrição por streaming e a API Realtime.

Erros

CódigoCorpo
400{"detail": "audio_too_short"} · "no_speech_detected" · "clip_too_long: max 600s per request"
401{"detail": "authentication_required"}: missing or invalid key
402{"detail": {"error": "insufficient_credits", …}}: full body below
403{"detail": "email_not_verified"}: verify the account's email address
405{"detail": "Method Not Allowed"}: /v1/audio/translations
413{"detail": "audio_too_large"}: file over 25 MB
415{"detail": "unsupported_media_type"}: file part is not audio
json
// 402 — the balance cannot cover this file
{
  "detail": {
    "error": "insufficient_credits",
    "plan_tier": "free",
    "monthly_grant": 250,
    "monthly_used": 250,
    "pack_credits": 0,
    "requested": 41,
    "upgrade_url": "/pricing",
    "offer": {
      "reason": "insufficient_credits",
      "headline": "You are out of credits",
      "detail": "This request needs 41 credits. …",
      "plan": { "tier": "pro", "price_eur": 29, "credits_per_month": 1200000 },
      "actions": [
        { "kind": "upgrade", "label": "Upgrade to Pro — €29/mo", "url": "https://audexum.com/r/402" },
        { "kind": "pack", "label": "Buy 250,000 credits — €7", "url": "https://audexum.com/pricing#packs" }
      ]
    }
  }
}

POST/api/batch

Envie até 50 textos em uma única solicitação. Aguarde a conclusão e baixe um zip.

curl
# submit
curl -X POST https://audexum.com/api/batch \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"texts": ["one", "two"], "voice": "F2", "lang": "en"}'

# poll
curl -H "Authorization: Bearer sk_live_..." \
  https://audexum.com/api/batch/$JOB_ID

# download once status=done
curl -H "Authorization: Bearer sk_live_..." \
  https://audexum.com/api/batch/$JOB_ID/download -O

Webhooks

Configure um endpoint de webhook no seu Configurações do desenvolvedor para receber notificações POST assinadas. Enviamos JSON com um X-Audexum-Signature Cabeçalho. Verifique-o antes de processar.

Formato do payload

json
{
  "event": "quota.warning_80",
  "data": {
    "monthly_grant": 3000,
    "monthly_used": 24000,
    "monthly_remaining": 6000,
    "overage_enabled": false,
    "plan_tier": "free",
    "period_end": "2026-06-30"
  },
  "timestamp": "2026-06-12T14:22:00.000000+00:00"
}

Eventos

CampoDigitePadrãoObservações
quota.warning_80stringpadrão —Fired when monthly quota crosses 80% used.
quota.exhaustedstringpadrão —Fired when monthly quota is fully consumed.
batch.completedstringpadrão —Fired when a batch job finishes.
audiobook.completedstringpadrão —Fired when an audiobook job finishes.

Verificação da assinatura

Cada entrega inclui X-Audexum-Signature: sha256=<hex>, calculado como HMAC-SHA256 sobre o corpo bruto da solicitação usando o segredo do seu webhook.

python
import hashlib, hmac

def verify_signature(body: bytes, secret: str, sig_header: str) -> bool:
    expected = "sha256=" + hmac.new(
        secret.encode(), body, hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, sig_header)

# In your FastAPI/Flask/Django handler:
# body = await request.body()
# sig  = request.headers["X-Audexum-Signature"]
# if not verify_signature(body, WEBHOOK_SECRET, sig):
#     return 401
curl
# Configure endpoint (session auth — browser only)
curl -X PUT https://audexum.com/api/account/webhook \
  -H "Cookie: audexum_session=..." \
  -H "X-Requested-With: XMLHttpRequest" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://your-server.com/webhooks/audexum"}'
# Response contains secret — store it, shown once only.

# Remove endpoint
curl -X DELETE https://audexum.com/api/account/webhook \
  -H "Cookie: audexum_session=..." \
  -H "X-Requested-With: XMLHttpRequest"
Apenas endpoints HTTPS. HTTP é rejeitado.
IPs privados/de loopback bloqueados (proteção contra SSRF).
Tempo limite de 5 s, 2 novas tentativas com backoff exponencial (1 s, 2 s).
O envio é fire-and-forget: nunca bloqueia uma solicitação de síntese.

Erros

CódigoSignificado
400Solicitação inválida: voz/idioma inválidos, texto vazio ou stream+formato diferente de wav
401Chave de API ausente ou inválida
402insufficient_credits: Cota mensal excedida; consulte /api/usage e /pricing para ver as opções de upgrade
402feature_gated: O recurso exige um plano superior (consulte error.feature e error.min_tier)
422URL de webhook inválida (não HTTPS, IP privado ou impossível de resolver)
429Muitas solicitações: reduza a taxa de solicitações e tente novamente
503Servidor ocupado (limite de concorrência atingido): tente novamente com backoff exponencial; respeite Retry-After

Limites de uso e uso justo

  • Limite de concorrência compartilhado: solicitações além dele recebem 503 + Retry-After
  • Taxas de solicitações abusivas contínuas podem ser limitadas (uso justo)
  • Cota mensal de créditos do seu nível de plano
  • Fale conosco para obter capacidade dedicada ou PAYG

Com problemas? Envie um e-mail para [email protected].

Sua primeira chamada está a um curl de distância.