# generated by datamodel-codegen:
#   filename:  tmp.MShrZT1AJJ.yml
#   timestamp: 2026-01-17T22:35:25+00:00

from typing import Any, Literal, NotRequired, TypedDict


class ChatCompletionFunctionCallOption(TypedDict):
    """
    Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.

    """

    name: str


class UrlCitation(TypedDict):
    """
    A URL citation when using web search.
    """

    end_index: int
    start_index: int
    url: str
    title: str


class Annotation(TypedDict):
    """
    A URL citation when using web search.

    """

    type: Literal["url_citation"]
    url_citation: UrlCitation


class FunctionCall(TypedDict):
    """
    Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
    """

    arguments: str
    name: str


class Audio1(TypedDict):
    """
    If the audio output modality is requested, this object contains data
    about the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).

    """

    id: str
    expires_at: int
    data: str
    transcript: str


class ChatCompletionStreamOptions1(TypedDict):
    """
    Options for streaming response. Only set this when you set `stream: true`.

    """

    include_usage: NotRequired[bool]
    include_obfuscation: NotRequired[bool]


class FunctionCall1(TypedDict):
    """
    Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
    """

    arguments: NotRequired[str]
    name: NotRequired[str]


class TopLogprob(TypedDict):
    token: str
    logprob: float
    bytes: list[int] | None


class ChatCompletionTokenLogprob(TypedDict):
    token: str
    logprob: float
    bytes: list[int] | None
    top_logprobs: list[TopLogprob]


class CompletionTokensDetails(TypedDict):
    """
    Breakdown of tokens used in a completion.
    """

    accepted_prediction_tokens: NotRequired[int]
    audio_tokens: NotRequired[int]
    reasoning_tokens: NotRequired[int]
    rejected_prediction_tokens: NotRequired[int]


class PromptTokensDetails(TypedDict):
    """
    Breakdown of tokens used in the prompt.
    """

    audio_tokens: NotRequired[int]
    cached_tokens: NotRequired[int]


class CompletionUsage(TypedDict):
    """
    Usage statistics for the completion request.
    """

    completion_tokens: int
    prompt_tokens: int
    total_tokens: int
    completion_tokens_details: NotRequired[CompletionTokensDetails]
    prompt_tokens_details: NotRequired[PromptTokensDetails]


class Format(TypedDict, closed=True):
    """
    Unconstrained free-form text.
    """

    type: Literal["text"]


class Grammar(TypedDict):
    """
    Your chosen grammar.
    """

    definition: str
    syntax: Literal["lark", "regex"]


class Format1(TypedDict, closed=True):
    """
    A grammar defined by the user.
    """

    type: Literal["grammar"]
    grammar: Grammar


class Custom(TypedDict):
    """
    Properties of the custom tool.

    """

    name: str
    description: NotRequired[str]
    format: NotRequired[Format | Format1]


class CustomToolChatCompletions(TypedDict):
    """
    A custom tool that processes input using a specified format.

    """

    type: Literal["custom"]
    custom: Custom


class ResponseFormatJsonObject(TypedDict):
    """
    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    """

    type: Literal["json_object"]


class ResponseFormatText(TypedDict):
    """
    Default response format. Used to generate text responses.

    """

    type: Literal["text"]


class WebSearchLocation(TypedDict):
    """
    Approximate location parameters for the search.
    """

    country: NotRequired[str]
    region: NotRequired[str]
    city: NotRequired[str]
    timezone: NotRequired[str]


class Function(TypedDict):
    name: NotRequired[str]
    arguments: NotRequired[str]


class ChatCompletionMessageToolCallChunk(TypedDict):
    index: int
    id: NotRequired[str]
    type: NotRequired[Literal["function"]]
    function: NotRequired[Function]


class Function1(TypedDict):
    name: str


class ChatCompletionNamedToolChoice(TypedDict):
    """
    Specifies a tool the model should use. Use to force the model to call a specific function.
    """

    type: Literal["function"]
    function: Function1


class Custom1(TypedDict):
    name: str


class ChatCompletionNamedToolChoiceCustom(TypedDict):
    """
    Specifies a tool the model should use. Use to force the model to call a specific custom tool.
    """

    type: Literal["custom"]
    custom: Custom1


class Audio2(TypedDict):
    """
    Data about a previous audio response from the model.
    [Learn more](https://platform.openai.com/docs/guides/audio).

    """

    id: str


class FunctionCall2(TypedDict):
    """
    Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
    """

    arguments: str
    name: str


class ChatCompletionRequestFunctionMessage(TypedDict):
    role: Literal["function"]
    content: str | None
    name: str


