Skip to main content

gproxy_protocol/wire/openai/
voices.rs

1//! Custom voice creation, OpenAI reference verified 2026-10-20.
2use crate::{Rest, WireRequest, WireResponse};
3use serde::{Deserialize, Serialize};
4#[derive(
5    Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
6)]
7#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
8#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
9#[derive(gproxy_protocol_macros::WireBuilder)]
10pub struct CreatePromptVoiceRequestBody {
11    #[serde(rename = "type")]
12    pub type_: PromptVoiceType,
13    pub name: String,
14    pub prompt: String,
15    #[serde(default, skip_serializing_if = "Option::is_none")]
16    pub model: Option<String>,
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub script_hint: Option<String>,
19    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
20    pub rest: Rest,
21}
22
23#[derive(
24    Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
25)]
26#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
27#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
28#[serde(rename_all = "snake_case")]
29pub enum PromptVoiceType {
30    Prompt,
31}
32
33#[derive(
34    Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
35)]
36#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
37#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
38#[serde(rename_all = "snake_case")]
39pub enum VoiceSource {
40    Prompt,
41    AudioSample,
42}
43
44#[derive(
45    Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
46)]
47#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
48#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
49#[derive(gproxy_protocol_macros::WireBuilder)]
50pub struct Voice {
51    pub id: String,
52    pub created_at: u64,
53    pub name: String,
54    pub object: String,
55    #[serde(rename = "type")]
56    pub type_: VoiceSource,
57    #[serde(default, skip_serializing_if = "Option::is_none")]
58    pub prompt: Option<String>,
59    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
60    pub rest: Rest,
61}
62
63#[derive(Debug, gproxy_protocol_macros::WireBuilder, gproxy_protocol_macros::DeclaredFields)]
64#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
65#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
66pub struct CreateSampleVoiceMultipartForm {
67    pub name: String,
68    pub consent: String,
69    pub audio_sample: crate::connection::MultipartPart,
70    #[cfg_attr(feature = "schema", schemars(rename = "type"))]
71    pub type_: Option<VoiceSource>,
72}
73pub type CreatePromptVoiceRequest = WireRequest<CreatePromptVoiceRequestBody>;
74pub type CreateSampleVoiceRequest = WireRequest<CreateSampleVoiceMultipartForm>;
75pub type CreateVoiceResponse = WireResponse<Voice>;