feat: Passwordless cross-device authentication

- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
This commit is contained in:
Bernt
2026-07-07 07:11:50 +00:00
parent 4aa984ad74
commit 6989a98d75
61843 changed files with 5491611 additions and 872231 deletions
+28
View File
@@ -0,0 +1,28 @@
import { APIResource } from "../../core/resource.mjs";
import * as SpeechAPI from "./speech.mjs";
import { Speech, SpeechCreateParams, SpeechModel } from "./speech.mjs";
import * as TranscriptionsAPI from "./transcriptions.mjs";
import { Transcription, TranscriptionCreateParams, TranscriptionCreateParamsNonStreaming, TranscriptionCreateParamsStreaming, TranscriptionCreateResponse, TranscriptionDiarized, TranscriptionDiarizedSegment, TranscriptionInclude, TranscriptionSegment, TranscriptionStreamEvent, TranscriptionTextDeltaEvent, TranscriptionTextDoneEvent, TranscriptionTextSegmentEvent, TranscriptionVerbose, TranscriptionWord, Transcriptions } from "./transcriptions.mjs";
import * as TranslationsAPI from "./translations.mjs";
import { Translation, TranslationCreateParams, TranslationCreateResponse, TranslationVerbose, Translations } from "./translations.mjs";
export declare class Audio extends APIResource {
transcriptions: TranscriptionsAPI.Transcriptions;
translations: TranslationsAPI.Translations;
speech: SpeechAPI.Speech;
}
export type AudioModel = 'whisper-1' | 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'gpt-4o-mini-transcribe-2025-12-15' | 'gpt-4o-transcribe-diarize';
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and
* `gpt-4o-mini-transcribe`, the only supported format is `json`. For
* `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and
* `diarized_json`, with `diarized_json` required to receive speaker annotations.
*/
export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt' | 'diarized_json';
export declare namespace Audio {
export { type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat };
export { Transcriptions as Transcriptions, type Transcription as Transcription, type TranscriptionDiarized as TranscriptionDiarized, type TranscriptionDiarizedSegment as TranscriptionDiarizedSegment, type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, type TranscriptionStreamEvent as TranscriptionStreamEvent, type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent as TranscriptionTextSegmentEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, };
export { Translations as Translations, type Translation as Translation, type TranslationVerbose as TranslationVerbose, type TranslationCreateResponse as TranslationCreateResponse, type TranslationCreateParams as TranslationCreateParams, };
export { Speech as Speech, type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
}
//# sourceMappingURL=audio.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"audio.d.mts","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,SAAS,qBAAiB;AACtC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAiB;AACnE,OAAO,KAAK,iBAAiB,6BAAyB;AACtD,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,qCAAqC,EACrC,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACf,6BAAyB;AAC1B,OAAO,KAAK,eAAe,2BAAuB;AAClD,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,YAAY,EACb,2BAAuB;AAExB,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAsD;IACtG,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;IAC5F,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;CAC/D;AAED,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,mCAAmC,GACnC,2BAA2B,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,KAAK,GAAG,eAAe,CAAC;AAMrG,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;IAE1F,OAAO,EACL,cAAc,IAAI,cAAc,EAChC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,kCAAkC,IAAI,kCAAkC,GAC9E,CAAC;IAEF,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;IAEF,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,KAAK,WAAW,IAAI,WAAW,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;CAC7G"}
+28
View File
@@ -0,0 +1,28 @@
import { APIResource } from "../../core/resource.js";
import * as SpeechAPI from "./speech.js";
import { Speech, SpeechCreateParams, SpeechModel } from "./speech.js";
import * as TranscriptionsAPI from "./transcriptions.js";
import { Transcription, TranscriptionCreateParams, TranscriptionCreateParamsNonStreaming, TranscriptionCreateParamsStreaming, TranscriptionCreateResponse, TranscriptionDiarized, TranscriptionDiarizedSegment, TranscriptionInclude, TranscriptionSegment, TranscriptionStreamEvent, TranscriptionTextDeltaEvent, TranscriptionTextDoneEvent, TranscriptionTextSegmentEvent, TranscriptionVerbose, TranscriptionWord, Transcriptions } from "./transcriptions.js";
import * as TranslationsAPI from "./translations.js";
import { Translation, TranslationCreateParams, TranslationCreateResponse, TranslationVerbose, Translations } from "./translations.js";
export declare class Audio extends APIResource {
transcriptions: TranscriptionsAPI.Transcriptions;
translations: TranslationsAPI.Translations;
speech: SpeechAPI.Speech;
}
export type AudioModel = 'whisper-1' | 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'gpt-4o-mini-transcribe-2025-12-15' | 'gpt-4o-transcribe-diarize';
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and
* `gpt-4o-mini-transcribe`, the only supported format is `json`. For
* `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and
* `diarized_json`, with `diarized_json` required to receive speaker annotations.
*/
export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt' | 'diarized_json';
export declare namespace Audio {
export { type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat };
export { Transcriptions as Transcriptions, type Transcription as Transcription, type TranscriptionDiarized as TranscriptionDiarized, type TranscriptionDiarizedSegment as TranscriptionDiarizedSegment, type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, type TranscriptionStreamEvent as TranscriptionStreamEvent, type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent as TranscriptionTextSegmentEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, };
export { Translations as Translations, type Translation as Translation, type TranslationVerbose as TranslationVerbose, type TranslationCreateResponse as TranslationCreateResponse, type TranslationCreateParams as TranslationCreateParams, };
export { Speech as Speech, type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
}
//# sourceMappingURL=audio.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,SAAS,oBAAiB;AACtC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAiB;AACnE,OAAO,KAAK,iBAAiB,4BAAyB;AACtD,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,qCAAqC,EACrC,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACf,4BAAyB;AAC1B,OAAO,KAAK,eAAe,0BAAuB;AAClD,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,YAAY,EACb,0BAAuB;AAExB,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAsD;IACtG,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;IAC5F,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;CAC/D;AAED,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,mCAAmC,GACnC,2BAA2B,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,KAAK,GAAG,eAAe,CAAC;AAMrG,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;IAE1F,OAAO,EACL,cAAc,IAAI,cAAc,EAChC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,kCAAkC,IAAI,kCAAkC,GAC9E,CAAC;IAEF,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;IAEF,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,KAAK,WAAW,IAAI,WAAW,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;CAC7G"}
+25
View File
@@ -0,0 +1,25 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Audio = void 0;
const tslib_1 = require("../../internal/tslib.js");
const resource_1 = require("../../core/resource.js");
const SpeechAPI = tslib_1.__importStar(require("./speech.js"));
const speech_1 = require("./speech.js");
const TranscriptionsAPI = tslib_1.__importStar(require("./transcriptions.js"));
const transcriptions_1 = require("./transcriptions.js");
const TranslationsAPI = tslib_1.__importStar(require("./translations.js"));
const translations_1 = require("./translations.js");
class Audio extends resource_1.APIResource {
constructor() {
super(...arguments);
this.transcriptions = new TranscriptionsAPI.Transcriptions(this._client);
this.translations = new TranslationsAPI.Translations(this._client);
this.speech = new SpeechAPI.Speech(this._client);
}
}
exports.Audio = Audio;
Audio.Transcriptions = transcriptions_1.Transcriptions;
Audio.Translations = translations_1.Translations;
Audio.Speech = speech_1.Speech;
//# sourceMappingURL=audio.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,+DAAsC;AACtC,wCAAmE;AACnE,+EAAsD;AACtD,wDAiB0B;AAC1B,2EAAkD;AAClD,oDAMwB;AAExB,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtG,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAJD,sBAIC;AAkBD,KAAK,CAAC,cAAc,GAAG,+BAAc,CAAC;AACtC,KAAK,CAAC,YAAY,GAAG,2BAAY,CAAC;AAClC,KAAK,CAAC,MAAM,GAAG,eAAM,CAAC"}
+20
View File
@@ -0,0 +1,20 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as SpeechAPI from "./speech.mjs";
import { Speech } from "./speech.mjs";
import * as TranscriptionsAPI from "./transcriptions.mjs";
import { Transcriptions, } from "./transcriptions.mjs";
import * as TranslationsAPI from "./translations.mjs";
import { Translations, } from "./translations.mjs";
export class Audio extends APIResource {
constructor() {
super(...arguments);
this.transcriptions = new TranscriptionsAPI.Transcriptions(this._client);
this.translations = new TranslationsAPI.Translations(this._client);
this.speech = new SpeechAPI.Speech(this._client);
}
}
Audio.Transcriptions = Transcriptions;
Audio.Translations = Translations;
Audio.Speech = Speech;
//# sourceMappingURL=audio.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"audio.mjs","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,SAAS,qBAAiB;AACtC,OAAO,EAAE,MAAM,EAAmC,qBAAiB;AACnE,OAAO,KAAK,iBAAiB,6BAAyB;AACtD,OAAO,EAgBL,cAAc,GACf,6BAAyB;AAC1B,OAAO,KAAK,eAAe,2BAAuB;AAClD,OAAO,EAKL,YAAY,GACb,2BAAuB;AAExB,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtG,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAkBD,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;AACtC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;AAClC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC"}
+5
View File
@@ -0,0 +1,5 @@
export { Audio, type AudioModel, type AudioResponseFormat } from "./audio.mjs";
export { Speech, type SpeechModel, type SpeechCreateParams } from "./speech.mjs";
export { Transcriptions, type Transcription, type TranscriptionDiarized, type TranscriptionDiarizedSegment, type TranscriptionInclude, type TranscriptionSegment, type TranscriptionStreamEvent, type TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent, type TranscriptionVerbose, type TranscriptionWord, type TranscriptionCreateResponse, type TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming, } from "./transcriptions.mjs";
export { Translations, type Translation, type TranslationVerbose, type TranslationCreateResponse, type TranslationCreateParams, } from "./translations.mjs";
//# sourceMappingURL=index.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,mBAAmB,EAAE,oBAAgB;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,qBAAiB;AAC7E,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,kCAAkC,GACxC,6BAAyB;AAC1B,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,2BAAuB"}
+5
View File
@@ -0,0 +1,5 @@
export { Audio, type AudioModel, type AudioResponseFormat } from "./audio.js";
export { Speech, type SpeechModel, type SpeechCreateParams } from "./speech.js";
export { Transcriptions, type Transcription, type TranscriptionDiarized, type TranscriptionDiarizedSegment, type TranscriptionInclude, type TranscriptionSegment, type TranscriptionStreamEvent, type TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent, type TranscriptionVerbose, type TranscriptionWord, type TranscriptionCreateResponse, type TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming, } from "./transcriptions.js";
export { Translations, type Translation, type TranslationVerbose, type TranslationCreateResponse, type TranslationCreateParams, } from "./translations.js";
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,mBAAmB,EAAE,mBAAgB;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,oBAAiB;AAC7E,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,kCAAkC,GACxC,4BAAyB;AAC1B,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,0BAAuB"}
+13
View File
@@ -0,0 +1,13 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Translations = exports.Transcriptions = exports.Speech = exports.Audio = void 0;
var audio_1 = require("./audio.js");
Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return audio_1.Audio; } });
var speech_1 = require("./speech.js");
Object.defineProperty(exports, "Speech", { enumerable: true, get: function () { return speech_1.Speech; } });
var transcriptions_1 = require("./transcriptions.js");
Object.defineProperty(exports, "Transcriptions", { enumerable: true, get: function () { return transcriptions_1.Transcriptions; } });
var translations_1 = require("./translations.js");
Object.defineProperty(exports, "Translations", { enumerable: true, get: function () { return translations_1.Translations; } });
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA2E;AAAlE,8FAAA,KAAK,OAAA;AACd,sCAA6E;AAApE,gGAAA,MAAM,OAAA;AACf,sDAiB0B;AAhBxB,gHAAA,cAAc,OAAA;AAiBhB,kDAMwB;AALtB,4GAAA,YAAY,OAAA"}
+6
View File
@@ -0,0 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
export { Audio } from "./audio.mjs";
export { Speech } from "./speech.mjs";
export { Transcriptions, } from "./transcriptions.mjs";
export { Translations, } from "./translations.mjs";
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,KAAK,EAA6C,oBAAgB;AAC3E,OAAO,EAAE,MAAM,EAA6C,qBAAiB;AAC7E,OAAO,EACL,cAAc,GAgBf,6BAAyB;AAC1B,OAAO,EACL,YAAY,GAKb,2BAAuB"}
+82
View File
@@ -0,0 +1,82 @@
import { APIResource } from "../../core/resource.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
/**
* Turn audio into text or text into audio.
*/
export declare class Speech extends APIResource {
/**
* Generates audio from the input text.
*
* Returns the audio file content, or a stream of audio events.
*
* @example
* ```ts
* const speech = await client.audio.speech.create({
* input: 'input',
* model: 'tts-1',
* voice: 'alloy',
* });
*
* const content = await speech.blob();
* console.log(content);
* ```
*/
create(body: SpeechCreateParams, options?: RequestOptions): APIPromise<Response>;
}
export type SpeechModel = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-12-15';
export interface SpeechCreateParams {
/**
* The text to generate audio for. The maximum length is 4096 characters.
*/
input: string;
/**
* One of the available [TTS models](https://platform.openai.com/docs/models#tts):
* `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
*/
model: (string & {}) | SpeechModel;
/**
* The voice to use when generating the audio. Supported built-in voices are
* `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
* `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
* object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
* voices are available in the
* [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
*/
voice: string | 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse' | 'marin' | 'cedar' | SpeechCreateParams.ID;
/**
* Control the voice of your generated audio with additional instructions. Does not
* work with `tts-1` or `tts-1-hd`.
*/
instructions?: string;
/**
* The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
* `wav`, and `pcm`.
*/
response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
/**
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
* the default.
*/
speed?: number;
/**
* The format to stream the audio in. Supported formats are `sse` and `audio`.
* `sse` is not supported for `tts-1` or `tts-1-hd`.
*/
stream_format?: 'sse' | 'audio';
}
export declare namespace SpeechCreateParams {
/**
* Custom voice reference.
*/
interface ID {
/**
* The custom voice ID, e.g. `voice_1234`.
*/
id: string;
}
}
export declare namespace Speech {
export { type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
}
//# sourceMappingURL=speech.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"speech.d.mts","sourceRoot":"","sources":["../../src/resources/audio/speech.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;CASjF;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,4BAA4B,CAAC;AAElG,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,WAAW,CAAC;IAEnC;;;;;;;OAOG;IACH,KAAK,EACD,MAAM,GACN,OAAO,GACP,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,GACP,OAAO,GACP,OAAO,GACP,kBAAkB,CAAC,EAAE,CAAC;IAE1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAElE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACjC;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;OAEG;IACH,UAAiB,EAAE;QACjB;;WAEG;QACH,EAAE,EAAE,MAAM,CAAC;KACZ;CACF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,WAAW,IAAI,WAAW,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;CAC3F"}
+82
View File
@@ -0,0 +1,82 @@
import { APIResource } from "../../core/resource.js";
import { APIPromise } from "../../core/api-promise.js";
import { RequestOptions } from "../../internal/request-options.js";
/**
* Turn audio into text or text into audio.
*/
export declare class Speech extends APIResource {
/**
* Generates audio from the input text.
*
* Returns the audio file content, or a stream of audio events.
*
* @example
* ```ts
* const speech = await client.audio.speech.create({
* input: 'input',
* model: 'tts-1',
* voice: 'alloy',
* });
*
* const content = await speech.blob();
* console.log(content);
* ```
*/
create(body: SpeechCreateParams, options?: RequestOptions): APIPromise<Response>;
}
export type SpeechModel = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-12-15';
export interface SpeechCreateParams {
/**
* The text to generate audio for. The maximum length is 4096 characters.
*/
input: string;
/**
* One of the available [TTS models](https://platform.openai.com/docs/models#tts):
* `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
*/
model: (string & {}) | SpeechModel;
/**
* The voice to use when generating the audio. Supported built-in voices are
* `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
* `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
* object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
* voices are available in the
* [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
*/
voice: string | 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse' | 'marin' | 'cedar' | SpeechCreateParams.ID;
/**
* Control the voice of your generated audio with additional instructions. Does not
* work with `tts-1` or `tts-1-hd`.
*/
instructions?: string;
/**
* The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
* `wav`, and `pcm`.
*/
response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
/**
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
* the default.
*/
speed?: number;
/**
* The format to stream the audio in. Supported formats are `sse` and `audio`.
* `sse` is not supported for `tts-1` or `tts-1-hd`.
*/
stream_format?: 'sse' | 'audio';
}
export declare namespace SpeechCreateParams {
/**
* Custom voice reference.
*/
interface ID {
/**
* The custom voice ID, e.g. `voice_1234`.
*/
id: string;
}
}
export declare namespace Speech {
export { type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
}
//# sourceMappingURL=speech.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../../src/resources/audio/speech.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;CASjF;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,4BAA4B,CAAC;AAElG,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,WAAW,CAAC;IAEnC;;;;;;;OAOG;IACH,KAAK,EACD,MAAM,GACN,OAAO,GACP,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,GACP,OAAO,GACP,OAAO,GACP,kBAAkB,CAAC,EAAE,CAAC;IAE1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAElE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACjC;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;OAEG;IACH,UAAiB,EAAE;QACjB;;WAEG;QACH,EAAE,EAAE,MAAM,CAAC;KACZ;CACF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,WAAW,IAAI,WAAW,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,CAAC;CAC3F"}
+39
View File
@@ -0,0 +1,39 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Speech = void 0;
const resource_1 = require("../../core/resource.js");
const headers_1 = require("../../internal/headers.js");
/**
* Turn audio into text or text into audio.
*/
class Speech extends resource_1.APIResource {
/**
* Generates audio from the input text.
*
* Returns the audio file content, or a stream of audio events.
*
* @example
* ```ts
* const speech = await client.audio.speech.create({
* input: 'input',
* model: 'tts-1',
* voice: 'alloy',
* });
*
* const content = await speech.blob();
* console.log(content);
* ```
*/
create(body, options) {
return this._client.post('/audio/speech', {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ Accept: 'application/octet-stream' }, options?.headers]),
__security: { bearerAuth: true },
__binaryResponse: true,
});
}
}
exports.Speech = Speech;
//# sourceMappingURL=speech.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"speech.js","sourceRoot":"","sources":["../../src/resources/audio/speech.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAGtD;;GAEG;AACH,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE;YACxC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;YAChC,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AA3BD,wBA2BC"}
+35
View File
@@ -0,0 +1,35 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { buildHeaders } from "../../internal/headers.mjs";
/**
* Turn audio into text or text into audio.
*/
export class Speech extends APIResource {
/**
* Generates audio from the input text.
*
* Returns the audio file content, or a stream of audio events.
*
* @example
* ```ts
* const speech = await client.audio.speech.create({
* input: 'input',
* model: 'tts-1',
* voice: 'alloy',
* });
*
* const content = await speech.blob();
* console.log(content);
* ```
*/
create(body, options) {
return this._client.post('/audio/speech', {
body,
...options,
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
__security: { bearerAuth: true },
__binaryResponse: true,
});
}
}
//# sourceMappingURL=speech.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"speech.mjs","sourceRoot":"","sources":["../../src/resources/audio/speech.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAGtD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE;YACxC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;YAChC,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
+662
View File
@@ -0,0 +1,662 @@
import { APIResource } from "../../core/resource.mjs";
import * as TranscriptionsAPI from "./transcriptions.mjs";
import * as AudioAPI from "./audio.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { Stream } from "../../core/streaming.mjs";
import { type Uploadable } from "../../core/uploads.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
/**
* Turn audio into text or text into audio.
*/
export declare class Transcriptions extends APIResource {
/**
* Transcribes audio into the input language.
*
* Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
* format, or a stream of transcript events.
*
* @example
* ```ts
* const transcription =
* await client.audio.transcriptions.create({
* file: fs.createReadStream('speech.mp3'),
* model: 'gpt-4o-transcribe',
* });
* ```
*/
create(body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, options?: RequestOptions): APIPromise<Transcription>;
create(body: TranscriptionCreateParamsNonStreaming<'verbose_json'>, options?: RequestOptions): APIPromise<TranscriptionVerbose>;
create(body: TranscriptionCreateParamsNonStreaming<'srt' | 'vtt' | 'text'>, options?: RequestOptions): APIPromise<string>;
create(body: TranscriptionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Transcription>;
create(body: TranscriptionCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<TranscriptionStreamEvent>>;
create(body: TranscriptionCreateParamsStreaming, options?: RequestOptions): APIPromise<TranscriptionCreateResponse | string | Stream<TranscriptionStreamEvent>>;
}
/**
* Represents a transcription response returned by model, based on the provided
* input.
*/
export interface Transcription {
/**
* The transcribed text.
*/
text: string;
/**
* The log probabilities of the tokens in the transcription. Only returned with the
* models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added
* to the `include` array.
*/
logprobs?: Array<Transcription.Logprob>;
/**
* Token usage statistics for the request.
*/
usage?: Transcription.Tokens | Transcription.Duration;
}
export declare namespace Transcription {
interface Logprob {
/**
* The token in the transcription.
*/
token?: string;
/**
* The bytes of the token.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
/**
* Usage statistics for models billed by token usage.
*/
interface Tokens {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Tokens.InputTokenDetails;
}
namespace Tokens {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
/**
* Usage statistics for models billed by audio input duration.
*/
interface Duration {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
/**
* Represents a diarized transcription response returned by the model, including
* the combined transcript and speaker-segment annotations.
*/
export interface TranscriptionDiarized {
/**
* Duration of the input audio in seconds.
*/
duration: number;
/**
* Segments of the transcript annotated with timestamps and speaker labels.
*/
segments: Array<TranscriptionDiarizedSegment>;
/**
* The type of task that was run. Always `transcribe`.
*/
task: 'transcribe';
/**
* The concatenated transcript text for the entire audio input.
*/
text: string;
/**
* Token or duration usage statistics for the request.
*/
usage?: TranscriptionDiarized.Tokens | TranscriptionDiarized.Duration;
}
export declare namespace TranscriptionDiarized {
/**
* Usage statistics for models billed by token usage.
*/
interface Tokens {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Tokens.InputTokenDetails;
}
namespace Tokens {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
/**
* Usage statistics for models billed by audio input duration.
*/
interface Duration {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
/**
* A segment of diarized transcript text with speaker metadata.
*/
export interface TranscriptionDiarizedSegment {
/**
* Unique identifier for the segment.
*/
id: string;
/**
* End timestamp of the segment in seconds.
*/
end: number;
/**
* Speaker label for this segment. When known speakers are provided, the label
* matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially
* using capital letters (`A`, `B`, ...).
*/
speaker: string;
/**
* Start timestamp of the segment in seconds.
*/
start: number;
/**
* Transcript text for this segment.
*/
text: string;
/**
* The type of the segment. Always `transcript.text.segment`.
*/
type: 'transcript.text.segment';
}
export type TranscriptionInclude = 'logprobs';
export interface TranscriptionSegment {
/**
* Unique identifier of the segment.
*/
id: number;
/**
* Average logprob of the segment. If the value is lower than -1, consider the
* logprobs failed.
*/
avg_logprob: number;
/**
* Compression ratio of the segment. If the value is greater than 2.4, consider the
* compression failed.
*/
compression_ratio: number;
/**
* End time of the segment in seconds.
*/
end: number;
/**
* Probability of no speech in the segment. If the value is higher than 1.0 and the
* `avg_logprob` is below -1, consider this segment silent.
*/
no_speech_prob: number;
/**
* Seek offset of the segment.
*/
seek: number;
/**
* Start time of the segment in seconds.
*/
start: number;
/**
* Temperature parameter used for generating the segment.
*/
temperature: number;
/**
* Text content of the segment.
*/
text: string;
/**
* Array of token IDs for the text content.
*/
tokens: Array<number>;
}
/**
* Emitted when a diarized transcription returns a completed segment with speaker
* information. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with `stream` set to `true` and `response_format` set to `diarized_json`.
*/
export type TranscriptionStreamEvent = TranscriptionTextSegmentEvent | TranscriptionTextDeltaEvent | TranscriptionTextDoneEvent;
/**
* Emitted when there is an additional text delta. This is also the first event
* emitted when the transcription starts. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `Stream` parameter set to `true`.
*/
export interface TranscriptionTextDeltaEvent {
/**
* The text delta that was additionally transcribed.
*/
delta: string;
/**
* The type of the event. Always `transcript.text.delta`.
*/
type: 'transcript.text.delta';
/**
* The log probabilities of the delta. Only included if you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `include[]` parameter set to `logprobs`.
*/
logprobs?: Array<TranscriptionTextDeltaEvent.Logprob>;
/**
* Identifier of the diarized segment that this delta belongs to. Only present when
* using `gpt-4o-transcribe-diarize`.
*/
segment_id?: string;
}
export declare namespace TranscriptionTextDeltaEvent {
interface Logprob {
/**
* The token that was used to generate the log probability.
*/
token?: string;
/**
* The bytes that were used to generate the log probability.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
}
/**
* Emitted when the transcription is complete. Contains the complete transcription
* text. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `Stream` parameter set to `true`.
*/
export interface TranscriptionTextDoneEvent {
/**
* The text that was transcribed.
*/
text: string;
/**
* The type of the event. Always `transcript.text.done`.
*/
type: 'transcript.text.done';
/**
* The log probabilities of the individual tokens in the transcription. Only
* included if you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `include[]` parameter set to `logprobs`.
*/
logprobs?: Array<TranscriptionTextDoneEvent.Logprob>;
/**
* Usage statistics for models billed by token usage.
*/
usage?: TranscriptionTextDoneEvent.Usage;
}
export declare namespace TranscriptionTextDoneEvent {
interface Logprob {
/**
* The token that was used to generate the log probability.
*/
token?: string;
/**
* The bytes that were used to generate the log probability.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
/**
* Usage statistics for models billed by token usage.
*/
interface Usage {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Usage.InputTokenDetails;
}
namespace Usage {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
}
/**
* Emitted when a diarized transcription returns a completed segment with speaker
* information. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with `stream` set to `true` and `response_format` set to `diarized_json`.
*/
export interface TranscriptionTextSegmentEvent {
/**
* Unique identifier for the segment.
*/
id: string;
/**
* End timestamp of the segment in seconds.
*/
end: number;
/**
* Speaker label for this segment.
*/
speaker: string;
/**
* Start timestamp of the segment in seconds.
*/
start: number;
/**
* Transcript text for this segment.
*/
text: string;
/**
* The type of the event. Always `transcript.text.segment`.
*/
type: 'transcript.text.segment';
}
/**
* Represents a verbose json transcription response returned by model, based on the
* provided input.
*/
export interface TranscriptionVerbose {
/**
* The duration of the input audio.
*/
duration: number;
/**
* The language of the input audio.
*/
language: string;
/**
* The transcribed text.
*/
text: string;
/**
* Segments of the transcribed text and their corresponding details.
*/
segments?: Array<TranscriptionSegment>;
/**
* Usage statistics for models billed by audio input duration.
*/
usage?: TranscriptionVerbose.Usage;
/**
* Extracted words and their corresponding timestamps.
*/
words?: Array<TranscriptionWord>;
}
export declare namespace TranscriptionVerbose {
/**
* Usage statistics for models billed by audio input duration.
*/
interface Usage {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
export interface TranscriptionWord {
/**
* End time of the word in seconds.
*/
end: number;
/**
* Start time of the word in seconds.
*/
start: number;
/**
* The text content of the word.
*/
word: string;
}
/**
* Represents a transcription response returned by model, based on the provided
* input.
*/
export type TranscriptionCreateResponse = Transcription | TranscriptionDiarized | TranscriptionVerbose;
export type TranscriptionCreateParams<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> = TranscriptionCreateParamsNonStreaming<ResponseFormat> | TranscriptionCreateParamsStreaming;
export interface TranscriptionCreateParamsBase<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> {
/**
* The audio file object (not file name) to transcribe, in one of these formats:
* flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
*/
file: Uploadable;
/**
* ID of the model to use. The options are `gpt-4o-transcribe`,
* `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1`
* (which is powered by our open source Whisper V2 model), and
* `gpt-4o-transcribe-diarize`.
*/
model: (string & {}) | AudioAPI.AudioModel;
/**
* Controls how the audio is cut into chunks. When set to `"auto"`, the server
* first normalizes loudness and then uses voice activity detection (VAD) to choose
* boundaries. `server_vad` object can be provided to tweak VAD detection
* parameters manually. If unset, the audio is transcribed as a single block.
* Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30
* seconds.
*/
chunking_strategy?: 'auto' | TranscriptionCreateParams.VadConfig | null;
/**
* Additional information to include in the transcription response. `logprobs` will
* return the log probabilities of the tokens in the response to understand the
* model's confidence in the transcription. `logprobs` only works with
* response_format set to `json` and only with the models `gpt-4o-transcribe`,
* `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is
* not supported when using `gpt-4o-transcribe-diarize`.
*/
include?: Array<TranscriptionInclude>;
/**
* Optional list of speaker names that correspond to the audio samples provided in
* `known_speaker_references[]`. Each entry should be a short identifier (for
* example `customer` or `agent`). Up to 4 speakers are supported.
*/
known_speaker_names?: Array<string>;
/**
* Optional list of audio samples (as
* [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs))
* that contain known speaker references matching `known_speaker_names[]`. Each
* sample must be between 2 and 10 seconds, and can use any of the same input audio
* formats supported by `file`.
*/
known_speaker_references?: Array<string>;
/**
* The language of the input audio. Supplying the input language in
* [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
* format will improve accuracy and latency.
*/
language?: string;
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should match the audio language. This field is not supported when using
* `gpt-4o-transcribe-diarize`.
*/
prompt?: string;
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and
* `gpt-4o-mini-transcribe`, the only supported format is `json`. For
* `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and
* `diarized_json`, with `diarized_json` required to receive speaker annotations.
*/
response_format?: ResponseFormat;
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream?: boolean | null;
/**
* The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
* output more random, while lower values like 0.2 will make it more focused and
* deterministic. If set to 0, the model will use
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to
* automatically increase the temperature until certain thresholds are hit.
*/
temperature?: number;
/**
* The timestamp granularities to populate for this transcription.
* `response_format` must be set `verbose_json` to use timestamp granularities.
* Either or both of these options are supported: `word`, or `segment`. Note: There
* is no additional latency for segment timestamps, but generating word timestamps
* incurs additional latency. This option is not available for
* `gpt-4o-transcribe-diarize`.
*/
timestamp_granularities?: Array<'word' | 'segment'>;
}
export declare namespace TranscriptionCreateParams {
interface VadConfig {
/**
* Must be set to `server_vad` to enable manual chunking using server side VAD.
*/
type: 'server_vad';
/**
* Amount of audio to include before the VAD detected speech (in milliseconds).
*/
prefix_padding_ms?: number;
/**
* Duration of silence to detect speech stop (in milliseconds). With shorter values
* the model will respond more quickly, but may jump in on short pauses from the
* user.
*/
silence_duration_ms?: number;
/**
* Sensitivity threshold (0.0 to 1.0) for voice activity detection. A higher
* threshold will require louder audio to activate the model, and thus might
* perform better in noisy environments.
*/
threshold?: number;
}
type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming;
type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming;
}
export interface TranscriptionCreateParamsNonStreaming<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> extends TranscriptionCreateParamsBase<ResponseFormat> {
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream?: false | null;
}
export interface TranscriptionCreateParamsStreaming extends TranscriptionCreateParamsBase {
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream: true;
}
export declare namespace Transcriptions {
export { type Transcription as Transcription, type TranscriptionDiarized as TranscriptionDiarized, type TranscriptionDiarizedSegment as TranscriptionDiarizedSegment, type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, type TranscriptionStreamEvent as TranscriptionStreamEvent, type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent as TranscriptionTextSegmentEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, };
}
//# sourceMappingURL=transcriptions.d.mts.map
File diff suppressed because one or more lines are too long
+662
View File
@@ -0,0 +1,662 @@
import { APIResource } from "../../core/resource.js";
import * as TranscriptionsAPI from "./transcriptions.js";
import * as AudioAPI from "./audio.js";
import { APIPromise } from "../../core/api-promise.js";
import { Stream } from "../../core/streaming.js";
import { type Uploadable } from "../../core/uploads.js";
import { RequestOptions } from "../../internal/request-options.js";
/**
* Turn audio into text or text into audio.
*/
export declare class Transcriptions extends APIResource {
/**
* Transcribes audio into the input language.
*
* Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
* format, or a stream of transcript events.
*
* @example
* ```ts
* const transcription =
* await client.audio.transcriptions.create({
* file: fs.createReadStream('speech.mp3'),
* model: 'gpt-4o-transcribe',
* });
* ```
*/
create(body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, options?: RequestOptions): APIPromise<Transcription>;
create(body: TranscriptionCreateParamsNonStreaming<'verbose_json'>, options?: RequestOptions): APIPromise<TranscriptionVerbose>;
create(body: TranscriptionCreateParamsNonStreaming<'srt' | 'vtt' | 'text'>, options?: RequestOptions): APIPromise<string>;
create(body: TranscriptionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Transcription>;
create(body: TranscriptionCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<TranscriptionStreamEvent>>;
create(body: TranscriptionCreateParamsStreaming, options?: RequestOptions): APIPromise<TranscriptionCreateResponse | string | Stream<TranscriptionStreamEvent>>;
}
/**
* Represents a transcription response returned by model, based on the provided
* input.
*/
export interface Transcription {
/**
* The transcribed text.
*/
text: string;
/**
* The log probabilities of the tokens in the transcription. Only returned with the
* models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added
* to the `include` array.
*/
logprobs?: Array<Transcription.Logprob>;
/**
* Token usage statistics for the request.
*/
usage?: Transcription.Tokens | Transcription.Duration;
}
export declare namespace Transcription {
interface Logprob {
/**
* The token in the transcription.
*/
token?: string;
/**
* The bytes of the token.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
/**
* Usage statistics for models billed by token usage.
*/
interface Tokens {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Tokens.InputTokenDetails;
}
namespace Tokens {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
/**
* Usage statistics for models billed by audio input duration.
*/
interface Duration {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
/**
* Represents a diarized transcription response returned by the model, including
* the combined transcript and speaker-segment annotations.
*/
export interface TranscriptionDiarized {
/**
* Duration of the input audio in seconds.
*/
duration: number;
/**
* Segments of the transcript annotated with timestamps and speaker labels.
*/
segments: Array<TranscriptionDiarizedSegment>;
/**
* The type of task that was run. Always `transcribe`.
*/
task: 'transcribe';
/**
* The concatenated transcript text for the entire audio input.
*/
text: string;
/**
* Token or duration usage statistics for the request.
*/
usage?: TranscriptionDiarized.Tokens | TranscriptionDiarized.Duration;
}
export declare namespace TranscriptionDiarized {
/**
* Usage statistics for models billed by token usage.
*/
interface Tokens {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Tokens.InputTokenDetails;
}
namespace Tokens {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
/**
* Usage statistics for models billed by audio input duration.
*/
interface Duration {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
/**
* A segment of diarized transcript text with speaker metadata.
*/
export interface TranscriptionDiarizedSegment {
/**
* Unique identifier for the segment.
*/
id: string;
/**
* End timestamp of the segment in seconds.
*/
end: number;
/**
* Speaker label for this segment. When known speakers are provided, the label
* matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially
* using capital letters (`A`, `B`, ...).
*/
speaker: string;
/**
* Start timestamp of the segment in seconds.
*/
start: number;
/**
* Transcript text for this segment.
*/
text: string;
/**
* The type of the segment. Always `transcript.text.segment`.
*/
type: 'transcript.text.segment';
}
export type TranscriptionInclude = 'logprobs';
export interface TranscriptionSegment {
/**
* Unique identifier of the segment.
*/
id: number;
/**
* Average logprob of the segment. If the value is lower than -1, consider the
* logprobs failed.
*/
avg_logprob: number;
/**
* Compression ratio of the segment. If the value is greater than 2.4, consider the
* compression failed.
*/
compression_ratio: number;
/**
* End time of the segment in seconds.
*/
end: number;
/**
* Probability of no speech in the segment. If the value is higher than 1.0 and the
* `avg_logprob` is below -1, consider this segment silent.
*/
no_speech_prob: number;
/**
* Seek offset of the segment.
*/
seek: number;
/**
* Start time of the segment in seconds.
*/
start: number;
/**
* Temperature parameter used for generating the segment.
*/
temperature: number;
/**
* Text content of the segment.
*/
text: string;
/**
* Array of token IDs for the text content.
*/
tokens: Array<number>;
}
/**
* Emitted when a diarized transcription returns a completed segment with speaker
* information. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with `stream` set to `true` and `response_format` set to `diarized_json`.
*/
export type TranscriptionStreamEvent = TranscriptionTextSegmentEvent | TranscriptionTextDeltaEvent | TranscriptionTextDoneEvent;
/**
* Emitted when there is an additional text delta. This is also the first event
* emitted when the transcription starts. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `Stream` parameter set to `true`.
*/
export interface TranscriptionTextDeltaEvent {
/**
* The text delta that was additionally transcribed.
*/
delta: string;
/**
* The type of the event. Always `transcript.text.delta`.
*/
type: 'transcript.text.delta';
/**
* The log probabilities of the delta. Only included if you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `include[]` parameter set to `logprobs`.
*/
logprobs?: Array<TranscriptionTextDeltaEvent.Logprob>;
/**
* Identifier of the diarized segment that this delta belongs to. Only present when
* using `gpt-4o-transcribe-diarize`.
*/
segment_id?: string;
}
export declare namespace TranscriptionTextDeltaEvent {
interface Logprob {
/**
* The token that was used to generate the log probability.
*/
token?: string;
/**
* The bytes that were used to generate the log probability.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
}
/**
* Emitted when the transcription is complete. Contains the complete transcription
* text. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `Stream` parameter set to `true`.
*/
export interface TranscriptionTextDoneEvent {
/**
* The text that was transcribed.
*/
text: string;
/**
* The type of the event. Always `transcript.text.done`.
*/
type: 'transcript.text.done';
/**
* The log probabilities of the individual tokens in the transcription. Only
* included if you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with the `include[]` parameter set to `logprobs`.
*/
logprobs?: Array<TranscriptionTextDoneEvent.Logprob>;
/**
* Usage statistics for models billed by token usage.
*/
usage?: TranscriptionTextDoneEvent.Usage;
}
export declare namespace TranscriptionTextDoneEvent {
interface Logprob {
/**
* The token that was used to generate the log probability.
*/
token?: string;
/**
* The bytes that were used to generate the log probability.
*/
bytes?: Array<number>;
/**
* The log probability of the token.
*/
logprob?: number;
}
/**
* Usage statistics for models billed by token usage.
*/
interface Usage {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;
/**
* Number of output tokens generated.
*/
output_tokens: number;
/**
* Total number of tokens used (input + output).
*/
total_tokens: number;
/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';
/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Usage.InputTokenDetails;
}
namespace Usage {
/**
* Details about the input tokens billed for this request.
*/
interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;
/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
}
/**
* Emitted when a diarized transcription returns a completed segment with speaker
* information. Only emitted when you
* [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
* with `stream` set to `true` and `response_format` set to `diarized_json`.
*/
export interface TranscriptionTextSegmentEvent {
/**
* Unique identifier for the segment.
*/
id: string;
/**
* End timestamp of the segment in seconds.
*/
end: number;
/**
* Speaker label for this segment.
*/
speaker: string;
/**
* Start timestamp of the segment in seconds.
*/
start: number;
/**
* Transcript text for this segment.
*/
text: string;
/**
* The type of the event. Always `transcript.text.segment`.
*/
type: 'transcript.text.segment';
}
/**
* Represents a verbose json transcription response returned by model, based on the
* provided input.
*/
export interface TranscriptionVerbose {
/**
* The duration of the input audio.
*/
duration: number;
/**
* The language of the input audio.
*/
language: string;
/**
* The transcribed text.
*/
text: string;
/**
* Segments of the transcribed text and their corresponding details.
*/
segments?: Array<TranscriptionSegment>;
/**
* Usage statistics for models billed by audio input duration.
*/
usage?: TranscriptionVerbose.Usage;
/**
* Extracted words and their corresponding timestamps.
*/
words?: Array<TranscriptionWord>;
}
export declare namespace TranscriptionVerbose {
/**
* Usage statistics for models billed by audio input duration.
*/
interface Usage {
/**
* Duration of the input audio in seconds.
*/
seconds: number;
/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}
export interface TranscriptionWord {
/**
* End time of the word in seconds.
*/
end: number;
/**
* Start time of the word in seconds.
*/
start: number;
/**
* The text content of the word.
*/
word: string;
}
/**
* Represents a transcription response returned by model, based on the provided
* input.
*/
export type TranscriptionCreateResponse = Transcription | TranscriptionDiarized | TranscriptionVerbose;
export type TranscriptionCreateParams<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> = TranscriptionCreateParamsNonStreaming<ResponseFormat> | TranscriptionCreateParamsStreaming;
export interface TranscriptionCreateParamsBase<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> {
/**
* The audio file object (not file name) to transcribe, in one of these formats:
* flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
*/
file: Uploadable;
/**
* ID of the model to use. The options are `gpt-4o-transcribe`,
* `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1`
* (which is powered by our open source Whisper V2 model), and
* `gpt-4o-transcribe-diarize`.
*/
model: (string & {}) | AudioAPI.AudioModel;
/**
* Controls how the audio is cut into chunks. When set to `"auto"`, the server
* first normalizes loudness and then uses voice activity detection (VAD) to choose
* boundaries. `server_vad` object can be provided to tweak VAD detection
* parameters manually. If unset, the audio is transcribed as a single block.
* Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30
* seconds.
*/
chunking_strategy?: 'auto' | TranscriptionCreateParams.VadConfig | null;
/**
* Additional information to include in the transcription response. `logprobs` will
* return the log probabilities of the tokens in the response to understand the
* model's confidence in the transcription. `logprobs` only works with
* response_format set to `json` and only with the models `gpt-4o-transcribe`,
* `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is
* not supported when using `gpt-4o-transcribe-diarize`.
*/
include?: Array<TranscriptionInclude>;
/**
* Optional list of speaker names that correspond to the audio samples provided in
* `known_speaker_references[]`. Each entry should be a short identifier (for
* example `customer` or `agent`). Up to 4 speakers are supported.
*/
known_speaker_names?: Array<string>;
/**
* Optional list of audio samples (as
* [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs))
* that contain known speaker references matching `known_speaker_names[]`. Each
* sample must be between 2 and 10 seconds, and can use any of the same input audio
* formats supported by `file`.
*/
known_speaker_references?: Array<string>;
/**
* The language of the input audio. Supplying the input language in
* [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
* format will improve accuracy and latency.
*/
language?: string;
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should match the audio language. This field is not supported when using
* `gpt-4o-transcribe-diarize`.
*/
prompt?: string;
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and
* `gpt-4o-mini-transcribe`, the only supported format is `json`. For
* `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and
* `diarized_json`, with `diarized_json` required to receive speaker annotations.
*/
response_format?: ResponseFormat;
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream?: boolean | null;
/**
* The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
* output more random, while lower values like 0.2 will make it more focused and
* deterministic. If set to 0, the model will use
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to
* automatically increase the temperature until certain thresholds are hit.
*/
temperature?: number;
/**
* The timestamp granularities to populate for this transcription.
* `response_format` must be set `verbose_json` to use timestamp granularities.
* Either or both of these options are supported: `word`, or `segment`. Note: There
* is no additional latency for segment timestamps, but generating word timestamps
* incurs additional latency. This option is not available for
* `gpt-4o-transcribe-diarize`.
*/
timestamp_granularities?: Array<'word' | 'segment'>;
}
export declare namespace TranscriptionCreateParams {
interface VadConfig {
/**
* Must be set to `server_vad` to enable manual chunking using server side VAD.
*/
type: 'server_vad';
/**
* Amount of audio to include before the VAD detected speech (in milliseconds).
*/
prefix_padding_ms?: number;
/**
* Duration of silence to detect speech stop (in milliseconds). With shorter values
* the model will respond more quickly, but may jump in on short pauses from the
* user.
*/
silence_duration_ms?: number;
/**
* Sensitivity threshold (0.0 to 1.0) for voice activity detection. A higher
* threshold will require louder audio to activate the model, and thus might
* perform better in noisy environments.
*/
threshold?: number;
}
type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming;
type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming;
}
export interface TranscriptionCreateParamsNonStreaming<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> extends TranscriptionCreateParamsBase<ResponseFormat> {
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream?: false | null;
}
export interface TranscriptionCreateParamsStreaming extends TranscriptionCreateParamsBase {
/**
* If set to true, the model response data will be streamed to the client as it is
* generated using
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
* See the
* [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
* for more information.
*
* Note: Streaming is not supported for the `whisper-1` model and will be ignored.
*/
stream: true;
}
export declare namespace Transcriptions {
export { type Transcription as Transcription, type TranscriptionDiarized as TranscriptionDiarized, type TranscriptionDiarizedSegment as TranscriptionDiarizedSegment, type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, type TranscriptionStreamEvent as TranscriptionStreamEvent, type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionTextSegmentEvent as TranscriptionTextSegmentEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, };
}
//# sourceMappingURL=transcriptions.d.ts.map
File diff suppressed because one or more lines are too long
+22
View File
@@ -0,0 +1,22 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transcriptions = void 0;
const resource_1 = require("../../core/resource.js");
const uploads_1 = require("../../internal/uploads.js");
/**
* Turn audio into text or text into audio.
*/
class Transcriptions extends resource_1.APIResource {
create(body, options) {
return this._client.post('/audio/transcriptions', (0, uploads_1.multipartFormRequestOptions)({
body,
...options,
stream: body.stream ?? false,
__metadata: { model: body.model },
__security: { bearerAuth: true },
}, this._client));
}
}
exports.Transcriptions = Transcriptions;
//# sourceMappingURL=transcriptions.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"transcriptions.js","sourceRoot":"","sources":["../../src/resources/audio/transcriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAOlD,uDAAqE;AAErE;;GAEG;AACH,MAAa,cAAe,SAAQ,sBAAW;IAqC7C,MAAM,CACJ,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,uBAAuB,EACvB,IAAA,qCAA2B,EACzB;YACE,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;YAC5B,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YACjC,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,EACD,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;CACF;AAvDD,wCAuDC"}
+18
View File
@@ -0,0 +1,18 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
/**
* Turn audio into text or text into audio.
*/
export class Transcriptions extends APIResource {
create(body, options) {
return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
body,
...options,
stream: body.stream ?? false,
__metadata: { model: body.model },
__security: { bearerAuth: true },
}, this._client));
}
}
//# sourceMappingURL=transcriptions.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"transcriptions.mjs","sourceRoot":"","sources":["../../src/resources/audio/transcriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAOlD,OAAO,EAAE,2BAA2B,EAAE,mCAA+B;AAErE;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAqC7C,MAAM,CACJ,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,uBAAuB,EACvB,2BAA2B,CACzB;YACE,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;YAC5B,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YACjC,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,EACD,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;CACF"}
+84
View File
@@ -0,0 +1,84 @@
import { APIResource } from "../../core/resource.mjs";
import * as AudioAPI from "./audio.mjs";
import * as TranscriptionsAPI from "./transcriptions.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { type Uploadable } from "../../core/uploads.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
/**
* Turn audio into text or text into audio.
*/
export declare class Translations extends APIResource {
/**
* Translates audio into English.
*
* @example
* ```ts
* const translation = await client.audio.translations.create({
* file: fs.createReadStream('speech.mp3'),
* model: 'whisper-1',
* });
* ```
*/
create(body: TranslationCreateParams<'json' | undefined>, options?: RequestOptions): APIPromise<Translation>;
create(body: TranslationCreateParams<'verbose_json'>, options?: RequestOptions): APIPromise<TranslationVerbose>;
create(body: TranslationCreateParams<'text' | 'srt' | 'vtt'>, options?: RequestOptions): APIPromise<string>;
create(body: TranslationCreateParams, options?: RequestOptions): APIPromise<Translation>;
}
export interface Translation {
text: string;
}
export interface TranslationVerbose {
/**
* The duration of the input audio.
*/
duration: number;
/**
* The language of the output translation (always `english`).
*/
language: string;
/**
* The translated text.
*/
text: string;
/**
* Segments of the translated text and their corresponding details.
*/
segments?: Array<TranscriptionsAPI.TranscriptionSegment>;
}
export type TranslationCreateResponse = Translation | TranslationVerbose;
export interface TranslationCreateParams<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> {
/**
* The audio file object (not file name) translate, in one of these formats: flac,
* mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
*/
file: Uploadable;
/**
* ID of the model to use. Only `whisper-1` (which is powered by our open source
* Whisper V2 model) is currently available.
*/
model: (string & {}) | AudioAPI.AudioModel;
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should be in English.
*/
prompt?: string;
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, or `vtt`.
*/
response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
/**
* The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
* output more random, while lower values like 0.2 will make it more focused and
* deterministic. If set to 0, the model will use
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to
* automatically increase the temperature until certain thresholds are hit.
*/
temperature?: number;
}
export declare namespace Translations {
export { type Translation as Translation, type TranslationVerbose as TranslationVerbose, type TranslationCreateResponse as TranslationCreateResponse, type TranslationCreateParams as TranslationCreateParams, };
}
//# sourceMappingURL=translations.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"translations.d.mts","sourceRoot":"","sources":["../../src/resources/audio/translations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,KAAK,iBAAiB,6BAAyB;AACtD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,+BAA2B;AACrD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAGhE;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;OAUG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,CAAC,MAAM,GAAG,SAAS,CAAC,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC;IAC1B,MAAM,CACJ,IAAI,EAAE,uBAAuB,CAAC,cAAc,CAAC,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kBAAkB,CAAC;IACjC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAC3G,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAazF;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEzE,MAAM,WAAW,uBAAuB,CACtC,cAAc,SAAS,QAAQ,CAAC,mBAAmB,GAAG,SAAS,GAAG,QAAQ,CAAC,mBAAmB,GAAG,SAAS;IAE1G;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC;IAE3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,KAAK,CAAC;IAEnE;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
+84
View File
@@ -0,0 +1,84 @@
import { APIResource } from "../../core/resource.js";
import * as AudioAPI from "./audio.js";
import * as TranscriptionsAPI from "./transcriptions.js";
import { APIPromise } from "../../core/api-promise.js";
import { type Uploadable } from "../../core/uploads.js";
import { RequestOptions } from "../../internal/request-options.js";
/**
* Turn audio into text or text into audio.
*/
export declare class Translations extends APIResource {
/**
* Translates audio into English.
*
* @example
* ```ts
* const translation = await client.audio.translations.create({
* file: fs.createReadStream('speech.mp3'),
* model: 'whisper-1',
* });
* ```
*/
create(body: TranslationCreateParams<'json' | undefined>, options?: RequestOptions): APIPromise<Translation>;
create(body: TranslationCreateParams<'verbose_json'>, options?: RequestOptions): APIPromise<TranslationVerbose>;
create(body: TranslationCreateParams<'text' | 'srt' | 'vtt'>, options?: RequestOptions): APIPromise<string>;
create(body: TranslationCreateParams, options?: RequestOptions): APIPromise<Translation>;
}
export interface Translation {
text: string;
}
export interface TranslationVerbose {
/**
* The duration of the input audio.
*/
duration: number;
/**
* The language of the output translation (always `english`).
*/
language: string;
/**
* The translated text.
*/
text: string;
/**
* Segments of the translated text and their corresponding details.
*/
segments?: Array<TranscriptionsAPI.TranscriptionSegment>;
}
export type TranslationCreateResponse = Translation | TranslationVerbose;
export interface TranslationCreateParams<ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined> {
/**
* The audio file object (not file name) translate, in one of these formats: flac,
* mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
*/
file: Uploadable;
/**
* ID of the model to use. Only `whisper-1` (which is powered by our open source
* Whisper V2 model) is currently available.
*/
model: (string & {}) | AudioAPI.AudioModel;
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should be in English.
*/
prompt?: string;
/**
* The format of the output, in one of these options: `json`, `text`, `srt`,
* `verbose_json`, or `vtt`.
*/
response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
/**
* The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
* output more random, while lower values like 0.2 will make it more focused and
* deterministic. If set to 0, the model will use
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to
* automatically increase the temperature until certain thresholds are hit.
*/
temperature?: number;
}
export declare namespace Translations {
export { type Translation as Translation, type TranslationVerbose as TranslationVerbose, type TranslationCreateResponse as TranslationCreateResponse, type TranslationCreateParams as TranslationCreateParams, };
}
//# sourceMappingURL=translations.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/resources/audio/translations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,QAAQ,mBAAgB;AACpC,OAAO,KAAK,iBAAiB,4BAAyB;AACtD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,8BAA2B;AACrD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAGhE;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;OAUG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,CAAC,MAAM,GAAG,SAAS,CAAC,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC;IAC1B,MAAM,CACJ,IAAI,EAAE,uBAAuB,CAAC,cAAc,CAAC,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kBAAkB,CAAC;IACjC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAC3G,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAazF;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEzE,MAAM,WAAW,uBAAuB,CACtC,cAAc,SAAS,QAAQ,CAAC,mBAAmB,GAAG,SAAS,GAAG,QAAQ,CAAC,mBAAmB,GAAG,SAAS;IAE1G;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC;IAE3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,KAAK,CAAC;IAEnE;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
+16
View File
@@ -0,0 +1,16 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Translations = void 0;
const resource_1 = require("../../core/resource.js");
const uploads_1 = require("../../internal/uploads.js");
/**
* Turn audio into text or text into audio.
*/
class Translations extends resource_1.APIResource {
create(body, options) {
return this._client.post('/audio/translations', (0, uploads_1.multipartFormRequestOptions)({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
}
}
exports.Translations = Translations;
//# sourceMappingURL=translations.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"translations.js","sourceRoot":"","sources":["../../src/resources/audio/translations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAMlD,uDAAqE;AAErE;;GAEG;AACH,MAAa,YAAa,SAAQ,sBAAW;IAsB3C,MAAM,CACJ,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,qBAAqB,EACrB,IAAA,qCAA2B,EACzB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EACzF,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;CACF;AAlCD,oCAkCC"}
+12
View File
@@ -0,0 +1,12 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
/**
* Turn audio into text or text into audio.
*/
export class Translations extends APIResource {
create(body, options) {
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
}
}
//# sourceMappingURL=translations.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"translations.mjs","sourceRoot":"","sources":["../../src/resources/audio/translations.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAMlD,OAAO,EAAE,2BAA2B,EAAE,mCAA+B;AAErE;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAsB3C,MAAM,CACJ,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,qBAAqB,EACrB,2BAA2B,CACzB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EACzF,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;CACF"}