🎙️ Speech & Transcription

Audio: Text-to-Speech & Transcription

Turn text into natural speech (/v1/audio/speech) and audio into text (/v1/audio/transcriptions). Both endpoints are 100% OpenAI SDK compatible — point your existing client at https://api.nicrron.ai/v1 and it works. Unlike video, audio is synchronous: one request, one response, done in seconds.

1. Text-to-Speech (`/v1/audio/speech`)

Send text (up to 4,096 characters per request), get back an audio stream. Billing is per input character, so you know the cost before you call: this entire paragraph would cost a fraction of a cent.

TypeScript (OpenAI SDK)
import OpenAI from "openai";
import { writeFile } from "node:fs/promises";

const client = new OpenAI({
  baseURL: "https://api.nicrron.ai/v1",
  apiKey: process.env.NICRRON_API_KEY,
});

const speech = await client.audio.speech.create({
  model: "openai/tts-1",
  input: "Welcome to Nicrron — one API key for every model.",
  voice: "nova",           // alloy (default), echo, fable, onyx, nova, shimmer, ...
  response_format: "mp3",  // mp3 (default), opus, aac, flac, wav, pcm
  speed: 1.0,              // 0.25 – 4.0
});

await writeFile("welcome.mp3", Buffer.from(await speech.arrayBuffer()));
cURL
curl https://api.nicrron.ai/v1/audio/speech \
  -H "Authorization: Bearer $NICRRON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/tts-1-hd", "input": "High fidelity narration.", "voice": "onyx"}' \
  --output narration.mp3
ModelPriceExample: 1,000-word article (~5,500 chars)Pick it when
openai/tts-1$15/1M chars≈ $0.08Low latency matters: voice assistants, real-time replies, drafts. The low-cost default.
openai/tts-1-hd$30/1M chars≈ $0.17Quality matters: podcasts, audiobooks, published narration. Same voices, cleaner audio.

For text longer than 4,096 characters, split on paragraph boundaries and concatenate the audio segments — the same voice stays consistent across requests.

2. Transcription (`/v1/audio/transcriptions`)

Upload an audio file (mp3, mp4, wav, webm, m4a — up to 25 MB), get the transcript back. Powered by openai/whisper-1 at $0.006 per minute of audio — a one-hour meeting costs about $0.38. You're billed on the actual audio duration reported by the model, never on file size.

TypeScript (OpenAI SDK)
import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({
  baseURL: "https://api.nicrron.ai/v1",
  apiKey: process.env.NICRRON_API_KEY,
});

const result = await client.audio.transcriptions.create({
  file: fs.createReadStream("meeting.mp3"),
  model: "whisper-1", // "openai/whisper-1" also accepted
});

console.log(result.text);
cURL — with timestamps
curl https://api.nicrron.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $NICRRON_API_KEY" \
  -F file=@meeting.mp3 \
  -F model=openai/whisper-1 \
  -F response_format=verbose_json
# -> { "text": "...", "duration": 3612.4, "segments": [ ... ] }
  • response_format: json (default, just the text), text (plain text body), or verbose_json (adds duration, language, and per-segment timestamps). srt/vtt subtitle formats are not supported yet.
  • Whisper handles 90+ languages and translates accents/noise well — no language parameter needed for auto-detection.
  • Files over 25 MB: compress to mp3/opus first (a 1-hour mp3 at 64 kbps is ~28 MB; at 32 kbps ~14 MB with negligible accuracy loss).

3. Billing & Errors

  • TTS is charged by input character count at request time — deterministic, visible in your dashboard logs immediately.
  • Transcription is charged after the fact from the audio duration Whisper itself reports — the fairest possible meter.
  • 402 means insufficient credits (nothing charged); 400 means an invalid parameter with details; 404 an unknown model slug.
  • Speech synthesis input text and uploaded audio stream through in memory only and are never stored — audio is covered by the Zero Data Retention guarantee, unlike video/image generation.
Audio API Guide: Text-to-Speech & Transcription | Nicrron Docs