import datetime

from google.api import annotations_pb2 as _annotations_pb2
from google.api import field_behavior_pb2 as _field_behavior_pb2
from google.protobuf import struct_pb2 as _struct_pb2
from google.protobuf import timestamp_pb2 as _timestamp_pb2
from tars.auth.v1 import auth_options_pb2 as _auth_options_pb2
from tars.cli.v1 import cli_pb2 as _cli_pb2
from tars.docs.v1 import docs_pb2 as _docs_pb2
from google.protobuf.internal import containers as _containers
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union

DESCRIPTOR: _descriptor.FileDescriptor

class ListCustomerRequestLogsRequest(_message.Message):
    __slots__ = ("customer_id", "project_id", "api_key_id", "model_name", "status", "status_code", "start_time", "end_time", "min_duration_ms", "max_duration_ms", "page_size", "page_token", "order_by", "order_direction")
    CUSTOMER_ID_FIELD_NUMBER: _ClassVar[int]
    PROJECT_ID_FIELD_NUMBER: _ClassVar[int]
    API_KEY_ID_FIELD_NUMBER: _ClassVar[int]
    MODEL_NAME_FIELD_NUMBER: _ClassVar[int]
    STATUS_FIELD_NUMBER: _ClassVar[int]
    STATUS_CODE_FIELD_NUMBER: _ClassVar[int]
    START_TIME_FIELD_NUMBER: _ClassVar[int]
    END_TIME_FIELD_NUMBER: _ClassVar[int]
    MIN_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    MAX_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    PAGE_SIZE_FIELD_NUMBER: _ClassVar[int]
    PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]
    ORDER_BY_FIELD_NUMBER: _ClassVar[int]
    ORDER_DIRECTION_FIELD_NUMBER: _ClassVar[int]
    customer_id: str
    project_id: str
    api_key_id: str
    model_name: str
    status: str
    status_code: int
    start_time: _timestamp_pb2.Timestamp
    end_time: _timestamp_pb2.Timestamp
    min_duration_ms: int
    max_duration_ms: int
    page_size: int
    page_token: str
    order_by: str
    order_direction: str
    def __init__(self, customer_id: _Optional[str] = ..., project_id: _Optional[str] = ..., api_key_id: _Optional[str] = ..., model_name: _Optional[str] = ..., status: _Optional[str] = ..., status_code: _Optional[int] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., end_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., min_duration_ms: _Optional[int] = ..., max_duration_ms: _Optional[int] = ..., page_size: _Optional[int] = ..., page_token: _Optional[str] = ..., order_by: _Optional[str] = ..., order_direction: _Optional[str] = ...) -> None: ...

class ListCustomerRequestLogsResponse(_message.Message):
    __slots__ = ("logs", "next_page_token", "total_count")
    LOGS_FIELD_NUMBER: _ClassVar[int]
    NEXT_PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]
    TOTAL_COUNT_FIELD_NUMBER: _ClassVar[int]
    logs: _containers.RepeatedCompositeFieldContainer[RequestLog]
    next_page_token: str
    total_count: int
    def __init__(self, logs: _Optional[_Iterable[_Union[RequestLog, _Mapping]]] = ..., next_page_token: _Optional[str] = ..., total_count: _Optional[int] = ...) -> None: ...

class GetCustomerRequestLogRequest(_message.Message):
    __slots__ = ("customer_id", "project_id", "request_id")
    CUSTOMER_ID_FIELD_NUMBER: _ClassVar[int]
    PROJECT_ID_FIELD_NUMBER: _ClassVar[int]
    REQUEST_ID_FIELD_NUMBER: _ClassVar[int]
    customer_id: str
    project_id: str
    request_id: str
    def __init__(self, customer_id: _Optional[str] = ..., project_id: _Optional[str] = ..., request_id: _Optional[str] = ...) -> None: ...

class GetCustomerRequestLogStatsRequest(_message.Message):
    __slots__ = ("customer_id", "project_id", "model_name", "start_time", "end_time", "group_by", "metric")
    CUSTOMER_ID_FIELD_NUMBER: _ClassVar[int]
    PROJECT_ID_FIELD_NUMBER: _ClassVar[int]
    MODEL_NAME_FIELD_NUMBER: _ClassVar[int]
    START_TIME_FIELD_NUMBER: _ClassVar[int]
    END_TIME_FIELD_NUMBER: _ClassVar[int]
    GROUP_BY_FIELD_NUMBER: _ClassVar[int]
    METRIC_FIELD_NUMBER: _ClassVar[int]
    customer_id: str
    project_id: str
    model_name: str
    start_time: _timestamp_pb2.Timestamp
    end_time: _timestamp_pb2.Timestamp
    group_by: str
    metric: str
    def __init__(self, customer_id: _Optional[str] = ..., project_id: _Optional[str] = ..., model_name: _Optional[str] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., end_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., group_by: _Optional[str] = ..., metric: _Optional[str] = ...) -> None: ...