class ChatCompletionRequestMessageContentPartText(TypedDict):
    """
    Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).

    """

    type: Literal["text"]
    text: str


class FunctionParameters(TypedDict):
    """
    The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

    Omitting `parameters` defines a function with an empty parameter list.
    """


class ResponseFormatJsonSchemaSchema(TypedDict):
    """
    The schema for the response format, described as a JSON Schema object.
    Learn how to build JSON schemas [here](https://json-schema.org/).

    """


class ChatCompletionAllowedTools(TypedDict):
    """
    Constrains the tools available to the model to a pre-defined set.

    """

    mode: Literal["auto", "required"]
    tools: list[dict[str, Any]]


class Custom2(TypedDict):
    """
    The custom tool that the model called.
    """

    name: str
    input: str


class ChatCompletionMessageCustomToolCall(TypedDict):
    """
    A call to a custom tool created by the model.

    """

    id: str
    type: Literal["custom"]
    custom: Custom2


class Function2(TypedDict):
    """
    The function that the model called.
    """

    name: str
    arguments: str


class ChatCompletionMessageToolCall(TypedDict):
    """
    A call to a function tool created by the model.

    """

    id: str
    type: Literal["function"]
    function: Function2


type ChatCompletionRequestSystemMessageContentPart = (
    ChatCompletionRequestMessageContentPartText
)


type ChatCompletionRequestToolMessageContentPart = (
    ChatCompletionRequestMessageContentPartText
)


type Metadata = dict[str, str] | None


class InputAudio(TypedDict):
    data: str
    format: Literal["wav", "mp3"]


class ChatCompletionRequestMessageContentPartAudio(TypedDict):
    """
    Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).

    """

    type: Literal["input_audio"]
    input_audio: InputAudio


class File(TypedDict):
    filename: NotRequired[str]
    file_data: NotRequired[str]
    file_id: NotRequired[str]


class ChatCompletionRequestMessageContentPartFile(TypedDict):
    """
    Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text generation.

    """

    type: Literal["file"]
    file: File


class ImageUrl(TypedDict):
    url: str
    detail: NotRequired[Literal["auto", "low", "high"]]


class ChatCompletionRequestMessageContentPartImage(TypedDict):
    """
    Learn about [image inputs](https://platform.openai.com/docs/guides/vision).

    """

    type: Literal["image_url"]
    image_url: ImageUrl


class ChatCompletionRequestMessageContentPartRefusal(TypedDict):
    type: Literal["refusal"]
    refusal: str


class UserLocation(TypedDict):
    """
    Approximate location parameters for the search.

    """

    type: Literal["approximate"]
    approximate: WebSearchLocation


class WebSearchOptions(TypedDict):
    """
    This tool searches the web for relevant results to use in a response.
    Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).

    """

    user_location: NotRequired[UserLocation]
    search_context_size: NotRequired[Literal["low", "medium", "high"]]


class Audio(TypedDict):
    """
    Parameters for audio output. Required when audio output is requested with
    `modalities: ["audio"]`. [Learn more](https://platform.openai.com/docs/guides/audio).

    """

    voice: (
        str
        | Literal[
            "alloy",
            "ash",
            "ballad",
            "coral",
            "echo",
            "sage",
            "shimmer",
            "verse",
            "marin",
            "cedar",
        ]
    )
    format: Literal["wav", "aac", "mp3", "flac", "opus", "pcm16"]


class Logprobs(TypedDict):
    """
    Log probability information for the choice.
    """

    content: list[ChatCompletionTokenLogprob] | None
    refusal: list[ChatCompletionTokenLogprob] | None


class Logprobs1(TypedDict):
    """
    Log probability information for the choice.
    """

    content: list[ChatCompletionTokenLogprob]
    refusal: list[ChatCompletionTokenLogprob]


class ChatCompletionFunctions(TypedDict):
    description: NotRequired[str]
    name: str
    parameters: NotRequired[FunctionParameters]


class ChatCompletionStreamResponseDelta(TypedDict):
    """
    A chat completion delta generated by streamed model responses.
    """

    content: NotRequired[str | None]
    function_call: NotRequired[FunctionCall1]
    tool_calls: NotRequired[list[ChatCompletionMessageToolCallChunk]]
    role: NotRequired[Literal["developer", "system", "user", "assistant", "tool"]]
    refusal: NotRequired[str | None]


class PredictionContent(TypedDict):
    """
    Static predicted output content, such as the content of a text file that is
    being regenerated.

    """

    type: Literal["content"]
    content: str | list[ChatCompletionRequestMessageContentPartText]


class JsonSchema(TypedDict):
    """
    Structured Outputs configuration options, including a JSON Schema.

    """

    description: NotRequired[str]
    name: str
    schema: NotRequired[ResponseFormatJsonSchemaSchema]
    strict: NotRequired[bool | None]


