// This file is auto-generated by @hey-api/openapi-ts

export type Audio = {
  id: string
}

export type Body_detect_speech_timestamps_v1_audio_speech_timestamps_post = {
  model?: string
  /**
   * Speech threshold. Silero VAD outputs speech probabilities for each audio chunk, probabilities ABOVE this value are considered as SPEECH. It is better to tune this parameter for each dataset separately, but "lazy" 0.5 is pretty good for most datasets.
   */
  threshold?: number
  /**
   * Silence threshold for determining the end of speech. If a probability is lower
   * than neg_threshold, it is always considered silence. Values higher than neg_threshold
   * are only considered speech if the previous sample was classified as speech; otherwise,
   * they are treated as silence. This parameter helps refine the detection of speech
   * transitions, ensuring smoother segment boundaries.
   */
  neg_threshold?: number | null
  /**
   * Final speech chunks shorter min_speech_duration_ms are thrown out.
   */
  min_speech_duration_ms?: number
  /**
   * Maximum duration of speech chunks in seconds. Chunks longer
   * than max_speech_duration_s will be split at the timestamp of the last silence that
   * lasts more than 100ms (if any), to prevent aggressive cutting. Otherwise, they will be
   * split aggressively just before max_speech_duration_s.
   */
  max_speech_duration_s?: number
  /**
   * In the end of each speech chunk wait for min_silence_duration_ms
   * before separating it
   */
  min_silence_duration_ms?: number
  /**
   * Final speech chunks are padded by speech_pad_ms each side
   */
  speech_pad_ms?: number
  file: Blob | File
}

export type Body_transcribe_file_v1_audio_transcriptions_post = {
  model: string
  language?: string | null
  prompt?: string | null
  response_format?: speaches__routers__stt__ResponseFormat
  temperature?: number
  timestamp_granularities?: Array<"segment" | "word">
  stream?: boolean
  hotwords?: string | null
  vad_filter?: boolean
  file: Blob | File
}

export type Body_translate_file_v1_audio_translations_post = {
  model: string
  prompt?: string | null
  response_format?: speaches__routers__stt__ResponseFormat
  temperature?: number
  stream?: boolean
  vad_filter?: boolean
  file: Blob | File
}

export type ChatCompletion = {
  id: string
  choices: Array<openai__types__chat__chat_completion__Choice>
  created: number
  model: string
  object: "chat.completion"
  service_tier?: "scale" | "default" | null
  system_fingerprint?: string | null
  usage?: CompletionUsage | null
  [key: string]:
    | unknown
    | string
    | openai__types__chat__chat_completion__Choice
    | number
    | "chat.completion"
}

export type ChatCompletionAssistantMessageParam = {
  role: "assistant"
  audio?: Audio | null
  content?:
    | string
    | Array<
        | ChatCompletionContentPartTextParam
        | ChatCompletionContentPartRefusalParam
      >
    | null
  function_call?: FunctionCall_Input | null
  name?: string | null
  refusal?: string | null
  tool_calls?: Array<ChatCompletionMessageToolCallParam> | null
}

export type ChatCompletionAudio = {
  id: string
  data: string
  expires_at: number
  transcript: string
  [key: string]: unknown | string | number
}

export type ChatCompletionAudioParam = {
  format: "wav" | "mp3" | "flac" | "opus" | "pcm16"
  voice: string
}

export type format = "wav" | "mp3" | "flac" | "opus" | "pcm16"

export type ChatCompletionChunk = {
  id: string
  choices: Array<openai__types__chat__chat_completion_chunk__Choice>
  created: number
  model: string
  object: "chat.completion.chunk"
  service_tier?: "scale" | "default" | null
  system_fingerprint?: string | null
  usage?: CompletionUsage | null
  [key: string]:
    | unknown
    | string
    | openai__types__chat__chat_completion_chunk__Choice
    | number
    | "chat.completion.chunk"
}

export type ChatCompletionContentPartImageParam = {
  image_url: ImageURL
  type: "image_url"
}

export type ChatCompletionContentPartInputAudioParam = {
  input_audio: InputAudio
  type: "input_audio"
}

export type ChatCompletionContentPartRefusalParam = {
  refusal: string
  type: "refusal"
}

export type ChatCompletionContentPartTextParam = {
  text: string
  type: "text"
}

export type ChatCompletionDeveloperMessageParam = {
  content: string | Array<ChatCompletionContentPartTextParam>
  role: "developer"
  name?: string | null
}

export type ChatCompletionFunctionCallOptionParam = {
  name: string
}

export type ChatCompletionFunctionMessageParam = {
  content: string | null
  name: string
  role: "function"
}

