"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from r9s.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class InputTokensDetailsTypedDict(TypedDict):
    r"""Details about input tokens"""

    cached_tokens: NotRequired[int]
    r"""Number of cached tokens"""


class InputTokensDetails(BaseModel):
    r"""Details about input tokens"""

    cached_tokens: Optional[int] = None
    r"""Number of cached tokens"""


class OutputTokensDetailsTypedDict(TypedDict):
    r"""Details about output tokens"""

    reasoning_tokens: NotRequired[int]
    r"""Number of reasoning tokens"""


class OutputTokensDetails(BaseModel):
    r"""Details about output tokens"""

    reasoning_tokens: Optional[int] = None
    r"""Number of reasoning tokens"""


class ResponseUsageTypedDict(TypedDict):
    input_tokens: int
    r"""Number of tokens in the input"""
    output_tokens: int
    r"""Number of tokens in the output"""
    total_tokens: int
    r"""Total number of tokens (input + output)"""
    input_tokens_details: NotRequired[InputTokensDetailsTypedDict]
    r"""Details about input tokens"""
    output_tokens_details: NotRequired[OutputTokensDetailsTypedDict]
    r"""Details about output tokens"""


class ResponseUsage(BaseModel):
    input_tokens: int
    r"""Number of tokens in the input"""

    output_tokens: int
    r"""Number of tokens in the output"""

    total_tokens: int
    r"""Total number of tokens (input + output)"""

    input_tokens_details: Optional[InputTokensDetails] = None
    r"""Details about input tokens"""

    output_tokens_details: Optional[OutputTokensDetails] = None
    r"""Details about output tokens"""
