This commit is contained in:
Matt Apperson
2025-11-13 14:21:27 -05:00
parent d13e797ad1
commit 94ba44c933
795 changed files with 5179 additions and 4513 deletions
File diff suppressed because it is too large Load Diff
-66
View File
@@ -1,66 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
import pydantic
from typing_extensions import Annotated, TypedDict
class ActivityItemTypedDict(TypedDict):
date_: str
r"""Date of the activity (YYYY-MM-DD format)"""
model: str
r"""Model slug (e.g., \"openai/gpt-4.1\")"""
model_permaslug: str
r"""Model permaslug (e.g., \"openai/gpt-4.1-2025-04-14\")"""
endpoint_id: str
r"""Unique identifier for the endpoint"""
provider_name: str
r"""Name of the provider serving this endpoint"""
usage: float
r"""Total cost in USD (OpenRouter credits spent)"""
byok_usage_inference: float
r"""BYOK inference cost in USD (external credits spent)"""
requests: float
r"""Number of requests made"""
prompt_tokens: float
r"""Total prompt tokens used"""
completion_tokens: float
r"""Total completion tokens generated"""
reasoning_tokens: float
r"""Total reasoning tokens used"""
class ActivityItem(BaseModel):
date_: Annotated[str, pydantic.Field(alias="date")]
r"""Date of the activity (YYYY-MM-DD format)"""
model: str
r"""Model slug (e.g., \"openai/gpt-4.1\")"""
model_permaslug: str
r"""Model permaslug (e.g., \"openai/gpt-4.1-2025-04-14\")"""
endpoint_id: str
r"""Unique identifier for the endpoint"""
provider_name: str
r"""Name of the provider serving this endpoint"""
usage: float
r"""Total cost in USD (OpenRouter credits spent)"""
byok_usage_inference: float
r"""BYOK inference cost in USD (external credits spent)"""
requests: float
r"""Number of requests made"""
prompt_tokens: float
r"""Total prompt tokens used"""
completion_tokens: float
r"""Total completion tokens generated"""
reasoning_tokens: float
r"""Total reasoning tokens used"""
-88
View File
@@ -1,88 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatmessagecontentitem import (
ChatMessageContentItem,
ChatMessageContentItemTypedDict,
)
from .chatmessagetoolcall import ChatMessageToolCall, ChatMessageToolCallTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
AssistantMessageContentTypedDict = TypeAliasType(
"AssistantMessageContentTypedDict",
Union[str, List[ChatMessageContentItemTypedDict]],
)
AssistantMessageContent = TypeAliasType(
"AssistantMessageContent", Union[str, List[ChatMessageContentItem]]
)
class AssistantMessageTypedDict(TypedDict):
role: Literal["assistant"]
content: NotRequired[Nullable[AssistantMessageContentTypedDict]]
name: NotRequired[str]
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
refusal: NotRequired[Nullable[str]]
reasoning: NotRequired[Nullable[str]]
class AssistantMessage(BaseModel):
ROLE: Annotated[
Annotated[Literal["assistant"], AfterValidator(validate_const("assistant"))],
pydantic.Field(alias="role"),
] = "assistant"
content: OptionalNullable[AssistantMessageContent] = UNSET
name: Optional[str] = None
tool_calls: Optional[List[ChatMessageToolCall]] = None
refusal: OptionalNullable[str] = UNSET
reasoning: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["content", "name", "tool_calls", "refusal", "reasoning"]
nullable_fields = ["content", "refusal", "reasoning"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class BadGatewayResponseErrorDataTypedDict(TypedDict):
r"""Error data for BadGatewayResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class BadGatewayResponseErrorData(BaseModel):
r"""Error data for BadGatewayResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class BadRequestResponseErrorDataTypedDict(TypedDict):
r"""Error data for BadRequestResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class BadRequestResponseErrorData(BaseModel):
r"""Error data for BadRequestResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,17 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ChatCompletionFinishReason = Union[
Literal[
"tool_calls",
"stop",
"length",
"content_filter",
"error",
],
UnrecognizedStr,
]
-66
View File
@@ -1,66 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
CodeTypedDict = TypeAliasType("CodeTypedDict", Union[str, float])
Code = TypeAliasType("Code", Union[str, float])
class ChatErrorErrorTypedDict(TypedDict):
code: Nullable[CodeTypedDict]
message: str
param: NotRequired[Nullable[str]]
type: NotRequired[Nullable[str]]
class ChatErrorError(BaseModel):
code: Nullable[Code]
message: str
param: OptionalNullable[str] = UNSET
type: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["param", "type"]
nullable_fields = ["code", "param", "type"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,291 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .message import Message, MessageTypedDict
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
from .responseformatjsonschema import (
ResponseFormatJSONSchema,
ResponseFormatJSONSchemaTypedDict,
)
from .responseformattextgrammar import (
ResponseFormatTextGrammar,
ResponseFormatTextGrammarTypedDict,
)
from .tooldefinitionjson import ToolDefinitionJSON, ToolDefinitionJSONTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_const, validate_open_enum
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Effort = Union[
Literal[
"minimal",
"low",
"medium",
"high",
],
UnrecognizedStr,
]
class ReasoningTypedDict(TypedDict):
effort: NotRequired[Nullable[Effort]]
summary: NotRequired[Nullable[ReasoningSummaryVerbosity]]
class Reasoning(BaseModel):
effort: Annotated[
OptionalNullable[Effort], PlainValidator(validate_open_enum(False))
] = UNSET
summary: Annotated[
OptionalNullable[ReasoningSummaryVerbosity],
PlainValidator(validate_open_enum(False)),
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["effort", "summary"]
nullable_fields = ["effort", "summary"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ChatGenerationParamsResponseFormatPythonTypedDict(TypedDict):
type: Literal["python"]
class ChatGenerationParamsResponseFormatPython(BaseModel):
TYPE: Annotated[
Annotated[Literal["python"], AfterValidator(validate_const("python"))],
pydantic.Field(alias="type"),
] = "python"
class ChatGenerationParamsResponseFormatJSONObjectTypedDict(TypedDict):
type: Literal["json_object"]
class ChatGenerationParamsResponseFormatJSONObject(BaseModel):
TYPE: Annotated[
Annotated[
Literal["json_object"], AfterValidator(validate_const("json_object"))
],
pydantic.Field(alias="type"),
] = "json_object"
class ChatGenerationParamsResponseFormatTextTypedDict(TypedDict):
type: Literal["text"]
class ChatGenerationParamsResponseFormatText(BaseModel):
TYPE: Annotated[
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
pydantic.Field(alias="type"),
] = "text"
ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
"ChatGenerationParamsResponseFormatUnionTypedDict",
Union[
ChatGenerationParamsResponseFormatTextTypedDict,
ChatGenerationParamsResponseFormatJSONObjectTypedDict,
ChatGenerationParamsResponseFormatPythonTypedDict,
ResponseFormatJSONSchemaTypedDict,
ResponseFormatTextGrammarTypedDict,
],
)
ChatGenerationParamsResponseFormatUnion = TypeAliasType(
"ChatGenerationParamsResponseFormatUnion",
Union[
ChatGenerationParamsResponseFormatText,
ChatGenerationParamsResponseFormatJSONObject,
ChatGenerationParamsResponseFormatPython,
ResponseFormatJSONSchema,
ResponseFormatTextGrammar,
],
)
ChatGenerationParamsStopTypedDict = TypeAliasType(
"ChatGenerationParamsStopTypedDict", Union[str, List[str]]
)
ChatGenerationParamsStop = TypeAliasType(
"ChatGenerationParamsStop", Union[str, List[str]]
)
class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict]
model: NotRequired[str]
models: NotRequired[List[str]]
frequency_penalty: NotRequired[Nullable[float]]
logit_bias: NotRequired[Nullable[Dict[str, float]]]
logprobs: NotRequired[Nullable[bool]]
top_logprobs: NotRequired[Nullable[float]]
max_completion_tokens: NotRequired[Nullable[float]]
max_tokens: NotRequired[Nullable[float]]
metadata: NotRequired[Dict[str, str]]
presence_penalty: NotRequired[Nullable[float]]
reasoning: NotRequired[ReasoningTypedDict]
response_format: NotRequired[ChatGenerationParamsResponseFormatUnionTypedDict]
seed: NotRequired[Nullable[int]]
stop: NotRequired[Nullable[ChatGenerationParamsStopTypedDict]]
stream: NotRequired[bool]
stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]]
temperature: NotRequired[Nullable[float]]
tool_choice: NotRequired[Any]
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]]
user: NotRequired[str]
class ChatGenerationParams(BaseModel):
messages: List[Message]
model: Optional[str] = None
models: Optional[List[str]] = None
frequency_penalty: OptionalNullable[float] = UNSET
logit_bias: OptionalNullable[Dict[str, float]] = UNSET
logprobs: OptionalNullable[bool] = UNSET
top_logprobs: OptionalNullable[float] = UNSET
max_completion_tokens: OptionalNullable[float] = UNSET
max_tokens: OptionalNullable[float] = UNSET
metadata: Optional[Dict[str, str]] = None
presence_penalty: OptionalNullable[float] = UNSET
reasoning: Optional[Reasoning] = None
response_format: Optional[ChatGenerationParamsResponseFormatUnion] = None
seed: OptionalNullable[int] = UNSET
stop: OptionalNullable[ChatGenerationParamsStop] = UNSET
stream: Optional[bool] = False
stream_options: OptionalNullable[ChatStreamOptions] = UNSET
temperature: OptionalNullable[float] = UNSET
tool_choice: Optional[Any] = None
tools: Optional[List[ToolDefinitionJSON]] = None
top_p: OptionalNullable[float] = UNSET
user: Optional[str] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"model",
"models",
"frequency_penalty",
"logit_bias",
"logprobs",
"top_logprobs",
"max_completion_tokens",
"max_tokens",
"metadata",
"presence_penalty",
"reasoning",
"response_format",
"seed",
"stop",
"stream",
"stream_options",
"temperature",
"tool_choice",
"tools",
"top_p",
"user",
]
nullable_fields = [
"frequency_penalty",
"logit_bias",
"logprobs",
"top_logprobs",
"max_completion_tokens",
"max_tokens",
"presence_penalty",
"seed",
"stop",
"stream_options",
"temperature",
"top_p",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,134 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
class CompletionTokensDetailsTypedDict(TypedDict):
reasoning_tokens: NotRequired[Nullable[float]]
audio_tokens: NotRequired[Nullable[float]]
accepted_prediction_tokens: NotRequired[Nullable[float]]
rejected_prediction_tokens: NotRequired[Nullable[float]]
class CompletionTokensDetails(BaseModel):
reasoning_tokens: OptionalNullable[float] = UNSET
audio_tokens: OptionalNullable[float] = UNSET
accepted_prediction_tokens: OptionalNullable[float] = UNSET
rejected_prediction_tokens: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"reasoning_tokens",
"audio_tokens",
"accepted_prediction_tokens",
"rejected_prediction_tokens",
]
nullable_fields = [
"reasoning_tokens",
"audio_tokens",
"accepted_prediction_tokens",
"rejected_prediction_tokens",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class PromptTokensDetailsTypedDict(TypedDict):
cached_tokens: NotRequired[float]
audio_tokens: NotRequired[float]
video_tokens: NotRequired[float]
class PromptTokensDetails(BaseModel):
cached_tokens: Optional[float] = None
audio_tokens: Optional[float] = None
video_tokens: Optional[float] = None
class ChatGenerationTokenUsageTypedDict(TypedDict):
completion_tokens: float
prompt_tokens: float
total_tokens: float
completion_tokens_details: NotRequired[Nullable[CompletionTokensDetailsTypedDict]]
prompt_tokens_details: NotRequired[Nullable[PromptTokensDetailsTypedDict]]
class ChatGenerationTokenUsage(BaseModel):
completion_tokens: float
prompt_tokens: float
total_tokens: float
completion_tokens_details: OptionalNullable[CompletionTokensDetails] = UNSET
prompt_tokens_details: OptionalNullable[PromptTokensDetails] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["completion_tokens_details", "prompt_tokens_details"]
nullable_fields = ["completion_tokens_details", "prompt_tokens_details"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,45 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio,
ChatMessageContentItemAudioTypedDict,
)
from .chatmessagecontentitemimage import (
ChatMessageContentItemImage,
ChatMessageContentItemImageTypedDict,
)
from .chatmessagecontentitemtext import (
ChatMessageContentItemText,
ChatMessageContentItemTextTypedDict,
)
from .chatmessagecontentitemvideo import (
ChatMessageContentItemVideo,
ChatMessageContentItemVideoTypedDict,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType
ChatMessageContentItemTypedDict = TypeAliasType(
"ChatMessageContentItemTypedDict",
Union[
ChatMessageContentItemTextTypedDict,
ChatMessageContentItemImageTypedDict,
ChatMessageContentItemAudioTypedDict,
ChatMessageContentItemVideoTypedDict,
],
)
ChatMessageContentItem = Annotated[
Union[
Annotated[ChatMessageContentItemText, Tag("text")],
Annotated[ChatMessageContentItemImage, Tag("image_url")],
Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
Annotated[ChatMessageContentItemVideo, Tag("input_video")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -1,55 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_const, validate_open_enum
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
ChatMessageContentItemAudioFormat = Union[
Literal[
"wav",
"mp3",
"flac",
"m4a",
"ogg",
"pcm16",
"pcm24",
],
UnrecognizedStr,
]
class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
data: str
format_: ChatMessageContentItemAudioFormat
class ChatMessageContentItemAudioInputAudio(BaseModel):
data: str
format_: Annotated[
Annotated[
ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"),
]
class ChatMessageContentItemAudioTypedDict(TypedDict):
input_audio: ChatMessageContentItemAudioInputAudioTypedDict
type: Literal["input_audio"]
class ChatMessageContentItemAudio(BaseModel):
input_audio: ChatMessageContentItemAudioInputAudio
TYPE: Annotated[
Annotated[
Literal["input_audio"], AfterValidator(validate_const("input_audio"))
],
pydantic.Field(alias="type"),
] = "input_audio"
@@ -1,47 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_const, validate_open_enum
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
ChatMessageContentItemImageDetail = Union[
Literal[
"auto",
"low",
"high",
],
UnrecognizedStr,
]
class ImageURLTypedDict(TypedDict):
url: str
detail: NotRequired[ChatMessageContentItemImageDetail]
class ImageURL(BaseModel):
url: str
detail: Annotated[
Optional[ChatMessageContentItemImageDetail],
PlainValidator(validate_open_enum(False)),
] = None
class ChatMessageContentItemImageTypedDict(TypedDict):
image_url: ImageURLTypedDict
type: Literal["image_url"]
class ChatMessageContentItemImage(BaseModel):
image_url: ImageURL
TYPE: Annotated[
Annotated[Literal["image_url"], AfterValidator(validate_const("image_url"))],
pydantic.Field(alias="type"),
] = "image_url"
@@ -1,23 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class ChatMessageContentItemTextTypedDict(TypedDict):
text: str
type: Literal["text"]
class ChatMessageContentItemText(BaseModel):
text: str
TYPE: Annotated[
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
pydantic.Field(alias="type"),
] = "text"
@@ -1,33 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class VideoURLTypedDict(TypedDict):
url: str
class VideoURL(BaseModel):
url: str
class ChatMessageContentItemVideoTypedDict(TypedDict):
video_url: VideoURLTypedDict
type: Literal["input_video"]
class ChatMessageContentItemVideo(BaseModel):
video_url: VideoURL
TYPE: Annotated[
Annotated[
Literal["input_video"], AfterValidator(validate_const("input_video"))
],
pydantic.Field(alias="type"),
] = "input_video"
@@ -1,99 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import List
from typing_extensions import Annotated, TypedDict
class TopLogprobTypedDict(TypedDict):
token: str
logprob: float
bytes_: Nullable[List[float]]
class TopLogprob(BaseModel):
token: str
logprob: float
bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["bytes"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ChatMessageTokenLogprobTypedDict(TypedDict):
token: str
logprob: float
bytes_: Nullable[List[float]]
top_logprobs: List[TopLogprobTypedDict]
class ChatMessageTokenLogprob(BaseModel):
token: str
logprob: float
bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")]
top_logprobs: List[TopLogprob]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["bytes"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,52 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatmessagetokenlogprob import (
ChatMessageTokenLogprob,
ChatMessageTokenLogprobTypedDict,
)
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List
from typing_extensions import TypedDict
class ChatMessageTokenLogprobsTypedDict(TypedDict):
content: Nullable[List[ChatMessageTokenLogprobTypedDict]]
refusal: Nullable[List[ChatMessageTokenLogprobTypedDict]]
class ChatMessageTokenLogprobs(BaseModel):
content: Nullable[List[ChatMessageTokenLogprob]]
refusal: Nullable[List[ChatMessageTokenLogprob]]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["content", "refusal"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,37 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class ChatMessageToolCallFunctionTypedDict(TypedDict):
name: str
arguments: str
class ChatMessageToolCallFunction(BaseModel):
name: str
arguments: str
class ChatMessageToolCallTypedDict(TypedDict):
id: str
function: ChatMessageToolCallFunctionTypedDict
type: Literal["function"]
class ChatMessageToolCall(BaseModel):
id: str
function: ChatMessageToolCallFunction
TYPE: Annotated[
Annotated[Literal["function"], AfterValidator(validate_const("function"))],
pydantic.Field(alias="type"),
] = "function"
-83
View File
@@ -1,83 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatgenerationtokenusage import (
ChatGenerationTokenUsage,
ChatGenerationTokenUsageTypedDict,
)
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatResponseTypedDict(TypedDict):
id: str
choices: List[ChatResponseChoiceTypedDict]
created: float
model: str
object: Literal["chat.completion"]
system_fingerprint: NotRequired[Nullable[str]]
usage: NotRequired[ChatGenerationTokenUsageTypedDict]
class ChatResponse(BaseModel):
id: str
choices: List[ChatResponseChoice]
created: float
model: str
OBJECT: Annotated[
Annotated[
Literal["chat.completion"],
AfterValidator(validate_const("chat.completion")),
],
pydantic.Field(alias="object"),
] = "chat.completion"
system_fingerprint: OptionalNullable[str] = UNSET
usage: Optional[ChatGenerationTokenUsage] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["system_fingerprint", "usage"]
nullable_fields = ["system_fingerprint"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,69 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import (
ChatMessageTokenLogprobs,
ChatMessageTokenLogprobsTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatResponseChoiceTypedDict(TypedDict):
finish_reason: Nullable[ChatCompletionFinishReason]
index: float
message: AssistantMessageTypedDict
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
class ChatResponseChoice(BaseModel):
finish_reason: Annotated[
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
]
index: float
message: AssistantMessage
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["logprobs"]
nullable_fields = ["finish_reason", "logprobs"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,72 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import (
ChatMessageTokenLogprobs,
ChatMessageTokenLogprobsTypedDict,
)
from .chatstreamingmessagechunk import (
ChatStreamingMessageChunk,
ChatStreamingMessageChunkTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatStreamingChoiceTypedDict(TypedDict):
delta: ChatStreamingMessageChunkTypedDict
finish_reason: Nullable[ChatCompletionFinishReason]
index: float
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
class ChatStreamingChoice(BaseModel):
delta: ChatStreamingMessageChunk
finish_reason: Annotated[
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
]
index: float
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["logprobs"]
nullable_fields = ["finish_reason", "logprobs"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,70 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatstreamingmessagetoolcall import (
ChatStreamingMessageToolCall,
ChatStreamingMessageToolCallTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict
ChatStreamingMessageChunkRole = Literal["assistant",]
class ChatStreamingMessageChunkTypedDict(TypedDict):
role: NotRequired[ChatStreamingMessageChunkRole]
content: NotRequired[Nullable[str]]
reasoning: NotRequired[Nullable[str]]
refusal: NotRequired[Nullable[str]]
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
class ChatStreamingMessageChunk(BaseModel):
role: Optional[ChatStreamingMessageChunkRole] = None
content: OptionalNullable[str] = UNSET
reasoning: OptionalNullable[str] = UNSET
refusal: OptionalNullable[str] = UNSET
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["role", "content", "reasoning", "refusal", "tool_calls"]
nullable_fields = ["content", "reasoning", "refusal"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,42 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatStreamingMessageToolCallFunctionTypedDict(TypedDict):
name: NotRequired[str]
arguments: NotRequired[str]
class ChatStreamingMessageToolCallFunction(BaseModel):
name: Optional[str] = None
arguments: Optional[str] = None
class ChatStreamingMessageToolCallTypedDict(TypedDict):
index: float
id: NotRequired[str]
type: Literal["function"]
function: NotRequired[ChatStreamingMessageToolCallFunctionTypedDict]
class ChatStreamingMessageToolCall(BaseModel):
index: float
id: Optional[str] = None
TYPE: Annotated[
Annotated[
Optional[Literal["function"]], AfterValidator(validate_const("function"))
],
pydantic.Field(alias="type"),
] = "function"
function: Optional[ChatStreamingMessageToolCallFunction] = None
@@ -1,105 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatgenerationtokenusage import (
ChatGenerationTokenUsage,
ChatGenerationTokenUsageTypedDict,
)
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatStreamingResponseChunkErrorTypedDict(TypedDict):
message: str
code: float
class ChatStreamingResponseChunkError(BaseModel):
message: str
code: float
class ChatStreamingResponseChunkDataTypedDict(TypedDict):
id: str
choices: List[ChatStreamingChoiceTypedDict]
created: float
model: str
object: Literal["chat.completion.chunk"]
system_fingerprint: NotRequired[Nullable[str]]
error: NotRequired[ChatStreamingResponseChunkErrorTypedDict]
usage: NotRequired[ChatGenerationTokenUsageTypedDict]
class ChatStreamingResponseChunkData(BaseModel):
id: str
choices: List[ChatStreamingChoice]
created: float
model: str
OBJECT: Annotated[
Annotated[
Literal["chat.completion.chunk"],
AfterValidator(validate_const("chat.completion.chunk")),
],
pydantic.Field(alias="object"),
] = "chat.completion.chunk"
system_fingerprint: OptionalNullable[str] = UNSET
error: Optional[ChatStreamingResponseChunkError] = None
usage: Optional[ChatGenerationTokenUsage] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["system_fingerprint", "error", "usage"]
nullable_fields = ["system_fingerprint"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ChatStreamingResponseChunkTypedDict(TypedDict):
data: ChatStreamingResponseChunkDataTypedDict
class ChatStreamingResponseChunk(BaseModel):
data: ChatStreamingResponseChunkData
@@ -1,14 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict
class ChatStreamOptionsTypedDict(TypedDict):
include_usage: NotRequired[bool]
class ChatStreamOptions(BaseModel):
include_usage: Optional[bool] = None
-69
View File
@@ -1,69 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
CompletionFinishReason = Union[
Literal[
"stop",
"length",
"content_filter",
],
UnrecognizedStr,
]
class CompletionChoiceTypedDict(TypedDict):
text: str
index: float
logprobs: Nullable[CompletionLogprobsTypedDict]
finish_reason: Nullable[CompletionFinishReason]
class CompletionChoice(BaseModel):
text: str
index: float
logprobs: Nullable[CompletionLogprobs]
finish_reason: Annotated[
Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False))
]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["logprobs", "finish_reason"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,277 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .responseformatjsonschema import (
ResponseFormatJSONSchema,
ResponseFormatJSONSchemaTypedDict,
)
from .responseformattextgrammar import (
ResponseFormatTextGrammar,
ResponseFormatTextGrammarTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
PromptTypedDict = TypeAliasType(
"PromptTypedDict", Union[str, List[str], List[float], List[List[float]]]
)
Prompt = TypeAliasType("Prompt", Union[str, List[str], List[float], List[List[float]]])
CompletionCreateParamsStopTypedDict = TypeAliasType(
"CompletionCreateParamsStopTypedDict", Union[str, List[str]]
)
CompletionCreateParamsStop = TypeAliasType(
"CompletionCreateParamsStop", Union[str, List[str]]
)
class StreamOptionsTypedDict(TypedDict):
include_usage: NotRequired[Nullable[bool]]
class StreamOptions(BaseModel):
include_usage: OptionalNullable[bool] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["include_usage"]
nullable_fields = ["include_usage"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class CompletionCreateParamsResponseFormatPythonTypedDict(TypedDict):
type: Literal["python"]
class CompletionCreateParamsResponseFormatPython(BaseModel):
TYPE: Annotated[
Annotated[Literal["python"], AfterValidator(validate_const("python"))],
pydantic.Field(alias="type"),
] = "python"
class CompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict):
type: Literal["json_object"]
class CompletionCreateParamsResponseFormatJSONObject(BaseModel):
TYPE: Annotated[
Annotated[
Literal["json_object"], AfterValidator(validate_const("json_object"))
],
pydantic.Field(alias="type"),
] = "json_object"
class CompletionCreateParamsResponseFormatTextTypedDict(TypedDict):
type: Literal["text"]
class CompletionCreateParamsResponseFormatText(BaseModel):
TYPE: Annotated[
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
pydantic.Field(alias="type"),
] = "text"
CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType(
"CompletionCreateParamsResponseFormatUnionTypedDict",
Union[
CompletionCreateParamsResponseFormatTextTypedDict,
CompletionCreateParamsResponseFormatJSONObjectTypedDict,
CompletionCreateParamsResponseFormatPythonTypedDict,
ResponseFormatJSONSchemaTypedDict,
ResponseFormatTextGrammarTypedDict,
],
)
CompletionCreateParamsResponseFormatUnion = TypeAliasType(
"CompletionCreateParamsResponseFormatUnion",
Union[
CompletionCreateParamsResponseFormatText,
CompletionCreateParamsResponseFormatJSONObject,
CompletionCreateParamsResponseFormatPython,
ResponseFormatJSONSchema,
ResponseFormatTextGrammar,
],
)
class CompletionCreateParamsTypedDict(TypedDict):
prompt: PromptTypedDict
model: NotRequired[str]
models: NotRequired[List[str]]
best_of: NotRequired[Nullable[int]]
echo: NotRequired[Nullable[bool]]
frequency_penalty: NotRequired[Nullable[float]]
logit_bias: NotRequired[Nullable[Dict[str, float]]]
logprobs: NotRequired[Nullable[int]]
max_tokens: NotRequired[Nullable[int]]
n: NotRequired[Nullable[int]]
presence_penalty: NotRequired[Nullable[float]]
seed: NotRequired[Nullable[int]]
stop: NotRequired[Nullable[CompletionCreateParamsStopTypedDict]]
stream: NotRequired[bool]
stream_options: NotRequired[Nullable[StreamOptionsTypedDict]]
suffix: NotRequired[Nullable[str]]
temperature: NotRequired[Nullable[float]]
top_p: NotRequired[Nullable[float]]
user: NotRequired[str]
metadata: NotRequired[Nullable[Dict[str, str]]]
response_format: NotRequired[
Nullable[CompletionCreateParamsResponseFormatUnionTypedDict]
]
class CompletionCreateParams(BaseModel):
prompt: Prompt
model: Optional[str] = None
models: Optional[List[str]] = None
best_of: OptionalNullable[int] = UNSET
echo: OptionalNullable[bool] = UNSET
frequency_penalty: OptionalNullable[float] = UNSET
logit_bias: OptionalNullable[Dict[str, float]] = UNSET
logprobs: OptionalNullable[int] = UNSET
max_tokens: OptionalNullable[int] = UNSET
n: OptionalNullable[int] = UNSET
presence_penalty: OptionalNullable[float] = UNSET
seed: OptionalNullable[int] = UNSET
stop: OptionalNullable[CompletionCreateParamsStop] = UNSET
stream: Optional[bool] = False
stream_options: OptionalNullable[StreamOptions] = UNSET
suffix: OptionalNullable[str] = UNSET
temperature: OptionalNullable[float] = UNSET
top_p: OptionalNullable[float] = UNSET
user: Optional[str] = None
metadata: OptionalNullable[Dict[str, str]] = UNSET
response_format: OptionalNullable[CompletionCreateParamsResponseFormatUnion] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"model",
"models",
"best_of",
"echo",
"frequency_penalty",
"logit_bias",
"logprobs",
"max_tokens",
"n",
"presence_penalty",
"seed",
"stop",
"stream",
"stream_options",
"suffix",
"temperature",
"top_p",
"user",
"metadata",
"response_format",
]
nullable_fields = [
"best_of",
"echo",
"frequency_penalty",
"logit_bias",
"logprobs",
"max_tokens",
"n",
"presence_penalty",
"seed",
"stop",
"stream_options",
"suffix",
"temperature",
"top_p",
"metadata",
"response_format",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,54 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Dict, List
from typing_extensions import TypedDict
class CompletionLogprobsTypedDict(TypedDict):
tokens: List[str]
token_logprobs: List[float]
top_logprobs: Nullable[List[Dict[str, float]]]
text_offset: List[float]
class CompletionLogprobs(BaseModel):
tokens: List[str]
token_logprobs: List[float]
top_logprobs: Nullable[List[Dict[str, float]]]
text_offset: List[float]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["top_logprobs"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,43 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .completionchoice import CompletionChoice, CompletionChoiceTypedDict
from .completionusage import CompletionUsage, CompletionUsageTypedDict
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class CompletionResponseTypedDict(TypedDict):
id: str
created: float
model: str
choices: List[CompletionChoiceTypedDict]
object: Literal["text_completion"]
system_fingerprint: NotRequired[str]
usage: NotRequired[CompletionUsageTypedDict]
class CompletionResponse(BaseModel):
id: str
created: float
model: str
choices: List[CompletionChoice]
OBJECT: Annotated[
Annotated[
Literal["text_completion"],
AfterValidator(validate_const("text_completion")),
],
pydantic.Field(alias="object"),
] = "text_completion"
system_fingerprint: Optional[str] = None
usage: Optional[CompletionUsage] = None
-19
View File
@@ -1,19 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class CompletionUsageTypedDict(TypedDict):
prompt_tokens: float
completion_tokens: float
total_tokens: float
class CompletionUsage(BaseModel):
prompt_tokens: float
completion_tokens: float
total_tokens: float
@@ -1,133 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from datetime import datetime
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
CreateAuthKeysCodeCodeChallengeMethod = Union[
Literal[
"S256",
"plain",
],
UnrecognizedStr,
]
r"""The method used to generate the code challenge"""
class CreateAuthKeysCodeRequestTypedDict(TypedDict):
callback_url: str
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed."""
code_challenge: NotRequired[str]
r"""PKCE code challenge for enhanced security"""
code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod]
r"""The method used to generate the code challenge"""
limit: NotRequired[float]
r"""Credit limit for the API key to be created"""
expires_at: NotRequired[Nullable[datetime]]
r"""Optional expiration time for the API key to be created"""
class CreateAuthKeysCodeRequest(BaseModel):
callback_url: str
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed."""
code_challenge: Optional[str] = None
r"""PKCE code challenge for enhanced security"""
code_challenge_method: Annotated[
Optional[CreateAuthKeysCodeCodeChallengeMethod],
PlainValidator(validate_open_enum(False)),
] = None
r"""The method used to generate the code challenge"""
limit: Optional[float] = None
r"""Credit limit for the API key to be created"""
expires_at: OptionalNullable[datetime] = UNSET
r"""Optional expiration time for the API key to be created"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"code_challenge",
"code_challenge_method",
"limit",
"expires_at",
]
nullable_fields = ["expires_at"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class CreateAuthKeysCodeDataTypedDict(TypedDict):
r"""Auth code data"""
id: str
r"""The authorization code ID to use in the exchange request"""
app_id: float
r"""The application ID associated with this auth code"""
created_at: str
r"""ISO 8601 timestamp of when the auth code was created"""
class CreateAuthKeysCodeData(BaseModel):
r"""Auth code data"""
id: str
r"""The authorization code ID to use in the exchange request"""
app_id: float
r"""The application ID associated with this auth code"""
created_at: str
r"""ISO 8601 timestamp of when the auth code was created"""
class CreateAuthKeysCodeResponseTypedDict(TypedDict):
r"""Successfully created authorization code"""
data: CreateAuthKeysCodeDataTypedDict
r"""Auth code data"""
class CreateAuthKeysCodeResponse(BaseModel):
r"""Successfully created authorization code"""
data: CreateAuthKeysCodeData
r"""Auth code data"""
@@ -1,36 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedInt
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
ChainID = Union[
Literal[
1,
137,
8453,
],
UnrecognizedInt,
]
class CreateChargeRequestTypedDict(TypedDict):
r"""Create a Coinbase charge for crypto payment"""
amount: float
sender: str
chain_id: ChainID
class CreateChargeRequest(BaseModel):
r"""Create a Coinbase charge for crypto payment"""
amount: float
sender: str
chain_id: Annotated[ChainID, PlainValidator(validate_open_enum(True))]
@@ -1,121 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, SecurityMetadata
from typing_extensions import Annotated, TypedDict
class CreateCoinbaseChargeSecurityTypedDict(TypedDict):
bearer: str
class CreateCoinbaseChargeSecurity(BaseModel):
bearer: Annotated[
str,
FieldMetadata(
security=SecurityMetadata(
scheme=True,
scheme_type="http",
sub_type="bearer",
field_name="Authorization",
)
),
]
class CallDataTypedDict(TypedDict):
deadline: str
fee_amount: str
id: str
operator: str
prefix: str
recipient: str
recipient_amount: str
recipient_currency: str
refund_destination: str
signature: str
class CallData(BaseModel):
deadline: str
fee_amount: str
id: str
operator: str
prefix: str
recipient: str
recipient_amount: str
recipient_currency: str
refund_destination: str
signature: str
class MetadataTypedDict(TypedDict):
chain_id: float
contract_address: str
sender: str
class Metadata(BaseModel):
chain_id: float
contract_address: str
sender: str
class TransferIntentTypedDict(TypedDict):
call_data: CallDataTypedDict
metadata: MetadataTypedDict
class TransferIntent(BaseModel):
call_data: CallData
metadata: Metadata
class Web3DataTypedDict(TypedDict):
transfer_intent: TransferIntentTypedDict
class Web3Data(BaseModel):
transfer_intent: TransferIntent
class CreateCoinbaseChargeDataTypedDict(TypedDict):
id: str
created_at: str
expires_at: str
web3_data: Web3DataTypedDict
class CreateCoinbaseChargeData(BaseModel):
id: str
created_at: str
expires_at: str
web3_data: Web3Data
class CreateCoinbaseChargeResponseTypedDict(TypedDict):
r"""Returns the calldata to fulfill the transaction"""
data: CreateCoinbaseChargeDataTypedDict
class CreateCoinbaseChargeResponse(BaseModel):
r"""Returns the calldata to fulfill the transaction"""
data: CreateCoinbaseChargeData
-366
View File
@@ -1,366 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .providername import ProviderName
from .quantization import Quantization
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
InputTypedDict = TypeAliasType(
"InputTypedDict", Union[str, List[str], List[float], List[List[float]]]
)
Input = TypeAliasType("Input", Union[str, List[str], List[float], List[List[float]]])
CreateEmbeddingsDataCollection = Union[
Literal[
"deny",
"allow",
],
UnrecognizedStr,
]
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
CreateEmbeddingsOrderTypedDict = TypeAliasType(
"CreateEmbeddingsOrderTypedDict", Union[ProviderName, str]
)
CreateEmbeddingsOrder = TypeAliasType(
"CreateEmbeddingsOrder",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
CreateEmbeddingsOnlyTypedDict = TypeAliasType(
"CreateEmbeddingsOnlyTypedDict", Union[ProviderName, str]
)
CreateEmbeddingsOnly = TypeAliasType(
"CreateEmbeddingsOnly",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
CreateEmbeddingsIgnoreTypedDict = TypeAliasType(
"CreateEmbeddingsIgnoreTypedDict", Union[ProviderName, str]
)
CreateEmbeddingsIgnore = TypeAliasType(
"CreateEmbeddingsIgnore",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
CreateEmbeddingsSort = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
class CreateEmbeddingsMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: NotRequired[Any]
r"""A value in string or number format that is a large number"""
completion: NotRequired[Any]
r"""A value in string or number format that is a large number"""
image: NotRequired[Any]
r"""A value in string or number format that is a large number"""
audio: NotRequired[Any]
r"""A value in string or number format that is a large number"""
request: NotRequired[Any]
r"""A value in string or number format that is a large number"""
class CreateEmbeddingsMaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: Optional[Any] = None
r"""A value in string or number format that is a large number"""
completion: Optional[Any] = None
r"""A value in string or number format that is a large number"""
image: Optional[Any] = None
r"""A value in string or number format that is a large number"""
audio: Optional[Any] = None
r"""A value in string or number format that is a large number"""
request: Optional[Any] = None
r"""A value in string or number format that is a large number"""
class CreateEmbeddingsProviderTypedDict(TypedDict):
allow_fallbacks: NotRequired[Nullable[bool]]
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: NotRequired[Nullable[bool]]
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
data_collection: NotRequired[Nullable[CreateEmbeddingsDataCollection]]
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: NotRequired[Nullable[List[CreateEmbeddingsOrderTypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: NotRequired[Nullable[List[CreateEmbeddingsOnlyTypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: NotRequired[Nullable[List[CreateEmbeddingsIgnoreTypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantization]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[CreateEmbeddingsSort]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[CreateEmbeddingsMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
class CreateEmbeddingsProvider(BaseModel):
allow_fallbacks: OptionalNullable[bool] = UNSET
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: OptionalNullable[bool] = UNSET
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
data_collection: Annotated[
OptionalNullable[CreateEmbeddingsDataCollection],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: OptionalNullable[List[CreateEmbeddingsOrder]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: OptionalNullable[List[CreateEmbeddingsOnly]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: OptionalNullable[List[CreateEmbeddingsIgnore]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: OptionalNullable[
List[Annotated[Quantization, PlainValidator(validate_open_enum(False))]]
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[CreateEmbeddingsSort],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: Optional[CreateEmbeddingsMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
"max_price",
]
nullable_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
EncodingFormatBase64 = Literal["base64",]
EncodingFormatFloat = Literal["float",]
EncodingFormatTypedDict = TypeAliasType(
"EncodingFormatTypedDict", Union[EncodingFormatFloat, EncodingFormatBase64]
)
EncodingFormat = TypeAliasType(
"EncodingFormat", Union[EncodingFormatFloat, EncodingFormatBase64]
)
class CreateEmbeddingsRequestTypedDict(TypedDict):
input: InputTypedDict
model: str
provider: NotRequired[CreateEmbeddingsProviderTypedDict]
encoding_format: NotRequired[EncodingFormatTypedDict]
user: NotRequired[str]
class CreateEmbeddingsRequest(BaseModel):
input: Input
model: str
provider: Optional[CreateEmbeddingsProvider] = None
encoding_format: Optional[EncodingFormat] = None
user: Optional[str] = None
CreateEmbeddingsObject = Literal["list",]
ObjectEmbedding = Literal["embedding",]
EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str])
Embedding = TypeAliasType("Embedding", Union[List[float], str])
class CreateEmbeddingsDataTypedDict(TypedDict):
object: ObjectEmbedding
embedding: EmbeddingTypedDict
index: NotRequired[float]
class CreateEmbeddingsData(BaseModel):
object: ObjectEmbedding
embedding: Embedding
index: Optional[float] = None
class UsageTypedDict(TypedDict):
prompt_tokens: float
total_tokens: float
cost: NotRequired[float]
class Usage(BaseModel):
prompt_tokens: float
total_tokens: float
cost: Optional[float] = None
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
r"""Embedding response"""
object: CreateEmbeddingsObject
data: List[CreateEmbeddingsDataTypedDict]
model: str
id: NotRequired[str]
usage: NotRequired[UsageTypedDict]
class CreateEmbeddingsResponseBody(BaseModel):
r"""Embedding response"""
object: CreateEmbeddingsObject
data: List[CreateEmbeddingsData]
model: str
id: Optional[str] = None
usage: Optional[Usage] = None
CreateEmbeddingsResponseTypedDict = TypeAliasType(
"CreateEmbeddingsResponseTypedDict",
Union[CreateEmbeddingsResponseBodyTypedDict, str],
)
CreateEmbeddingsResponse = TypeAliasType(
"CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str]
)
-255
View File
@@ -1,255 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from datetime import datetime
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
CreateKeysLimitReset = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
class CreateKeysRequestTypedDict(TypedDict):
name: str
r"""Name for the new API key"""
limit: NotRequired[Nullable[float]]
r"""Optional spending limit for the API key in USD"""
limit_reset: NotRequired[Nullable[CreateKeysLimitReset]]
r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: NotRequired[bool]
r"""Whether to include BYOK usage in the limit"""
expires_at: NotRequired[Nullable[datetime]]
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
class CreateKeysRequest(BaseModel):
name: str
r"""Name for the new API key"""
limit: OptionalNullable[float] = UNSET
r"""Optional spending limit for the API key in USD"""
limit_reset: Annotated[
OptionalNullable[CreateKeysLimitReset],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: Optional[bool] = None
r"""Whether to include BYOK usage in the limit"""
expires_at: OptionalNullable[datetime] = UNSET
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"limit",
"limit_reset",
"include_byok_in_limit",
"expires_at",
]
nullable_fields = ["limit", "limit_reset", "expires_at"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class CreateKeysDataTypedDict(TypedDict):
r"""The created API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
class CreateKeysData(BaseModel):
r"""The created API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class CreateKeysResponseTypedDict(TypedDict):
r"""API key created successfully"""
data: CreateKeysDataTypedDict
r"""The created API key information"""
key: str
r"""The actual API key string (only shown once)"""
class CreateKeysResponse(BaseModel):
r"""API key created successfully"""
data: CreateKeysData
r"""The created API key information"""
key: str
r"""The actual API key string (only shown once)"""
@@ -1,53 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openresponsesnonstreamingresponse import (
OpenResponsesNonStreamingResponse,
OpenResponsesNonStreamingResponseTypedDict,
)
from .openresponsesstreamevent import (
OpenResponsesStreamEvent,
OpenResponsesStreamEventTypedDict,
)
from openrouter.types import BaseModel
from openrouter.utils import eventstreaming
from typing import Union
from typing_extensions import TypeAliasType, TypedDict
class CreateResponsesResponseBodyTypedDict(TypedDict):
r"""Successful response"""
data: OpenResponsesStreamEventTypedDict
r"""Union of all possible event types emitted during response streaming"""
class CreateResponsesResponseBody(BaseModel):
r"""Successful response"""
data: OpenResponsesStreamEvent
r"""Union of all possible event types emitted during response streaming"""
CreateResponsesResponseTypedDict = TypeAliasType(
"CreateResponsesResponseTypedDict",
Union[
OpenResponsesNonStreamingResponseTypedDict,
Union[
eventstreaming.EventStream[OpenResponsesStreamEventTypedDict],
eventstreaming.EventStreamAsync[OpenResponsesStreamEventTypedDict],
],
],
)
CreateResponsesResponse = TypeAliasType(
"CreateResponsesResponse",
Union[
OpenResponsesNonStreamingResponse,
Union[
eventstreaming.EventStream[OpenResponsesStreamEvent],
eventstreaming.EventStreamAsync[OpenResponsesStreamEvent],
],
],
)
@@ -1,60 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing_extensions import NotRequired, TypedDict
class DefaultParametersTypedDict(TypedDict):
r"""Default parameters for this model"""
temperature: NotRequired[Nullable[float]]
top_p: NotRequired[Nullable[float]]
frequency_penalty: NotRequired[Nullable[float]]
class DefaultParameters(BaseModel):
r"""Default parameters for this model"""
temperature: OptionalNullable[float] = UNSET
top_p: OptionalNullable[float] = UNSET
frequency_penalty: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["temperature", "top_p", "frequency_penalty"]
nullable_fields = ["temperature", "top_p", "frequency_penalty"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-38
View File
@@ -1,38 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, PathParamMetadata, validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class DeleteKeysRequestTypedDict(TypedDict):
hash: str
r"""The hash identifier of the API key to delete"""
class DeleteKeysRequest(BaseModel):
hash: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The hash identifier of the API key to delete"""
class DeleteKeysResponseTypedDict(TypedDict):
r"""API key deleted successfully"""
deleted: Literal[True]
r"""Confirmation that the API key was deleted"""
class DeleteKeysResponse(BaseModel):
r"""API key deleted successfully"""
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Confirmation that the API key was deleted"""
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class EdgeNetworkTimeoutResponseErrorDataTypedDict(TypedDict):
r"""Error data for EdgeNetworkTimeoutResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class EdgeNetworkTimeoutResponseErrorData(BaseModel):
r"""Error data for EdgeNetworkTimeoutResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-18
View File
@@ -1,18 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedInt
from typing import Literal, Union
EndpointStatus = Union[
Literal[
0,
-1,
-2,
-3,
-5,
-10,
],
UnrecognizedInt,
]
@@ -1,130 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[
Literal[
"S256",
"plain",
],
UnrecognizedStr,
]
r"""The method used to generate the code challenge"""
class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict):
code: str
r"""The authorization code received from the OAuth redirect"""
code_verifier: NotRequired[str]
r"""The code verifier if code_challenge was used in the authorization request"""
code_challenge_method: NotRequired[
Nullable[ExchangeAuthCodeForAPIKeyCodeChallengeMethod]
]
r"""The method used to generate the code challenge"""
class ExchangeAuthCodeForAPIKeyRequest(BaseModel):
code: str
r"""The authorization code received from the OAuth redirect"""
code_verifier: Optional[str] = None
r"""The code verifier if code_challenge was used in the authorization request"""
code_challenge_method: Annotated[
OptionalNullable[ExchangeAuthCodeForAPIKeyCodeChallengeMethod],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""The method used to generate the code challenge"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["code_verifier", "code_challenge_method"]
nullable_fields = ["code_challenge_method"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ExchangeAuthCodeForAPIKeyResponseTypedDict(TypedDict):
r"""Successfully exchanged code for an API key"""
key: str
r"""The API key to use for OpenRouter requests"""
user_id: Nullable[str]
r"""User ID associated with the API key"""
class ExchangeAuthCodeForAPIKeyResponse(BaseModel):
r"""Successfully exchanged code for an API key"""
key: str
r"""The API key to use for OpenRouter requests"""
user_id: Nullable[str]
r"""User ID associated with the API key"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["user_id"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-26
View File
@@ -1,26 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
FileCitationType = Literal["file_citation",]
class FileCitationTypedDict(TypedDict):
type: FileCitationType
file_id: str
filename: str
index: float
class FileCitation(BaseModel):
type: FileCitationType
file_id: str
filename: str
index: float
-23
View File
@@ -1,23 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
FilePathType = Literal["file_path",]
class FilePathTypedDict(TypedDict):
type: FilePathType
file_id: str
index: float
class FilePath(BaseModel):
type: FilePathType
file_id: str
index: float
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class ForbiddenResponseErrorDataTypedDict(TypedDict):
r"""Error data for ForbiddenResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class ForbiddenResponseErrorData(BaseModel):
r"""Error data for ForbiddenResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-13
View File
@@ -1,13 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class GetCreditsResponseTypedDict(TypedDict):
r"""Total credits purchased and used"""
class GetCreditsResponse(BaseModel):
r"""Total credits purchased and used"""
-187
View File
@@ -1,187 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from datetime import datetime
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
import pydantic
from pydantic import model_serializer
from typing_extensions import Annotated, NotRequired, TypedDict, deprecated
@deprecated(
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
)
class RateLimitTypedDict(TypedDict):
r"""Legacy rate limit information about a key. Will always return -1."""
requests: float
r"""Number of requests allowed per interval"""
interval: str
r"""Rate limit interval"""
note: str
r"""Note about the rate limit"""
@deprecated(
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
)
class RateLimit(BaseModel):
r"""Legacy rate limit information about a key. Will always return -1."""
requests: float
r"""Number of requests allowed per interval"""
interval: str
r"""Rate limit interval"""
note: str
r"""Note about the rate limit"""
class GetCurrentKeyDataTypedDict(TypedDict):
r"""Current API key information"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
is_free_tier: bool
r"""Whether this is a free tier API key"""
is_provisioning_key: bool
r"""Whether this is a provisioning key"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
rate_limit: RateLimitTypedDict
r"""Legacy rate limit information about a key. Will always return -1."""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
class GetCurrentKeyData(BaseModel):
r"""Current API key information"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
is_free_tier: bool
r"""Whether this is a free tier API key"""
is_provisioning_key: bool
r"""Whether this is a provisioning key"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
rate_limit: Annotated[
RateLimit,
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
),
]
r"""Legacy rate limit information about a key. Will always return -1."""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = ["limit", "limit_remaining", "limit_reset", "expires_at"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class GetCurrentKeyResponseTypedDict(TypedDict):
r"""API key details"""
data: GetCurrentKeyDataTypedDict
r"""Current API key information"""
class GetCurrentKeyResponse(BaseModel):
r"""API key details"""
data: GetCurrentKeyData
r"""Current API key information"""
-268
View File
@@ -1,268 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
class GetGenerationRequestTypedDict(TypedDict):
id: str
class GetGenerationRequest(BaseModel):
id: Annotated[
str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
]
APIType = Union[
Literal[
"completions",
"embeddings",
],
UnrecognizedStr,
]
r"""Type of API used for the generation"""
class GetGenerationDataTypedDict(TypedDict):
r"""Generation data"""
id: str
r"""Unique identifier for the generation"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
total_cost: float
r"""Total cost of the generation in USD"""
cache_discount: Nullable[float]
r"""Discount applied due to caching"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
created_at: str
r"""ISO 8601 timestamp of when the generation was created"""
model: str
r"""Model used for the generation"""
app_id: Nullable[float]
r"""ID of the app that made the request"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
cancelled: Nullable[bool]
r"""Whether the generation was cancelled"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
finish_reason: Nullable[str]
r"""Reason the generation finished"""
tokens_prompt: Nullable[float]
r"""Number of tokens in the prompt"""
tokens_completion: Nullable[float]
r"""Number of tokens in the completion"""
native_tokens_prompt: Nullable[float]
r"""Native prompt tokens as reported by provider"""
native_tokens_completion: Nullable[float]
r"""Native completion tokens as reported by provider"""
native_tokens_completion_images: Nullable[float]
r"""Native completion image tokens as reported by provider"""
native_tokens_reasoning: Nullable[float]
r"""Native reasoning tokens as reported by provider"""
native_tokens_cached: Nullable[float]
r"""Native cached tokens as reported by provider"""
num_media_prompt: Nullable[float]
r"""Number of media items in the prompt"""
num_input_audio_prompt: Nullable[float]
r"""Number of audio inputs in the prompt"""
num_media_completion: Nullable[float]
r"""Number of media items in the completion"""
num_search_results: Nullable[float]
r"""Number of search results included"""
origin: str
r"""Origin URL of the request"""
usage: float
r"""Usage amount in USD"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
external_user: Nullable[str]
r"""External user identifier"""
api_type: Nullable[APIType]
r"""Type of API used for the generation"""
class GetGenerationData(BaseModel):
r"""Generation data"""
id: str
r"""Unique identifier for the generation"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
total_cost: float
r"""Total cost of the generation in USD"""
cache_discount: Nullable[float]
r"""Discount applied due to caching"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
created_at: str
r"""ISO 8601 timestamp of when the generation was created"""
model: str
r"""Model used for the generation"""
app_id: Nullable[float]
r"""ID of the app that made the request"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
cancelled: Nullable[bool]
r"""Whether the generation was cancelled"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
finish_reason: Nullable[str]
r"""Reason the generation finished"""
tokens_prompt: Nullable[float]
r"""Number of tokens in the prompt"""
tokens_completion: Nullable[float]
r"""Number of tokens in the completion"""
native_tokens_prompt: Nullable[float]
r"""Native prompt tokens as reported by provider"""
native_tokens_completion: Nullable[float]
r"""Native completion tokens as reported by provider"""
native_tokens_completion_images: Nullable[float]
r"""Native completion image tokens as reported by provider"""
native_tokens_reasoning: Nullable[float]
r"""Native reasoning tokens as reported by provider"""
native_tokens_cached: Nullable[float]
r"""Native cached tokens as reported by provider"""
num_media_prompt: Nullable[float]
r"""Number of media items in the prompt"""
num_input_audio_prompt: Nullable[float]
r"""Number of audio inputs in the prompt"""
num_media_completion: Nullable[float]
r"""Number of media items in the completion"""
num_search_results: Nullable[float]
r"""Number of search results included"""
origin: str
r"""Origin URL of the request"""
usage: float
r"""Usage amount in USD"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
external_user: Nullable[str]
r"""External user identifier"""
api_type: Annotated[Nullable[APIType], PlainValidator(validate_open_enum(False))]
r"""Type of API used for the generation"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = [
"upstream_id",
"cache_discount",
"upstream_inference_cost",
"app_id",
"streamed",
"cancelled",
"provider_name",
"latency",
"moderation_latency",
"generation_time",
"finish_reason",
"tokens_prompt",
"tokens_completion",
"native_tokens_prompt",
"native_tokens_completion",
"native_tokens_completion_images",
"native_tokens_reasoning",
"native_tokens_cached",
"num_media_prompt",
"num_input_audio_prompt",
"num_media_completion",
"num_search_results",
"native_finish_reason",
"external_user",
"api_type",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class GetGenerationResponseTypedDict(TypedDict):
r"""Generation response"""
data: GetGenerationDataTypedDict
r"""Generation data"""
class GetGenerationResponse(BaseModel):
r"""Generation response"""
data: GetGenerationData
r"""Generation data"""
-180
View File
@@ -1,180 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from datetime import datetime
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import FieldMetadata, PathParamMetadata
from pydantic import model_serializer
from typing_extensions import Annotated, NotRequired, TypedDict
class GetKeyRequestTypedDict(TypedDict):
hash: str
r"""The hash identifier of the API key to retrieve"""
class GetKeyRequest(BaseModel):
hash: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The hash identifier of the API key to retrieve"""
class GetKeyDataTypedDict(TypedDict):
r"""The API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
class GetKeyData(BaseModel):
r"""The API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class GetKeyResponseTypedDict(TypedDict):
r"""API key details"""
data: GetKeyDataTypedDict
r"""The API key information"""
class GetKeyResponse(BaseModel):
r"""API key details"""
data: GetKeyData
r"""The API key information"""
-24
View File
@@ -1,24 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, QueryParamMetadata
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetModelsRequestTypedDict(TypedDict):
category: NotRequired[str]
supported_parameters: NotRequired[str]
class GetModelsRequest(BaseModel):
category: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
supported_parameters: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
-195
View File
@@ -1,195 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import (
FieldMetadata,
PathParamMetadata,
QueryParamMetadata,
SecurityMetadata,
validate_open_enum,
)
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class GetParametersSecurityTypedDict(TypedDict):
bearer: str
class GetParametersSecurity(BaseModel):
bearer: Annotated[
str,
FieldMetadata(
security=SecurityMetadata(
scheme=True,
scheme_type="http",
sub_type="bearer",
field_name="Authorization",
)
),
]
GetParametersProvider = Union[
Literal[
"AI21",
"AionLabs",
"Alibaba",
"Amazon Bedrock",
"Anthropic",
"AtlasCloud",
"Atoma",
"Avian",
"Azure",
"BaseTen",
"Cerebras",
"Chutes",
"Cirrascale",
"Clarifai",
"Cloudflare",
"Cohere",
"CrofAI",
"Crusoe",
"DeepInfra",
"DeepSeek",
"Enfer",
"Featherless",
"Fireworks",
"Friendli",
"GMICloud",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"InferenceNet",
"Infermatic",
"Inflection",
"Kluster",
"Lambda",
"Liquid",
"Mancer 2",
"Meta",
"Minimax",
"ModelRun",
"Mistral",
"Modular",
"Moonshot AI",
"Morph",
"NCompass",
"Nebius",
"NextBit",
"Nineteen",
"Novita",
"Nvidia",
"OpenAI",
"OpenInference",
"Parasail",
"Perplexity",
"Phala",
"Relace",
"SambaNova",
"SiliconFlow",
"Stealth",
"Switchpoint",
"Targon",
"Together",
"Ubicloud",
"Venice",
"WandB",
"xAI",
"Z.AI",
"FakeProvider",
],
UnrecognizedStr,
]
class GetParametersRequestTypedDict(TypedDict):
author: str
slug: str
provider: NotRequired[GetParametersProvider]
class GetParametersRequest(BaseModel):
author: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
slug: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
provider: Annotated[
Annotated[
Optional[GetParametersProvider], PlainValidator(validate_open_enum(False))
],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
SupportedParameter = Union[
Literal[
"temperature",
"top_p",
"top_k",
"min_p",
"top_a",
"frequency_penalty",
"presence_penalty",
"repetition_penalty",
"max_tokens",
"logit_bias",
"logprobs",
"top_logprobs",
"seed",
"response_format",
"structured_outputs",
"stop",
"tools",
"tool_choice",
"parallel_tool_calls",
"include_reasoning",
"reasoning",
"web_search_options",
"verbosity",
],
UnrecognizedStr,
]
class GetParametersDataTypedDict(TypedDict):
r"""Parameter analytics data"""
model: str
r"""Model identifier"""
supported_parameters: List[SupportedParameter]
r"""List of parameters supported by this model"""
class GetParametersData(BaseModel):
r"""Parameter analytics data"""
model: str
r"""Model identifier"""
supported_parameters: List[
Annotated[SupportedParameter, PlainValidator(validate_open_enum(False))]
]
r"""List of parameters supported by this model"""
class GetParametersResponseTypedDict(TypedDict):
r"""Returns the parameters for the specified model"""
data: GetParametersDataTypedDict
r"""Parameter analytics data"""
class GetParametersResponse(BaseModel):
r"""Returns the parameters for the specified model"""
data: GetParametersData
r"""Parameter analytics data"""
@@ -1,37 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .activityitem import ActivityItem, ActivityItemTypedDict
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, QueryParamMetadata
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetUserActivityRequestTypedDict(TypedDict):
date_: NotRequired[str]
r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)."""
class GetUserActivityRequest(BaseModel):
date_: Annotated[
Optional[str],
pydantic.Field(alias="date"),
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)."""
class GetUserActivityResponseTypedDict(TypedDict):
r"""Returns user activity data grouped by endpoint"""
data: List[ActivityItemTypedDict]
r"""List of activity items"""
class GetUserActivityResponse(BaseModel):
r"""Returns user activity data grouped by endpoint"""
data: List[ActivityItem]
r"""List of activity items"""
@@ -1,16 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ImageGenerationStatus = Union[
Literal[
"in_progress",
"completed",
"generating",
"failed",
],
UnrecognizedStr,
]
-17
View File
@@ -1,17 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
InputModality = Union[
Literal[
"text",
"image",
"file",
"audio",
"video",
],
UnrecognizedStr,
]
-35
View File
@@ -1,35 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
InstructType = Union[
Literal[
"none",
"airoboros",
"alpaca",
"alpaca-modif",
"chatml",
"claude",
"code-llama",
"gemma",
"llama2",
"llama3",
"mistral",
"nemotron",
"neural",
"openchat",
"phi3",
"rwkv",
"vicuna",
"zephyr",
"deepseek-r1",
"deepseek-v3.1",
"qwq",
"qwen3",
],
UnrecognizedStr,
]
r"""Instruction format type"""
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class InternalServerResponseErrorDataTypedDict(TypedDict):
r"""Error data for InternalServerResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class InternalServerResponseErrorData(BaseModel):
r"""Error data for InternalServerResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-61
View File
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
import pydantic
from pydantic import model_serializer
from typing import Any, Dict, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class JSONSchemaConfigTypedDict(TypedDict):
name: str
description: NotRequired[str]
schema_: NotRequired[Dict[str, Any]]
strict: NotRequired[Nullable[bool]]
class JSONSchemaConfig(BaseModel):
name: str
description: Optional[str] = None
schema_: Annotated[Optional[Dict[str, Any]], pydantic.Field(alias="schema")] = None
strict: OptionalNullable[bool] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["description", "schema", "strict"]
nullable_fields = ["strict"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-36
View File
@@ -1,36 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .listendpointsresponse import ListEndpointsResponse, ListEndpointsResponseTypedDict
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, PathParamMetadata
from typing_extensions import Annotated, TypedDict
class ListEndpointsRequestTypedDict(TypedDict):
author: str
slug: str
class ListEndpointsRequest(BaseModel):
author: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
slug: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
class EndpointsListEndpointsResponseTypedDict(TypedDict):
r"""Returns a list of endpoints"""
data: ListEndpointsResponseTypedDict
r"""List of available endpoints for a model"""
class EndpointsListEndpointsResponse(BaseModel):
r"""Returns a list of endpoints"""
data: ListEndpointsResponse
r"""List of available endpoints for a model"""
@@ -1,145 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .inputmodality import InputModality
from .instructtype import InstructType
from .outputmodality import OutputModality
from .publicendpoint import PublicEndpoint, PublicEndpointTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Union
from typing_extensions import Annotated, TypedDict
Tokenizer = Union[
Literal[
"Router",
"Media",
"Other",
"GPT",
"Claude",
"Gemini",
"Grok",
"Cohere",
"Nova",
"Qwen",
"Yi",
"DeepSeek",
"Mistral",
"Llama2",
"Llama3",
"Llama4",
"PaLM",
"RWKV",
"Qwen3",
],
UnrecognizedStr,
]
r"""Tokenizer type used by the model"""
class ArchitectureTypedDict(TypedDict):
r"""Model architecture information"""
tokenizer: Nullable[Tokenizer]
instruct_type: Nullable[InstructType]
r"""Instruction format type"""
modality: Nullable[str]
r"""Primary modality of the model"""
input_modalities: List[InputModality]
r"""Supported input modalities"""
output_modalities: List[OutputModality]
r"""Supported output modalities"""
class Architecture(BaseModel):
r"""Model architecture information"""
tokenizer: Annotated[Nullable[Tokenizer], PlainValidator(validate_open_enum(False))]
instruct_type: Annotated[
Nullable[InstructType], PlainValidator(validate_open_enum(False))
]
r"""Instruction format type"""
modality: Nullable[str]
r"""Primary modality of the model"""
input_modalities: List[
Annotated[InputModality, PlainValidator(validate_open_enum(False))]
]
r"""Supported input modalities"""
output_modalities: List[
Annotated[OutputModality, PlainValidator(validate_open_enum(False))]
]
r"""Supported output modalities"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["tokenizer", "instruct_type", "modality"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ListEndpointsResponseTypedDict(TypedDict):
r"""List of available endpoints for a model"""
id: str
r"""Unique identifier for the model"""
name: str
r"""Display name of the model"""
created: float
r"""Unix timestamp of when the model was created"""
description: str
r"""Description of the model"""
architecture: ArchitectureTypedDict
endpoints: List[PublicEndpointTypedDict]
r"""List of available endpoints for this model"""
class ListEndpointsResponse(BaseModel):
r"""List of available endpoints for a model"""
id: str
r"""Unique identifier for the model"""
name: str
r"""Display name of the model"""
created: float
r"""Unix timestamp of when the model was created"""
description: str
r"""Description of the model"""
architecture: Architecture
endpoints: List[PublicEndpoint]
r"""List of available endpoints for this model"""
@@ -1,19 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .publicendpoint import PublicEndpoint, PublicEndpointTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class ListEndpointsZdrResponseTypedDict(TypedDict):
r"""Returns a list of endpoints"""
data: List[PublicEndpointTypedDict]
class ListEndpointsZdrResponse(BaseModel):
r"""Returns a list of endpoints"""
data: List[PublicEndpoint]
-24
View File
@@ -1,24 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, SecurityMetadata
from typing_extensions import Annotated, TypedDict
class ListModelsUserSecurityTypedDict(TypedDict):
bearer: str
class ListModelsUserSecurity(BaseModel):
bearer: Annotated[
str,
FieldMetadata(
security=SecurityMetadata(
scheme=True,
scheme_type="http",
sub_type="bearer",
field_name="Authorization",
)
),
]
-186
View File
@@ -1,186 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from datetime import datetime
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import FieldMetadata, QueryParamMetadata
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ListRequestTypedDict(TypedDict):
include_disabled: NotRequired[str]
r"""Whether to include disabled API keys in the response"""
offset: NotRequired[str]
r"""Number of API keys to skip for pagination"""
class ListRequest(BaseModel):
include_disabled: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Whether to include disabled API keys in the response"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of API keys to skip for pagination"""
class ListDataTypedDict(TypedDict):
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
class ListData(BaseModel):
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
disabled: bool
r"""Whether the API key is disabled"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ListResponseTypedDict(TypedDict):
r"""List of API keys"""
data: List[ListDataTypedDict]
r"""List of API keys"""
class ListResponse(BaseModel):
r"""List of API keys"""
data: List[ListData]
r"""List of API keys"""
-89
View File
@@ -1,89 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import List
from typing_extensions import NotRequired, TypedDict
class ListProvidersDataTypedDict(TypedDict):
name: str
r"""Display name of the provider"""
slug: str
r"""URL-friendly identifier for the provider"""
privacy_policy_url: Nullable[str]
r"""URL to the provider's privacy policy"""
terms_of_service_url: NotRequired[Nullable[str]]
r"""URL to the provider's terms of service"""
status_page_url: NotRequired[Nullable[str]]
r"""URL to the provider's status page"""
class ListProvidersData(BaseModel):
name: str
r"""Display name of the provider"""
slug: str
r"""URL-friendly identifier for the provider"""
privacy_policy_url: Nullable[str]
r"""URL to the provider's privacy policy"""
terms_of_service_url: OptionalNullable[str] = UNSET
r"""URL to the provider's terms of service"""
status_page_url: OptionalNullable[str] = UNSET
r"""URL to the provider's status page"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["terms_of_service_url", "status_page_url"]
nullable_fields = [
"privacy_policy_url",
"terms_of_service_url",
"status_page_url",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ListProvidersResponseTypedDict(TypedDict):
r"""Returns a list of providers"""
data: List[ListProvidersDataTypedDict]
class ListProvidersResponse(BaseModel):
r"""Returns a list of providers"""
data: List[ListProvidersData]
-68
View File
@@ -1,68 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatmessagecontentitemtext import (
ChatMessageContentItemText,
ChatMessageContentItemTextTypedDict,
)
from .systemmessage import SystemMessage, SystemMessageTypedDict
from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict
from .usermessage import UserMessage, UserMessageTypedDict
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
MessageContentTypedDict = TypeAliasType(
"MessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]]
)
MessageContent = TypeAliasType(
"MessageContent", Union[str, List[ChatMessageContentItemText]]
)
class MessageDeveloperTypedDict(TypedDict):
content: MessageContentTypedDict
role: Literal["developer"]
name: NotRequired[str]
class MessageDeveloper(BaseModel):
content: MessageContent
ROLE: Annotated[
Annotated[Literal["developer"], AfterValidator(validate_const("developer"))],
pydantic.Field(alias="role"),
] = "developer"
name: Optional[str] = None
MessageTypedDict = TypeAliasType(
"MessageTypedDict",
Union[
SystemMessageTypedDict,
UserMessageTypedDict,
MessageDeveloperTypedDict,
ToolResponseMessageTypedDict,
AssistantMessageTypedDict,
],
)
Message = TypeAliasType(
"Message",
Union[
SystemMessage,
UserMessage,
MessageDeveloper,
ToolResponseMessage,
AssistantMessage,
],
)
-132
View File
@@ -1,132 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
from .parameter import Parameter
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
from .publicpricing import PublicPricing, PublicPricingTypedDict
from .topproviderinfo import TopProviderInfo, TopProviderInfoTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ModelTypedDict(TypedDict):
r"""Information about an AI model available on OpenRouter"""
id: str
r"""Unique identifier for the model"""
canonical_slug: str
r"""Canonical slug for the model"""
name: str
r"""Display name of the model"""
created: float
r"""Unix timestamp of when the model was created"""
pricing: PublicPricingTypedDict
r"""Pricing information for the model"""
context_length: Nullable[float]
r"""Maximum context length in tokens"""
architecture: ModelArchitectureTypedDict
r"""Model architecture information"""
top_provider: TopProviderInfoTypedDict
r"""Information about the top provider for this model"""
per_request_limits: Nullable[PerRequestLimitsTypedDict]
r"""Per-request token limits"""
supported_parameters: List[Parameter]
r"""List of supported parameters for this model"""
default_parameters: Nullable[DefaultParametersTypedDict]
r"""Default parameters for this model"""
hugging_face_id: NotRequired[Nullable[str]]
r"""Hugging Face model identifier, if applicable"""
description: NotRequired[str]
r"""Description of the model"""
class Model(BaseModel):
r"""Information about an AI model available on OpenRouter"""
id: str
r"""Unique identifier for the model"""
canonical_slug: str
r"""Canonical slug for the model"""
name: str
r"""Display name of the model"""
created: float
r"""Unix timestamp of when the model was created"""
pricing: PublicPricing
r"""Pricing information for the model"""
context_length: Nullable[float]
r"""Maximum context length in tokens"""
architecture: ModelArchitecture
r"""Model architecture information"""
top_provider: TopProviderInfo
r"""Information about the top provider for this model"""
per_request_limits: Nullable[PerRequestLimits]
r"""Per-request token limits"""
supported_parameters: List[
Annotated[Parameter, PlainValidator(validate_open_enum(False))]
]
r"""List of supported parameters for this model"""
default_parameters: Nullable[DefaultParameters]
r"""Default parameters for this model"""
hugging_face_id: OptionalNullable[str] = UNSET
r"""Hugging Face model identifier, if applicable"""
description: Optional[str] = None
r"""Description of the model"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["hugging_face_id", "description"]
nullable_fields = [
"hugging_face_id",
"context_length",
"per_request_limits",
"default_parameters",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-122
View File
@@ -1,122 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .inputmodality import InputModality
from .modelgroup import ModelGroup
from .outputmodality import OutputModality
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
ModelArchitectureInstructType = Union[
Literal[
"none",
"airoboros",
"alpaca",
"alpaca-modif",
"chatml",
"claude",
"code-llama",
"gemma",
"llama2",
"llama3",
"mistral",
"nemotron",
"neural",
"openchat",
"phi3",
"rwkv",
"vicuna",
"zephyr",
"deepseek-r1",
"deepseek-v3.1",
"qwq",
"qwen3",
],
UnrecognizedStr,
]
r"""Instruction format type"""
class ModelArchitectureTypedDict(TypedDict):
r"""Model architecture information"""
modality: Nullable[str]
r"""Primary modality of the model"""
input_modalities: List[InputModality]
r"""Supported input modalities"""
output_modalities: List[OutputModality]
r"""Supported output modalities"""
tokenizer: NotRequired[ModelGroup]
r"""Tokenizer type used by the model"""
instruct_type: NotRequired[Nullable[ModelArchitectureInstructType]]
r"""Instruction format type"""
class ModelArchitecture(BaseModel):
r"""Model architecture information"""
modality: Nullable[str]
r"""Primary modality of the model"""
input_modalities: List[
Annotated[InputModality, PlainValidator(validate_open_enum(False))]
]
r"""Supported input modalities"""
output_modalities: List[
Annotated[OutputModality, PlainValidator(validate_open_enum(False))]
]
r"""Supported output modalities"""
tokenizer: Annotated[
Optional[ModelGroup], PlainValidator(validate_open_enum(False))
] = None
r"""Tokenizer type used by the model"""
instruct_type: Annotated[
OptionalNullable[ModelArchitectureInstructType],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Instruction format type"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["tokenizer", "instruct_type"]
nullable_fields = ["instruct_type", "modality"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
-32
View File
@@ -1,32 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ModelGroup = Union[
Literal[
"Router",
"Media",
"Other",
"GPT",
"Claude",
"Gemini",
"Grok",
"Cohere",
"Nova",
"Qwen",
"Yi",
"DeepSeek",
"Mistral",
"Llama2",
"Llama3",
"Llama4",
"PaLM",
"RWKV",
"Qwen3",
],
UnrecognizedStr,
]
r"""Tokenizer type used by the model"""
@@ -1,33 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class ModelsCountResponseDataTypedDict(TypedDict):
r"""Model count data"""
count: float
r"""Total number of available models"""
class ModelsCountResponseData(BaseModel):
r"""Model count data"""
count: float
r"""Total number of available models"""
class ModelsCountResponseTypedDict(TypedDict):
r"""Model count data"""
data: ModelsCountResponseDataTypedDict
r"""Model count data"""
class ModelsCountResponse(BaseModel):
r"""Model count data"""
data: ModelsCountResponseData
r"""Model count data"""
@@ -1,21 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .model import Model, ModelTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class ModelsListResponseTypedDict(TypedDict):
r"""List of available models"""
data: List[ModelTypedDict]
r"""List of available models"""
class ModelsListResponse(BaseModel):
r"""List of available models"""
data: List[Model]
r"""List of available models"""
-31
View File
@@ -1,31 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class NamedToolChoiceFunctionTypedDict(TypedDict):
name: str
class NamedToolChoiceFunction(BaseModel):
name: str
class NamedToolChoiceTypedDict(TypedDict):
function: NamedToolChoiceFunctionTypedDict
type: Literal["function"]
class NamedToolChoice(BaseModel):
function: NamedToolChoiceFunction
TYPE: Annotated[
Annotated[Literal["function"], AfterValidator(validate_const("function"))],
pydantic.Field(alias="type"),
] = "function"
@@ -1,61 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class NotFoundResponseErrorDataTypedDict(TypedDict):
r"""Error data for NotFoundResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class NotFoundResponseErrorData(BaseModel):
r"""Error data for NotFoundResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,19 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .filecitation import FileCitation, FileCitationTypedDict
from .filepath import FilePath, FilePathTypedDict
from .urlcitation import URLCitation, URLCitationTypedDict
from typing import Union
from typing_extensions import TypeAliasType
OpenAIResponsesAnnotationTypedDict = TypeAliasType(
"OpenAIResponsesAnnotationTypedDict",
Union[FilePathTypedDict, FileCitationTypedDict, URLCitationTypedDict],
)
OpenAIResponsesAnnotation = TypeAliasType(
"OpenAIResponsesAnnotation", Union[FilePath, FileCitation, URLCitation]
)
@@ -1,17 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
OpenAIResponsesIncludable = Union[
Literal[
"file_search_call.results",
"message.input_image.image_url",
"computer_call_output.output.image_url",
"reasoning.encrypted_content",
"code_interpreter_call.outputs",
],
UnrecognizedStr,
]
@@ -1,27 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
Reason = Union[
Literal[
"max_output_tokens",
"content_filter",
],
UnrecognizedStr,
]
class OpenAIResponsesIncompleteDetailsTypedDict(TypedDict):
reason: NotRequired[Reason]
class OpenAIResponsesIncompleteDetails(BaseModel):
reason: Annotated[Optional[Reason], PlainValidator(validate_open_enum(False))] = (
None
)
@@ -1,330 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .outputitemimagegenerationcall import (
OutputItemImageGenerationCall,
OutputItemImageGenerationCallTypedDict,
)
from .outputmessage import OutputMessage, OutputMessageTypedDict
from .responseinputaudio import ResponseInputAudio, ResponseInputAudioTypedDict
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from .toolcallstatus import ToolCallStatus
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenAIResponsesInputTypeFunctionCall = Literal["function_call",]
class OpenAIResponsesInputFunctionCallTypedDict(TypedDict):
type: OpenAIResponsesInputTypeFunctionCall
call_id: str
name: str
arguments: str
id: NotRequired[str]
status: NotRequired[Nullable[ToolCallStatus]]
class OpenAIResponsesInputFunctionCall(BaseModel):
type: OpenAIResponsesInputTypeFunctionCall
call_id: str
name: str
arguments: str
id: Optional[str] = None
status: Annotated[
OptionalNullable[ToolCallStatus], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "status"]
nullable_fields = ["status"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
OpenAIResponsesInputTypeFunctionCallOutput = Literal["function_call_output",]
class OpenAIResponsesInputFunctionCallOutputTypedDict(TypedDict):
type: OpenAIResponsesInputTypeFunctionCallOutput
call_id: str
output: str
id: NotRequired[Nullable[str]]
status: NotRequired[Nullable[ToolCallStatus]]
class OpenAIResponsesInputFunctionCallOutput(BaseModel):
type: OpenAIResponsesInputTypeFunctionCallOutput
call_id: str
output: str
id: OptionalNullable[str] = UNSET
status: Annotated[
OptionalNullable[ToolCallStatus], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "status"]
nullable_fields = ["id", "status"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
OpenAIResponsesInputTypeMessage2 = Literal["message",]
OpenAIResponsesInputRoleDeveloper2 = Literal["developer",]
OpenAIResponsesInputRoleSystem2 = Literal["system",]
OpenAIResponsesInputRoleUser2 = Literal["user",]
OpenAIResponsesInputRoleUnion2TypedDict = TypeAliasType(
"OpenAIResponsesInputRoleUnion2TypedDict",
Union[
OpenAIResponsesInputRoleUser2,
OpenAIResponsesInputRoleSystem2,
OpenAIResponsesInputRoleDeveloper2,
],
)
OpenAIResponsesInputRoleUnion2 = TypeAliasType(
"OpenAIResponsesInputRoleUnion2",
Union[
OpenAIResponsesInputRoleUser2,
OpenAIResponsesInputRoleSystem2,
OpenAIResponsesInputRoleDeveloper2,
],
)
OpenAIResponsesInputContent3TypedDict = TypeAliasType(
"OpenAIResponsesInputContent3TypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenAIResponsesInputContent3 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
class OpenAIResponsesInputMessage2TypedDict(TypedDict):
id: str
role: OpenAIResponsesInputRoleUnion2TypedDict
content: List[OpenAIResponsesInputContent3TypedDict]
type: NotRequired[OpenAIResponsesInputTypeMessage2]
class OpenAIResponsesInputMessage2(BaseModel):
id: str
role: OpenAIResponsesInputRoleUnion2
content: List[OpenAIResponsesInputContent3]
type: Optional[OpenAIResponsesInputTypeMessage2] = None
OpenAIResponsesInputTypeMessage1 = Literal["message",]
OpenAIResponsesInputRoleDeveloper1 = Literal["developer",]
OpenAIResponsesInputRoleAssistant = Literal["assistant",]
OpenAIResponsesInputRoleSystem1 = Literal["system",]
OpenAIResponsesInputRoleUser1 = Literal["user",]
OpenAIResponsesInputRoleUnion1TypedDict = TypeAliasType(
"OpenAIResponsesInputRoleUnion1TypedDict",
Union[
OpenAIResponsesInputRoleUser1,
OpenAIResponsesInputRoleSystem1,
OpenAIResponsesInputRoleAssistant,
OpenAIResponsesInputRoleDeveloper1,
],
)
OpenAIResponsesInputRoleUnion1 = TypeAliasType(
"OpenAIResponsesInputRoleUnion1",
Union[
OpenAIResponsesInputRoleUser1,
OpenAIResponsesInputRoleSystem1,
OpenAIResponsesInputRoleAssistant,
OpenAIResponsesInputRoleDeveloper1,
],
)
OpenAIResponsesInputContent1TypedDict = TypeAliasType(
"OpenAIResponsesInputContent1TypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenAIResponsesInputContent1 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenAIResponsesInputContent2TypedDict = TypeAliasType(
"OpenAIResponsesInputContent2TypedDict",
Union[List[OpenAIResponsesInputContent1TypedDict], str],
)
OpenAIResponsesInputContent2 = TypeAliasType(
"OpenAIResponsesInputContent2", Union[List[OpenAIResponsesInputContent1], str]
)
class OpenAIResponsesInputMessage1TypedDict(TypedDict):
role: OpenAIResponsesInputRoleUnion1TypedDict
content: OpenAIResponsesInputContent2TypedDict
type: NotRequired[OpenAIResponsesInputTypeMessage1]
class OpenAIResponsesInputMessage1(BaseModel):
role: OpenAIResponsesInputRoleUnion1
content: OpenAIResponsesInputContent2
type: Optional[OpenAIResponsesInputTypeMessage1] = None
OpenAIResponsesInputUnion1TypedDict = TypeAliasType(
"OpenAIResponsesInputUnion1TypedDict",
Union[
OpenAIResponsesInputMessage1TypedDict,
OpenAIResponsesInputMessage2TypedDict,
OutputItemImageGenerationCallTypedDict,
OpenAIResponsesInputFunctionCallOutputTypedDict,
OutputMessageTypedDict,
OpenAIResponsesInputFunctionCallTypedDict,
],
)
OpenAIResponsesInputUnion1 = TypeAliasType(
"OpenAIResponsesInputUnion1",
Union[
OpenAIResponsesInputMessage1,
OpenAIResponsesInputMessage2,
OutputItemImageGenerationCall,
OpenAIResponsesInputFunctionCallOutput,
OutputMessage,
OpenAIResponsesInputFunctionCall,
],
)
OpenAIResponsesInputUnionTypedDict = TypeAliasType(
"OpenAIResponsesInputUnionTypedDict",
Union[str, List[OpenAIResponsesInputUnion1TypedDict], Any],
)
OpenAIResponsesInputUnion = TypeAliasType(
"OpenAIResponsesInputUnion", Union[str, List[OpenAIResponsesInputUnion1], Any]
)
@@ -1,73 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Dict, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
VariablesTypedDict = TypeAliasType(
"VariablesTypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
str,
],
)
Variables = TypeAliasType(
"Variables", Union[ResponseInputText, ResponseInputImage, ResponseInputFile, str]
)
class OpenAIResponsesPromptTypedDict(TypedDict):
id: str
variables: NotRequired[Nullable[Dict[str, VariablesTypedDict]]]
class OpenAIResponsesPrompt(BaseModel):
id: str
variables: OptionalNullable[Dict[str, Variables]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["variables"]
nullable_fields = ["variables"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,63 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openairesponsesreasoningeffort import OpenAIResponsesReasoningEffort
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class OpenAIResponsesReasoningConfigTypedDict(TypedDict):
effort: NotRequired[Nullable[OpenAIResponsesReasoningEffort]]
summary: NotRequired[ReasoningSummaryVerbosity]
class OpenAIResponsesReasoningConfig(BaseModel):
effort: Annotated[
OptionalNullable[OpenAIResponsesReasoningEffort],
PlainValidator(validate_open_enum(False)),
] = UNSET
summary: Annotated[
Optional[ReasoningSummaryVerbosity], PlainValidator(validate_open_enum(False))
] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["effort", "summary"]
nullable_fields = ["effort"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,16 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
OpenAIResponsesReasoningEffort = Union[
Literal[
"high",
"medium",
"low",
"minimal",
],
UnrecognizedStr,
]
@@ -1,20 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenAIResponsesRefusalContentType = Literal["refusal",]
class OpenAIResponsesRefusalContentTypedDict(TypedDict):
type: OpenAIResponsesRefusalContentType
refusal: str
class OpenAIResponsesRefusalContent(BaseModel):
type: OpenAIResponsesRefusalContentType
refusal: str
@@ -1,18 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
OpenAIResponsesResponseStatus = Union[
Literal[
"completed",
"incomplete",
"in_progress",
"failed",
"cancelled",
"queued",
],
UnrecognizedStr,
]
@@ -1,17 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
OpenAIResponsesServiceTier = Union[
Literal[
"auto",
"default",
"flex",
"priority",
"scale",
],
UnrecognizedStr,
]
@@ -1,87 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal, Union
from typing_extensions import TypeAliasType, TypedDict
OpenAIResponsesToolChoiceTypeWebSearchPreview = Literal["web_search_preview",]
OpenAIResponsesToolChoiceTypeWebSearchPreview20250311 = Literal[
"web_search_preview_2025_03_11",
]
TypeTypedDict = TypeAliasType(
"TypeTypedDict",
Union[
OpenAIResponsesToolChoiceTypeWebSearchPreview20250311,
OpenAIResponsesToolChoiceTypeWebSearchPreview,
],
)
Type = TypeAliasType(
"Type",
Union[
OpenAIResponsesToolChoiceTypeWebSearchPreview20250311,
OpenAIResponsesToolChoiceTypeWebSearchPreview,
],
)
class OpenAIResponsesToolChoiceTypedDict(TypedDict):
type: TypeTypedDict
class OpenAIResponsesToolChoice(BaseModel):
type: Type
OpenAIResponsesToolChoiceTypeFunction = Literal["function",]
class OpenAIResponsesToolChoiceFunctionTypedDict(TypedDict):
type: OpenAIResponsesToolChoiceTypeFunction
name: str
class OpenAIResponsesToolChoiceFunction(BaseModel):
type: OpenAIResponsesToolChoiceTypeFunction
name: str
OpenAIResponsesToolChoiceRequired = Literal["required",]
OpenAIResponsesToolChoiceNone = Literal["none",]
OpenAIResponsesToolChoiceAuto = Literal["auto",]
OpenAIResponsesToolChoiceUnionTypedDict = TypeAliasType(
"OpenAIResponsesToolChoiceUnionTypedDict",
Union[
OpenAIResponsesToolChoiceTypedDict,
OpenAIResponsesToolChoiceFunctionTypedDict,
OpenAIResponsesToolChoiceAuto,
OpenAIResponsesToolChoiceNone,
OpenAIResponsesToolChoiceRequired,
],
)
OpenAIResponsesToolChoiceUnion = TypeAliasType(
"OpenAIResponsesToolChoiceUnion",
Union[
OpenAIResponsesToolChoice,
OpenAIResponsesToolChoiceFunction,
OpenAIResponsesToolChoiceAuto,
OpenAIResponsesToolChoiceNone,
OpenAIResponsesToolChoiceRequired,
],
)
@@ -1,14 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
OpenAIResponsesTruncation = Union[
Literal[
"auto",
"disabled",
],
UnrecognizedStr,
]
@@ -1,97 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .responseinputaudio import ResponseInputAudio, ResponseInputAudioTypedDict
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesEasyInputMessageType = Literal["message",]
OpenResponsesEasyInputMessageRoleDeveloper = Literal["developer",]
OpenResponsesEasyInputMessageRoleAssistant = Literal["assistant",]
OpenResponsesEasyInputMessageRoleSystem = Literal["system",]
OpenResponsesEasyInputMessageRoleUser = Literal["user",]
OpenResponsesEasyInputMessageRoleUnionTypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageRoleUnionTypedDict",
Union[
OpenResponsesEasyInputMessageRoleUser,
OpenResponsesEasyInputMessageRoleSystem,
OpenResponsesEasyInputMessageRoleAssistant,
OpenResponsesEasyInputMessageRoleDeveloper,
],
)
OpenResponsesEasyInputMessageRoleUnion = TypeAliasType(
"OpenResponsesEasyInputMessageRoleUnion",
Union[
OpenResponsesEasyInputMessageRoleUser,
OpenResponsesEasyInputMessageRoleSystem,
OpenResponsesEasyInputMessageRoleAssistant,
OpenResponsesEasyInputMessageRoleDeveloper,
],
)
OpenResponsesEasyInputMessageContent1TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContent1TypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenResponsesEasyInputMessageContent1 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenResponsesEasyInputMessageContent2TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContent2TypedDict",
Union[List[OpenResponsesEasyInputMessageContent1TypedDict], str],
)
OpenResponsesEasyInputMessageContent2 = TypeAliasType(
"OpenResponsesEasyInputMessageContent2",
Union[List[OpenResponsesEasyInputMessageContent1], str],
)
class OpenResponsesEasyInputMessageTypedDict(TypedDict):
role: OpenResponsesEasyInputMessageRoleUnionTypedDict
content: OpenResponsesEasyInputMessageContent2TypedDict
type: NotRequired[OpenResponsesEasyInputMessageType]
class OpenResponsesEasyInputMessage(BaseModel):
role: OpenResponsesEasyInputMessageRoleUnion
content: OpenResponsesEasyInputMessageContent2
type: Optional[OpenResponsesEasyInputMessageType] = None
@@ -1,64 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesErrorEventType = Literal["error",]
class OpenResponsesErrorEventTypedDict(TypedDict):
r"""Event emitted when an error occurs during streaming"""
type: OpenResponsesErrorEventType
code: Nullable[str]
message: str
param: Nullable[str]
sequence_number: float
class OpenResponsesErrorEvent(BaseModel):
r"""Event emitted when an error occurs during streaming"""
type: OpenResponsesErrorEventType
code: Nullable[str]
message: str
param: Nullable[str]
sequence_number: float
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["code", "param"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,75 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .toolcallstatus import ToolCallStatus
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesFunctionCallOutputType = Literal["function_call_output",]
class OpenResponsesFunctionCallOutputTypedDict(TypedDict):
r"""The output from a function call execution"""
type: OpenResponsesFunctionCallOutputType
call_id: str
output: str
id: NotRequired[Nullable[str]]
status: NotRequired[Nullable[ToolCallStatus]]
class OpenResponsesFunctionCallOutput(BaseModel):
r"""The output from a function call execution"""
type: OpenResponsesFunctionCallOutputType
call_id: str
output: str
id: OptionalNullable[str] = UNSET
status: Annotated[
OptionalNullable[ToolCallStatus], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "status"]
nullable_fields = ["id", "status"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,78 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .toolcallstatus import ToolCallStatus
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesFunctionToolCallType = Literal["function_call",]
class OpenResponsesFunctionToolCallTypedDict(TypedDict):
r"""A function call initiated by the model"""
type: OpenResponsesFunctionToolCallType
call_id: str
name: str
arguments: str
id: str
status: NotRequired[Nullable[ToolCallStatus]]
class OpenResponsesFunctionToolCall(BaseModel):
r"""A function call initiated by the model"""
type: OpenResponsesFunctionToolCallType
call_id: str
name: str
arguments: str
id: str
status: Annotated[
OptionalNullable[ToolCallStatus], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["status"]
nullable_fields = ["status"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,32 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesImageGenCallCompletedType = Literal[
"response.image_generation_call.completed",
]
class OpenResponsesImageGenCallCompletedTypedDict(TypedDict):
r"""Image generation call completed"""
type: OpenResponsesImageGenCallCompletedType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesImageGenCallCompleted(BaseModel):
r"""Image generation call completed"""
type: OpenResponsesImageGenCallCompletedType
item_id: str
output_index: float
sequence_number: float
@@ -1,32 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesImageGenCallGeneratingType = Literal[
"response.image_generation_call.generating",
]
class OpenResponsesImageGenCallGeneratingTypedDict(TypedDict):
r"""Image generation call is generating"""
type: OpenResponsesImageGenCallGeneratingType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesImageGenCallGenerating(BaseModel):
r"""Image generation call is generating"""
type: OpenResponsesImageGenCallGeneratingType
item_id: str
output_index: float
sequence_number: float
@@ -1,32 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesImageGenCallInProgressType = Literal[
"response.image_generation_call.in_progress",
]
class OpenResponsesImageGenCallInProgressTypedDict(TypedDict):
r"""Image generation call in progress"""
type: OpenResponsesImageGenCallInProgressType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesImageGenCallInProgress(BaseModel):
r"""Image generation call in progress"""
type: OpenResponsesImageGenCallInProgressType
item_id: str
output_index: float
sequence_number: float
@@ -1,38 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesImageGenCallPartialImageType = Literal[
"response.image_generation_call.partial_image",
]
class OpenResponsesImageGenCallPartialImageTypedDict(TypedDict):
r"""Image generation call with partial image"""
type: OpenResponsesImageGenCallPartialImageType
item_id: str
output_index: float
sequence_number: float
partial_image_b64: str
partial_image_index: float
class OpenResponsesImageGenCallPartialImage(BaseModel):
r"""Image generation call with partial image"""
type: OpenResponsesImageGenCallPartialImageType
item_id: str
output_index: float
sequence_number: float
partial_image_b64: str
partial_image_index: float
@@ -1,97 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openresponseseasyinputmessage import (
OpenResponsesEasyInputMessage,
OpenResponsesEasyInputMessageTypedDict,
)
from .openresponsesfunctioncalloutput import (
OpenResponsesFunctionCallOutput,
OpenResponsesFunctionCallOutputTypedDict,
)
from .openresponsesfunctiontoolcall import (
OpenResponsesFunctionToolCall,
OpenResponsesFunctionToolCallTypedDict,
)
from .openresponsesinputmessageitem import (
OpenResponsesInputMessageItem,
OpenResponsesInputMessageItemTypedDict,
)
from .openresponsesreasoning import (
OpenResponsesReasoning,
OpenResponsesReasoningTypedDict,
)
from .responsesimagegenerationcall import (
ResponsesImageGenerationCall,
ResponsesImageGenerationCallTypedDict,
)
from .responsesoutputitemfilesearchcall import (
ResponsesOutputItemFileSearchCall,
ResponsesOutputItemFileSearchCallTypedDict,
)
from .responsesoutputitemfunctioncall import (
ResponsesOutputItemFunctionCall,
ResponsesOutputItemFunctionCallTypedDict,
)
from .responsesoutputitemreasoning import (
ResponsesOutputItemReasoning,
ResponsesOutputItemReasoningTypedDict,
)
from .responsesoutputmessage import (
ResponsesOutputMessage,
ResponsesOutputMessageTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
)
from typing import List, Union
from typing_extensions import TypeAliasType
OpenResponsesInput1TypedDict = TypeAliasType(
"OpenResponsesInput1TypedDict",
Union[
OpenResponsesEasyInputMessageTypedDict,
ResponsesWebSearchCallOutputTypedDict,
OpenResponsesInputMessageItemTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
OpenResponsesFunctionCallOutputTypedDict,
ResponsesOutputMessageTypedDict,
OpenResponsesFunctionToolCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
OpenResponsesReasoningTypedDict,
],
)
OpenResponsesInput1 = TypeAliasType(
"OpenResponsesInput1",
Union[
OpenResponsesEasyInputMessage,
ResponsesWebSearchCallOutput,
OpenResponsesInputMessageItem,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
OpenResponsesFunctionCallOutput,
ResponsesOutputMessage,
OpenResponsesFunctionToolCall,
ResponsesOutputItemReasoning,
ResponsesOutputItemFunctionCall,
OpenResponsesReasoning,
],
)
OpenResponsesInputTypedDict = TypeAliasType(
"OpenResponsesInputTypedDict", Union[str, List[OpenResponsesInput1TypedDict]]
)
r"""Input for a response request - can be a string or array of items"""
OpenResponsesInput = TypeAliasType(
"OpenResponsesInput", Union[str, List[OpenResponsesInput1]]
)
r"""Input for a response request - can be a string or array of items"""
@@ -1,83 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .responseinputaudio import ResponseInputAudio, ResponseInputAudioTypedDict
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesInputMessageItemType = Literal["message",]
OpenResponsesInputMessageItemRoleDeveloper = Literal["developer",]
OpenResponsesInputMessageItemRoleSystem = Literal["system",]
OpenResponsesInputMessageItemRoleUser = Literal["user",]
OpenResponsesInputMessageItemRoleUnionTypedDict = TypeAliasType(
"OpenResponsesInputMessageItemRoleUnionTypedDict",
Union[
OpenResponsesInputMessageItemRoleUser,
OpenResponsesInputMessageItemRoleSystem,
OpenResponsesInputMessageItemRoleDeveloper,
],
)
OpenResponsesInputMessageItemRoleUnion = TypeAliasType(
"OpenResponsesInputMessageItemRoleUnion",
Union[
OpenResponsesInputMessageItemRoleUser,
OpenResponsesInputMessageItemRoleSystem,
OpenResponsesInputMessageItemRoleDeveloper,
],
)
OpenResponsesInputMessageItemContentTypedDict = TypeAliasType(
"OpenResponsesInputMessageItemContentTypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenResponsesInputMessageItemContent = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
class OpenResponsesInputMessageItemTypedDict(TypedDict):
role: OpenResponsesInputMessageItemRoleUnionTypedDict
content: List[OpenResponsesInputMessageItemContentTypedDict]
id: NotRequired[str]
type: NotRequired[OpenResponsesInputMessageItemType]
class OpenResponsesInputMessageItem(BaseModel):
role: OpenResponsesInputMessageItemRoleUnion
content: List[OpenResponsesInputMessageItemContent]
id: Optional[str] = None
type: Optional[OpenResponsesInputMessageItemType] = None
@@ -1,28 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openresponsestoplogprobs import (
OpenResponsesTopLogprobs,
OpenResponsesTopLogprobsTypedDict,
)
from openrouter.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class OpenResponsesLogProbsTypedDict(TypedDict):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: NotRequired[List[OpenResponsesTopLogprobsTypedDict]]
class OpenResponsesLogProbs(BaseModel):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: Optional[List[OpenResponsesTopLogprobs]] = None
@@ -1,324 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openairesponsesincompletedetails import (
OpenAIResponsesIncompleteDetails,
OpenAIResponsesIncompleteDetailsTypedDict,
)
from .openairesponsesinput_union import (
OpenAIResponsesInputUnion,
OpenAIResponsesInputUnionTypedDict,
)
from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict
from .openairesponsesreasoningconfig import (
OpenAIResponsesReasoningConfig,
OpenAIResponsesReasoningConfigTypedDict,
)
from .openairesponsesresponsestatus import OpenAIResponsesResponseStatus
from .openairesponsesservicetier import OpenAIResponsesServiceTier
from .openairesponsestoolchoice_union import (
OpenAIResponsesToolChoiceUnion,
OpenAIResponsesToolChoiceUnionTypedDict,
)
from .openairesponsestruncation import OpenAIResponsesTruncation
from .openresponsesusage import OpenResponsesUsage, OpenResponsesUsageTypedDict
from .openresponseswebsearch20250826tool import (
OpenResponsesWebSearch20250826Tool,
OpenResponsesWebSearch20250826ToolTypedDict,
)
from .openresponseswebsearchpreview20250311tool import (
OpenResponsesWebSearchPreview20250311Tool,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
)
from .openresponseswebsearchpreviewtool import (
OpenResponsesWebSearchPreviewTool,
OpenResponsesWebSearchPreviewToolTypedDict,
)
from .openresponseswebsearchtool import (
OpenResponsesWebSearchTool,
OpenResponsesWebSearchToolTypedDict,
)
from .responseserrorfield import ResponsesErrorField, ResponsesErrorFieldTypedDict
from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict
from .responsetextconfig import ResponseTextConfig, ResponseTextConfigTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Object = Literal["response",]
OpenResponsesNonStreamingResponseType = Literal["function",]
class OpenResponsesNonStreamingResponseToolFunctionTypedDict(TypedDict):
r"""Function tool definition"""
type: OpenResponsesNonStreamingResponseType
name: str
parameters: Nullable[Dict[str, Nullable[Any]]]
description: NotRequired[Nullable[str]]
strict: NotRequired[Nullable[bool]]
class OpenResponsesNonStreamingResponseToolFunction(BaseModel):
r"""Function tool definition"""
type: OpenResponsesNonStreamingResponseType
name: str
parameters: Nullable[Dict[str, Nullable[Any]]]
description: OptionalNullable[str] = UNSET
strict: OptionalNullable[bool] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["description", "strict"]
nullable_fields = ["description", "strict", "parameters"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType(
"OpenResponsesNonStreamingResponseToolUnionTypedDict",
Union[
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesNonStreamingResponseToolFunctionTypedDict,
],
)
OpenResponsesNonStreamingResponseToolUnion = TypeAliasType(
"OpenResponsesNonStreamingResponseToolUnion",
Union[
OpenResponsesWebSearchPreviewTool,
OpenResponsesWebSearchPreview20250311Tool,
OpenResponsesWebSearchTool,
OpenResponsesWebSearch20250826Tool,
OpenResponsesNonStreamingResponseToolFunction,
],
)
class OpenResponsesNonStreamingResponseTypedDict(TypedDict):
r"""Complete non-streaming response from the Responses API"""
id: str
object: Object
created_at: float
model: str
output: List[ResponsesOutputItemTypedDict]
error: Nullable[ResponsesErrorFieldTypedDict]
r"""Error information returned from the API"""
incomplete_details: Nullable[OpenAIResponsesIncompleteDetailsTypedDict]
temperature: Nullable[float]
top_p: Nullable[float]
instructions: Nullable[OpenAIResponsesInputUnionTypedDict]
metadata: Nullable[Dict[str, str]]
r"""Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed."""
tools: List[OpenResponsesNonStreamingResponseToolUnionTypedDict]
tool_choice: OpenAIResponsesToolChoiceUnionTypedDict
parallel_tool_calls: bool
status: NotRequired[OpenAIResponsesResponseStatus]
user: NotRequired[Nullable[str]]
output_text: NotRequired[str]
prompt_cache_key: NotRequired[Nullable[str]]
safety_identifier: NotRequired[Nullable[str]]
usage: NotRequired[OpenResponsesUsageTypedDict]
r"""Token usage information for the response"""
max_tool_calls: NotRequired[Nullable[float]]
top_logprobs: NotRequired[float]
max_output_tokens: NotRequired[Nullable[float]]
prompt: NotRequired[Nullable[OpenAIResponsesPromptTypedDict]]
background: NotRequired[Nullable[bool]]
previous_response_id: NotRequired[Nullable[str]]
reasoning: NotRequired[Nullable[OpenAIResponsesReasoningConfigTypedDict]]
service_tier: NotRequired[Nullable[OpenAIResponsesServiceTier]]
store: NotRequired[bool]
truncation: NotRequired[Nullable[OpenAIResponsesTruncation]]
text: NotRequired[ResponseTextConfigTypedDict]
r"""Text output configuration including format and verbosity"""
class OpenResponsesNonStreamingResponse(BaseModel):
r"""Complete non-streaming response from the Responses API"""
id: str
object: Object
created_at: float
model: str
output: List[ResponsesOutputItem]
error: Nullable[ResponsesErrorField]
r"""Error information returned from the API"""
incomplete_details: Nullable[OpenAIResponsesIncompleteDetails]
temperature: Nullable[float]
top_p: Nullable[float]
instructions: Nullable[OpenAIResponsesInputUnion]
metadata: Nullable[Dict[str, str]]
r"""Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed."""
tools: List[OpenResponsesNonStreamingResponseToolUnion]
tool_choice: OpenAIResponsesToolChoiceUnion
parallel_tool_calls: bool
status: Annotated[
Optional[OpenAIResponsesResponseStatus],
PlainValidator(validate_open_enum(False)),
] = None
user: OptionalNullable[str] = UNSET
output_text: Optional[str] = None
prompt_cache_key: OptionalNullable[str] = UNSET
safety_identifier: OptionalNullable[str] = UNSET
usage: Optional[OpenResponsesUsage] = None
r"""Token usage information for the response"""
max_tool_calls: OptionalNullable[float] = UNSET
top_logprobs: Optional[float] = None
max_output_tokens: OptionalNullable[float] = UNSET
prompt: OptionalNullable[OpenAIResponsesPrompt] = UNSET
background: OptionalNullable[bool] = UNSET
previous_response_id: OptionalNullable[str] = UNSET
reasoning: OptionalNullable[OpenAIResponsesReasoningConfig] = UNSET
service_tier: Annotated[
OptionalNullable[OpenAIResponsesServiceTier],
PlainValidator(validate_open_enum(False)),
] = UNSET
store: Optional[bool] = None
truncation: Annotated[
OptionalNullable[OpenAIResponsesTruncation],
PlainValidator(validate_open_enum(False)),
] = UNSET
text: Optional[ResponseTextConfig] = None
r"""Text output configuration including format and verbosity"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"status",
"user",
"output_text",
"prompt_cache_key",
"safety_identifier",
"usage",
"max_tool_calls",
"top_logprobs",
"max_output_tokens",
"prompt",
"background",
"previous_response_id",
"reasoning",
"service_tier",
"store",
"truncation",
"text",
]
nullable_fields = [
"user",
"prompt_cache_key",
"safety_identifier",
"error",
"incomplete_details",
"max_tool_calls",
"max_output_tokens",
"temperature",
"top_p",
"instructions",
"metadata",
"prompt",
"background",
"previous_response_id",
"reasoning",
"service_tier",
"truncation",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,137 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .reasoningsummarytext import ReasoningSummaryText, ReasoningSummaryTextTypedDict
from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesReasoningType = Literal["reasoning",]
OpenResponsesReasoningStatusInProgress = Literal["in_progress",]
OpenResponsesReasoningStatusIncomplete = Literal["incomplete",]
OpenResponsesReasoningStatusCompleted = Literal["completed",]
OpenResponsesReasoningStatusUnionTypedDict = TypeAliasType(
"OpenResponsesReasoningStatusUnionTypedDict",
Union[
OpenResponsesReasoningStatusCompleted,
OpenResponsesReasoningStatusIncomplete,
OpenResponsesReasoningStatusInProgress,
],
)
OpenResponsesReasoningStatusUnion = TypeAliasType(
"OpenResponsesReasoningStatusUnion",
Union[
OpenResponsesReasoningStatusCompleted,
OpenResponsesReasoningStatusIncomplete,
OpenResponsesReasoningStatusInProgress,
],
)
OpenResponsesReasoningFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
],
UnrecognizedStr,
]
class OpenResponsesReasoningTypedDict(TypedDict):
r"""Reasoning output item with signature and format extensions"""
type: OpenResponsesReasoningType
id: str
summary: List[ReasoningSummaryTextTypedDict]
content: NotRequired[List[ReasoningTextContentTypedDict]]
encrypted_content: NotRequired[Nullable[str]]
status: NotRequired[OpenResponsesReasoningStatusUnionTypedDict]
signature: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[OpenResponsesReasoningFormat]]
class OpenResponsesReasoning(BaseModel):
r"""Reasoning output item with signature and format extensions"""
type: OpenResponsesReasoningType
id: str
summary: List[ReasoningSummaryText]
content: Optional[List[ReasoningTextContent]] = None
encrypted_content: OptionalNullable[str] = UNSET
status: Optional[OpenResponsesReasoningStatusUnion] = None
signature: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[
OptionalNullable[OpenResponsesReasoningFormat],
PlainValidator(validate_open_enum(False)),
],
pydantic.Field(alias="format"),
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"content",
"encrypted_content",
"status",
"signature",
"format",
]
nullable_fields = ["encrypted_content", "signature", "format"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,73 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openairesponsesreasoningeffort import OpenAIResponsesReasoningEffort
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class OpenResponsesReasoningConfigTypedDict(TypedDict):
r"""Configuration for reasoning mode in the response"""
effort: NotRequired[Nullable[OpenAIResponsesReasoningEffort]]
summary: NotRequired[ReasoningSummaryVerbosity]
max_tokens: NotRequired[Nullable[float]]
enabled: NotRequired[Nullable[bool]]
class OpenResponsesReasoningConfig(BaseModel):
r"""Configuration for reasoning mode in the response"""
effort: Annotated[
OptionalNullable[OpenAIResponsesReasoningEffort],
PlainValidator(validate_open_enum(False)),
] = UNSET
summary: Annotated[
Optional[ReasoningSummaryVerbosity], PlainValidator(validate_open_enum(False))
] = None
max_tokens: OptionalNullable[float] = UNSET
enabled: OptionalNullable[bool] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["effort", "summary", "max_tokens", "enabled"]
nullable_fields = ["effort", "max_tokens", "enabled"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,36 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesReasoningDeltaEventType = Literal["response.reasoning_text.delta",]
class OpenResponsesReasoningDeltaEventTypedDict(TypedDict):
r"""Event emitted when reasoning text delta is streamed"""
type: OpenResponsesReasoningDeltaEventType
output_index: float
item_id: str
content_index: float
delta: str
sequence_number: float
class OpenResponsesReasoningDeltaEvent(BaseModel):
r"""Event emitted when reasoning text delta is streamed"""
type: OpenResponsesReasoningDeltaEventType
output_index: float
item_id: str
content_index: float
delta: str
sequence_number: float
@@ -1,36 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesReasoningDoneEventType = Literal["response.reasoning_text.done",]
class OpenResponsesReasoningDoneEventTypedDict(TypedDict):
r"""Event emitted when reasoning text streaming is complete"""
type: OpenResponsesReasoningDoneEventType
output_index: float
item_id: str
content_index: float
text: str
sequence_number: float
class OpenResponsesReasoningDoneEvent(BaseModel):
r"""Event emitted when reasoning text streaming is complete"""
type: OpenResponsesReasoningDoneEventType
output_index: float
item_id: str
content_index: float
text: str
sequence_number: float
@@ -1,39 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .reasoningsummarytext import ReasoningSummaryText, ReasoningSummaryTextTypedDict
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesReasoningSummaryPartAddedEventType = Literal[
"response.reasoning_summary_part.added",
]
class OpenResponsesReasoningSummaryPartAddedEventTypedDict(TypedDict):
r"""Event emitted when a reasoning summary part is added"""
type: OpenResponsesReasoningSummaryPartAddedEventType
output_index: float
item_id: str
summary_index: float
part: ReasoningSummaryTextTypedDict
sequence_number: float
class OpenResponsesReasoningSummaryPartAddedEvent(BaseModel):
r"""Event emitted when a reasoning summary part is added"""
type: OpenResponsesReasoningSummaryPartAddedEventType
output_index: float
item_id: str
summary_index: float
part: ReasoningSummaryText
sequence_number: float
@@ -1,38 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesReasoningSummaryTextDeltaEventType = Literal[
"response.reasoning_summary_text.delta",
]
class OpenResponsesReasoningSummaryTextDeltaEventTypedDict(TypedDict):
r"""Event emitted when reasoning summary text delta is streamed"""
type: OpenResponsesReasoningSummaryTextDeltaEventType
item_id: str
output_index: float
summary_index: float
delta: str
sequence_number: float
class OpenResponsesReasoningSummaryTextDeltaEvent(BaseModel):
r"""Event emitted when reasoning summary text delta is streamed"""
type: OpenResponsesReasoningSummaryTextDeltaEventType
item_id: str
output_index: float
summary_index: float
delta: str
sequence_number: float
@@ -1,38 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesReasoningSummaryTextDoneEventType = Literal[
"response.reasoning_summary_text.done",
]
class OpenResponsesReasoningSummaryTextDoneEventTypedDict(TypedDict):
r"""Event emitted when reasoning summary text streaming is complete"""
type: OpenResponsesReasoningSummaryTextDoneEventType
item_id: str
output_index: float
summary_index: float
text: str
sequence_number: float
class OpenResponsesReasoningSummaryTextDoneEvent(BaseModel):
r"""Event emitted when reasoning summary text streaming is complete"""
type: OpenResponsesReasoningSummaryTextDoneEventType
item_id: str
output_index: float
summary_index: float
text: str
sequence_number: float

Some files were not shown because too many files have changed in this diff Show More