Transcribes audio into text. Accepts base64-encoded audio input as JSON, an OpenAI-style multipart/form-data file upload, or a URL the provider downloads directly, and returns the transcribed text.
import { OpenRouterCore } from "@openrouter/sdk/core.js";import { sttCreateTranscription } from "@openrouter/sdk/funcs/sttCreateTranscription.js";// Use `OpenRouterCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const openRouter = new OpenRouterCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["OPENROUTER_API_KEY"] ?? "",});async function run() { const res = await sttCreateTranscription(openRouter, { sttRequest: { inputAudio: { data: "UklGRiQA...", format: "wav", }, language: "en", model: "openai/whisper-large-v3", }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("sttCreateTranscription failed:", res.error); }}run();
Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
Transcribes audio into text. Accepts base64-encoded audio input as JSON, an OpenAI-style multipart/form-data file upload, or a URL the provider downloads directly, and returns the transcribed text.
Example Usage
import { OpenRouter } from "@openrouter/sdk";import { openAsBlob } from "node:fs";const openRouter = new OpenRouter({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["OPENROUTER_API_KEY"] ?? "",});async function run() { const result = await openRouter.stt.createTranscriptionMultipart({ requestBody: { file: await openAsBlob("example.file"), language: "en", model: "openai/whisper-large-v3", }, }); console.log(result);}run();
Standalone function
The standalone function version of this method:
import { OpenRouterCore } from "@openrouter/sdk/core.js";import { sttCreateTranscriptionMultipart } from "@openrouter/sdk/funcs/sttCreateTranscriptionMultipart.js";import { openAsBlob } from "node:fs";// Use `OpenRouterCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const openRouter = new OpenRouterCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["OPENROUTER_API_KEY"] ?? "",});async function run() { const res = await sttCreateTranscriptionMultipart(openRouter, { requestBody: { file: await openAsBlob("example.file"), language: "en", model: "openai/whisper-large-v3", }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("sttCreateTranscriptionMultipart failed:", res.error); }}run();
Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
Lists every speech-to-text model with its typed Models API V2 input and output members, merged across its endpoints, plus each endpoint with its own.
Example Usage
import { OpenRouter } from "@openrouter/sdk";const openRouter = new OpenRouter({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>",});async function run() { const result = await openRouter.stt.listModels(); console.log(result);}run();
Standalone function
The standalone function version of this method:
import { OpenRouterCore } from "@openrouter/sdk/core.js";import { sttListModels } from "@openrouter/sdk/funcs/sttListModels.js";// Use `OpenRouterCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const openRouter = new OpenRouterCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>",});async function run() { const res = await sttListModels(openRouter); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("sttListModels failed:", res.error); }}run();
Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
Returns a speech-to-text model with each endpoint’s own typed members.
Example Usage
import { OpenRouter } from "@openrouter/sdk";const openRouter = new OpenRouter({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>",});async function run() { const result = await openRouter.stt.getModel({ author: "openai", slug: "whisper-1", }); console.log(result);}run();
Standalone function
The standalone function version of this method:
import { OpenRouterCore } from "@openrouter/sdk/core.js";import { sttGetModel } from "@openrouter/sdk/funcs/sttGetModel.js";// Use `OpenRouterCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const openRouter = new OpenRouterCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>",});async function run() { const res = await sttGetModel(openRouter, { author: "openai", slug: "whisper-1", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("sttGetModel failed:", res.error); }}run();
Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.