class QueryRequestLogsRequest(_message.Message):
    __slots__ = ("user_id", "api_key_id", "model_name", "status", "status_code", "start_time", "end_time", "min_duration_ms", "max_duration_ms", "page_size", "page_token", "order_by", "order_direction")
    USER_ID_FIELD_NUMBER: _ClassVar[int]
    API_KEY_ID_FIELD_NUMBER: _ClassVar[int]
    MODEL_NAME_FIELD_NUMBER: _ClassVar[int]
    STATUS_FIELD_NUMBER: _ClassVar[int]
    STATUS_CODE_FIELD_NUMBER: _ClassVar[int]
    START_TIME_FIELD_NUMBER: _ClassVar[int]
    END_TIME_FIELD_NUMBER: _ClassVar[int]
    MIN_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    MAX_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    PAGE_SIZE_FIELD_NUMBER: _ClassVar[int]
    PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]
    ORDER_BY_FIELD_NUMBER: _ClassVar[int]
    ORDER_DIRECTION_FIELD_NUMBER: _ClassVar[int]
    user_id: str
    api_key_id: str
    model_name: str
    status: str
    status_code: int
    start_time: _timestamp_pb2.Timestamp
    end_time: _timestamp_pb2.Timestamp
    min_duration_ms: int
    max_duration_ms: int
    page_size: int
    page_token: str
    order_by: str
    order_direction: str
    def __init__(self, user_id: _Optional[str] = ..., api_key_id: _Optional[str] = ..., model_name: _Optional[str] = ..., status: _Optional[str] = ..., status_code: _Optional[int] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., end_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., min_duration_ms: _Optional[int] = ..., max_duration_ms: _Optional[int] = ..., page_size: _Optional[int] = ..., page_token: _Optional[str] = ..., order_by: _Optional[str] = ..., order_direction: _Optional[str] = ...) -> None: ...

class QueryRequestLogsResponse(_message.Message):
    __slots__ = ("logs", "next_page_token", "total_count")
    LOGS_FIELD_NUMBER: _ClassVar[int]
    NEXT_PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]
    TOTAL_COUNT_FIELD_NUMBER: _ClassVar[int]
    logs: _containers.RepeatedCompositeFieldContainer[RequestLog]
    next_page_token: str
    total_count: int
    def __init__(self, logs: _Optional[_Iterable[_Union[RequestLog, _Mapping]]] = ..., next_page_token: _Optional[str] = ..., total_count: _Optional[int] = ...) -> None: ...

class GetRequestLogRequest(_message.Message):
    __slots__ = ("request_id",)
    REQUEST_ID_FIELD_NUMBER: _ClassVar[int]
    request_id: str
    def __init__(self, request_id: _Optional[str] = ...) -> None: ...