class ResponseFormatJsonSchema(TypedDict):
    """
    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

    """

    type: Literal["json_schema"]
    json_schema: JsonSchema


class ChatCompletionAllowedToolsChoice(TypedDict):
    """
    Constrains the tools available to the model to a pre-defined set.

    """

    type: Literal["allowed_tools"]
    allowed_tools: ChatCompletionAllowedTools


class ChatCompletionRequestDeveloperMessage(TypedDict):
    """
    Developer-provided instructions that the model should follow, regardless of
    messages sent by the user. With o1 models and newer, `developer` messages
    replace the previous `system` messages.

    """

    content: str | list[ChatCompletionRequestMessageContentPartText]
    role: Literal["developer"]
    name: NotRequired[str]


class ChatCompletionRequestSystemMessage(TypedDict):
    """
    Developer-provided instructions that the model should follow, regardless of
    messages sent by the user. With o1 models and newer, use `developer` messages
    for this purpose instead.

    """

    content: str | list[ChatCompletionRequestSystemMessageContentPart]
    role: Literal["system"]
    name: NotRequired[str]


class ChatCompletionRequestToolMessage(TypedDict):
    role: Literal["tool"]
    content: str | list[ChatCompletionRequestToolMessageContentPart]
    tool_call_id: str


class FunctionObject(TypedDict):
    description: NotRequired[str]
    name: str
    parameters: NotRequired[FunctionParameters]
    strict: NotRequired[bool | None]


class ModelResponseProperties(TypedDict):
    metadata: NotRequired[dict[str, str] | None]
    top_logprobs: NotRequired[int | None]
    temperature: NotRequired[float | None]
    top_p: NotRequired[float | None]
    user: NotRequired[str]
    safety_identifier: NotRequired[str]
    prompt_cache_key: NotRequired[str]
    service_tier: NotRequired[
        Literal["auto", "default", "flex", "scale", "priority"] | None
    ]
    prompt_cache_retention: NotRequired[Literal["in-memory", "24h"] | None]


class Choice1(TypedDict):
    delta: ChatCompletionStreamResponseDelta
    logprobs: NotRequired[Logprobs1]
    finish_reason: Literal[
        "stop", "length", "tool_calls", "content_filter", "function_call"
    ]
    index: int


class CreateChatCompletionStreamResponse(TypedDict):
    """
    Represents a streamed chunk of a chat completion response returned
    by the model, based on the provided input.
    [Learn more](https://platform.openai.com/docs/guides/streaming-responses).

    """

    id: str
    choices: list[Choice1]
    created: int
    model: str
    service_tier: NotRequired[
        Literal["auto", "default", "flex", "scale", "priority"] | None
    ]
    system_fingerprint: NotRequired[str]
    object: Literal["chat.completion.chunk"]
    usage: NotRequired[CompletionUsage]


class ChatCompletionResponseMessage(TypedDict):
    """
    A chat completion message generated by the model.
    """

    content: str | None
    refusal: str | None
    tool_calls: NotRequired[
        list[ChatCompletionMessageToolCall | ChatCompletionMessageCustomToolCall]
    ]
    annotations: NotRequired[list[Annotation]]
    role: Literal["assistant"]
    function_call: NotRequired[FunctionCall]
    audio: NotRequired[Audio1 | None]


class ChatCompletionTool(TypedDict):
    """
    A function tool that can be used to generate a response.

    """

    type: Literal["function"]
    function: FunctionObject


class CreateModelResponseProperties(ModelResponseProperties):
    top_logprobs: NotRequired[int | None]


class ChatCompletionRequestAssistantMessage(TypedDict):
    """
    Messages sent by the model in response to user messages.

    """

    content: NotRequired[
        str
        | list[
            ChatCompletionRequestMessageContentPartText
            | ChatCompletionRequestMessageContentPartRefusal
        ]
        | None
    ]
    refusal: NotRequired[str | None]
    role: Literal["assistant"]
    name: NotRequired[str]
    audio: NotRequired[Audio2 | None]
    tool_calls: NotRequired[
        list[ChatCompletionMessageToolCall | ChatCompletionMessageCustomToolCall]
    ]
    function_call: NotRequired[FunctionCall2 | None]


class ChatCompletionRequestUserMessage(TypedDict):
    """
    Messages sent by an end user, containing prompts or additional context
    information.

    """

    content: (
        str
        | list[
            ChatCompletionRequestMessageContentPartText
            | ChatCompletionRequestMessageContentPartImage
            | ChatCompletionRequestMessageContentPartAudio
            | ChatCompletionRequestMessageContentPartFile
        ]
    )
    role: Literal["user"]
    name: NotRequired[str]


