main
 1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 2
 3from typing import List, Union, Optional
 4from typing_extensions import Literal, Annotated, TypeAlias
 5
 6from ..._utils import PropertyInfo
 7from ..._models import BaseModel
 8from .transcription_diarized_segment import TranscriptionDiarizedSegment
 9
10__all__ = ["TranscriptionDiarized", "Usage", "UsageTokens", "UsageTokensInputTokenDetails", "UsageDuration"]
11
12
13class UsageTokensInputTokenDetails(BaseModel):
14    audio_tokens: Optional[int] = None
15    """Number of audio tokens billed for this request."""
16
17    text_tokens: Optional[int] = None
18    """Number of text tokens billed for this request."""
19
20
21class UsageTokens(BaseModel):
22    input_tokens: int
23    """Number of input tokens billed for this request."""
24
25    output_tokens: int
26    """Number of output tokens generated."""
27
28    total_tokens: int
29    """Total number of tokens used (input + output)."""
30
31    type: Literal["tokens"]
32    """The type of the usage object. Always `tokens` for this variant."""
33
34    input_token_details: Optional[UsageTokensInputTokenDetails] = None
35    """Details about the input tokens billed for this request."""
36
37
38class UsageDuration(BaseModel):
39    seconds: float
40    """Duration of the input audio in seconds."""
41
42    type: Literal["duration"]
43    """The type of the usage object. Always `duration` for this variant."""
44
45
46Usage: TypeAlias = Annotated[Union[UsageTokens, UsageDuration], PropertyInfo(discriminator="type")]
47
48
49class TranscriptionDiarized(BaseModel):
50    duration: float
51    """Duration of the input audio in seconds."""
52
53    segments: List[TranscriptionDiarizedSegment]
54    """Segments of the transcript annotated with timestamps and speaker labels."""
55
56    task: Literal["transcribe"]
57    """The type of task that was run. Always `transcribe`."""
58
59    text: str
60    """The concatenated transcript text for the entire audio input."""
61
62    usage: Optional[Usage] = None
63    """Token or duration usage statistics for the request."""