class RequestLog(_message.Message):
    __slots__ = ("id", "timestamp", "user_id", "api_key_id", "api_key_prefix", "api_key_hash", "api_key_address", "api_key_name", "model_name", "input_tokens", "output_tokens", "input_tokens_cost_microdollar", "input_tokens_cost", "input_tokens_cost_before_fee", "output_tokens_cost_microdollar", "output_tokens_cost", "output_tokens_cost_before_fee", "status", "status_code", "request_headers", "request_body", "response_headers", "response_body", "response_body_raw", "llm_parameters", "upstream_duration_ms", "duration_ms", "request_id", "created_at", "storage_location", "storage_row_index", "storage_batch_id", "use_object_storage", "cached_input_tokens", "cached_input_tokens_cost", "cached_input_tokens_cost_before_fee", "cache_creation_input_tokens", "cache_creation_input_tokens_cost", "cache_creation_input_tokens_cost_before_fee")
    ID_FIELD_NUMBER: _ClassVar[int]
    TIMESTAMP_FIELD_NUMBER: _ClassVar[int]
    USER_ID_FIELD_NUMBER: _ClassVar[int]
    API_KEY_ID_FIELD_NUMBER: _ClassVar[int]
    API_KEY_PREFIX_FIELD_NUMBER: _ClassVar[int]
    API_KEY_HASH_FIELD_NUMBER: _ClassVar[int]
    API_KEY_ADDRESS_FIELD_NUMBER: _ClassVar[int]
    API_KEY_NAME_FIELD_NUMBER: _ClassVar[int]
    MODEL_NAME_FIELD_NUMBER: _ClassVar[int]
    INPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    INPUT_TOKENS_COST_MICRODOLLAR_FIELD_NUMBER: _ClassVar[int]
    INPUT_TOKENS_COST_FIELD_NUMBER: _ClassVar[int]
    INPUT_TOKENS_COST_BEFORE_FEE_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_TOKENS_COST_MICRODOLLAR_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_TOKENS_COST_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_TOKENS_COST_BEFORE_FEE_FIELD_NUMBER: _ClassVar[int]
    STATUS_FIELD_NUMBER: _ClassVar[int]
    STATUS_CODE_FIELD_NUMBER: _ClassVar[int]
    REQUEST_HEADERS_FIELD_NUMBER: _ClassVar[int]
    REQUEST_BODY_FIELD_NUMBER: _ClassVar[int]
    RESPONSE_HEADERS_FIELD_NUMBER: _ClassVar[int]
    RESPONSE_BODY_FIELD_NUMBER: _ClassVar[int]
    RESPONSE_BODY_RAW_FIELD_NUMBER: _ClassVar[int]
    LLM_PARAMETERS_FIELD_NUMBER: _ClassVar[int]
    UPSTREAM_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    REQUEST_ID_FIELD_NUMBER: _ClassVar[int]
    CREATED_AT_FIELD_NUMBER: _ClassVar[int]
    STORAGE_LOCATION_FIELD_NUMBER: _ClassVar[int]
    STORAGE_ROW_INDEX_FIELD_NUMBER: _ClassVar[int]
    STORAGE_BATCH_ID_FIELD_NUMBER: _ClassVar[int]
    USE_OBJECT_STORAGE_FIELD_NUMBER: _ClassVar[int]
    CACHED_INPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    CACHED_INPUT_TOKENS_COST_FIELD_NUMBER: _ClassVar[int]
    CACHED_INPUT_TOKENS_COST_BEFORE_FEE_FIELD_NUMBER: _ClassVar[int]
    CACHE_CREATION_INPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    CACHE_CREATION_INPUT_TOKENS_COST_FIELD_NUMBER: _ClassVar[int]
    CACHE_CREATION_INPUT_TOKENS_COST_BEFORE_FEE_FIELD_NUMBER: _ClassVar[int]
    id: str
    timestamp: _timestamp_pb2.Timestamp
    user_id: str
    api_key_id: str
    api_key_prefix: str
    api_key_hash: str
    api_key_address: str
    api_key_name: str
    model_name: str
    input_tokens: int
    output_tokens: int
    input_tokens_cost_microdollar: int
    input_tokens_cost: str
    input_tokens_cost_before_fee: str
    output_tokens_cost_microdollar: int
    output_tokens_cost: str
    output_tokens_cost_before_fee: str
    status: str
    status_code: int
    request_headers: _struct_pb2.Struct
    request_body: _struct_pb2.Struct
    response_headers: _struct_pb2.Struct
    response_body: str
    response_body_raw: bytes
    llm_parameters: _struct_pb2.Struct
    upstream_duration_ms: int
    duration_ms: int
    request_id: str
    created_at: _timestamp_pb2.Timestamp
    storage_location: str
    storage_row_index: int
    storage_batch_id: str
    use_object_storage: bool
    cached_input_tokens: int
    cached_input_tokens_cost: str
    cached_input_tokens_cost_before_fee: str
    cache_creation_input_tokens: int
    cache_creation_input_tokens_cost: str
    cache_creation_input_tokens_cost_before_fee: str
    def __init__(self, id: _Optional[str] = ..., timestamp: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., user_id: _Optional[str] = ..., api_key_id: _Optional[str] = ..., api_key_prefix: _Optional[str] = ..., api_key_hash: _Optional[str] = ..., api_key_address: _Optional[str] = ..., api_key_name: _Optional[str] = ..., model_name: _Optional[str] = ..., input_tokens: _Optional[int] = ..., output_tokens: _Optional[int] = ..., input_tokens_cost_microdollar: _Optional[int] = ..., input_tokens_cost: _Optional[str] = ..., input_tokens_cost_before_fee: _Optional[str] = ..., output_tokens_cost_microdollar: _Optional[int] = ..., output_tokens_cost: _Optional[str] = ..., output_tokens_cost_before_fee: _Optional[str] = ..., status: _Optional[str] = ..., status_code: _Optional[int] = ..., request_headers: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., request_body: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., response_headers: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., response_body: _Optional[str] = ..., response_body_raw: _Optional[bytes] = ..., llm_parameters: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., upstream_duration_ms: _Optional[int] = ..., duration_ms: _Optional[int] = ..., request_id: _Optional[str] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., storage_location: _Optional[str] = ..., storage_row_index: _Optional[int] = ..., storage_batch_id: _Optional[str] = ..., use_object_storage: _Optional[bool] = ..., cached_input_tokens: _Optional[int] = ..., cached_input_tokens_cost: _Optional[str] = ..., cached_input_tokens_cost_before_fee: _Optional[str] = ..., cache_creation_input_tokens: _Optional[int] = ..., cache_creation_input_tokens_cost: _Optional[str] = ..., cache_creation_input_tokens_cost_before_fee: _Optional[str] = ...) -> None: ...

