SaidwireDevelopers

Guide · Vercel AI SDK

Saidwire speech-to-text in the AI SDK

The AI SDK's transcribe() function works with any transcription provider. Saidwire's transcription endpoint is compatible with OpenAI's, so the AI SDK's own OpenAI provider can call it once you set its baseURL. You don't need a new package.

you need
AI SDKnpm install ai @ai-sdk/openai. Checked with ai 7.0 and @ai-sdk/openai 4.0, on Node.js 18 or later.
Saidwire API keysk_live_... from saidwire.com/dev (120 free hours, no card)
Saidwire provider package

Prefer a dedicated provider? Install it from npm:

npm install @saidwire/ai-sdk-provider

npm package · Source on GitHub · The steps below use the OpenAI provider with our base URL and work too.

Transcribe a file

import { createOpenAI } from '@ai-sdk/openai';
import { transcribe } from 'ai';
import { readFile } from 'node:fs/promises';

const saidwire = createOpenAI({
  apiKey: process.env.SAIDWIRE_API_KEY,
  baseURL: 'https://api.saidwire.com/v1',
});

const result = await transcribe({
  model: saidwire.transcription('whisper-1'),   // any name works; see below
  audio: await readFile('meeting.mp3'),
});

console.log(result.text);
console.log(result.segments);            // [{ text, startSecond, endSecond }, ...]
console.log(result.durationInSeconds);   // 12
export SAIDWIRE_API_KEY=sk_live_xxxxxxxx.yyyyyyyyyyyyyyyy
node transcribe.mjs

audio can be a Buffer, Uint8Array, base64 string or URL. If you pass a URL, the AI SDK downloads the file first. In AI SDK 5 and 6, the function is called experimental_transcribe.

Which model name to use

Saidwire accepts any model name, but the AI SDK chooses the reply format from the name you pass:

model nameyou get
whisper-1text, segments with start and end times, durationInSeconds and language, because the AI SDK asks for the detailed reply format
saidwire-en or any other nametext and durationInSeconds only

For word timestamps, pass providerOptions: { openai: { timestampGranularities: ['word'] } }. result.segments then has one entry per word. The full reply, with words, is in result.responses[0].body.

Troubleshooting

you seefix
401 Incorrect API key providedCheck that SAIDWIRE_API_KEY is set and that you passed it as apiKey. Without it, the provider falls back to OPENAI_API_KEY.
404Set baseURL to exactly https://api.saidwire.com/v1.
400 ... unsupported_languageSaidwire transcribes English only. Leave out language or set it to en.
429Too many files at once for your key (trial keys allow 4), or your free hours are used up.

Good to know

Stuck? Email support@saidwire.com with the x-request-id from the failed call.

OpenAI is a trademark of OpenAI. Open WebUI, n8n, LiteLLM, Dify, Flowise, Vercel and the AI SDK belong to their respective owners. Saidwire is not affiliated with OpenAI or with these projects.