# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .completion_tokens_details import CompletionTokensDetails
from .prompt_tokens_details import PromptTokensDetails


class Usage(UniversalBaseModel):
    total_tokens: typing.Optional[int] = None
    prompt_tokens: typing.Optional[int] = None
    prompt_tokens_details: typing.Optional[PromptTokensDetails] = None
    completion_tokens: typing.Optional[int] = None
    completion_tokens_details: typing.Optional[CompletionTokensDetails] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
