mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
|
|
from pydantic import model_serializer
|
|
from typing import Literal, Union
|
|
from typing_extensions import TypedDict
|
|
|
|
|
|
ResetInterval = Union[
|
|
Literal[
|
|
"daily",
|
|
"weekly",
|
|
"monthly",
|
|
],
|
|
UnrecognizedStr,
|
|
]
|
|
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
|
|
|
|
|
class WorkspaceBudgetTypedDict(TypedDict):
|
|
created_at: str
|
|
r"""ISO 8601 timestamp of when the budget was created"""
|
|
id: str
|
|
r"""Unique identifier for the budget"""
|
|
limit_usd: float
|
|
r"""Spending limit in USD for this interval"""
|
|
reset_interval: Nullable[ResetInterval]
|
|
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
|
updated_at: str
|
|
r"""ISO 8601 timestamp of when the budget was last updated"""
|
|
workspace_id: str
|
|
r"""ID of the workspace the budget belongs to"""
|
|
|
|
|
|
class WorkspaceBudget(BaseModel):
|
|
created_at: str
|
|
r"""ISO 8601 timestamp of when the budget was created"""
|
|
|
|
id: str
|
|
r"""Unique identifier for the budget"""
|
|
|
|
limit_usd: float
|
|
r"""Spending limit in USD for this interval"""
|
|
|
|
reset_interval: Nullable[ResetInterval]
|
|
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
|
|
|
updated_at: str
|
|
r"""ISO 8601 timestamp of when the budget was last updated"""
|
|
|
|
workspace_id: str
|
|
r"""ID of the workspace the budget belongs to"""
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
serialized = handler(self)
|
|
m = {}
|
|
|
|
for n, f in type(self).model_fields.items():
|
|
k = f.alias or n
|
|
val = serialized.get(k, serialized.get(n))
|
|
|
|
if val != UNSET_SENTINEL:
|
|
m[k] = val
|
|
|
|
return m
|