Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { z } from 'zod';
/**
* Word-level transcription with timestamps.
*/
export const TranscriptionWord = z.object({
/** The transcribed word. */
word: z.string(),
/** Start time of the word in seconds. */
start: z.number(),
/** End time of the word in seconds. */
end: z.number(),
});
export type TranscriptionWord = z.infer<typeof TranscriptionWord>;
/**
* Segment of transcription with timestamps and metadata.
*/
export const TranscriptionSegment = z.object({
/** Unique identifier of the segment. */
id: z.number(),
/** Seek position of the segment. */
seek: z.number(),
/** Start time of the segment in seconds. */
start: z.number(),
/** End time of the segment in seconds. */
end: z.number(),
/** Text content of the segment. */
text: z.string(),
/** Array of tokens in the segment. */
tokens: z.array(z.number()),
/** Temperature parameter used for the segment. */
temperature: z.number(),
/** Average log probability of the segment. */
avg_logprob: z.number(),
/** Compression ratio of the segment. */
compression_ratio: z.number(),
/** Probability that the segment contains no speech. */
no_speech_prob: z.number(),
/** Words in the segment with timestamps (only if requested). */
words: z.array(TranscriptionWord).optional(),
});
export type TranscriptionSegment = z.infer<typeof TranscriptionSegment>;
/**
* Response for create speech API - returns audio data directly
* The actual response is binary audio data, not JSON
*/
export const CreateSpeechResponseBody = z.instanceof(Blob); // Binary audio data
export type CreateSpeechResponseBody = z.infer<typeof CreateSpeechResponseBody>;
/**
* Response for create transcription API (json format)
*/
export const CreateTranscriptionResponseBody = z.object({
/** The transcribed text. */
text: z.string(),
});
export type CreateTranscriptionResponseBody = z.infer<
typeof CreateTranscriptionResponseBody
>;
/**
* Response for create transcription API (verbose_json format)
*/
export const CreateTranscriptionVerboseResponseBody = z.object({
/** The task performed. Always "transcribe" for transcriptions. */
task: z.literal('transcribe').optional(),
/** The language of the input audio. */
language: z.string(),
/** The duration of the input audio. */
duration: z.number(),
/** The transcribed text. */
text: z.string(),
/** The total number of words in the transcription. */
word_count: z.number().optional(),
/** Segments of the transcription with timestamps and metadata. */
segments: z.array(TranscriptionSegment).optional(),
/** Words of the transcription with timestamps (only if requested). */
words: z.array(TranscriptionWord).optional(),
});
export type CreateTranscriptionVerboseResponseBody = z.infer<
typeof CreateTranscriptionVerboseResponseBody
>;
/**
* Response for create translation API (json format)
*/
export const CreateTranslationResponseBody = z.object({
/** The translated text. */
text: z.string(),
});
export type CreateTranslationResponseBody = z.infer<
typeof CreateTranslationResponseBody
>;
/**
* Response for create translation API (verbose_json format)
*/
export const CreateTranslationVerboseResponseBody = z.object({
/** The task performed. Always "translate" for translations. */
task: z.literal('translate').optional(),
/** The language of the input audio. */
language: z.string(),
/** The duration of the input audio. */
duration: z.number(),
/** The translated text. */
text: z.string(),
/** The total number of words in the translation. */
word_count: z.number().optional(),
/** Segments of the translation with timestamps and metadata. */
segments: z.array(TranscriptionSegment).optional(),
});
export type CreateTranslationVerboseResponseBody = z.infer<
typeof CreateTranslationVerboseResponseBody
>;
|