class Choice(TypedDict):
    finish_reason: Literal[
        "stop", "length", "tool_calls", "content_filter", "function_call"
    ]
    index: int
    message: ChatCompletionResponseMessage
    logprobs: Logprobs | None


class CreateChatCompletionResponse(TypedDict):
    """
    Represents a chat completion response returned by model, based on the provided input.
    """

    id: str
    choices: list[Choice]
    created: int
    model: str
    service_tier: NotRequired[
        Literal["auto", "default", "flex", "scale", "priority"] | None
    ]
    system_fingerprint: NotRequired[str]
    object: Literal["chat.completion"]
    usage: NotRequired[CompletionUsage]


class ChatCompletionList(TypedDict):
    """
    An object representing a list of Chat Completions.

    """

    object: Literal["list"]
    data: list[CreateChatCompletionResponse]
    first_id: str
    last_id: str
    has_more: bool


class CreateChatCompletionRequest(CreateModelResponseProperties):
    messages: list[
        ChatCompletionRequestDeveloperMessage
        | ChatCompletionRequestSystemMessage
        | ChatCompletionRequestUserMessage
        | ChatCompletionRequestAssistantMessage
        | ChatCompletionRequestToolMessage
        | ChatCompletionRequestFunctionMessage
    ]
    model: (
        str
        | Literal[
            "gpt-5.2",
            "gpt-5.2-2025-12-11",
            "gpt-5.2-chat-latest",
            "gpt-5.2-pro",
            "gpt-5.2-pro-2025-12-11",
            "gpt-5.1",
            "gpt-5.1-2025-11-13",
            "gpt-5.1-codex",
            "gpt-5.1-mini",
            "gpt-5.1-chat-latest",
            "gpt-5",
            "gpt-5-mini",
            "gpt-5-nano",
            "gpt-5-2025-08-07",
            "gpt-5-mini-2025-08-07",
            "gpt-5-nano-2025-08-07",
            "gpt-5-chat-latest",
            "gpt-4.1",
            "gpt-4.1-mini",
            "gpt-4.1-nano",
            "gpt-4.1-2025-04-14",
            "gpt-4.1-mini-2025-04-14",
            "gpt-4.1-nano-2025-04-14",
            "o4-mini",
            "o4-mini-2025-04-16",
            "o3",
            "o3-2025-04-16",
            "o3-mini",
            "o3-mini-2025-01-31",
            "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-audio-preview-2025-06-03",
            "gpt-4o-mini-audio-preview",
            "gpt-4o-mini-audio-preview-2024-12-17",
            "gpt-4o-search-preview",
            "gpt-4o-mini-search-preview",
            "gpt-4o-search-preview-2025-03-11",
            "gpt-4o-mini-search-preview-2025-03-11",
            "chatgpt-4o-latest",
            "codex-mini-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",
        ]
    )
    modalities: NotRequired[list[Literal["text", "audio"]] | None]
    verbosity: NotRequired[Literal["low", "medium", "high"] | None]
    reasoning_effort: NotRequired[
        Literal["none", "minimal", "low", "medium", "high", "xhigh"] | None
    ]
    max_completion_tokens: NotRequired[int]
    frequency_penalty: NotRequired[float]
    presence_penalty: NotRequired[float]
    web_search_options: NotRequired[WebSearchOptions]
    top_logprobs: NotRequired[int | None]
    response_format: NotRequired[
        ResponseFormatText | ResponseFormatJsonSchema | ResponseFormatJsonObject
    ]
    audio: NotRequired[Audio]
    store: NotRequired[bool]
    stream: NotRequired[bool]
    stop: NotRequired[str | list[str]]
    logit_bias: NotRequired[dict[str, int]]
    logprobs: NotRequired[bool]
    max_tokens: NotRequired[int]
    n: NotRequired[int]
    prediction: NotRequired[PredictionContent]
    seed: NotRequired[int]
    stream_options: NotRequired[ChatCompletionStreamOptions1 | None]
    tools: NotRequired[list[ChatCompletionTool | CustomToolChatCompletions]]
    tool_choice: NotRequired[
        Literal["none", "auto", "required"]
        | ChatCompletionAllowedToolsChoice
        | ChatCompletionNamedToolChoice
        | ChatCompletionNamedToolChoiceCustom
    ]
    parallel_tool_calls: NotRequired[bool]
    function_call: NotRequired[
        Literal["none", "auto"] | ChatCompletionFunctionCallOption
    ]
    functions: NotRequired[list[ChatCompletionFunctions]]