class GetRequestLogStatsRequest(_message.Message):
    __slots__ = ("user_id", "model_name", "start_time", "end_time", "group_by", "metric")
    USER_ID_FIELD_NUMBER: _ClassVar[int]
    MODEL_NAME_FIELD_NUMBER: _ClassVar[int]
    START_TIME_FIELD_NUMBER: _ClassVar[int]
    END_TIME_FIELD_NUMBER: _ClassVar[int]
    GROUP_BY_FIELD_NUMBER: _ClassVar[int]
    METRIC_FIELD_NUMBER: _ClassVar[int]
    user_id: str
    model_name: str
    start_time: _timestamp_pb2.Timestamp
    end_time: _timestamp_pb2.Timestamp
    group_by: str
    metric: str
    def __init__(self, user_id: _Optional[str] = ..., model_name: _Optional[str] = ..., start_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., end_time: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., group_by: _Optional[str] = ..., metric: _Optional[str] = ...) -> None: ...

class RequestLogStatsResponse(_message.Message):
    __slots__ = ("stats", "total_count", "total_input_tokens", "total_output_tokens", "total_cost", "avg_duration_ms", "error_count")
    STATS_FIELD_NUMBER: _ClassVar[int]
    TOTAL_COUNT_FIELD_NUMBER: _ClassVar[int]
    TOTAL_INPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    TOTAL_OUTPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    TOTAL_COST_FIELD_NUMBER: _ClassVar[int]
    AVG_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    ERROR_COUNT_FIELD_NUMBER: _ClassVar[int]
    stats: _containers.RepeatedCompositeFieldContainer[StatEntry]
    total_count: int
    total_input_tokens: int
    total_output_tokens: int
    total_cost: str
    avg_duration_ms: float
    error_count: int
    def __init__(self, stats: _Optional[_Iterable[_Union[StatEntry, _Mapping]]] = ..., total_count: _Optional[int] = ..., total_input_tokens: _Optional[int] = ..., total_output_tokens: _Optional[int] = ..., total_cost: _Optional[str] = ..., avg_duration_ms: _Optional[float] = ..., error_count: _Optional[int] = ...) -> None: ...

class StatEntry(_message.Message):
    __slots__ = ("key", "count", "error_count", "input_tokens", "output_tokens", "total_tokens", "cost", "cost_microdollar", "avg_duration_ms", "min_duration_ms", "max_duration_ms", "p50_duration_ms", "p95_duration_ms", "p99_duration_ms")
    KEY_FIELD_NUMBER: _ClassVar[int]
    COUNT_FIELD_NUMBER: _ClassVar[int]
    ERROR_COUNT_FIELD_NUMBER: _ClassVar[int]
    INPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    TOTAL_TOKENS_FIELD_NUMBER: _ClassVar[int]
    COST_FIELD_NUMBER: _ClassVar[int]
    COST_MICRODOLLAR_FIELD_NUMBER: _ClassVar[int]
    AVG_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    MIN_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    MAX_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    P50_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    P95_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    P99_DURATION_MS_FIELD_NUMBER: _ClassVar[int]
    key: str
    count: int
    error_count: int
    input_tokens: int
    output_tokens: int
    total_tokens: int
    cost: str
    cost_microdollar: int
    avg_duration_ms: int
    min_duration_ms: int
    max_duration_ms: int
    p50_duration_ms: int
    p95_duration_ms: int
    p99_duration_ms: int
    def __init__(self, key: _Optional[str] = ..., count: _Optional[int] = ..., error_count: _Optional[int] = ..., input_tokens: _Optional[int] = ..., output_tokens: _Optional[int] = ..., total_tokens: _Optional[int] = ..., cost: _Optional[str] = ..., cost_microdollar: _Optional[int] = ..., avg_duration_ms: _Optional[int] = ..., min_duration_ms: _Optional[int] = ..., max_duration_ms: _Optional[int] = ..., p50_duration_ms: _Optional[int] = ..., p95_duration_ms: _Optional[int] = ..., p99_duration_ms: _Optional[int] = ...) -> None: ...