export type ChatCompletionMessage = {
  content?: string | null
  refusal?: string | null
  role: "assistant"
  audio?: ChatCompletionAudio | null
  function_call?: FunctionCall_Output | null
  tool_calls?: Array<ChatCompletionMessageToolCall> | null
  [key: string]: unknown | "assistant"
}

export type ChatCompletionMessageToolCall = {
  id: string
  function: Function
  type: "function"
  [key: string]: unknown | string | Function | "function"
}

export type ChatCompletionMessageToolCallParam = {
  id: string
  function: OpenaiTypesChatChatCompletionMessageToolCallParamFunction
  type: "function"
}

export type ChatCompletionNamedToolChoiceParam = {
  function: OpenaiTypesChatChatCompletionNamedToolChoiceParamFunction
  type: "function"
}

export type ChatCompletionPredictionContentParam = {
  content: string | Array<ChatCompletionContentPartTextParam>
  type: "content"
}

export type ChatCompletionStreamOptionsParam = {
  include_usage?: boolean | null
}

export type ChatCompletionSystemMessageParam = {
  content: string | Array<ChatCompletionContentPartTextParam>
  role: "system"
  name?: string | null
}

export type ChatCompletionTokenLogprob = {
  token: string
  bytes?: Array<number> | null
  logprob: number
  top_logprobs: Array<TopLogprob>
  [key: string]: unknown | string | number | TopLogprob
}

export type ChatCompletionToolMessageParam = {
  content: string | Array<ChatCompletionContentPartTextParam>
  role: "tool"
  tool_call_id: string
}

export type ChatCompletionToolParam = {
  function: FunctionDefinition
  type: "function"
}

export type ChatCompletionUserMessageParam = {
  content:
    | string
    | Array<
        | ChatCompletionContentPartTextParam
        | ChatCompletionContentPartImageParam
        | ChatCompletionContentPartInputAudioParam
      >
  role: "user"
  name?: string | null
}

export type ChoiceDelta = {
  content?: string | null
  function_call?: ChoiceDeltaFunctionCall | null
  refusal?: string | null
  role?: "developer" | "system" | "user" | "assistant" | "tool" | null
  tool_calls?: Array<ChoiceDeltaToolCall> | null
  [key: string]: unknown
}

export type ChoiceDeltaFunctionCall = {
  arguments?: string | null
  name?: string | null
  [key: string]: unknown
}

export type ChoiceDeltaToolCall = {
  index: number
  id?: string | null
  function?: ChoiceDeltaToolCallFunction | null
  type?: "function" | null
  [key: string]: unknown | number
}

export type ChoiceDeltaToolCallFunction = {
  arguments?: string | null
  name?: string | null
  [key: string]: unknown
}

export type ChoiceLogprobs = {
  content?: Array<ChatCompletionTokenLogprob> | null
  refusal?: Array<ChatCompletionTokenLogprob> | null
  [key: string]: unknown
}

export type CompletionCreateParamsBase = {
  messages: Array<
    | ChatCompletionDeveloperMessageParam
    | ChatCompletionSystemMessageParam
    | ChatCompletionUserMessageParam
    | ChatCompletionAssistantMessageParam
    | ChatCompletionToolMessageParam
    | ChatCompletionFunctionMessageParam
  >
  model:
    | string
    | "o1"
    | "o1-2024-12-17"
    | "o1-preview"
    | "o1-preview-2024-09-12"
    | "o1-mini"
    | "o1-mini-2024-09-12"
    | "gpt-4o"
    | "gpt-4o-2024-11-20"
    | "gpt-4o-2024-08-06"
    | "gpt-4o-2024-05-13"
    | "gpt-4o-audio-preview"
    | "gpt-4o-audio-preview-2024-10-01"
    | "gpt-4o-audio-preview-2024-12-17"
    | "gpt-4o-mini-audio-preview"
    | "gpt-4o-mini-audio-preview-2024-12-17"
    | "chatgpt-4o-latest"
    | "gpt-4o-mini"
    | "gpt-4o-mini-2024-07-18"
    | "gpt-4-turbo"
    | "gpt-4-turbo-2024-04-09"
    | "gpt-4-0125-preview"
    | "gpt-4-turbo-preview"
    | "gpt-4-1106-preview"
    | "gpt-4-vision-preview"
    | "gpt-4"
    | "gpt-4-0314"
    | "gpt-4-0613"
    | "gpt-4-32k"
    | "gpt-4-32k-0314"
    | "gpt-4-32k-0613"
    | "gpt-3.5-turbo"
    | "gpt-3.5-turbo-16k"
    | "gpt-3.5-turbo-0301"
    | "gpt-3.5-turbo-0613"
    | "gpt-3.5-turbo-1106"
    | "gpt-3.5-turbo-0125"
    | "gpt-3.5-turbo-16k-0613"
  audio?: ChatCompletionAudioParam | null
  frequency_penalty?: number | null
  function_call?: "none" | "auto" | ChatCompletionFunctionCallOptionParam | null
  functions?: Array<OpenaiTypesChatCompletionCreateParamsFunction> | null
  logit_bias?: {
    [key: string]: number
  } | null
  logprobs?: boolean | null
  max_completion_tokens?: number | null
  max_tokens?: number | null
  metadata?: {
    [key: string]: string
  } | null
  modalities?: Array<"text" | "audio"> | null
  n?: number | null
  parallel_tool_calls?: boolean | null
  prediction?: ChatCompletionPredictionContentParam | null
  presence_penalty?: number | null
  reasoning_effort?: "low" | "medium" | "high" | null
  response_format?:
    | ResponseFormatText
    | ResponseFormatJSONObject
    | ResponseFormatJSONSchema
    | null
  seed?: number | null
  service_tier?: "auto" | "default" | null
  stop?: string | Array<string> | null
  store?: boolean | null
  stream_options?: ChatCompletionStreamOptionsParam | null
  temperature?: number | null
  tool_choice?:
    | "none"
    | "auto"
    | "required"
    | ChatCompletionNamedToolChoiceParam
    | null
  tools?: Array<ChatCompletionToolParam> | null
  top_logprobs?: number | null
  top_p?: number | null
  user?: string | null
  stream?: boolean
  trancription_model?: string
  transcription_extra_body?: {
    [key: string]: unknown
  } | null
  speech_model?: string
  speech_extra_body?: {
    [key: string]: unknown
  } | null
}

