mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
chore: 🐝 Update SDK - Generate 0.10.1 (#366)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
speakeasybot
speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent
667941aaa8
commit
5e0b1a2b69
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
AdvisorReasoningEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropiciterationcachecreation import (
|
||||
AnthropicIterationCacheCreation,
|
||||
AnthropicIterationCacheCreationTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
AnthropicAdvisorMessageUsageIterationType = Literal["advisor_message",]
|
||||
|
||||
|
||||
class AnthropicAdvisorMessageUsageIterationTypedDict(TypedDict):
|
||||
model: str
|
||||
type: AnthropicAdvisorMessageUsageIterationType
|
||||
cache_creation: NotRequired[Nullable[AnthropicIterationCacheCreationTypedDict]]
|
||||
cache_creation_input_tokens: NotRequired[int]
|
||||
cache_read_input_tokens: NotRequired[int]
|
||||
input_tokens: NotRequired[int]
|
||||
output_tokens: NotRequired[int]
|
||||
|
||||
|
||||
class AnthropicAdvisorMessageUsageIteration(BaseModel):
|
||||
model: str
|
||||
|
||||
type: AnthropicAdvisorMessageUsageIterationType
|
||||
|
||||
cache_creation: OptionalNullable[AnthropicIterationCacheCreation] = UNSET
|
||||
|
||||
cache_creation_input_tokens: Optional[int] = None
|
||||
|
||||
cache_read_input_tokens: Optional[int] = None
|
||||
|
||||
input_tokens: Optional[int] = None
|
||||
|
||||
output_tokens: Optional[int] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"cache_creation",
|
||||
"cache_creation_input_tokens",
|
||||
"cache_read_input_tokens",
|
||||
"input_tokens",
|
||||
"output_tokens",
|
||||
]
|
||||
nullable_fields = ["cache_creation"]
|
||||
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
|
||||
@@ -0,0 +1,79 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropiciterationcachecreation import (
|
||||
AnthropicIterationCacheCreation,
|
||||
AnthropicIterationCacheCreationTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
AnthropicCompactionUsageIterationType = Literal["compaction",]
|
||||
|
||||
|
||||
class AnthropicCompactionUsageIterationTypedDict(TypedDict):
|
||||
type: AnthropicCompactionUsageIterationType
|
||||
cache_creation: NotRequired[Nullable[AnthropicIterationCacheCreationTypedDict]]
|
||||
cache_creation_input_tokens: NotRequired[int]
|
||||
cache_read_input_tokens: NotRequired[int]
|
||||
input_tokens: NotRequired[int]
|
||||
output_tokens: NotRequired[int]
|
||||
|
||||
|
||||
class AnthropicCompactionUsageIteration(BaseModel):
|
||||
type: AnthropicCompactionUsageIterationType
|
||||
|
||||
cache_creation: OptionalNullable[AnthropicIterationCacheCreation] = UNSET
|
||||
|
||||
cache_creation_input_tokens: Optional[int] = None
|
||||
|
||||
cache_read_input_tokens: Optional[int] = None
|
||||
|
||||
input_tokens: Optional[int] = None
|
||||
|
||||
output_tokens: Optional[int] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"cache_creation",
|
||||
"cache_creation_input_tokens",
|
||||
"cache_read_input_tokens",
|
||||
"input_tokens",
|
||||
"output_tokens",
|
||||
]
|
||||
nullable_fields = ["cache_creation"]
|
||||
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
|
||||
@@ -0,0 +1,17 @@
|
||||
"""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 AnthropicIterationCacheCreationTypedDict(TypedDict):
|
||||
ephemeral_1h_input_tokens: NotRequired[int]
|
||||
ephemeral_5m_input_tokens: NotRequired[int]
|
||||
|
||||
|
||||
class AnthropicIterationCacheCreation(BaseModel):
|
||||
ephemeral_1h_input_tokens: Optional[int] = None
|
||||
|
||||
ephemeral_5m_input_tokens: Optional[int] = None
|
||||
@@ -0,0 +1,83 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropiciterationcachecreation import (
|
||||
AnthropicIterationCacheCreation,
|
||||
AnthropicIterationCacheCreationTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
AnthropicMessageUsageIterationType = Literal["message",]
|
||||
|
||||
|
||||
class AnthropicMessageUsageIterationTypedDict(TypedDict):
|
||||
type: AnthropicMessageUsageIterationType
|
||||
cache_creation: NotRequired[Nullable[AnthropicIterationCacheCreationTypedDict]]
|
||||
cache_creation_input_tokens: NotRequired[int]
|
||||
cache_read_input_tokens: NotRequired[int]
|
||||
input_tokens: NotRequired[int]
|
||||
output_tokens: NotRequired[int]
|
||||
model: NotRequired[str]
|
||||
|
||||
|
||||
class AnthropicMessageUsageIteration(BaseModel):
|
||||
type: AnthropicMessageUsageIterationType
|
||||
|
||||
cache_creation: OptionalNullable[AnthropicIterationCacheCreation] = UNSET
|
||||
|
||||
cache_creation_input_tokens: Optional[int] = None
|
||||
|
||||
cache_read_input_tokens: Optional[int] = None
|
||||
|
||||
input_tokens: Optional[int] = None
|
||||
|
||||
output_tokens: Optional[int] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"cache_creation",
|
||||
"cache_creation_input_tokens",
|
||||
"cache_read_input_tokens",
|
||||
"input_tokens",
|
||||
"output_tokens",
|
||||
"model",
|
||||
]
|
||||
nullable_fields = ["cache_creation"]
|
||||
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
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
AnthropicSpeed = Union[
|
||||
Literal[
|
||||
"fast",
|
||||
"standard",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -0,0 +1,76 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropiciterationcachecreation import (
|
||||
AnthropicIterationCacheCreation,
|
||||
AnthropicIterationCacheCreationTypedDict,
|
||||
)
|
||||
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 AnthropicUnknownUsageIterationTypedDict(TypedDict):
|
||||
type: str
|
||||
cache_creation: NotRequired[Nullable[AnthropicIterationCacheCreationTypedDict]]
|
||||
cache_creation_input_tokens: NotRequired[int]
|
||||
cache_read_input_tokens: NotRequired[int]
|
||||
input_tokens: NotRequired[int]
|
||||
output_tokens: NotRequired[int]
|
||||
|
||||
|
||||
class AnthropicUnknownUsageIteration(BaseModel):
|
||||
type: str
|
||||
|
||||
cache_creation: OptionalNullable[AnthropicIterationCacheCreation] = UNSET
|
||||
|
||||
cache_creation_input_tokens: Optional[int] = None
|
||||
|
||||
cache_read_input_tokens: Optional[int] = None
|
||||
|
||||
input_tokens: Optional[int] = None
|
||||
|
||||
output_tokens: Optional[int] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"cache_creation",
|
||||
"cache_creation_input_tokens",
|
||||
"cache_read_input_tokens",
|
||||
"input_tokens",
|
||||
"output_tokens",
|
||||
]
|
||||
nullable_fields = ["cache_creation"]
|
||||
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
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropicadvisormessageusageiteration import (
|
||||
AnthropicAdvisorMessageUsageIteration,
|
||||
AnthropicAdvisorMessageUsageIterationTypedDict,
|
||||
)
|
||||
from .anthropiccompactionusageiteration import (
|
||||
AnthropicCompactionUsageIteration,
|
||||
AnthropicCompactionUsageIterationTypedDict,
|
||||
)
|
||||
from .anthropicmessageusageiteration import (
|
||||
AnthropicMessageUsageIteration,
|
||||
AnthropicMessageUsageIterationTypedDict,
|
||||
)
|
||||
from .anthropicunknownusageiteration import (
|
||||
AnthropicUnknownUsageIteration,
|
||||
AnthropicUnknownUsageIterationTypedDict,
|
||||
)
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
|
||||
|
||||
AnthropicUsageIterationTypedDict = TypeAliasType(
|
||||
"AnthropicUsageIterationTypedDict",
|
||||
Union[
|
||||
AnthropicCompactionUsageIterationTypedDict,
|
||||
AnthropicUnknownUsageIterationTypedDict,
|
||||
AnthropicMessageUsageIterationTypedDict,
|
||||
AnthropicAdvisorMessageUsageIterationTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
AnthropicUsageIteration = TypeAliasType(
|
||||
"AnthropicUsageIteration",
|
||||
Union[
|
||||
AnthropicCompactionUsageIteration,
|
||||
AnthropicUnknownUsageIteration,
|
||||
AnthropicMessageUsageIteration,
|
||||
AnthropicAdvisorMessageUsageIteration,
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
APIErrorType = Union[
|
||||
Literal[
|
||||
"context_length_exceeded",
|
||||
"max_tokens_exceeded",
|
||||
"token_limit_exceeded",
|
||||
"string_too_long",
|
||||
"authentication",
|
||||
"permission_denied",
|
||||
"payment_required",
|
||||
"rate_limit_exceeded",
|
||||
"provider_overloaded",
|
||||
"provider_unavailable",
|
||||
"invalid_request",
|
||||
"invalid_prompt",
|
||||
"not_found",
|
||||
"precondition_failed",
|
||||
"payload_too_large",
|
||||
"unprocessable",
|
||||
"content_policy_violation",
|
||||
"refusal",
|
||||
"invalid_image",
|
||||
"image_too_large",
|
||||
"image_too_small",
|
||||
"unsupported_image_format",
|
||||
"image_not_found",
|
||||
"image_download_failed",
|
||||
"server",
|
||||
"timeout",
|
||||
"unmapped",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Canonical OpenRouter error type, stable across all API formats"""
|
||||
@@ -1,53 +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
|
||||
|
||||
|
||||
BenchmarksAAMetaSource = Literal["artificial-analysis",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksAAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMetaTypedDict(TypedDict):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMeta(BaseModel):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
@@ -1,19 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
|
||||
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksAAItemTypedDict]
|
||||
meta: BenchmarksAAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponse(BaseModel):
|
||||
data: List[BenchmarksAAItem]
|
||||
|
||||
meta: BenchmarksAAMeta
|
||||
@@ -1,118 +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
|
||||
|
||||
|
||||
class EloBoundsTypedDict(TypedDict):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
class EloBounds(BaseModel):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSource = Literal["design-arena",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksDAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMetaTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
elo_bounds: EloBoundsTypedDict
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMeta(BaseModel):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
elo_bounds: EloBounds
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["category"]
|
||||
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 .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
|
||||
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksDAItemTypedDict]
|
||||
meta: BenchmarksDAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponse(BaseModel):
|
||||
data: List[BenchmarksDAItem]
|
||||
|
||||
meta: BenchmarksDAMeta
|
||||
@@ -0,0 +1,21 @@
|
||||
"""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
|
||||
|
||||
|
||||
BooleanCapabilityType = Literal["boolean",]
|
||||
|
||||
|
||||
class BooleanCapabilityTypedDict(TypedDict):
|
||||
r"""A supported-or-not flag. Present means the parameter is accepted."""
|
||||
|
||||
type: BooleanCapabilityType
|
||||
|
||||
|
||||
class BooleanCapability(BaseModel):
|
||||
r"""A supported-or-not flag. Present means the parameter is accepted."""
|
||||
|
||||
type: BooleanCapabilityType
|
||||
@@ -43,8 +43,10 @@ BYOKProviderSlug = Union[
|
||||
"google-ai-studio",
|
||||
"google-vertex",
|
||||
"groq",
|
||||
"heygen",
|
||||
"inception",
|
||||
"inceptron",
|
||||
"inferact-vllm",
|
||||
"inference-net",
|
||||
"infermatic",
|
||||
"inflection",
|
||||
@@ -75,6 +77,7 @@ BYOKProviderSlug = Union[
|
||||
"recraft",
|
||||
"reka",
|
||||
"relace",
|
||||
"sakana-ai",
|
||||
"sambanova",
|
||||
"seed",
|
||||
"siliconflow",
|
||||
@@ -82,6 +85,7 @@ BYOKProviderSlug = Union[
|
||||
"stepfun",
|
||||
"streamlake",
|
||||
"switchpoint",
|
||||
"tenstorrent",
|
||||
"together",
|
||||
"upstage",
|
||||
"venice",
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .booleancapability import BooleanCapability, BooleanCapabilityTypedDict
|
||||
from .enumcapability import EnumCapability, EnumCapabilityTypedDict
|
||||
from .rangecapability import RangeCapability, RangeCapabilityTypedDict
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
CapabilityDescriptorTypedDict = TypeAliasType(
|
||||
"CapabilityDescriptorTypedDict",
|
||||
Union[
|
||||
BooleanCapabilityTypedDict, EnumCapabilityTypedDict, RangeCapabilityTypedDict
|
||||
],
|
||||
)
|
||||
r"""A typed descriptor for one supported request parameter."""
|
||||
|
||||
|
||||
CapabilityDescriptor = Annotated[
|
||||
Union[
|
||||
Annotated[EnumCapability, Tag("enum")],
|
||||
Annotated[RangeCapability, Tag("range")],
|
||||
Annotated[BooleanCapability, Tag("boolean")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""A typed descriptor for one supported request parameter."""
|
||||
@@ -106,6 +106,7 @@ ChatRequestPlugin = Annotated[
|
||||
|
||||
ChatRequestEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
@@ -172,6 +173,7 @@ class ChatRequestReasoning(BaseModel):
|
||||
|
||||
ChatRequestReasoningEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .apierrortype import APIErrorType
|
||||
from .chatstreamchoice import ChatStreamChoice, ChatStreamChoiceTypedDict
|
||||
from .chatusage import ChatUsage, ChatUsageTypedDict
|
||||
from .openroutermetadata import OpenRouterMetadata, OpenRouterMetadataTypedDict
|
||||
@@ -11,21 +12,44 @@ from openrouter.types import (
|
||||
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, Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ErrorTypedDict(TypedDict):
|
||||
class ChatStreamChunkMetadataTypedDict(TypedDict):
|
||||
r"""Structured error metadata"""
|
||||
|
||||
error_type: APIErrorType
|
||||
r"""Canonical OpenRouter error type, stable across all API formats"""
|
||||
provider_code: NotRequired[str]
|
||||
r"""Upstream provider-specific error code, when available"""
|
||||
|
||||
|
||||
class ChatStreamChunkMetadata(BaseModel):
|
||||
r"""Structured error metadata"""
|
||||
|
||||
error_type: Annotated[APIErrorType, PlainValidator(validate_open_enum(False))]
|
||||
r"""Canonical OpenRouter error type, stable across all API formats"""
|
||||
|
||||
provider_code: Optional[str] = None
|
||||
r"""Upstream provider-specific error code, when available"""
|
||||
|
||||
|
||||
class ChatStreamChunkErrorTypedDict(TypedDict):
|
||||
r"""Error information"""
|
||||
|
||||
code: int
|
||||
r"""Error code"""
|
||||
message: str
|
||||
r"""Error message"""
|
||||
metadata: NotRequired[ChatStreamChunkMetadataTypedDict]
|
||||
r"""Structured error metadata"""
|
||||
|
||||
|
||||
class Error(BaseModel):
|
||||
class ChatStreamChunkError(BaseModel):
|
||||
r"""Error information"""
|
||||
|
||||
code: int
|
||||
@@ -34,6 +58,9 @@ class Error(BaseModel):
|
||||
message: str
|
||||
r"""Error message"""
|
||||
|
||||
metadata: Optional[ChatStreamChunkMetadata] = None
|
||||
r"""Structured error metadata"""
|
||||
|
||||
|
||||
ChatStreamChunkObject = Literal["chat.completion.chunk",]
|
||||
|
||||
@@ -50,7 +77,7 @@ class ChatStreamChunkTypedDict(TypedDict):
|
||||
model: str
|
||||
r"""Model used for completion"""
|
||||
object: ChatStreamChunkObject
|
||||
error: NotRequired[ErrorTypedDict]
|
||||
error: NotRequired[ChatStreamChunkErrorTypedDict]
|
||||
r"""Error information"""
|
||||
openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict]
|
||||
service_tier: NotRequired[Nullable[str]]
|
||||
@@ -78,7 +105,7 @@ class ChatStreamChunk(BaseModel):
|
||||
|
||||
object: ChatStreamChunkObject
|
||||
|
||||
error: Optional[Error] = None
|
||||
error: Optional[ChatStreamChunkError] = None
|
||||
r"""Error information"""
|
||||
|
||||
openrouter_metadata: Optional[OpenRouterMetadata] = None
|
||||
|
||||
@@ -14,7 +14,7 @@ from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class CompletionTokensDetailsTypedDict(TypedDict):
|
||||
class ChatUsageCompletionTokensDetailsTypedDict(TypedDict):
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
accepted_prediction_tokens: NotRequired[Nullable[int]]
|
||||
@@ -27,7 +27,7 @@ class CompletionTokensDetailsTypedDict(TypedDict):
|
||||
r"""Rejected prediction tokens"""
|
||||
|
||||
|
||||
class CompletionTokensDetails(BaseModel):
|
||||
class ChatUsageCompletionTokensDetails(BaseModel):
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
accepted_prediction_tokens: OptionalNullable[int] = UNSET
|
||||
@@ -83,7 +83,7 @@ class CompletionTokensDetails(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class PromptTokensDetailsTypedDict(TypedDict):
|
||||
class ChatUsagePromptTokensDetailsTypedDict(TypedDict):
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
audio_tokens: NotRequired[int]
|
||||
@@ -96,7 +96,7 @@ class PromptTokensDetailsTypedDict(TypedDict):
|
||||
r"""Video input tokens"""
|
||||
|
||||
|
||||
class PromptTokensDetails(BaseModel):
|
||||
class ChatUsagePromptTokensDetails(BaseModel):
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
audio_tokens: Optional[int] = None
|
||||
@@ -112,68 +112,141 @@ class PromptTokensDetails(BaseModel):
|
||||
r"""Video input tokens"""
|
||||
|
||||
|
||||
class ChatUsageTypedDict(TypedDict):
|
||||
r"""Token usage statistics"""
|
||||
class ServerToolUseDetailsTypedDict(TypedDict):
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""Number of tokens in the completion"""
|
||||
prompt_tokens: int
|
||||
r"""Number of tokens in the prompt"""
|
||||
total_tokens: int
|
||||
r"""Total number of tokens"""
|
||||
completion_tokens_details: NotRequired[Nullable[CompletionTokensDetailsTypedDict]]
|
||||
r"""Detailed completion token usage"""
|
||||
cost: NotRequired[Nullable[float]]
|
||||
r"""Cost of the completion"""
|
||||
cost_details: NotRequired[Nullable[CostDetailsTypedDict]]
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
is_byok: NotRequired[bool]
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
prompt_tokens_details: NotRequired[Nullable[PromptTokensDetailsTypedDict]]
|
||||
r"""Detailed prompt token usage"""
|
||||
tool_calls_executed: NotRequired[Nullable[int]]
|
||||
r"""Number of OpenRouter server tool calls that executed and produced a result"""
|
||||
tool_calls_requested: NotRequired[Nullable[int]]
|
||||
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
|
||||
web_search_requests: NotRequired[Nullable[int]]
|
||||
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
|
||||
|
||||
|
||||
class ChatUsage(BaseModel):
|
||||
r"""Token usage statistics"""
|
||||
class ServerToolUseDetails(BaseModel):
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""Number of tokens in the completion"""
|
||||
tool_calls_executed: OptionalNullable[int] = UNSET
|
||||
r"""Number of OpenRouter server tool calls that executed and produced a result"""
|
||||
|
||||
prompt_tokens: int
|
||||
r"""Number of tokens in the prompt"""
|
||||
tool_calls_requested: OptionalNullable[int] = UNSET
|
||||
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
|
||||
|
||||
total_tokens: int
|
||||
r"""Total number of tokens"""
|
||||
|
||||
completion_tokens_details: OptionalNullable[CompletionTokensDetails] = UNSET
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
cost: OptionalNullable[float] = UNSET
|
||||
r"""Cost of the completion"""
|
||||
|
||||
cost_details: OptionalNullable[CostDetails] = UNSET
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
is_byok: Optional[bool] = None
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
|
||||
prompt_tokens_details: OptionalNullable[PromptTokensDetails] = UNSET
|
||||
r"""Detailed prompt token usage"""
|
||||
web_search_requests: OptionalNullable[int] = UNSET
|
||||
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"completion_tokens_details",
|
||||
"cost",
|
||||
"cost_details",
|
||||
"is_byok",
|
||||
"prompt_tokens_details",
|
||||
"tool_calls_executed",
|
||||
"tool_calls_requested",
|
||||
"web_search_requests",
|
||||
]
|
||||
nullable_fields = [
|
||||
"tool_calls_executed",
|
||||
"tool_calls_requested",
|
||||
"web_search_requests",
|
||||
]
|
||||
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 ChatUsageTypedDict(TypedDict):
|
||||
r"""Token usage statistics"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""Number of tokens in the completion"""
|
||||
prompt_tokens: int
|
||||
r"""Number of tokens in the prompt"""
|
||||
total_tokens: int
|
||||
r"""Total number of tokens"""
|
||||
completion_tokens_details: NotRequired[
|
||||
Nullable[ChatUsageCompletionTokensDetailsTypedDict]
|
||||
]
|
||||
r"""Detailed completion token usage"""
|
||||
cost: NotRequired[Nullable[float]]
|
||||
r"""Cost of the completion"""
|
||||
cost_details: NotRequired[Nullable[CostDetailsTypedDict]]
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
is_byok: NotRequired[bool]
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
prompt_tokens_details: NotRequired[Nullable[ChatUsagePromptTokensDetailsTypedDict]]
|
||||
r"""Detailed prompt token usage"""
|
||||
server_tool_use_details: NotRequired[Nullable[ServerToolUseDetailsTypedDict]]
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
|
||||
class ChatUsage(BaseModel):
|
||||
r"""Token usage statistics"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""Number of tokens in the completion"""
|
||||
|
||||
prompt_tokens: int
|
||||
r"""Number of tokens in the prompt"""
|
||||
|
||||
total_tokens: int
|
||||
r"""Total number of tokens"""
|
||||
|
||||
completion_tokens_details: OptionalNullable[ChatUsageCompletionTokensDetails] = (
|
||||
UNSET
|
||||
)
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
cost: OptionalNullable[float] = UNSET
|
||||
r"""Cost of the completion"""
|
||||
|
||||
cost_details: OptionalNullable[CostDetails] = UNSET
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
is_byok: Optional[bool] = None
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
|
||||
prompt_tokens_details: OptionalNullable[ChatUsagePromptTokensDetails] = UNSET
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
server_tool_use_details: OptionalNullable[ServerToolUseDetails] = UNSET
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"completion_tokens_details",
|
||||
"cost",
|
||||
"cost_details",
|
||||
"is_byok",
|
||||
"prompt_tokens_details",
|
||||
"server_tool_use_details",
|
||||
]
|
||||
nullable_fields = [
|
||||
"completion_tokens_details",
|
||||
"cost",
|
||||
"cost_details",
|
||||
"prompt_tokens_details",
|
||||
"server_tool_use_details",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, Dict, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
Event = Union[
|
||||
Literal[
|
||||
"adapter_request",
|
||||
"upstream_headers_received",
|
||||
"first_token_received",
|
||||
"upstream_body_ended",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class TimingsTypedDict(TypedDict):
|
||||
epoch_ms: int
|
||||
event: Event
|
||||
start_ms: int
|
||||
|
||||
|
||||
class Timings(BaseModel):
|
||||
epoch_ms: int
|
||||
|
||||
event: Annotated[Event, PlainValidator(validate_open_enum(False))]
|
||||
|
||||
start_ms: int
|
||||
|
||||
|
||||
class DebugTypedDict(TypedDict):
|
||||
echo_upstream_body: NotRequired[Dict[str, Nullable[Any]]]
|
||||
timings: NotRequired[TimingsTypedDict]
|
||||
|
||||
|
||||
class Debug(BaseModel):
|
||||
echo_upstream_body: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
timings: Optional[Timings] = None
|
||||
|
||||
|
||||
DebugEventType = Literal["response.debug",]
|
||||
|
||||
|
||||
class DebugEventTypedDict(TypedDict):
|
||||
r"""Debug event emitted when debug.echo_upstream_body is true. Contains the transformed upstream request body or timing milestones."""
|
||||
|
||||
debug: DebugTypedDict
|
||||
sequence_number: int
|
||||
type: DebugEventType
|
||||
|
||||
|
||||
class DebugEvent(BaseModel):
|
||||
r"""Debug event emitted when debug.echo_upstream_body is true. Contains the transformed upstream request body or timing milestones."""
|
||||
|
||||
debug: Debug
|
||||
|
||||
sequence_number: int
|
||||
|
||||
type: DebugEventType
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
EnumCapabilityType = Literal["enum",]
|
||||
|
||||
|
||||
class EnumCapabilityTypedDict(TypedDict):
|
||||
r"""A parameter that accepts one of a discrete set of string values."""
|
||||
|
||||
type: EnumCapabilityType
|
||||
values: List[str]
|
||||
|
||||
|
||||
class EnumCapability(BaseModel):
|
||||
r"""A parameter that accepts one of a discrete set of string values."""
|
||||
|
||||
type: EnumCapabilityType
|
||||
|
||||
values: List[str]
|
||||
@@ -15,6 +15,7 @@ PresetEnum = Union[
|
||||
Literal[
|
||||
"general-high",
|
||||
"general-budget",
|
||||
"general-fast",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropiccachecontroldirective import (
|
||||
AnthropicCacheControlDirective,
|
||||
AnthropicCacheControlDirectiveTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
@@ -10,6 +14,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
FusionServerToolConfigEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
@@ -64,6 +69,8 @@ class FusionServerToolConfigTypedDict(TypedDict):
|
||||
|
||||
analysis_models: NotRequired[List[str]]
|
||||
r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion."""
|
||||
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
|
||||
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
|
||||
max_completion_tokens: NotRequired[int]
|
||||
r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies."""
|
||||
max_tool_calls: NotRequired[int]
|
||||
@@ -73,7 +80,7 @@ class FusionServerToolConfigTypedDict(TypedDict):
|
||||
reasoning: NotRequired[FusionServerToolConfigReasoningTypedDict]
|
||||
r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
temperature: NotRequired[float]
|
||||
r"""Sampling temperature forwarded to panelist and judge inner calls. When omitted, the provider's default applies."""
|
||||
r"""Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies."""
|
||||
tools: NotRequired[List[FusionServerToolConfigToolTypedDict]]
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -84,6 +91,9 @@ class FusionServerToolConfig(BaseModel):
|
||||
analysis_models: Optional[List[str]] = None
|
||||
r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion."""
|
||||
|
||||
cache_control: Optional[AnthropicCacheControlDirective] = None
|
||||
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
|
||||
|
||||
max_completion_tokens: Optional[int] = None
|
||||
r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies."""
|
||||
|
||||
@@ -97,7 +107,7 @@ class FusionServerToolConfig(BaseModel):
|
||||
r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
temperature: Optional[float] = None
|
||||
r"""Sampling temperature forwarded to panelist and judge inner calls. When omitted, the provider's default applies."""
|
||||
r"""Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies."""
|
||||
|
||||
tools: Optional[List[FusionServerToolConfigTool]] = None
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .capabilitydescriptor import CapabilityDescriptor, CapabilityDescriptorTypedDict
|
||||
from .imagepricingentry import ImagePricingEntry, ImagePricingEntryTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Dict, List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ImageEndpointTypedDict(TypedDict):
|
||||
r"""An endpoint that serves a given image model."""
|
||||
|
||||
allowed_passthrough_parameters: List[str]
|
||||
r"""Provider-specific options accepted under provider.options[provider_slug]."""
|
||||
pricing: List[ImagePricingEntryTypedDict]
|
||||
r"""Billable pricing lines for this endpoint."""
|
||||
provider_name: str
|
||||
r"""Provider display name"""
|
||||
provider_slug: str
|
||||
r"""Provider slug"""
|
||||
provider_tag: Nullable[str]
|
||||
r"""Provider tag for request-side selection"""
|
||||
supported_parameters: Dict[str, CapabilityDescriptorTypedDict]
|
||||
supports_streaming: bool
|
||||
r"""Whether this endpoint supports native SSE streaming (`stream: true` in the request)."""
|
||||
|
||||
|
||||
class ImageEndpoint(BaseModel):
|
||||
r"""An endpoint that serves a given image model."""
|
||||
|
||||
allowed_passthrough_parameters: List[str]
|
||||
r"""Provider-specific options accepted under provider.options[provider_slug]."""
|
||||
|
||||
pricing: List[ImagePricingEntry]
|
||||
r"""Billable pricing lines for this endpoint."""
|
||||
|
||||
provider_name: str
|
||||
r"""Provider display name"""
|
||||
|
||||
provider_slug: str
|
||||
r"""Provider slug"""
|
||||
|
||||
provider_tag: Nullable[str]
|
||||
r"""Provider tag for request-side selection"""
|
||||
|
||||
supported_parameters: Dict[str, CapabilityDescriptor]
|
||||
|
||||
supports_streaming: bool
|
||||
r"""Whether this endpoint supports native SSE streaming (`stream: true` in the request)."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["provider_tag"]
|
||||
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
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imagegenerationusage import ImageGenerationUsage, ImageGenerationUsageTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
ImageGenCompletedEventType = Literal["image_generation.completed",]
|
||||
r"""The event type"""
|
||||
|
||||
|
||||
class ImageGenCompletedEventTypedDict(TypedDict):
|
||||
r"""Emitted when generation completes and the final image is available"""
|
||||
|
||||
b64_json: str
|
||||
r"""Base64-encoded final image data"""
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) when the image was generated"""
|
||||
type: ImageGenCompletedEventType
|
||||
r"""The event type"""
|
||||
usage: NotRequired[ImageGenerationUsageTypedDict]
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
|
||||
|
||||
class ImageGenCompletedEvent(BaseModel):
|
||||
r"""Emitted when generation completes and the final image is available"""
|
||||
|
||||
b64_json: str
|
||||
r"""Base64-encoded final image data"""
|
||||
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) when the image was generated"""
|
||||
|
||||
type: ImageGenCompletedEventType
|
||||
r"""The event type"""
|
||||
|
||||
usage: Optional[ImageGenerationUsage] = None
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
@@ -0,0 +1,606 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .contentpartimage import ContentPartImage, ContentPartImageTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
import pydantic
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
ImageGenerationRequestAspectRatio = Union[
|
||||
Literal[
|
||||
"1:1",
|
||||
"1:2",
|
||||
"1:4",
|
||||
"1:8",
|
||||
"2:1",
|
||||
"2:3",
|
||||
"3:2",
|
||||
"3:4",
|
||||
"4:1",
|
||||
"4:3",
|
||||
"4:5",
|
||||
"5:4",
|
||||
"8:1",
|
||||
"9:16",
|
||||
"16:9",
|
||||
"9:19.5",
|
||||
"19.5:9",
|
||||
"9:20",
|
||||
"20:9",
|
||||
"9:21",
|
||||
"21:9",
|
||||
"auto",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Normalized aspect ratio of the generated image. Providers clamp to their supported subset."""
|
||||
|
||||
|
||||
ImageGenerationRequestBackground = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"transparent",
|
||||
"opaque",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Background treatment. `transparent` requires an output_format that supports alpha (png or webp)."""
|
||||
|
||||
|
||||
ImageGenerationRequestOutputFormat = Union[
|
||||
Literal[
|
||||
"png",
|
||||
"jpeg",
|
||||
"webp",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Encoding of the returned image bytes."""
|
||||
|
||||
|
||||
class ImageGenerationRequestOptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ai21: NotRequired[Dict[str, Nullable[Any]]]
|
||||
aion_labs: NotRequired[Dict[str, Nullable[Any]]]
|
||||
akashml: NotRequired[Dict[str, Nullable[Any]]]
|
||||
alibaba: NotRequired[Dict[str, Nullable[Any]]]
|
||||
amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]]
|
||||
amazon_nova: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ambient: NotRequired[Dict[str, Nullable[Any]]]
|
||||
anthropic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
anyscale: NotRequired[Dict[str, Nullable[Any]]]
|
||||
arcee_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
atlas_cloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
atoma: NotRequired[Dict[str, Nullable[Any]]]
|
||||
avian: NotRequired[Dict[str, Nullable[Any]]]
|
||||
azure: NotRequired[Dict[str, Nullable[Any]]]
|
||||
baidu: NotRequired[Dict[str, Nullable[Any]]]
|
||||
baseten: NotRequired[Dict[str, Nullable[Any]]]
|
||||
black_forest_labs: NotRequired[Dict[str, Nullable[Any]]]
|
||||
byteplus: NotRequired[Dict[str, Nullable[Any]]]
|
||||
centml: NotRequired[Dict[str, Nullable[Any]]]
|
||||
cerebras: NotRequired[Dict[str, Nullable[Any]]]
|
||||
chutes: NotRequired[Dict[str, Nullable[Any]]]
|
||||
cirrascale: NotRequired[Dict[str, Nullable[Any]]]
|
||||
clarifai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
cloudflare: NotRequired[Dict[str, Nullable[Any]]]
|
||||
cohere: NotRequired[Dict[str, Nullable[Any]]]
|
||||
crofai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
crucible: NotRequired[Dict[str, Nullable[Any]]]
|
||||
crusoe: NotRequired[Dict[str, Nullable[Any]]]
|
||||
darkbloom: NotRequired[Dict[str, Nullable[Any]]]
|
||||
decart: NotRequired[Dict[str, Nullable[Any]]]
|
||||
deepinfra: NotRequired[Dict[str, Nullable[Any]]]
|
||||
deepseek: NotRequired[Dict[str, Nullable[Any]]]
|
||||
dekallm: NotRequired[Dict[str, Nullable[Any]]]
|
||||
digitalocean: NotRequired[Dict[str, Nullable[Any]]]
|
||||
enfer: NotRequired[Dict[str, Nullable[Any]]]
|
||||
fake_provider: NotRequired[Dict[str, Nullable[Any]]]
|
||||
featherless: NotRequired[Dict[str, Nullable[Any]]]
|
||||
fireworks: NotRequired[Dict[str, Nullable[Any]]]
|
||||
friendli: NotRequired[Dict[str, Nullable[Any]]]
|
||||
gmicloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
google_ai_studio: NotRequired[Dict[str, Nullable[Any]]]
|
||||
google_vertex: NotRequired[Dict[str, Nullable[Any]]]
|
||||
gopomelo: NotRequired[Dict[str, Nullable[Any]]]
|
||||
groq: NotRequired[Dict[str, Nullable[Any]]]
|
||||
heygen: NotRequired[Dict[str, Nullable[Any]]]
|
||||
huggingface: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inception: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inceptron: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inferact_vllm: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inference_net: NotRequired[Dict[str, Nullable[Any]]]
|
||||
infermatic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inflection: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inocloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
io_net: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ionstream: NotRequired[Dict[str, Nullable[Any]]]
|
||||
klusterai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
lambda_: NotRequired[Dict[str, Nullable[Any]]]
|
||||
lepton: NotRequired[Dict[str, Nullable[Any]]]
|
||||
liquid: NotRequired[Dict[str, Nullable[Any]]]
|
||||
lynn: NotRequired[Dict[str, Nullable[Any]]]
|
||||
lynn_private: NotRequired[Dict[str, Nullable[Any]]]
|
||||
mancer: NotRequired[Dict[str, Nullable[Any]]]
|
||||
mancer_old: NotRequired[Dict[str, Nullable[Any]]]
|
||||
mara: NotRequired[Dict[str, Nullable[Any]]]
|
||||
meta: NotRequired[Dict[str, Nullable[Any]]]
|
||||
minimax: NotRequired[Dict[str, Nullable[Any]]]
|
||||
mistral: NotRequired[Dict[str, Nullable[Any]]]
|
||||
modal: NotRequired[Dict[str, Nullable[Any]]]
|
||||
modelrun: NotRequired[Dict[str, Nullable[Any]]]
|
||||
modular: NotRequired[Dict[str, Nullable[Any]]]
|
||||
moonshotai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
morph: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ncompass: NotRequired[Dict[str, Nullable[Any]]]
|
||||
nebius: NotRequired[Dict[str, Nullable[Any]]]
|
||||
nex_agi: NotRequired[Dict[str, Nullable[Any]]]
|
||||
nextbit: NotRequired[Dict[str, Nullable[Any]]]
|
||||
nineteen: NotRequired[Dict[str, Nullable[Any]]]
|
||||
novita: NotRequired[Dict[str, Nullable[Any]]]
|
||||
nvidia: NotRequired[Dict[str, Nullable[Any]]]
|
||||
octoai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
open_inference: NotRequired[Dict[str, Nullable[Any]]]
|
||||
openai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
parasail: NotRequired[Dict[str, Nullable[Any]]]
|
||||
perceptron: NotRequired[Dict[str, Nullable[Any]]]
|
||||
perplexity: NotRequired[Dict[str, Nullable[Any]]]
|
||||
phala: NotRequired[Dict[str, Nullable[Any]]]
|
||||
poolside: NotRequired[Dict[str, Nullable[Any]]]
|
||||
recraft: NotRequired[Dict[str, Nullable[Any]]]
|
||||
recursal: NotRequired[Dict[str, Nullable[Any]]]
|
||||
reflection: NotRequired[Dict[str, Nullable[Any]]]
|
||||
reka: NotRequired[Dict[str, Nullable[Any]]]
|
||||
relace: NotRequired[Dict[str, Nullable[Any]]]
|
||||
replicate: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sakana_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]]
|
||||
seed: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sf_compute: NotRequired[Dict[str, Nullable[Any]]]
|
||||
siliconflow: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sourceful: NotRequired[Dict[str, Nullable[Any]]]
|
||||
stealth: NotRequired[Dict[str, Nullable[Any]]]
|
||||
stepfun: NotRequired[Dict[str, Nullable[Any]]]
|
||||
streamlake: NotRequired[Dict[str, Nullable[Any]]]
|
||||
switchpoint: NotRequired[Dict[str, Nullable[Any]]]
|
||||
targon: NotRequired[Dict[str, Nullable[Any]]]
|
||||
tenstorrent: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together_lite: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ubicloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
upstage: NotRequired[Dict[str, Nullable[Any]]]
|
||||
venice: NotRequired[Dict[str, Nullable[Any]]]
|
||||
wafer: NotRequired[Dict[str, Nullable[Any]]]
|
||||
wandb: NotRequired[Dict[str, Nullable[Any]]]
|
||||
xai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
xiaomi: NotRequired[Dict[str, Nullable[Any]]]
|
||||
z_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
|
||||
|
||||
class ImageGenerationRequestOptions(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
|
||||
] = None
|
||||
|
||||
ai21: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
aion_labs: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs")
|
||||
] = None
|
||||
|
||||
akashml: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
alibaba: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
amazon_bedrock: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock")
|
||||
] = None
|
||||
|
||||
amazon_nova: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova")
|
||||
] = None
|
||||
|
||||
ambient: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
anthropic: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
anyscale: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
arcee_ai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai")
|
||||
] = None
|
||||
|
||||
atlas_cloud: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud")
|
||||
] = None
|
||||
|
||||
atoma: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
avian: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
azure: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
baidu: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
baseten: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
black_forest_labs: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs")
|
||||
] = None
|
||||
|
||||
byteplus: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
centml: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
cerebras: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
chutes: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
cirrascale: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
clarifai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
cloudflare: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
cohere: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
crofai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
crucible: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
crusoe: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
darkbloom: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
decart: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
deepinfra: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
deepseek: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
dekallm: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
digitalocean: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
enfer: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
fake_provider: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider")
|
||||
] = None
|
||||
|
||||
featherless: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
fireworks: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
friendli: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
gmicloud: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
google_ai_studio: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio")
|
||||
] = None
|
||||
|
||||
google_vertex: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex")
|
||||
] = None
|
||||
|
||||
gopomelo: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
groq: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
heygen: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
huggingface: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
hyperbolic: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
hyperbolic_quantized: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized")
|
||||
] = None
|
||||
|
||||
inception: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inceptron: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inferact_vllm: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm")
|
||||
] = None
|
||||
|
||||
inference_net: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net")
|
||||
] = None
|
||||
|
||||
infermatic: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inflection: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inocloud: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
io_net: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net")
|
||||
] = None
|
||||
|
||||
ionstream: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
klusterai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
lambda_: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda")
|
||||
] = None
|
||||
|
||||
lepton: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
liquid: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
lynn: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
lynn_private: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private")
|
||||
] = None
|
||||
|
||||
mancer: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
mancer_old: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old")
|
||||
] = None
|
||||
|
||||
mara: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
meta: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
minimax: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
mistral: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
modal: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
modelrun: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
modular: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
moonshotai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
morph: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
ncompass: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
nebius: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
nex_agi: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="nex-agi")
|
||||
] = None
|
||||
|
||||
nextbit: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
nineteen: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
novita: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
nvidia: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
octoai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
open_inference: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference")
|
||||
] = None
|
||||
|
||||
openai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
parasail: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
perceptron: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
perplexity: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
phala: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
poolside: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
recraft: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
recursal: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
reflection: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
reka: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
relace: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
replicate: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sakana_ai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai")
|
||||
] = None
|
||||
|
||||
sambanova: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sambanova_cloaked: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked")
|
||||
] = None
|
||||
|
||||
seed: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sf_compute: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute")
|
||||
] = None
|
||||
|
||||
siliconflow: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sourceful: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
stealth: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
stepfun: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
streamlake: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
switchpoint: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
targon: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
tenstorrent: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together_lite: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite")
|
||||
] = None
|
||||
|
||||
ubicloud: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
upstage: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
venice: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
wafer: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
wandb: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
xai: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
xiaomi: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
z_ai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai")
|
||||
] = None
|
||||
|
||||
|
||||
class ImageGenerationRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[ImageGenerationRequestOptionsTypedDict]
|
||||
|
||||
|
||||
class ImageGenerationRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[ImageGenerationRequestOptions] = None
|
||||
|
||||
|
||||
ImageGenerationRequestQuality = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Rendering quality. Providers without a quality knob ignore this."""
|
||||
|
||||
|
||||
ImageGenerationRequestResolution = Union[
|
||||
Literal[
|
||||
"512",
|
||||
"1K",
|
||||
"2K",
|
||||
"4K",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider."""
|
||||
|
||||
|
||||
class ImageGenerationRequestTypedDict(TypedDict):
|
||||
r"""Image generation request input"""
|
||||
|
||||
model: str
|
||||
r"""The image generation model to use"""
|
||||
prompt: str
|
||||
r"""Text description of the desired image"""
|
||||
aspect_ratio: NotRequired[ImageGenerationRequestAspectRatio]
|
||||
r"""Normalized aspect ratio of the generated image. Providers clamp to their supported subset."""
|
||||
background: NotRequired[ImageGenerationRequestBackground]
|
||||
r"""Background treatment. `transparent` requires an output_format that supports alpha (png or webp)."""
|
||||
input_references: NotRequired[List[ContentPartImageTypedDict]]
|
||||
r"""Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs."""
|
||||
n: NotRequired[int]
|
||||
r"""Number of images to generate (1-10). Providers that only support single-image generation reject n > 1."""
|
||||
output_compression: NotRequired[int]
|
||||
r"""Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob."""
|
||||
output_format: NotRequired[ImageGenerationRequestOutputFormat]
|
||||
r"""Encoding of the returned image bytes."""
|
||||
provider: NotRequired[ImageGenerationRequestProviderTypedDict]
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
quality: NotRequired[ImageGenerationRequestQuality]
|
||||
r"""Rendering quality. Providers without a quality knob ignore this."""
|
||||
resolution: NotRequired[ImageGenerationRequestResolution]
|
||||
r"""Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider."""
|
||||
seed: NotRequired[int]
|
||||
r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers."""
|
||||
size: NotRequired[str]
|
||||
r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected."""
|
||||
stream: NotRequired[bool]
|
||||
r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response."""
|
||||
|
||||
|
||||
class ImageGenerationRequest(BaseModel):
|
||||
r"""Image generation request input"""
|
||||
|
||||
model: str
|
||||
r"""The image generation model to use"""
|
||||
|
||||
prompt: str
|
||||
r"""Text description of the desired image"""
|
||||
|
||||
aspect_ratio: Annotated[
|
||||
Optional[ImageGenerationRequestAspectRatio],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Normalized aspect ratio of the generated image. Providers clamp to their supported subset."""
|
||||
|
||||
background: Annotated[
|
||||
Optional[ImageGenerationRequestBackground],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Background treatment. `transparent` requires an output_format that supports alpha (png or webp)."""
|
||||
|
||||
input_references: Optional[List[ContentPartImage]] = None
|
||||
r"""Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs."""
|
||||
|
||||
n: Optional[int] = None
|
||||
r"""Number of images to generate (1-10). Providers that only support single-image generation reject n > 1."""
|
||||
|
||||
output_compression: Optional[int] = None
|
||||
r"""Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob."""
|
||||
|
||||
output_format: Annotated[
|
||||
Optional[ImageGenerationRequestOutputFormat],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Encoding of the returned image bytes."""
|
||||
|
||||
provider: Optional[ImageGenerationRequestProvider] = None
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
quality: Annotated[
|
||||
Optional[ImageGenerationRequestQuality],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Rendering quality. Providers without a quality knob ignore this."""
|
||||
|
||||
resolution: Annotated[
|
||||
Optional[ImageGenerationRequestResolution],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider."""
|
||||
|
||||
seed: Optional[int] = None
|
||||
r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers."""
|
||||
|
||||
size: Optional[str] = None
|
||||
r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected."""
|
||||
|
||||
stream: Optional[bool] = None
|
||||
r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response."""
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imagegenerationusage import ImageGenerationUsage, ImageGenerationUsageTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ImageGenerationResponseDataTypedDict(TypedDict):
|
||||
b64_json: str
|
||||
r"""Base64-encoded image bytes"""
|
||||
|
||||
|
||||
class ImageGenerationResponseData(BaseModel):
|
||||
b64_json: str
|
||||
r"""Base64-encoded image bytes"""
|
||||
|
||||
|
||||
class ImageGenerationResponseTypedDict(TypedDict):
|
||||
r"""Image generation response"""
|
||||
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) when the image was generated"""
|
||||
data: List[ImageGenerationResponseDataTypedDict]
|
||||
r"""Generated images"""
|
||||
usage: NotRequired[ImageGenerationUsageTypedDict]
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
|
||||
|
||||
class ImageGenerationResponse(BaseModel):
|
||||
r"""Image generation response"""
|
||||
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) when the image was generated"""
|
||||
|
||||
data: List[ImageGenerationResponseData]
|
||||
r"""Generated images"""
|
||||
|
||||
usage: Optional[ImageGenerationUsage] = None
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
@@ -16,7 +16,7 @@ from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
Background = Union[
|
||||
ImageGenerationServerToolBackground = Union[
|
||||
Literal[
|
||||
"transparent",
|
||||
"opaque",
|
||||
@@ -64,7 +64,7 @@ Moderation = Union[
|
||||
]
|
||||
|
||||
|
||||
OutputFormat = Union[
|
||||
ImageGenerationServerToolOutputFormat = Union[
|
||||
Literal[
|
||||
"png",
|
||||
"webp",
|
||||
@@ -74,7 +74,7 @@ OutputFormat = Union[
|
||||
]
|
||||
|
||||
|
||||
Quality = Union[
|
||||
ImageGenerationServerToolQuality = Union[
|
||||
Literal[
|
||||
"low",
|
||||
"medium",
|
||||
@@ -103,15 +103,15 @@ class ImageGenerationServerToolTypedDict(TypedDict):
|
||||
r"""Image generation tool configuration"""
|
||||
|
||||
type: ImageGenerationServerToolType
|
||||
background: NotRequired[Background]
|
||||
background: NotRequired[ImageGenerationServerToolBackground]
|
||||
input_fidelity: NotRequired[Nullable[InputFidelity]]
|
||||
input_image_mask: NotRequired[InputImageMaskTypedDict]
|
||||
model: NotRequired[ModelEnum]
|
||||
moderation: NotRequired[Moderation]
|
||||
output_compression: NotRequired[int]
|
||||
output_format: NotRequired[OutputFormat]
|
||||
output_format: NotRequired[ImageGenerationServerToolOutputFormat]
|
||||
partial_images: NotRequired[int]
|
||||
quality: NotRequired[Quality]
|
||||
quality: NotRequired[ImageGenerationServerToolQuality]
|
||||
size: NotRequired[Size]
|
||||
|
||||
|
||||
@@ -121,7 +121,8 @@ class ImageGenerationServerTool(BaseModel):
|
||||
type: ImageGenerationServerToolType
|
||||
|
||||
background: Annotated[
|
||||
Optional[Background], PlainValidator(validate_open_enum(False))
|
||||
Optional[ImageGenerationServerToolBackground],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
|
||||
input_fidelity: Annotated[
|
||||
@@ -141,14 +142,16 @@ class ImageGenerationServerTool(BaseModel):
|
||||
output_compression: Optional[int] = None
|
||||
|
||||
output_format: Annotated[
|
||||
Optional[OutputFormat], PlainValidator(validate_open_enum(False))
|
||||
Optional[ImageGenerationServerToolOutputFormat],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
|
||||
partial_images: Optional[int] = None
|
||||
|
||||
quality: Annotated[Optional[Quality], PlainValidator(validate_open_enum(False))] = (
|
||||
None
|
||||
)
|
||||
quality: Annotated[
|
||||
Optional[ImageGenerationServerToolQuality],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
|
||||
size: Annotated[Optional[Size], PlainValidator(validate_open_enum(False))] = None
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .anthropicspeed import AnthropicSpeed
|
||||
from .anthropicusageiteration import (
|
||||
AnthropicUsageIteration,
|
||||
AnthropicUsageIterationTypedDict,
|
||||
)
|
||||
from .costdetails import CostDetails, CostDetailsTypedDict
|
||||
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 ImageGenerationUsageCompletionTokensDetailsTypedDict(TypedDict):
|
||||
audio_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens generated by the model for audio output."""
|
||||
image_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens generated by the model for image output."""
|
||||
reasoning_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens generated by the model for reasoning."""
|
||||
|
||||
|
||||
class ImageGenerationUsageCompletionTokensDetails(BaseModel):
|
||||
audio_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens generated by the model for audio output."""
|
||||
|
||||
image_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens generated by the model for image output."""
|
||||
|
||||
reasoning_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens generated by the model for reasoning."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["audio_tokens", "image_tokens", "reasoning_tokens"]
|
||||
nullable_fields = ["audio_tokens", "image_tokens", "reasoning_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 ImageGenerationUsagePromptTokensDetailsTypedDict(TypedDict):
|
||||
r"""Breakdown of tokens used in the prompt."""
|
||||
|
||||
audio_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens used for input audio."""
|
||||
cache_write_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing."""
|
||||
cached_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens cached by the endpoint."""
|
||||
file_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens used for input files/documents."""
|
||||
video_tokens: NotRequired[Nullable[int]]
|
||||
r"""Tokens used for input video."""
|
||||
|
||||
|
||||
class ImageGenerationUsagePromptTokensDetails(BaseModel):
|
||||
r"""Breakdown of tokens used in the prompt."""
|
||||
|
||||
audio_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens used for input audio."""
|
||||
|
||||
cache_write_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing."""
|
||||
|
||||
cached_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens cached by the endpoint."""
|
||||
|
||||
file_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens used for input files/documents."""
|
||||
|
||||
video_tokens: OptionalNullable[int] = UNSET
|
||||
r"""Tokens used for input video."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"audio_tokens",
|
||||
"cache_write_tokens",
|
||||
"cached_tokens",
|
||||
"file_tokens",
|
||||
"video_tokens",
|
||||
]
|
||||
nullable_fields = [
|
||||
"audio_tokens",
|
||||
"cache_write_tokens",
|
||||
"cached_tokens",
|
||||
"file_tokens",
|
||||
"video_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 ServerToolUseTypedDict(TypedDict):
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
tool_calls_executed: NotRequired[Nullable[int]]
|
||||
r"""Number of OpenRouter server tool calls that executed and produced a result."""
|
||||
tool_calls_requested: NotRequired[Nullable[int]]
|
||||
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
|
||||
web_search_requests: NotRequired[Nullable[int]]
|
||||
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
|
||||
|
||||
|
||||
class ServerToolUse(BaseModel):
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
tool_calls_executed: OptionalNullable[int] = UNSET
|
||||
r"""Number of OpenRouter server tool calls that executed and produced a result."""
|
||||
|
||||
tool_calls_requested: OptionalNullable[int] = UNSET
|
||||
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
|
||||
|
||||
web_search_requests: OptionalNullable[int] = UNSET
|
||||
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"tool_calls_executed",
|
||||
"tool_calls_requested",
|
||||
"web_search_requests",
|
||||
]
|
||||
nullable_fields = [
|
||||
"tool_calls_executed",
|
||||
"tool_calls_requested",
|
||||
"web_search_requests",
|
||||
]
|
||||
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 ImageGenerationUsageTypedDict(TypedDict):
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""The tokens generated"""
|
||||
prompt_tokens: int
|
||||
r"""Including images, input audio, and tools if any"""
|
||||
total_tokens: int
|
||||
r"""Sum of the above two fields"""
|
||||
completion_tokens_details: NotRequired[
|
||||
Nullable[ImageGenerationUsageCompletionTokensDetailsTypedDict]
|
||||
]
|
||||
cost: NotRequired[Nullable[float]]
|
||||
r"""Cost of the completion"""
|
||||
cost_details: NotRequired[Nullable[CostDetailsTypedDict]]
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
is_byok: NotRequired[bool]
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
iterations: NotRequired[Nullable[List[AnthropicUsageIterationTypedDict]]]
|
||||
prompt_tokens_details: NotRequired[
|
||||
Nullable[ImageGenerationUsagePromptTokensDetailsTypedDict]
|
||||
]
|
||||
r"""Breakdown of tokens used in the prompt."""
|
||||
server_tool_use: NotRequired[Nullable[ServerToolUseTypedDict]]
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
service_tier: NotRequired[Nullable[str]]
|
||||
r"""The service tier used by the upstream provider for this request"""
|
||||
speed: NotRequired[Nullable[AnthropicSpeed]]
|
||||
|
||||
|
||||
class ImageGenerationUsage(BaseModel):
|
||||
r"""Token and cost usage for the image generation request, when available"""
|
||||
|
||||
completion_tokens: int
|
||||
r"""The tokens generated"""
|
||||
|
||||
prompt_tokens: int
|
||||
r"""Including images, input audio, and tools if any"""
|
||||
|
||||
total_tokens: int
|
||||
r"""Sum of the above two fields"""
|
||||
|
||||
completion_tokens_details: OptionalNullable[
|
||||
ImageGenerationUsageCompletionTokensDetails
|
||||
] = UNSET
|
||||
|
||||
cost: OptionalNullable[float] = UNSET
|
||||
r"""Cost of the completion"""
|
||||
|
||||
cost_details: OptionalNullable[CostDetails] = UNSET
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
is_byok: Optional[bool] = None
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
|
||||
iterations: OptionalNullable[List[AnthropicUsageIteration]] = UNSET
|
||||
|
||||
prompt_tokens_details: OptionalNullable[ImageGenerationUsagePromptTokensDetails] = (
|
||||
UNSET
|
||||
)
|
||||
r"""Breakdown of tokens used in the prompt."""
|
||||
|
||||
server_tool_use: OptionalNullable[ServerToolUse] = UNSET
|
||||
r"""Usage for server-side tool execution (e.g., web search)"""
|
||||
|
||||
service_tier: OptionalNullable[str] = UNSET
|
||||
r"""The service tier used by the upstream provider for this request"""
|
||||
|
||||
speed: Annotated[
|
||||
OptionalNullable[AnthropicSpeed], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"completion_tokens_details",
|
||||
"cost",
|
||||
"cost_details",
|
||||
"is_byok",
|
||||
"iterations",
|
||||
"prompt_tokens_details",
|
||||
"server_tool_use",
|
||||
"service_tier",
|
||||
"speed",
|
||||
]
|
||||
nullable_fields = [
|
||||
"completion_tokens_details",
|
||||
"cost",
|
||||
"cost_details",
|
||||
"iterations",
|
||||
"prompt_tokens_details",
|
||||
"server_tool_use",
|
||||
"service_tier",
|
||||
"speed",
|
||||
]
|
||||
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
|
||||
@@ -0,0 +1,34 @@
|
||||
"""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
|
||||
|
||||
|
||||
ImageGenPartialImageEventType = Literal["image_generation.partial_image",]
|
||||
r"""The event type"""
|
||||
|
||||
|
||||
class ImageGenPartialImageEventTypedDict(TypedDict):
|
||||
r"""Emitted when a partial image becomes available during streaming generation"""
|
||||
|
||||
b64_json: str
|
||||
r"""Base64-encoded partial image data"""
|
||||
partial_image_index: int
|
||||
r"""0-based index indicating which partial image this is in the sequence"""
|
||||
type: ImageGenPartialImageEventType
|
||||
r"""The event type"""
|
||||
|
||||
|
||||
class ImageGenPartialImageEvent(BaseModel):
|
||||
r"""Emitted when a partial image becomes available during streaming generation"""
|
||||
|
||||
b64_json: str
|
||||
r"""Base64-encoded partial image data"""
|
||||
|
||||
partial_image_index: int
|
||||
r"""0-based index indicating which partial image this is in the sequence"""
|
||||
|
||||
type: ImageGenPartialImageEventType
|
||||
r"""The event type"""
|
||||
@@ -0,0 +1,95 @@
|
||||
"""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 Literal
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ImageGenStreamErrorEventErrorTypedDict(TypedDict):
|
||||
r"""Provider error details"""
|
||||
|
||||
message: str
|
||||
r"""Provider error message"""
|
||||
code: NotRequired[Nullable[str]]
|
||||
r"""Provider error code, when supplied"""
|
||||
param: NotRequired[Nullable[str]]
|
||||
r"""Request parameter associated with the error, when supplied"""
|
||||
type: NotRequired[Nullable[str]]
|
||||
r"""Provider error type, when supplied"""
|
||||
|
||||
|
||||
class ImageGenStreamErrorEventError(BaseModel):
|
||||
r"""Provider error details"""
|
||||
|
||||
message: str
|
||||
r"""Provider error message"""
|
||||
|
||||
code: OptionalNullable[str] = UNSET
|
||||
r"""Provider error code, when supplied"""
|
||||
|
||||
param: OptionalNullable[str] = UNSET
|
||||
r"""Request parameter associated with the error, when supplied"""
|
||||
|
||||
type: OptionalNullable[str] = UNSET
|
||||
r"""Provider error type, when supplied"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["code", "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
|
||||
|
||||
|
||||
ImageGenStreamErrorEventType = Literal["error",]
|
||||
r"""The event type"""
|
||||
|
||||
|
||||
class ImageGenStreamErrorEventTypedDict(TypedDict):
|
||||
r"""Emitted when streaming generation fails after the SSE response starts"""
|
||||
|
||||
error: ImageGenStreamErrorEventErrorTypedDict
|
||||
r"""Provider error details"""
|
||||
type: ImageGenStreamErrorEventType
|
||||
r"""The event type"""
|
||||
|
||||
|
||||
class ImageGenStreamErrorEvent(BaseModel):
|
||||
r"""Emitted when streaming generation fails after the SSE response starts"""
|
||||
|
||||
error: ImageGenStreamErrorEventError
|
||||
r"""Provider error details"""
|
||||
|
||||
type: ImageGenStreamErrorEventType
|
||||
r"""The event type"""
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imageoutputmodality import ImageOutputModality
|
||||
from .inputmodality import InputModality
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import List
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
class ImageModelArchitectureTypedDict(TypedDict):
|
||||
input_modalities: List[InputModality]
|
||||
r"""Supported input modalities"""
|
||||
output_modalities: List[ImageOutputModality]
|
||||
r"""Supported output modalities"""
|
||||
|
||||
|
||||
class ImageModelArchitecture(BaseModel):
|
||||
input_modalities: List[
|
||||
Annotated[InputModality, PlainValidator(validate_open_enum(False))]
|
||||
]
|
||||
r"""Supported input modalities"""
|
||||
|
||||
output_modalities: List[
|
||||
Annotated[ImageOutputModality, PlainValidator(validate_open_enum(False))]
|
||||
]
|
||||
r"""Supported output modalities"""
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imageendpoint import ImageEndpoint, ImageEndpointTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ImageModelEndpointsResponseTypedDict(TypedDict):
|
||||
r"""The full per-endpoint records for an image model."""
|
||||
|
||||
endpoints: List[ImageEndpointTypedDict]
|
||||
id: str
|
||||
r"""Model slug"""
|
||||
|
||||
|
||||
class ImageModelEndpointsResponse(BaseModel):
|
||||
r"""The full per-endpoint records for an image model."""
|
||||
|
||||
endpoints: List[ImageEndpoint]
|
||||
|
||||
id: str
|
||||
r"""Model slug"""
|
||||
@@ -0,0 +1,56 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .capabilitydescriptor import CapabilityDescriptor, CapabilityDescriptorTypedDict
|
||||
from .imagemodelarchitecture import (
|
||||
ImageModelArchitecture,
|
||||
ImageModelArchitectureTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Dict
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ImageModelListItemTypedDict(TypedDict):
|
||||
r"""A single image model in the discovery listing."""
|
||||
|
||||
architecture: ImageModelArchitectureTypedDict
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) of when the model was created"""
|
||||
description: str
|
||||
endpoints: str
|
||||
r"""Relative URL to the full per-endpoint records for this model"""
|
||||
id: str
|
||||
r"""Model slug"""
|
||||
name: str
|
||||
r"""Display name"""
|
||||
supported_parameters: Dict[str, CapabilityDescriptorTypedDict]
|
||||
r"""Union of supported parameters across every endpoint of this model. Coarse discovery aid; the definitive per-endpoint set is behind the endpoints URL."""
|
||||
supports_streaming: bool
|
||||
r"""Whether any endpoint of this model supports native SSE streaming on the dedicated Image API (i.e. `stream: true` in the request). OR across endpoints."""
|
||||
|
||||
|
||||
class ImageModelListItem(BaseModel):
|
||||
r"""A single image model in the discovery listing."""
|
||||
|
||||
architecture: ImageModelArchitecture
|
||||
|
||||
created: int
|
||||
r"""Unix timestamp (seconds) of when the model was created"""
|
||||
|
||||
description: str
|
||||
|
||||
endpoints: str
|
||||
r"""Relative URL to the full per-endpoint records for this model"""
|
||||
|
||||
id: str
|
||||
r"""Model slug"""
|
||||
|
||||
name: str
|
||||
r"""Display name"""
|
||||
|
||||
supported_parameters: Dict[str, CapabilityDescriptor]
|
||||
r"""Union of supported parameters across every endpoint of this model. Coarse discovery aid; the definitive per-endpoint set is behind the endpoints URL."""
|
||||
|
||||
supports_streaming: bool
|
||||
r"""Whether any endpoint of this model supports native SSE streaming on the dedicated Image API (i.e. `stream: true` in the request). OR across endpoints."""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imagemodellistitem import ImageModelListItem, ImageModelListItemTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ImageModelsListResponseTypedDict(TypedDict):
|
||||
r"""List of image generation models."""
|
||||
|
||||
data: List[ImageModelListItemTypedDict]
|
||||
|
||||
|
||||
class ImageModelsListResponse(BaseModel):
|
||||
r"""List of image generation models."""
|
||||
|
||||
data: List[ImageModelListItem]
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ImageOutputModality = Union[
|
||||
Literal[
|
||||
"text",
|
||||
"image",
|
||||
"embeddings",
|
||||
"audio",
|
||||
"video",
|
||||
"rerank",
|
||||
"speech",
|
||||
"transcription",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -0,0 +1,51 @@
|
||||
"""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
|
||||
|
||||
|
||||
Billable = Union[
|
||||
Literal[
|
||||
"output_image",
|
||||
"input_image",
|
||||
"input_font",
|
||||
"input_reference",
|
||||
"input_text",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
Unit = Union[
|
||||
Literal[
|
||||
"image",
|
||||
"megapixel",
|
||||
"token",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ImagePricingEntryTypedDict(TypedDict):
|
||||
r"""One billable pricing line for an image provider."""
|
||||
|
||||
billable: Billable
|
||||
cost_usd: float
|
||||
unit: Unit
|
||||
variant: NotRequired[str]
|
||||
|
||||
|
||||
class ImagePricingEntry(BaseModel):
|
||||
r"""One billable pricing line for an image provider."""
|
||||
|
||||
billable: Annotated[Billable, PlainValidator(validate_open_enum(False))]
|
||||
|
||||
cost_usd: float
|
||||
|
||||
unit: Annotated[Unit, PlainValidator(validate_open_enum(False))]
|
||||
|
||||
variant: Optional[str] = None
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imagegencompletedevent import (
|
||||
ImageGenCompletedEvent,
|
||||
ImageGenCompletedEventTypedDict,
|
||||
)
|
||||
from .imagegenpartialimageevent import (
|
||||
ImageGenPartialImageEvent,
|
||||
ImageGenPartialImageEventTypedDict,
|
||||
)
|
||||
from .imagegenstreamerrorevent import (
|
||||
ImageGenStreamErrorEvent,
|
||||
ImageGenStreamErrorEventTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
ImageStreamingResponseDataTypedDict = TypeAliasType(
|
||||
"ImageStreamingResponseDataTypedDict",
|
||||
Union[
|
||||
ImageGenStreamErrorEventTypedDict,
|
||||
ImageGenPartialImageEventTypedDict,
|
||||
ImageGenCompletedEventTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ImageStreamingResponseData = Annotated[
|
||||
Union[
|
||||
Annotated[ImageGenPartialImageEvent, Tag("image_generation.partial_image")],
|
||||
Annotated[ImageGenCompletedEvent, Tag("image_generation.completed")],
|
||||
Annotated[ImageGenStreamErrorEvent, Tag("error")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class ImageStreamingResponseTypedDict(TypedDict):
|
||||
data: ImageStreamingResponseDataTypedDict
|
||||
|
||||
|
||||
class ImageStreamingResponse(BaseModel):
|
||||
data: ImageStreamingResponseData
|
||||
@@ -298,11 +298,11 @@ class ContextManagement(BaseModel):
|
||||
edits: Optional[List[Edit]] = None
|
||||
|
||||
|
||||
class MetadataTypedDict(TypedDict):
|
||||
class MessagesRequestMetadataTypedDict(TypedDict):
|
||||
user_id: NotRequired[Nullable[str]]
|
||||
|
||||
|
||||
class Metadata(BaseModel):
|
||||
class MessagesRequestMetadata(BaseModel):
|
||||
user_id: OptionalNullable[str] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
@@ -1050,7 +1050,7 @@ class MessagesRequestTypedDict(TypedDict):
|
||||
fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]]
|
||||
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
|
||||
max_tokens: NotRequired[int]
|
||||
metadata: NotRequired[MetadataTypedDict]
|
||||
metadata: NotRequired[MessagesRequestMetadataTypedDict]
|
||||
models: NotRequired[List[str]]
|
||||
output_config: NotRequired[MessagesOutputConfigTypedDict]
|
||||
r"""Configuration for controlling output behavior. Supports the effort parameter and structured output format."""
|
||||
@@ -1096,7 +1096,7 @@ class MessagesRequest(BaseModel):
|
||||
|
||||
max_tokens: Optional[int] = None
|
||||
|
||||
metadata: Optional[Metadata] = None
|
||||
metadata: Optional[MessagesRequestMetadata] = None
|
||||
|
||||
models: Optional[List[str]] = None
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
from .modelreasoning import ModelReasoning, ModelReasoningTypedDict
|
||||
from .parameter import Parameter
|
||||
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
|
||||
from .publicpricing import PublicPricing, PublicPricingTypedDict
|
||||
@@ -62,6 +63,8 @@ class ModelTypedDict(TypedDict):
|
||||
r"""Hugging Face model identifier, if applicable"""
|
||||
knowledge_cutoff: NotRequired[Nullable[str]]
|
||||
r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown."""
|
||||
reasoning: NotRequired[ModelReasoningTypedDict]
|
||||
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
@@ -123,6 +126,9 @@ class Model(BaseModel):
|
||||
knowledge_cutoff: OptionalNullable[str] = UNSET
|
||||
r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown."""
|
||||
|
||||
reasoning: Optional[ModelReasoning] = None
|
||||
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
@@ -131,6 +137,7 @@ class Model(BaseModel):
|
||||
"expiration_date",
|
||||
"hugging_face_id",
|
||||
"knowledge_cutoff",
|
||||
"reasoning",
|
||||
]
|
||||
nullable_fields = [
|
||||
"context_length",
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .reasoningeffort import ReasoningEffort
|
||||
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
|
||||
|
||||
|
||||
DefaultEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Default reasoning effort when the client enables reasoning without specifying effort. Maps to `reasoning.effort` in chat requests. When `\"none\"`, prefer omitting effort unless the user explicitly disables reasoning."""
|
||||
|
||||
|
||||
class ModelReasoningTypedDict(TypedDict):
|
||||
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
|
||||
|
||||
mandatory: bool
|
||||
r"""When true, reasoning cannot be disabled and effort \"none\" is rejected."""
|
||||
default_effort: NotRequired[Nullable[DefaultEffort]]
|
||||
default_enabled: NotRequired[bool]
|
||||
r"""Default reasoning enabled state when the client does not set `reasoning.enabled`."""
|
||||
supported_efforts: NotRequired[Nullable[List[Nullable[ReasoningEffort]]]]
|
||||
r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted."""
|
||||
supports_max_tokens: NotRequired[bool]
|
||||
r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise."""
|
||||
|
||||
|
||||
class ModelReasoning(BaseModel):
|
||||
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
|
||||
|
||||
mandatory: bool
|
||||
r"""When true, reasoning cannot be disabled and effort \"none\" is rejected."""
|
||||
|
||||
default_effort: Annotated[
|
||||
OptionalNullable[DefaultEffort], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
|
||||
default_enabled: Optional[bool] = None
|
||||
r"""Default reasoning enabled state when the client does not set `reasoning.enabled`."""
|
||||
|
||||
supported_efforts: OptionalNullable[
|
||||
List[
|
||||
Annotated[
|
||||
Nullable[ReasoningEffort], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
]
|
||||
] = UNSET
|
||||
r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted."""
|
||||
|
||||
supports_max_tokens: Optional[bool] = None
|
||||
r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"default_effort",
|
||||
"default_enabled",
|
||||
"supported_efforts",
|
||||
"supports_max_tokens",
|
||||
]
|
||||
nullable_fields = ["default_effort", "supported_efforts"]
|
||||
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
|
||||
@@ -15,6 +15,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
class ObservabilityArizeDestinationConfigTypedDict(TypedDict):
|
||||
api_key: str
|
||||
model_id: str
|
||||
r"""The name of the tracing project in Arize AX"""
|
||||
space_key: str
|
||||
base_url: NotRequired[str]
|
||||
headers: NotRequired[Dict[str, str]]
|
||||
@@ -25,6 +26,7 @@ class ObservabilityArizeDestinationConfig(BaseModel):
|
||||
api_key: Annotated[str, pydantic.Field(alias="apiKey")]
|
||||
|
||||
model_id: Annotated[str, pydantic.Field(alias="modelId")]
|
||||
r"""The name of the tracing project in Arize AX"""
|
||||
|
||||
space_key: Annotated[str, pydantic.Field(alias="spaceKey")]
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .apierrortype import APIErrorType
|
||||
from .applypatchservertool import ApplyPatchServerTool, ApplyPatchServerToolTypedDict
|
||||
from .baseinputs_union import BaseInputsUnion, BaseInputsUnionTypedDict
|
||||
from .basereasoningconfig import BaseReasoningConfig, BaseReasoningConfigTypedDict
|
||||
@@ -203,6 +204,8 @@ class OpenResponsesResultTypedDict(TypedDict):
|
||||
usage: NotRequired[Nullable[UsageTypedDict]]
|
||||
r"""Token usage information for the response"""
|
||||
user: NotRequired[Nullable[str]]
|
||||
error_type: NotRequired[APIErrorType]
|
||||
r"""Canonical OpenRouter error type, stable across all API formats"""
|
||||
openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict]
|
||||
|
||||
|
||||
@@ -285,6 +288,11 @@ class OpenResponsesResult(BaseModel):
|
||||
|
||||
user: OptionalNullable[str] = UNSET
|
||||
|
||||
error_type: Annotated[
|
||||
Optional[APIErrorType], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Canonical OpenRouter error type, stable across all API formats"""
|
||||
|
||||
openrouter_metadata: Optional[OpenRouterMetadata] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
@@ -306,6 +314,7 @@ class OpenResponsesResult(BaseModel):
|
||||
"truncation",
|
||||
"usage",
|
||||
"user",
|
||||
"error_type",
|
||||
"openrouter_metadata",
|
||||
]
|
||||
nullable_fields = [
|
||||
|
||||
@@ -44,12 +44,14 @@ ProviderName = Union[
|
||||
"Google",
|
||||
"Google AI Studio",
|
||||
"Groq",
|
||||
"HeyGen",
|
||||
"Inception",
|
||||
"Inceptron",
|
||||
"InferenceNet",
|
||||
"Ionstream",
|
||||
"Infermatic",
|
||||
"Io Net",
|
||||
"Inferact vLLM",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
@@ -76,6 +78,7 @@ ProviderName = Union[
|
||||
"Recraft",
|
||||
"Reka",
|
||||
"Relace",
|
||||
"Sakana AI",
|
||||
"SambaNova",
|
||||
"Seed",
|
||||
"SiliconFlow",
|
||||
@@ -84,6 +87,7 @@ ProviderName = Union[
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
"Tenstorrent",
|
||||
"Together",
|
||||
"Upstage",
|
||||
"Venice",
|
||||
|
||||
@@ -55,11 +55,13 @@ class ProviderOptionsTypedDict(TypedDict):
|
||||
google_vertex: NotRequired[Dict[str, Nullable[Any]]]
|
||||
gopomelo: NotRequired[Dict[str, Nullable[Any]]]
|
||||
groq: NotRequired[Dict[str, Nullable[Any]]]
|
||||
heygen: NotRequired[Dict[str, Nullable[Any]]]
|
||||
huggingface: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inception: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inceptron: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inferact_vllm: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inference_net: NotRequired[Dict[str, Nullable[Any]]]
|
||||
infermatic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inflection: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -104,6 +106,7 @@ class ProviderOptionsTypedDict(TypedDict):
|
||||
reka: NotRequired[Dict[str, Nullable[Any]]]
|
||||
relace: NotRequired[Dict[str, Nullable[Any]]]
|
||||
replicate: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sakana_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]]
|
||||
seed: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -115,6 +118,7 @@ class ProviderOptionsTypedDict(TypedDict):
|
||||
streamlake: NotRequired[Dict[str, Nullable[Any]]]
|
||||
switchpoint: NotRequired[Dict[str, Nullable[Any]]]
|
||||
targon: NotRequired[Dict[str, Nullable[Any]]]
|
||||
tenstorrent: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together_lite: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ubicloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -240,6 +244,8 @@ class ProviderOptions(BaseModel):
|
||||
|
||||
groq: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
heygen: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
huggingface: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
hyperbolic: Optional[Dict[str, Nullable[Any]]] = None
|
||||
@@ -252,6 +258,10 @@ class ProviderOptions(BaseModel):
|
||||
|
||||
inceptron: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inferact_vllm: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm")
|
||||
] = None
|
||||
|
||||
inference_net: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net")
|
||||
] = None
|
||||
@@ -354,6 +364,10 @@ class ProviderOptions(BaseModel):
|
||||
|
||||
replicate: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sakana_ai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai")
|
||||
] = None
|
||||
|
||||
sambanova: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sambanova_cloaked: Annotated[
|
||||
@@ -380,6 +394,8 @@ class ProviderOptions(BaseModel):
|
||||
|
||||
targon: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
tenstorrent: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together_lite: Annotated[
|
||||
|
||||
@@ -77,12 +77,14 @@ ProviderResponseProviderName = Union[
|
||||
"Google",
|
||||
"Google AI Studio",
|
||||
"Groq",
|
||||
"HeyGen",
|
||||
"Inception",
|
||||
"Inceptron",
|
||||
"InferenceNet",
|
||||
"Ionstream",
|
||||
"Infermatic",
|
||||
"Io Net",
|
||||
"Inferact vLLM",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
@@ -109,6 +111,7 @@ ProviderResponseProviderName = Union[
|
||||
"Recraft",
|
||||
"Reka",
|
||||
"Relace",
|
||||
"Sakana AI",
|
||||
"SambaNova",
|
||||
"Seed",
|
||||
"SiliconFlow",
|
||||
@@ -117,6 +120,7 @@ ProviderResponseProviderName = Union[
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
"Tenstorrent",
|
||||
"Together",
|
||||
"Upstage",
|
||||
"Venice",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"""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
|
||||
|
||||
|
||||
RangeCapabilityType = Literal["range",]
|
||||
|
||||
|
||||
class RangeCapabilityTypedDict(TypedDict):
|
||||
r"""A parameter that accepts any value within an inclusive numeric range."""
|
||||
|
||||
max: float
|
||||
min: float
|
||||
type: RangeCapabilityType
|
||||
|
||||
|
||||
class RangeCapability(BaseModel):
|
||||
r"""A parameter that accepts any value within an inclusive numeric range."""
|
||||
|
||||
max: float
|
||||
|
||||
min: float
|
||||
|
||||
type: RangeCapabilityType
|
||||
@@ -7,6 +7,7 @@ from typing import Literal, Union
|
||||
|
||||
ReasoningEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
|
||||
@@ -16,6 +16,7 @@ from .applypatchservertool_openrouter import (
|
||||
)
|
||||
from .autorouterplugin import AutoRouterPlugin, AutoRouterPluginTypedDict
|
||||
from .bashservertool import BashServerTool, BashServerToolTypedDict
|
||||
from .chatdebugoptions import ChatDebugOptions, ChatDebugOptionsTypedDict
|
||||
from .chatsearchmodelsservertool import (
|
||||
ChatSearchModelsServerTool,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
@@ -291,6 +292,8 @@ class ResponsesRequestTypedDict(TypedDict):
|
||||
background: NotRequired[Nullable[bool]]
|
||||
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
|
||||
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
|
||||
debug: NotRequired[ChatDebugOptionsTypedDict]
|
||||
r"""Debug options for inspecting request transformations (streaming only)"""
|
||||
frequency_penalty: NotRequired[Nullable[float]]
|
||||
image_config: NotRequired[Dict[str, ImageConfigTypedDict]]
|
||||
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details."""
|
||||
@@ -348,6 +351,9 @@ class ResponsesRequest(BaseModel):
|
||||
cache_control: Optional[AnthropicCacheControlDirective] = None
|
||||
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
|
||||
|
||||
debug: Optional[ChatDebugOptions] = None
|
||||
r"""Debug options for inspecting request transformations (streaming only)"""
|
||||
|
||||
frequency_penalty: OptionalNullable[float] = UNSET
|
||||
|
||||
image_config: Optional[Dict[str, ImageConfig]] = None
|
||||
@@ -448,6 +454,7 @@ class ResponsesRequest(BaseModel):
|
||||
optional_fields = [
|
||||
"background",
|
||||
"cache_control",
|
||||
"debug",
|
||||
"frequency_penalty",
|
||||
"image_config",
|
||||
"include",
|
||||
|
||||
@@ -20,6 +20,7 @@ from .customtoolcallinputdoneevent import (
|
||||
CustomToolCallInputDoneEvent,
|
||||
CustomToolCallInputDoneEventTypedDict,
|
||||
)
|
||||
from .debugevent import DebugEvent, DebugEventTypedDict
|
||||
from .errorevent import ErrorEvent, ErrorEventTypedDict
|
||||
from .functioncallargsdeltaevent import (
|
||||
FunctionCallArgsDeltaEvent,
|
||||
@@ -152,34 +153,35 @@ from typing_extensions import Annotated, TypeAliasType
|
||||
StreamEventsTypedDict = TypeAliasType(
|
||||
"StreamEventsTypedDict",
|
||||
Union[
|
||||
OpenResponsesCreatedEventTypedDict,
|
||||
DebugEventTypedDict,
|
||||
OpenResponsesInProgressEventTypedDict,
|
||||
StreamEventsResponseCompletedTypedDict,
|
||||
StreamEventsResponseIncompleteTypedDict,
|
||||
StreamEventsResponseFailedTypedDict,
|
||||
FusionCallInProgressEventTypedDict,
|
||||
OpenResponsesCreatedEventTypedDict,
|
||||
FusionCallCompletedEventTypedDict,
|
||||
StreamEventsResponseOutputItemAddedTypedDict,
|
||||
WebSearchCallCompletedEventTypedDict,
|
||||
StreamEventsResponseOutputItemDoneTypedDict,
|
||||
FusionCallCompletedEventTypedDict,
|
||||
ImageGenCallInProgressEventTypedDict,
|
||||
StreamEventsResponseOutputItemAddedTypedDict,
|
||||
ImageGenCallCompletedEventTypedDict,
|
||||
ImageGenCallGeneratingEventTypedDict,
|
||||
ImageGenCallCompletedEventTypedDict,
|
||||
FusionCallInProgressEventTypedDict,
|
||||
WebSearchCallInProgressEventTypedDict,
|
||||
WebSearchCallSearchingEventTypedDict,
|
||||
FusionCallAnalysisInProgressEventTypedDict,
|
||||
FusionCallPanelAddedEventTypedDict,
|
||||
CustomToolCallInputDoneEventTypedDict,
|
||||
CustomToolCallInputDeltaEventTypedDict,
|
||||
FunctionCallArgsDeltaEventTypedDict,
|
||||
ApplyPatchCallOperationDiffDeltaEventTypedDict,
|
||||
ErrorEventTypedDict,
|
||||
FunctionCallArgsDeltaEventTypedDict,
|
||||
ApplyPatchCallOperationDiffDoneEventTypedDict,
|
||||
FusionCallPanelAddedEventTypedDict,
|
||||
FusionCallAnalysisInProgressEventTypedDict,
|
||||
FusionCallAnalysisCompletedEventTypedDict,
|
||||
ReasoningSummaryPartDoneEventTypedDict,
|
||||
RefusalDoneEventTypedDict,
|
||||
ErrorEventTypedDict,
|
||||
ReasoningSummaryTextDoneEventTypedDict,
|
||||
RefusalDoneEventTypedDict,
|
||||
ReasoningSummaryTextDeltaEventTypedDict,
|
||||
ReasoningSummaryPartDoneEventTypedDict,
|
||||
ReasoningSummaryPartAddedEventTypedDict,
|
||||
ReasoningDoneEventTypedDict,
|
||||
ReasoningDeltaEventTypedDict,
|
||||
@@ -187,13 +189,13 @@ StreamEventsTypedDict = TypeAliasType(
|
||||
ContentPartAddedEventTypedDict,
|
||||
ImageGenCallPartialImageEventTypedDict,
|
||||
RefusalDeltaEventTypedDict,
|
||||
ContentPartDoneEventTypedDict,
|
||||
FusionCallPanelDeltaEventTypedDict,
|
||||
FusionCallPanelReasoningDeltaEventTypedDict,
|
||||
FusionCallPanelCompletedEventTypedDict,
|
||||
FusionCallPanelFailedEventTypedDict,
|
||||
TextDeltaEventTypedDict,
|
||||
ContentPartDoneEventTypedDict,
|
||||
TextDoneEventTypedDict,
|
||||
TextDeltaEventTypedDict,
|
||||
FusionCallPanelFailedEventTypedDict,
|
||||
AnnotationAddedEventTypedDict,
|
||||
],
|
||||
)
|
||||
@@ -221,6 +223,7 @@ StreamEvents = Annotated[
|
||||
Annotated[
|
||||
CustomToolCallInputDoneEvent, Tag("response.custom_tool_call_input.done")
|
||||
],
|
||||
Annotated[DebugEvent, Tag("response.debug")],
|
||||
Annotated[StreamEventsResponseFailed, Tag("response.failed")],
|
||||
Annotated[
|
||||
FunctionCallArgsDeltaEvent, Tag("response.function_call_arguments.delta")
|
||||
|
||||
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
SubagentReasoningEffort = Union[
|
||||
Literal[
|
||||
"max",
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .taskclassificationmodel import (
|
||||
TaskClassificationModel,
|
||||
TaskClassificationModelTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class TaskClassificationItemTypedDict(TypedDict):
|
||||
category_token_share: float
|
||||
r"""Fraction of this classification's token volume within its macro-category (0–1). Sums to 1 across all classifications sharing the same `macro_category`."""
|
||||
category_usage_share: float
|
||||
r"""Fraction of this classification's usage within its macro-category (0–1). Sums to 1 across all classifications sharing the same `macro_category`."""
|
||||
display_name: str
|
||||
r"""Human-readable label for the classification."""
|
||||
macro_category: str
|
||||
r"""Coarse grouping derived from the tag prefix: `code`, `data`, `agent`, or `general`."""
|
||||
models: List[TaskClassificationModelTypedDict]
|
||||
r"""Top models for this classification by request volume, sorted descending. Each entry reports the model's share of this classification's requests and tokens."""
|
||||
tag: str
|
||||
r"""Classification tag identifier (e.g. `code:general_impl`, `agent:web_search`)."""
|
||||
token_share: float
|
||||
r"""Fraction of classified sampled token volume (prompt + completion) attributed to this classification (0–1). The unclassified `other` bucket is excluded from the denominator."""
|
||||
usage_share: float
|
||||
r"""Fraction of classified sampled requests attributed to this classification (0–1). The unclassified `other` bucket is excluded from the denominator."""
|
||||
|
||||
|
||||
class TaskClassificationItem(BaseModel):
|
||||
category_token_share: float
|
||||
r"""Fraction of this classification's token volume within its macro-category (0–1). Sums to 1 across all classifications sharing the same `macro_category`."""
|
||||
|
||||
category_usage_share: float
|
||||
r"""Fraction of this classification's usage within its macro-category (0–1). Sums to 1 across all classifications sharing the same `macro_category`."""
|
||||
|
||||
display_name: str
|
||||
r"""Human-readable label for the classification."""
|
||||
|
||||
macro_category: str
|
||||
r"""Coarse grouping derived from the tag prefix: `code`, `data`, `agent`, or `general`."""
|
||||
|
||||
models: List[TaskClassificationModel]
|
||||
r"""Top models for this classification by request volume, sorted descending. Each entry reports the model's share of this classification's requests and tokens."""
|
||||
|
||||
tag: str
|
||||
r"""Classification tag identifier (e.g. `code:general_impl`, `agent:web_search`)."""
|
||||
|
||||
token_share: float
|
||||
r"""Fraction of classified sampled token volume (prompt + completion) attributed to this classification (0–1). The unclassified `other` bucket is excluded from the denominator."""
|
||||
|
||||
usage_share: float
|
||||
r"""Fraction of classified sampled requests attributed to this classification (0–1). The unclassified `other` bucket is excluded from the denominator."""
|
||||
@@ -0,0 +1,30 @@
|
||||
"""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 TaskClassificationMacroCategoryTypedDict(TypedDict):
|
||||
key: str
|
||||
r"""Macro-category identifier."""
|
||||
label: str
|
||||
r"""Human-readable label for the macro-category."""
|
||||
token_share: float
|
||||
r"""Combined token share of all classifications in this macro-category (0–1)."""
|
||||
usage_share: float
|
||||
r"""Combined usage share of all classifications in this macro-category (0–1)."""
|
||||
|
||||
|
||||
class TaskClassificationMacroCategory(BaseModel):
|
||||
key: str
|
||||
r"""Macro-category identifier."""
|
||||
|
||||
label: str
|
||||
r"""Human-readable label for the macro-category."""
|
||||
|
||||
token_share: float
|
||||
r"""Combined token share of all classifications in this macro-category (0–1)."""
|
||||
|
||||
usage_share: float
|
||||
r"""Combined usage share of all classifications in this macro-category (0–1)."""
|
||||
@@ -0,0 +1,25 @@
|
||||
"""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 TaskClassificationModelTypedDict(TypedDict):
|
||||
id: str
|
||||
r"""Model identifier (permaslug)."""
|
||||
tag_token_share: float
|
||||
r"""Fraction of this classification's sampled token volume attributed to this model (0–1). Sums to ≤1 across the returned models (only top-N are included and unattributed requests are excluded)."""
|
||||
tag_usage_share: float
|
||||
r"""Fraction of this classification's sampled requests attributed to this model (0–1). Sums to ≤1 across the returned models (only top-N are included and unattributed requests are excluded)."""
|
||||
|
||||
|
||||
class TaskClassificationModel(BaseModel):
|
||||
id: str
|
||||
r"""Model identifier (permaslug)."""
|
||||
|
||||
tag_token_share: float
|
||||
r"""Fraction of this classification's sampled token volume attributed to this model (0–1). Sums to ≤1 across the returned models (only top-N are included and unattributed requests are excluded)."""
|
||||
|
||||
tag_usage_share: float
|
||||
r"""Fraction of this classification's sampled requests attributed to this model (0–1). Sums to ≤1 across the returned models (only top-N are included and unattributed requests are excluded)."""
|
||||
@@ -0,0 +1,47 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .taskclassificationitem import (
|
||||
TaskClassificationItem,
|
||||
TaskClassificationItemTypedDict,
|
||||
)
|
||||
from .taskclassificationmacrocategory import (
|
||||
TaskClassificationMacroCategory,
|
||||
TaskClassificationMacroCategoryTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class TaskClassificationResponseDataTypedDict(TypedDict):
|
||||
as_of: str
|
||||
r"""UTC date (YYYY-MM-DD) of the window upper bound (yesterday). Data is exclusive of the current incomplete UTC day. This is the expected latest date in the snapshot; it does not confirm data presence for that date."""
|
||||
classifications: List[TaskClassificationItemTypedDict]
|
||||
r"""Per-task classification market-share data, sorted by usage_share descending."""
|
||||
macro_categories: List[TaskClassificationMacroCategoryTypedDict]
|
||||
r"""Aggregate market-share data per macro-category (code, data, agent, general)."""
|
||||
window_days: int
|
||||
r"""Number of trailing days covered by this snapshot."""
|
||||
|
||||
|
||||
class TaskClassificationResponseData(BaseModel):
|
||||
as_of: str
|
||||
r"""UTC date (YYYY-MM-DD) of the window upper bound (yesterday). Data is exclusive of the current incomplete UTC day. This is the expected latest date in the snapshot; it does not confirm data presence for that date."""
|
||||
|
||||
classifications: List[TaskClassificationItem]
|
||||
r"""Per-task classification market-share data, sorted by usage_share descending."""
|
||||
|
||||
macro_categories: List[TaskClassificationMacroCategory]
|
||||
r"""Aggregate market-share data per macro-category (code, data, agent, general)."""
|
||||
|
||||
window_days: int
|
||||
r"""Number of trailing days covered by this snapshot."""
|
||||
|
||||
|
||||
class TaskClassificationResponseTypedDict(TypedDict):
|
||||
data: TaskClassificationResponseDataTypedDict
|
||||
|
||||
|
||||
class TaskClassificationResponse(BaseModel):
|
||||
data: TaskClassificationResponseData
|
||||
+2
-2
@@ -5,7 +5,7 @@ from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarkPricingTypedDict(TypedDict):
|
||||
class UnifiedBenchmarkPricingTypedDict(TypedDict):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
@@ -14,7 +14,7 @@ class BenchmarkPricingTypedDict(TypedDict):
|
||||
r"""Cost per input token (USD, decimal string)."""
|
||||
|
||||
|
||||
class BenchmarkPricing(BaseModel):
|
||||
class UnifiedBenchmarkPricing(BaseModel):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
+23
-10
@@ -1,46 +1,59 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from .unifiedbenchmarkpricing import (
|
||||
UnifiedBenchmarkPricing,
|
||||
UnifiedBenchmarkPricingTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAItemTypedDict(TypedDict):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
UnifiedBenchmarksAAItemSource = Literal["artificial-analysis",]
|
||||
r"""Benchmark source discriminator."""
|
||||
|
||||
|
||||
class UnifiedBenchmarksAAItemTypedDict(TypedDict):
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
display_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
source: UnifiedBenchmarksAAItemSource
|
||||
r"""Benchmark source discriminator."""
|
||||
|
||||
|
||||
class BenchmarksAAItem(BaseModel):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
|
||||
class UnifiedBenchmarksAAItem(BaseModel):
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
|
||||
display_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
pricing: Nullable[UnifiedBenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
source: UnifiedBenchmarksAAItemSource
|
||||
r"""Benchmark source discriminator."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
+20
-7
@@ -1,12 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from .unifiedbenchmarkpricing import (
|
||||
UnifiedBenchmarkPricing,
|
||||
UnifiedBenchmarkPricingTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
UnifiedBenchmarksDAItemSource = Literal["design-arena",]
|
||||
r"""Benchmark source discriminator."""
|
||||
|
||||
|
||||
class TournamentStatsTypedDict(TypedDict):
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
@@ -67,7 +75,7 @@ class TournamentStats(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class BenchmarksDAItemTypedDict(TypedDict):
|
||||
class UnifiedBenchmarksDAItemTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
avg_generation_time_ms: Nullable[float]
|
||||
@@ -79,16 +87,18 @@ class BenchmarksDAItemTypedDict(TypedDict):
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
|
||||
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
source: UnifiedBenchmarksDAItemSource
|
||||
r"""Benchmark source discriminator."""
|
||||
tournament_stats: TournamentStatsTypedDict
|
||||
r"""Placement distribution from tournament matches."""
|
||||
win_rate: float
|
||||
r"""Win rate as a percentage (0–100)."""
|
||||
|
||||
|
||||
class BenchmarksDAItem(BaseModel):
|
||||
class UnifiedBenchmarksDAItem(BaseModel):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
|
||||
@@ -105,11 +115,14 @@ class BenchmarksDAItem(BaseModel):
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
pricing: Nullable[UnifiedBenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
source: UnifiedBenchmarksDAItemSource
|
||||
r"""Benchmark source discriminator."""
|
||||
|
||||
tournament_stats: TournamentStats
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
"""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 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
|
||||
|
||||
|
||||
UnifiedBenchmarksMetaSource = Union[
|
||||
Literal[
|
||||
"artificial-analysis",
|
||||
"design-arena",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The source filter applied, or null when all sources are returned."""
|
||||
|
||||
|
||||
UnifiedBenchmarksMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class UnifiedBenchmarksMetaTypedDict(TypedDict):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
citation: Nullable[str]
|
||||
r"""Required attribution when republishing this data, or null when results span multiple sources (attribute each item individually by its `source` discriminator)."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: Nullable[UnifiedBenchmarksMetaSource]
|
||||
r"""The source filter applied, or null when all sources are returned."""
|
||||
source_url: Nullable[str]
|
||||
r"""URL of the upstream data source, or null when results span multiple sources."""
|
||||
task_type: Nullable[str]
|
||||
r"""The task_type filter applied, or null if showing all."""
|
||||
version: UnifiedBenchmarksMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class UnifiedBenchmarksMeta(BaseModel):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
|
||||
citation: Nullable[str]
|
||||
r"""Required attribution when republishing this data, or null when results span multiple sources (attribute each item individually by its `source` discriminator)."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: Annotated[
|
||||
Nullable[UnifiedBenchmarksMetaSource], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
r"""The source filter applied, or null when all sources are returned."""
|
||||
|
||||
source_url: Nullable[str]
|
||||
r"""URL of the upstream data source, or null when results span multiple sources."""
|
||||
|
||||
task_type: Nullable[str]
|
||||
r"""The task_type filter applied, or null if showing all."""
|
||||
|
||||
version: UnifiedBenchmarksMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["citation", "source", "source_url", "task_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
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .unifiedbenchmarksaaitem import (
|
||||
UnifiedBenchmarksAAItem,
|
||||
UnifiedBenchmarksAAItemTypedDict,
|
||||
)
|
||||
from .unifiedbenchmarksdaitem import (
|
||||
UnifiedBenchmarksDAItem,
|
||||
UnifiedBenchmarksDAItemTypedDict,
|
||||
)
|
||||
from .unifiedbenchmarksmeta import UnifiedBenchmarksMeta, UnifiedBenchmarksMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import List, Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
UnifiedBenchmarksResponseDataTypedDict = TypeAliasType(
|
||||
"UnifiedBenchmarksResponseDataTypedDict",
|
||||
Union[UnifiedBenchmarksAAItemTypedDict, UnifiedBenchmarksDAItemTypedDict],
|
||||
)
|
||||
|
||||
|
||||
UnifiedBenchmarksResponseData = Annotated[
|
||||
Union[
|
||||
Annotated[UnifiedBenchmarksAAItem, Tag("artificial-analysis")],
|
||||
Annotated[UnifiedBenchmarksDAItem, Tag("design-arena")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "source", "source")),
|
||||
]
|
||||
|
||||
|
||||
class UnifiedBenchmarksResponseTypedDict(TypedDict):
|
||||
data: List[UnifiedBenchmarksResponseDataTypedDict]
|
||||
meta: UnifiedBenchmarksMetaTypedDict
|
||||
|
||||
|
||||
class UnifiedBenchmarksResponse(BaseModel):
|
||||
data: List[UnifiedBenchmarksResponseData]
|
||||
|
||||
meta: UnifiedBenchmarksMeta
|
||||
@@ -11,7 +11,7 @@ from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
AspectRatio = Union[
|
||||
VideoGenerationRequestAspectRatio = Union[
|
||||
Literal[
|
||||
"16:9",
|
||||
"9:16",
|
||||
@@ -28,7 +28,7 @@ AspectRatio = Union[
|
||||
r"""Aspect ratio of the generated video"""
|
||||
|
||||
|
||||
class OptionsTypedDict(TypedDict):
|
||||
class VideoGenerationRequestOptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -76,11 +76,13 @@ class OptionsTypedDict(TypedDict):
|
||||
google_vertex: NotRequired[Dict[str, Nullable[Any]]]
|
||||
gopomelo: NotRequired[Dict[str, Nullable[Any]]]
|
||||
groq: NotRequired[Dict[str, Nullable[Any]]]
|
||||
heygen: NotRequired[Dict[str, Nullable[Any]]]
|
||||
huggingface: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inception: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inceptron: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inferact_vllm: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inference_net: NotRequired[Dict[str, Nullable[Any]]]
|
||||
infermatic: NotRequired[Dict[str, Nullable[Any]]]
|
||||
inflection: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -125,6 +127,7 @@ class OptionsTypedDict(TypedDict):
|
||||
reka: NotRequired[Dict[str, Nullable[Any]]]
|
||||
relace: NotRequired[Dict[str, Nullable[Any]]]
|
||||
replicate: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sakana_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova: NotRequired[Dict[str, Nullable[Any]]]
|
||||
sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]]
|
||||
seed: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -136,6 +139,7 @@ class OptionsTypedDict(TypedDict):
|
||||
streamlake: NotRequired[Dict[str, Nullable[Any]]]
|
||||
switchpoint: NotRequired[Dict[str, Nullable[Any]]]
|
||||
targon: NotRequired[Dict[str, Nullable[Any]]]
|
||||
tenstorrent: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together: NotRequired[Dict[str, Nullable[Any]]]
|
||||
together_lite: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ubicloud: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -148,7 +152,7 @@ class OptionsTypedDict(TypedDict):
|
||||
z_ai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
|
||||
|
||||
class Options(BaseModel):
|
||||
class VideoGenerationRequestOptions(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
@@ -261,6 +265,8 @@ class Options(BaseModel):
|
||||
|
||||
groq: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
heygen: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
huggingface: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
hyperbolic: Optional[Dict[str, Nullable[Any]]] = None
|
||||
@@ -273,6 +279,10 @@ class Options(BaseModel):
|
||||
|
||||
inceptron: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
inferact_vllm: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm")
|
||||
] = None
|
||||
|
||||
inference_net: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net")
|
||||
] = None
|
||||
@@ -375,6 +385,10 @@ class Options(BaseModel):
|
||||
|
||||
replicate: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sakana_ai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai")
|
||||
] = None
|
||||
|
||||
sambanova: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
sambanova_cloaked: Annotated[
|
||||
@@ -401,6 +415,8 @@ class Options(BaseModel):
|
||||
|
||||
targon: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
tenstorrent: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
together_lite: Annotated[
|
||||
@@ -429,16 +445,16 @@ class Options(BaseModel):
|
||||
class VideoGenerationRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[OptionsTypedDict]
|
||||
options: NotRequired[VideoGenerationRequestOptionsTypedDict]
|
||||
|
||||
|
||||
class VideoGenerationRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[Options] = None
|
||||
options: Optional[VideoGenerationRequestOptions] = None
|
||||
|
||||
|
||||
Resolution = Union[
|
||||
VideoGenerationRequestResolution = Union[
|
||||
Literal[
|
||||
"480p",
|
||||
"720p",
|
||||
@@ -455,7 +471,7 @@ r"""Resolution of the generated video"""
|
||||
class VideoGenerationRequestTypedDict(TypedDict):
|
||||
model: str
|
||||
prompt: str
|
||||
aspect_ratio: NotRequired[AspectRatio]
|
||||
aspect_ratio: NotRequired[VideoGenerationRequestAspectRatio]
|
||||
r"""Aspect ratio of the generated video"""
|
||||
callback_url: NotRequired[str]
|
||||
r"""URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS."""
|
||||
@@ -469,7 +485,7 @@ class VideoGenerationRequestTypedDict(TypedDict):
|
||||
r"""Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (currently BytePlus Seedance 2.0); other providers use image references and ignore the rest."""
|
||||
provider: NotRequired[VideoGenerationRequestProviderTypedDict]
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
resolution: NotRequired[Resolution]
|
||||
resolution: NotRequired[VideoGenerationRequestResolution]
|
||||
r"""Resolution of the generated video"""
|
||||
seed: NotRequired[int]
|
||||
r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers."""
|
||||
@@ -483,7 +499,8 @@ class VideoGenerationRequest(BaseModel):
|
||||
prompt: str
|
||||
|
||||
aspect_ratio: Annotated[
|
||||
Optional[AspectRatio], PlainValidator(validate_open_enum(False))
|
||||
Optional[VideoGenerationRequestAspectRatio],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Aspect ratio of the generated video"""
|
||||
|
||||
@@ -506,7 +523,8 @@ class VideoGenerationRequest(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
resolution: Annotated[
|
||||
Optional[Resolution], PlainValidator(validate_open_enum(False))
|
||||
Optional[VideoGenerationRequestResolution],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
r"""Resolution of the generated video"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user