export type CompletionTokensDetails = {
  accepted_prediction_tokens?: number | null
  audio_tokens?: number | null
  reasoning_tokens?: number | null
  rejected_prediction_tokens?: number | null
  [key: string]: unknown
}

export type CompletionUsage = {
  completion_tokens: number
  prompt_tokens: number
  total_tokens: number
  completion_tokens_details?: CompletionTokensDetails | null
  prompt_tokens_details?: PromptTokensDetails | null
  [key: string]: unknown | number
}

export type CreateSpeechRequestBody = {
  /**
   * The ID of the model. You can get a list of available models by calling `/v1/models`.
   */
  model: string
  input: string
  voice: string
  response_format?: speaches__routers__speech__ResponseFormat
  speed?: number
  sample_rate?: number | null
}

export type CreateTranscriptionResponseJson = {
  text: string
}

export type CreateTranscriptionResponseVerboseJson = {
  task?: string
  language: string
  duration: number
  text: string
  words: Array<TranscriptionWord> | null
  segments: Array<TranscriptionSegment>
}

export type Function = {
  arguments: string
  name: string
  [key: string]: unknown | string
}

export type FunctionCall_Input = {
  arguments: string
  name: string
}

export type FunctionCall_Output = {
  arguments: string
  name: string
  [key: string]: unknown | string
}

export type FunctionDefinition = {
  name: string
  description?: string | null
  parameters?: {
    [key: string]: unknown
  } | null
  strict?: boolean | null
}

export type HTTPValidationError = {
  detail?: Array<ValidationError>
}

export type ImageURL = {
  url: string
  detail?: "auto" | "low" | "high" | null
}

export type InputAudio = {
  data: string
  format: "wav" | "mp3"
}

export type format2 = "wav" | "mp3"

export type JSONSchema = {
  name: string
  description?: string | null
  schema?: {
    [key: string]: unknown
  } | null
  strict?: boolean | null
}

export type ListModelsResponse = {
  data: Array<Model>
  object?: "list"
}

/**
 * There may be additional fields in the response that are specific to the model type.
 */
export type Model = {
  id: string
  created?: number
  object?: "model"
  owned_by: string
  language?: Array<string> | null
  task: "automatic-speech-recognition" | "text-to-speech"
  [key: string]: unknown | string | number | "model"
}

export type task = "automatic-speech-recognition" | "text-to-speech"

export type openai__types__chat__chat_completion__Choice = {
  finish_reason:
    | "stop"
    | "length"
    | "tool_calls"
    | "content_filter"
    | "function_call"
  index: number
  logprobs?: ChoiceLogprobs | null
  message: ChatCompletionMessage
  [key: string]: unknown | string | number | ChatCompletionMessage
}

export type finish_reason =
  | "stop"
  | "length"
  | "tool_calls"
  | "content_filter"
  | "function_call"

export type openai__types__chat__chat_completion_chunk__Choice = {
  delta: ChoiceDelta
  finish_reason?:
    | "stop"
    | "length"
    | "tool_calls"
    | "content_filter"
    | "function_call"
    | null
  index: number
  logprobs?: ChoiceLogprobs | null
  [key: string]: unknown | ChoiceDelta | number
}

export type OpenaiTypesChatChatCompletionMessageToolCallParamFunction = {
  arguments: string
  name: string
}

export type OpenaiTypesChatChatCompletionNamedToolChoiceParamFunction = {
  name: string
}

export type OpenaiTypesChatCompletionCreateParamsFunction = {
  name: string
  description?: string | null
  parameters?: {
    [key: string]: unknown
  } | null
}

export type PromptTokensDetails = {
  audio_tokens?: number | null
  cached_tokens?: number | null
  [key: string]: unknown
}

export type ResponseFormatJSONObject = {
  type: "json_object"
}

export type ResponseFormatJSONSchema = {
  json_schema: JSONSchema
  type: "json_schema"
}

export type ResponseFormatText = {
  type: "text"
}

export type speaches__routers__speech__ResponseFormat =
  | "mp3"
  | "flac"
  | "wav"
  | "pcm"

export type speaches__routers__stt__ResponseFormat =
  | "text"
  | "json"
  | "verbose_json"
  | "srt"
  | "vtt"

export type SpeechTimestamp = {
  start: number
  end: number
}

export type TopLogprob = {
  token: string
  bytes?: Array<number> | null
  logprob: number
  [key: string]: unknown | string | number
}

export type TranscriptionSegment = {
  id: number
  seek: number
  start: number
  end: number
  text: string
  tokens: Array<number>
  temperature: number
  avg_logprob: number
  compression_ratio: number
  no_speech_prob: number
  words: Array<TranscriptionWord> | null
}

export type TranscriptionWord = {
  start: number
  end: number
  word: string
  probability: number
}

export type ValidationError = {
  loc: Array<string | number>
  msg: string
  type: string
}

export type TranslateFileV1AudioTranslationsPostData = {
  formData: Body_translate_file_v1_audio_translations_post
}

export type TranslateFileV1AudioTranslationsPostResponse =
  | string
  | CreateTranscriptionResponseJson
  | CreateTranscriptionResponseVerboseJson

export type TranscribeFileV1AudioTranscriptionsPostData = {
  formData: Body_transcribe_file_v1_audio_transcriptions_post
}

export type TranscribeFileV1AudioTranscriptionsPostResponse =
  | string
  | CreateTranscriptionResponseJson
  | CreateTranscriptionResponseVerboseJson

export type HandleCompletionsV1ChatCompletionsPostData = {
  requestBody: CompletionCreateParamsBase
}

export type HandleCompletionsV1ChatCompletionsPostResponse =
  | ChatCompletion
  | ChatCompletionChunk

export type HealthHealthGetResponse = unknown

export type GetRunningModelsApiPsGetResponse = {
  [key: string]: Array<string>
}

export type LoadModelRouteApiPsModelIdPostData = {
  modelId: string
}

export type LoadModelRouteApiPsModelIdPostResponse = unknown

export type StopRunningModelApiPsModelIdDeleteData = {
  modelId: string
}

export type StopRunningModelApiPsModelIdDeleteResponse = unknown

export type ListLocalModelsV1ModelsGetData = {
  task?: "automatic-speech-recognition" | "text-to-speech" | null
}

export type ListLocalModelsV1ModelsGetResponse = ListModelsResponse

export type GetLocalModelV1ModelsModelIdGetData = {
  modelId: string
}

export type GetLocalModelV1ModelsModelIdGetResponse = Model

export type DownloadRemoteModelV1ModelsModelIdPostData = {
  modelId: string
}

export type DownloadRemoteModelV1ModelsModelIdPostResponse = unknown

export type DeleteModelV1ModelsModelIdDeleteData = {
  modelId: string
}

export type DeleteModelV1ModelsModelIdDeleteResponse = unknown

export type GetRemoteModelsV1RegistryGetData = {
  task?: "automatic-speech-recognition" | "text-to-speech" | null
}

export type GetRemoteModelsV1RegistryGetResponse = ListModelsResponse

export type RealtimeWebrtcV1RealtimePostData = {
  model: string
}

export type RealtimeWebrtcV1RealtimePostResponse = unknown

export type SynthesizeV1AudioSpeechPostData = {
  requestBody: CreateSpeechRequestBody
}

export type SynthesizeV1AudioSpeechPostResponse = unknown

export type DetectSpeechTimestampsV1AudioSpeechTimestampsPostData = {
  formData: Body_detect_speech_timestamps_v1_audio_speech_timestamps_post
}

export type DetectSpeechTimestampsV1AudioSpeechTimestampsPostResponse =
  Array<SpeechTimestamp>
