chore: 🐝 Update SDK - Generate 0.9.2 (#205)

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:
github-actions[bot]
2026-06-11 12:10:31 -04:00
committed by GitHub
co-authored by speakeasybot speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent 0c735989c1
commit 0f116c9792
392 changed files with 49644 additions and 2501 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable
import pydantic
from pydantic import ConfigDict
from typing import Any, Dict, Optional
from typing_extensions import NotRequired, TypedDict
class AdvisorNestedToolTypedDict(TypedDict):
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself."""
type: str
function: NotRequired[Dict[str, Nullable[Any]]]
parameters: NotRequired[Dict[str, Nullable[Any]]]
class AdvisorNestedTool(BaseModel):
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself."""
model_config = ConfigDict(
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
)
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
type: str
function: Optional[Dict[str, Nullable[Any]]] = None
parameters: Optional[Dict[str, Nullable[Any]]] = None
@property
def additional_properties(self):
return self.__pydantic_extra__
@additional_properties.setter
def additional_properties(self, value):
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
@@ -0,0 +1,43 @@
"""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
AdvisorReasoningEffort = Union[
Literal[
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
r"""Reasoning effort level for the advisor call."""
class AdvisorReasoningTypedDict(TypedDict):
r"""Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking."""
effort: NotRequired[AdvisorReasoningEffort]
r"""Reasoning effort level for the advisor call."""
max_tokens: NotRequired[int]
r"""Maximum number of reasoning tokens the advisor may use."""
class AdvisorReasoning(BaseModel):
r"""Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking."""
effort: Annotated[
Optional[AdvisorReasoningEffort], PlainValidator(validate_open_enum(False))
] = None
r"""Reasoning effort level for the advisor call."""
max_tokens: Optional[int] = None
r"""Maximum number of reasoning tokens the advisor may use."""
@@ -0,0 +1,30 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .advisorservertoolconfig import (
AdvisorServerToolConfig,
AdvisorServerToolConfigTypedDict,
)
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
AdvisorServerToolOpenRouterType = Literal["openrouter:advisor",]
class AdvisorServerToolOpenRouterTypedDict(TypedDict):
r"""OpenRouter built-in server tool: consults a higher-intelligence advisor model (any OpenRouter model) for guidance mid-generation and returns its response. The advisor may run as a sub-agent with its own tools. Include multiple entries to offer several named advisors; at most one entry may omit `name` to act as the default advisor."""
type: AdvisorServerToolOpenRouterType
parameters: NotRequired[AdvisorServerToolConfigTypedDict]
r"""Configuration for one openrouter:advisor server tool entry."""
class AdvisorServerToolOpenRouter(BaseModel):
r"""OpenRouter built-in server tool: consults a higher-intelligence advisor model (any OpenRouter model) for guidance mid-generation and returns its response. The advisor may run as a sub-agent with its own tools. Include multiple entries to offer several named advisors; at most one entry may omit `name` to act as the default advisor."""
type: AdvisorServerToolOpenRouterType
parameters: Optional[AdvisorServerToolConfig] = None
r"""Configuration for one openrouter:advisor server tool entry."""
@@ -0,0 +1,67 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict
from .advisorreasoning import AdvisorReasoning, AdvisorReasoningTypedDict
from openrouter.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class AdvisorServerToolConfigTypedDict(TypedDict):
r"""Configuration for one openrouter:advisor server tool entry."""
forward_transcript: NotRequired[bool]
r"""When true, the full parent conversation is forwarded to the advisor so it sees the same context the executor does (and the tool-call `prompt`, if given, is appended as a final user turn). When false or omitted, the advisor receives only the `prompt` the executor passes in the tool call."""
instructions: NotRequired[str]
r"""System instructions for the advisor sub-agent. When omitted, the advisor responds with no system prompt of its own."""
max_completion_tokens: NotRequired[int]
r"""Maximum number of output tokens (including reasoning) the advisor may produce. When omitted, the provider's default applies."""
max_tool_calls: NotRequired[int]
r"""Maximum number of tool-calling steps the advisor sub-agent may take during its agentic loop. Capped at 25. Only relevant when the advisor is given tools."""
model: NotRequired[str]
r"""Slug of the advisor model to consult (any OpenRouter model). When omitted, the executor can choose it via the tool call's `model` argument; if neither is set, the model from the outer API request is used. The advisor tool itself cannot be the advisor model."""
name: NotRequired[str]
r"""Optional name for this advisor. The model sees one tool per named advisor (and one default for an unnamed entry). Names must be unique across advisor entries. Letters, digits, spaces, underscores, and dashes; trimmed; 164 chars."""
reasoning: NotRequired[AdvisorReasoningTypedDict]
r"""Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking."""
stream: NotRequired[bool]
r"""When true, the advisor's advice streams incrementally as it is produced. In the Responses API this emits `response.output_text.delta` events targeting the advisor output item; the final `advice` field is still set on the completed item. Has no effect on the Chat Completions API (where the advice arrives only as the final tool result). When false or omitted, the advice arrives only as the final result."""
temperature: NotRequired[float]
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
tools: NotRequired[List[AdvisorNestedToolTypedDict]]
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself."""
class AdvisorServerToolConfig(BaseModel):
r"""Configuration for one openrouter:advisor server tool entry."""
forward_transcript: Optional[bool] = None
r"""When true, the full parent conversation is forwarded to the advisor so it sees the same context the executor does (and the tool-call `prompt`, if given, is appended as a final user turn). When false or omitted, the advisor receives only the `prompt` the executor passes in the tool call."""
instructions: Optional[str] = None
r"""System instructions for the advisor sub-agent. When omitted, the advisor responds with no system prompt of its own."""
max_completion_tokens: Optional[int] = None
r"""Maximum number of output tokens (including reasoning) the advisor may produce. When omitted, the provider's default applies."""
max_tool_calls: Optional[int] = None
r"""Maximum number of tool-calling steps the advisor sub-agent may take during its agentic loop. Capped at 25. Only relevant when the advisor is given tools."""
model: Optional[str] = None
r"""Slug of the advisor model to consult (any OpenRouter model). When omitted, the executor can choose it via the tool call's `model` argument; if neither is set, the model from the outer API request is used. The advisor tool itself cannot be the advisor model."""
name: Optional[str] = None
r"""Optional name for this advisor. The model sees one tool per named advisor (and one default for an unnamed entry). Names must be unique across advisor entries. Letters, digits, spaces, underscores, and dashes; trimmed; 164 chars."""
reasoning: Optional[AdvisorReasoning] = None
r"""Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking."""
stream: Optional[bool] = None
r"""When true, the advisor's advice streams incrementally as it is produced. In the Responses API this emits `response.output_text.delta` events targeting the advisor output item; the final `advice` field is still set on the completed item. Has no effect on the Chat Completions API (where the advice arrives only as the final tool result). When false or omitted, the advice arrives only as the final result."""
temperature: Optional[float] = None
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
tools: Optional[List[AdvisorNestedTool]] = None
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself."""
@@ -0,0 +1,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
AnthropicAllowedCallers = Union[
Literal[
"direct",
"code_execution_20250825",
"code_execution_20260120",
],
UnrecognizedStr,
]
@@ -0,0 +1,28 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .anthropicimagemimetype import AnthropicImageMimeType
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
AnthropicBase64ImageSourceType = Literal["base64",]
class AnthropicBase64ImageSourceTypedDict(TypedDict):
data: str
media_type: AnthropicImageMimeType
type: AnthropicBase64ImageSourceType
class AnthropicBase64ImageSource(BaseModel):
data: str
media_type: Annotated[
AnthropicImageMimeType, PlainValidator(validate_open_enum(False))
]
type: AnthropicBase64ImageSourceType
@@ -0,0 +1,26 @@
"""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
AnthropicBase64PdfSourceMediaType = Literal["application/pdf",]
AnthropicBase64PdfSourceType = Literal["base64",]
class AnthropicBase64PdfSourceTypedDict(TypedDict):
data: str
media_type: AnthropicBase64PdfSourceMediaType
type: AnthropicBase64PdfSourceType
class AnthropicBase64PdfSource(BaseModel):
data: str
media_type: AnthropicBase64PdfSourceMediaType
type: AnthropicBase64PdfSourceType
@@ -13,14 +13,14 @@ AnthropicCacheControlDirectiveType = Literal["ephemeral",]
class AnthropicCacheControlDirectiveTypedDict(TypedDict):
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
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."""
type: AnthropicCacheControlDirectiveType
ttl: NotRequired[AnthropicCacheControlTTL]
class AnthropicCacheControlDirective(BaseModel):
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
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."""
type: AnthropicCacheControlDirectiveType
@@ -0,0 +1,63 @@
"""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
AnthropicCitationCharLocationParamType = Literal["char_location",]
class AnthropicCitationCharLocationParamTypedDict(TypedDict):
cited_text: str
document_index: int
document_title: Nullable[str]
end_char_index: int
start_char_index: int
type: AnthropicCitationCharLocationParamType
class AnthropicCitationCharLocationParam(BaseModel):
cited_text: str
document_index: int
document_title: Nullable[str]
end_char_index: int
start_char_index: int
type: AnthropicCitationCharLocationParamType
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["document_title"]
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,63 @@
"""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
AnthropicCitationContentBlockLocationParamType = Literal["content_block_location",]
class AnthropicCitationContentBlockLocationParamTypedDict(TypedDict):
cited_text: str
document_index: int
document_title: Nullable[str]
end_block_index: int
start_block_index: int
type: AnthropicCitationContentBlockLocationParamType
class AnthropicCitationContentBlockLocationParam(BaseModel):
cited_text: str
document_index: int
document_title: Nullable[str]
end_block_index: int
start_block_index: int
type: AnthropicCitationContentBlockLocationParamType
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["document_title"]
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,63 @@
"""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
AnthropicCitationPageLocationParamType = Literal["page_location",]
class AnthropicCitationPageLocationParamTypedDict(TypedDict):
cited_text: str
document_index: int
document_title: Nullable[str]
end_page_number: int
start_page_number: int
type: AnthropicCitationPageLocationParamType
class AnthropicCitationPageLocationParam(BaseModel):
cited_text: str
document_index: int
document_title: Nullable[str]
end_page_number: int
start_page_number: int
type: AnthropicCitationPageLocationParamType
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["document_title"]
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,66 @@
"""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
AnthropicCitationSearchResultLocationType = Literal["search_result_location",]
class AnthropicCitationSearchResultLocationTypedDict(TypedDict):
cited_text: str
end_block_index: int
search_result_index: int
source: str
start_block_index: int
title: Nullable[str]
type: AnthropicCitationSearchResultLocationType
class AnthropicCitationSearchResultLocation(BaseModel):
cited_text: str
end_block_index: int
search_result_index: int
source: str
start_block_index: int
title: Nullable[str]
type: AnthropicCitationSearchResultLocationType
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["title"]
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,60 @@
"""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
AnthropicCitationWebSearchResultLocationType = Literal["web_search_result_location",]
class AnthropicCitationWebSearchResultLocationTypedDict(TypedDict):
cited_text: str
encrypted_index: str
title: Nullable[str]
type: AnthropicCitationWebSearchResultLocationType
url: str
class AnthropicCitationWebSearchResultLocation(BaseModel):
cited_text: str
encrypted_index: str
title: Nullable[str]
type: AnthropicCitationWebSearchResultLocationType
url: str
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["title"]
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,164 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .anthropicbase64pdfsource import (
AnthropicBase64PdfSource,
AnthropicBase64PdfSourceTypedDict,
)
from .anthropiccachecontroldirective import (
AnthropicCacheControlDirective,
AnthropicCacheControlDirectiveTypedDict,
)
from .anthropicimageblockparam import (
AnthropicImageBlockParam,
AnthropicImageBlockParamTypedDict,
)
from .anthropicplaintextsource import (
AnthropicPlainTextSource,
AnthropicPlainTextSourceTypedDict,
)
from .anthropictextblockparam import (
AnthropicTextBlockParam,
AnthropicTextBlockParamTypedDict,
)
from .anthropicurlpdfsource import AnthropicURLPdfSource, AnthropicURLPdfSourceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag, model_serializer
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
class AnthropicDocumentBlockParamCitationsTypedDict(TypedDict):
enabled: NotRequired[bool]
class AnthropicDocumentBlockParamCitations(BaseModel):
enabled: Optional[bool] = None
AnthropicDocumentBlockParamContent1TypedDict = TypeAliasType(
"AnthropicDocumentBlockParamContent1TypedDict",
Union[AnthropicImageBlockParamTypedDict, AnthropicTextBlockParamTypedDict],
)
AnthropicDocumentBlockParamContent1 = Annotated[
Union[
Annotated[AnthropicImageBlockParam, Tag("image")],
Annotated[AnthropicTextBlockParam, Tag("text")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
AnthropicDocumentBlockParamContent2TypedDict = TypeAliasType(
"AnthropicDocumentBlockParamContent2TypedDict",
Union[str, List[AnthropicDocumentBlockParamContent1TypedDict]],
)
AnthropicDocumentBlockParamContent2 = TypeAliasType(
"AnthropicDocumentBlockParamContent2",
Union[str, List[AnthropicDocumentBlockParamContent1]],
)
SourceType = Literal["content",]
class SourceContentTypedDict(TypedDict):
content: AnthropicDocumentBlockParamContent2TypedDict
type: SourceType
class SourceContent(BaseModel):
content: AnthropicDocumentBlockParamContent2
type: SourceType
AnthropicDocumentBlockParamSourceUnionTypedDict = TypeAliasType(
"AnthropicDocumentBlockParamSourceUnionTypedDict",
Union[
SourceContentTypedDict,
AnthropicURLPdfSourceTypedDict,
AnthropicBase64PdfSourceTypedDict,
AnthropicPlainTextSourceTypedDict,
],
)
AnthropicDocumentBlockParamSourceUnion = Annotated[
Union[
Annotated[AnthropicBase64PdfSource, Tag("base64")],
Annotated[AnthropicPlainTextSource, Tag("text")],
Annotated[SourceContent, Tag("content")],
Annotated[AnthropicURLPdfSource, Tag("url")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
TypeDocument = Literal["document",]
class AnthropicDocumentBlockParamTypedDict(TypedDict):
source: AnthropicDocumentBlockParamSourceUnionTypedDict
type: TypeDocument
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."""
citations: NotRequired[Nullable[AnthropicDocumentBlockParamCitationsTypedDict]]
context: NotRequired[Nullable[str]]
title: NotRequired[Nullable[str]]
class AnthropicDocumentBlockParam(BaseModel):
source: AnthropicDocumentBlockParamSourceUnion
type: TypeDocument
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."""
citations: OptionalNullable[AnthropicDocumentBlockParamCitations] = UNSET
context: OptionalNullable[str] = UNSET
title: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["cache_control", "citations", "context", "title"]
nullable_fields = ["citations", "context", "title"]
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,54 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .anthropicbase64imagesource import (
AnthropicBase64ImageSource,
AnthropicBase64ImageSourceTypedDict,
)
from .anthropiccachecontroldirective import (
AnthropicCacheControlDirective,
AnthropicCacheControlDirectiveTypedDict,
)
from .anthropicurlimagesource import (
AnthropicURLImageSource,
AnthropicURLImageSourceTypedDict,
)
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
AnthropicImageBlockParamSourceTypedDict = TypeAliasType(
"AnthropicImageBlockParamSourceTypedDict",
Union[AnthropicURLImageSourceTypedDict, AnthropicBase64ImageSourceTypedDict],
)
AnthropicImageBlockParamSource = Annotated[
Union[
Annotated[AnthropicBase64ImageSource, Tag("base64")],
Annotated[AnthropicURLImageSource, Tag("url")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
AnthropicImageBlockParamType = Literal["image",]
class AnthropicImageBlockParamTypedDict(TypedDict):
source: AnthropicImageBlockParamSourceTypedDict
type: AnthropicImageBlockParamType
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."""
class AnthropicImageBlockParam(BaseModel):
source: AnthropicImageBlockParamSource
type: AnthropicImageBlockParamType
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."""
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
AnthropicImageMimeType = Union[
Literal[
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
],
UnrecognizedStr,
]
@@ -0,0 +1,20 @@
"""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
AnthropicInputTokensClearAtLeastType = Literal["input_tokens",]
class AnthropicInputTokensClearAtLeastTypedDict(TypedDict):
type: AnthropicInputTokensClearAtLeastType
value: int
class AnthropicInputTokensClearAtLeast(BaseModel):
type: AnthropicInputTokensClearAtLeastType
value: int
@@ -0,0 +1,20 @@
"""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
AnthropicInputTokensTriggerType = Literal["input_tokens",]
class AnthropicInputTokensTriggerTypedDict(TypedDict):
type: AnthropicInputTokensTriggerType
value: int
class AnthropicInputTokensTrigger(BaseModel):
type: AnthropicInputTokensTriggerType
value: int
@@ -0,0 +1,26 @@
"""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
AnthropicPlainTextSourceMediaType = Literal["text/plain",]
AnthropicPlainTextSourceType = Literal["text",]
class AnthropicPlainTextSourceTypedDict(TypedDict):
data: str
media_type: AnthropicPlainTextSourceMediaType
type: AnthropicPlainTextSourceType
class AnthropicPlainTextSource(BaseModel):
data: str
media_type: AnthropicPlainTextSourceMediaType
type: AnthropicPlainTextSourceType
@@ -0,0 +1,50 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .anthropiccachecontroldirective import (
AnthropicCacheControlDirective,
AnthropicCacheControlDirectiveTypedDict,
)
from .anthropictextblockparam import (
AnthropicTextBlockParam,
AnthropicTextBlockParamTypedDict,
)
from openrouter.types import BaseModel
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict
class AnthropicSearchResultBlockParamCitationsTypedDict(TypedDict):
enabled: NotRequired[bool]
class AnthropicSearchResultBlockParamCitations(BaseModel):
enabled: Optional[bool] = None
AnthropicSearchResultBlockParamType = Literal["search_result",]
class AnthropicSearchResultBlockParamTypedDict(TypedDict):
content: List[AnthropicTextBlockParamTypedDict]
source: str
title: str
type: AnthropicSearchResultBlockParamType
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."""
citations: NotRequired[AnthropicSearchResultBlockParamCitationsTypedDict]
class AnthropicSearchResultBlockParam(BaseModel):
content: List[AnthropicTextBlockParam]
source: str
title: str
type: AnthropicSearchResultBlockParamType
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."""
citations: Optional[AnthropicSearchResultBlockParamCitations] = None
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .anthropiccachecontroldirective import (
AnthropicCacheControlDirective,
AnthropicCacheControlDirectiveTypedDict,
)
from .anthropiccitationcharlocationparam import (
AnthropicCitationCharLocationParam,
AnthropicCitationCharLocationParamTypedDict,
)
from .anthropiccitationcontentblocklocationparam import (
AnthropicCitationContentBlockLocationParam,
AnthropicCitationContentBlockLocationParamTypedDict,
)
from .anthropiccitationpagelocationparam import (
AnthropicCitationPageLocationParam,
AnthropicCitationPageLocationParamTypedDict,
)
from .anthropiccitationsearchresultlocation import (
AnthropicCitationSearchResultLocation,
AnthropicCitationSearchResultLocationTypedDict,
)
from .anthropiccitationwebsearchresultlocation import (
AnthropicCitationWebSearchResultLocation,
AnthropicCitationWebSearchResultLocationTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag, model_serializer
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
CitationTypedDict = TypeAliasType(
"CitationTypedDict",
Union[
AnthropicCitationWebSearchResultLocationTypedDict,
AnthropicCitationCharLocationParamTypedDict,
AnthropicCitationPageLocationParamTypedDict,
AnthropicCitationContentBlockLocationParamTypedDict,
AnthropicCitationSearchResultLocationTypedDict,
],
)
Citation = Annotated[
Union[
Annotated[AnthropicCitationCharLocationParam, Tag("char_location")],
Annotated[
AnthropicCitationContentBlockLocationParam, Tag("content_block_location")
],
Annotated[AnthropicCitationPageLocationParam, Tag("page_location")],
Annotated[AnthropicCitationSearchResultLocation, Tag("search_result_location")],
Annotated[
AnthropicCitationWebSearchResultLocation, Tag("web_search_result_location")
],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
AnthropicTextBlockParamType = Literal["text",]
class AnthropicTextBlockParamTypedDict(TypedDict):
text: str
type: AnthropicTextBlockParamType
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."""
citations: NotRequired[Nullable[List[CitationTypedDict]]]
class AnthropicTextBlockParam(BaseModel):
text: str
type: AnthropicTextBlockParamType
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."""
citations: OptionalNullable[List[Citation]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["cache_control", "citations"]
nullable_fields = ["citations"]
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
AnthropicThinkingDisplay = Union[
Literal[
"summarized",
"omitted",
],
UnrecognizedStr,
]
@@ -0,0 +1,20 @@
"""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
AnthropicThinkingTurnsType = Literal["thinking_turns",]
class AnthropicThinkingTurnsTypedDict(TypedDict):
type: AnthropicThinkingTurnsType
value: int
class AnthropicThinkingTurns(BaseModel):
type: AnthropicThinkingTurnsType
value: int
@@ -0,0 +1,20 @@
"""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
AnthropicToolUsesKeepType = Literal["tool_uses",]
class AnthropicToolUsesKeepTypedDict(TypedDict):
type: AnthropicToolUsesKeepType
value: int
class AnthropicToolUsesKeep(BaseModel):
type: AnthropicToolUsesKeepType
value: int
@@ -0,0 +1,20 @@
"""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
AnthropicToolUsesTriggerType = Literal["tool_uses",]
class AnthropicToolUsesTriggerTypedDict(TypedDict):
type: AnthropicToolUsesTriggerType
value: int
class AnthropicToolUsesTrigger(BaseModel):
type: AnthropicToolUsesTriggerType
value: int
@@ -0,0 +1,20 @@
"""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
AnthropicURLImageSourceType = Literal["url",]
class AnthropicURLImageSourceTypedDict(TypedDict):
type: AnthropicURLImageSourceType
url: str
class AnthropicURLImageSource(BaseModel):
type: AnthropicURLImageSourceType
url: str
@@ -0,0 +1,20 @@
"""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
AnthropicURLPdfSourceType = Literal["url",]
class AnthropicURLPdfSourceTypedDict(TypedDict):
type: AnthropicURLPdfSourceType
url: str
class AnthropicURLPdfSource(BaseModel):
type: AnthropicURLPdfSourceType
url: str
@@ -0,0 +1,66 @@
"""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
AnthropicWebSearchResultBlockParamType = Literal["web_search_result",]
class AnthropicWebSearchResultBlockParamTypedDict(TypedDict):
encrypted_content: str
title: str
type: AnthropicWebSearchResultBlockParamType
url: str
page_age: NotRequired[Nullable[str]]
class AnthropicWebSearchResultBlockParam(BaseModel):
encrypted_content: str
title: str
type: AnthropicWebSearchResultBlockParamType
url: str
page_age: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["page_age"]
nullable_fields = ["page_age"]
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,66 @@
"""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
AnthropicWebSearchToolUserLocationType = Literal["approximate",]
class AnthropicWebSearchToolUserLocationTypedDict(TypedDict):
type: AnthropicWebSearchToolUserLocationType
city: NotRequired[Nullable[str]]
country: NotRequired[Nullable[str]]
region: NotRequired[Nullable[str]]
timezone: NotRequired[Nullable[str]]
class AnthropicWebSearchToolUserLocation(BaseModel):
type: AnthropicWebSearchToolUserLocationType
city: OptionalNullable[str] = UNSET
country: OptionalNullable[str] = UNSET
region: OptionalNullable[str] = UNSET
timezone: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["city", "country", "region", "timezone"]
nullable_fields = ["city", "country", "region", "timezone"]
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,81 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .applypatchcalloperation import (
ApplyPatchCallOperation,
ApplyPatchCallOperationTypedDict,
)
from .applypatchcallstatus import ApplyPatchCallStatus
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, NotRequired, TypedDict
ApplyPatchCallItemType = Literal["apply_patch_call",]
class ApplyPatchCallItemTypedDict(TypedDict):
r"""A tool call emitted by the model requesting a V4A patch operation. The client applies the patch and echoes an `apply_patch_call_output` on the next turn."""
call_id: str
operation: ApplyPatchCallOperationTypedDict
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
status: ApplyPatchCallStatus
r"""Lifecycle state of an `apply_patch_call` output item."""
type: ApplyPatchCallItemType
id: NotRequired[Nullable[str]]
class ApplyPatchCallItem(BaseModel):
r"""A tool call emitted by the model requesting a V4A patch operation. The client applies the patch and echoes an `apply_patch_call_output` on the next turn."""
call_id: str
operation: ApplyPatchCallOperation
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
status: Annotated[ApplyPatchCallStatus, PlainValidator(validate_open_enum(False))]
r"""Lifecycle state of an `apply_patch_call` output item."""
type: ApplyPatchCallItemType
id: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id"]
nullable_fields = ["id"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,41 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .applypatchcreatefileoperation import (
ApplyPatchCreateFileOperation,
ApplyPatchCreateFileOperationTypedDict,
)
from .applypatchdeletefileoperation import (
ApplyPatchDeleteFileOperation,
ApplyPatchDeleteFileOperationTypedDict,
)
from .applypatchupdatefileoperation import (
ApplyPatchUpdateFileOperation,
ApplyPatchUpdateFileOperationTypedDict,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType
ApplyPatchCallOperationTypedDict = TypeAliasType(
"ApplyPatchCallOperationTypedDict",
Union[
ApplyPatchDeleteFileOperationTypedDict,
ApplyPatchCreateFileOperationTypedDict,
ApplyPatchUpdateFileOperationTypedDict,
],
)
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
ApplyPatchCallOperation = Annotated[
Union[
Annotated[ApplyPatchCreateFileOperation, Tag("create_file")],
Annotated[ApplyPatchDeleteFileOperation, Tag("delete_file")],
Annotated[ApplyPatchUpdateFileOperation, Tag("update_file")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
@@ -0,0 +1,35 @@
"""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
ApplyPatchCallOperationDiffDeltaEventType = Literal[
"response.apply_patch_call_operation_diff.delta",
]
class ApplyPatchCallOperationDiffDeltaEventTypedDict(TypedDict):
r"""Incremental chunk of `operation.diff` for an `apply_patch_call`. Matches OpenAI's streaming shape."""
delta: str
item_id: str
output_index: int
sequence_number: int
type: ApplyPatchCallOperationDiffDeltaEventType
class ApplyPatchCallOperationDiffDeltaEvent(BaseModel):
r"""Incremental chunk of `operation.diff` for an `apply_patch_call`. Matches OpenAI's streaming shape."""
delta: str
item_id: str
output_index: int
sequence_number: int
type: ApplyPatchCallOperationDiffDeltaEventType
@@ -0,0 +1,35 @@
"""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
ApplyPatchCallOperationDiffDoneEventType = Literal[
"response.apply_patch_call_operation_diff.done",
]
class ApplyPatchCallOperationDiffDoneEventTypedDict(TypedDict):
r"""Emitted when `operation.diff` streaming completes for an `apply_patch_call`."""
diff: str
item_id: str
output_index: int
sequence_number: int
type: ApplyPatchCallOperationDiffDoneEventType
class ApplyPatchCallOperationDiffDoneEvent(BaseModel):
r"""Emitted when `operation.diff` streaming completes for an `apply_patch_call`."""
diff: str
item_id: str
output_index: int
sequence_number: int
type: ApplyPatchCallOperationDiffDoneEventType
@@ -0,0 +1,84 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, NotRequired, TypedDict
ApplyPatchCallOutputItemStatus = Union[
Literal[
"completed",
"failed",
],
UnrecognizedStr,
]
ApplyPatchCallOutputItemType = Literal["apply_patch_call_output",]
class ApplyPatchCallOutputItemTypedDict(TypedDict):
r"""The client's echo of an `apply_patch_call` after applying the patch. `output` is an optional human-readable log; `status` is `completed` when the patch was applied successfully, `failed` otherwise."""
call_id: str
status: ApplyPatchCallOutputItemStatus
type: ApplyPatchCallOutputItemType
id: NotRequired[Nullable[str]]
output: NotRequired[Nullable[str]]
class ApplyPatchCallOutputItem(BaseModel):
r"""The client's echo of an `apply_patch_call` after applying the patch. `output` is an optional human-readable log; `status` is `completed` when the patch was applied successfully, `failed` otherwise."""
call_id: str
status: Annotated[
ApplyPatchCallOutputItemStatus, PlainValidator(validate_open_enum(False))
]
type: ApplyPatchCallOutputItemType
id: OptionalNullable[str] = UNSET
output: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "output"]
nullable_fields = ["id", "output"]
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,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ApplyPatchCallStatus = Union[
Literal[
"in_progress",
"completed",
],
UnrecognizedStr,
]
r"""Lifecycle state of an `apply_patch_call` output item."""
@@ -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
ApplyPatchCreateFileOperationType = Literal["create_file",]
class ApplyPatchCreateFileOperationTypedDict(TypedDict):
r"""The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents."""
diff: str
path: str
type: ApplyPatchCreateFileOperationType
class ApplyPatchCreateFileOperation(BaseModel):
r"""The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents."""
diff: str
path: str
type: ApplyPatchCreateFileOperationType
@@ -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 Literal
from typing_extensions import TypedDict
ApplyPatchDeleteFileOperationType = Literal["delete_file",]
class ApplyPatchDeleteFileOperationTypedDict(TypedDict):
r"""The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required."""
path: str
type: ApplyPatchDeleteFileOperationType
class ApplyPatchDeleteFileOperation(BaseModel):
r"""The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required."""
path: str
type: ApplyPatchDeleteFileOperationType
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ApplyPatchEngineEnum = Union[
Literal[
"auto",
"native",
"openrouter",
],
UnrecognizedStr,
]
r"""Which apply_patch engine to use. \"auto\" (default) uses native passthrough when the endpoint advertises native apply_patch support, otherwise falls back to OpenRouter's HITL validator. \"native\" forces native passthrough — when the endpoint does not support native, the request falls back to HITL. \"openrouter\" always runs the HITL validator. Native passthrough streams the diff incrementally via `apply_patch_call_operation_diff.delta` events; HITL buffers the diff for atomic delivery as a single delta."""
@@ -0,0 +1,30 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .applypatchservertoolconfig import (
ApplyPatchServerToolConfig,
ApplyPatchServerToolConfigTypedDict,
)
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
ApplyPatchServerToolOpenRouterType = Literal["openrouter:apply_patch",]
class ApplyPatchServerToolOpenRouterTypedDict(TypedDict):
r"""OpenRouter built-in server tool: validates V4A diff patches for file operations (create, update, delete). Restricted to the Responses API."""
type: ApplyPatchServerToolOpenRouterType
parameters: NotRequired[ApplyPatchServerToolConfigTypedDict]
r"""Configuration for the openrouter:apply_patch server tool"""
class ApplyPatchServerToolOpenRouter(BaseModel):
r"""OpenRouter built-in server tool: validates V4A diff patches for file operations (create, update, delete). Restricted to the Responses API."""
type: ApplyPatchServerToolOpenRouterType
parameters: Optional[ApplyPatchServerToolConfig] = None
r"""Configuration for the openrouter:apply_patch server tool"""
@@ -0,0 +1,25 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .applypatchengineenum import ApplyPatchEngineEnum
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ApplyPatchServerToolConfigTypedDict(TypedDict):
r"""Configuration for the openrouter:apply_patch server tool"""
engine: NotRequired[ApplyPatchEngineEnum]
r"""Which apply_patch engine to use. \"auto\" (default) uses native passthrough when the endpoint advertises native apply_patch support, otherwise falls back to OpenRouter's HITL validator. \"native\" forces native passthrough — when the endpoint does not support native, the request falls back to HITL. \"openrouter\" always runs the HITL validator. Native passthrough streams the diff incrementally via `apply_patch_call_operation_diff.delta` events; HITL buffers the diff for atomic delivery as a single delta."""
class ApplyPatchServerToolConfig(BaseModel):
r"""Configuration for the openrouter:apply_patch server tool"""
engine: Annotated[
Optional[ApplyPatchEngineEnum], PlainValidator(validate_open_enum(False))
] = None
r"""Which apply_patch engine to use. \"auto\" (default) uses native passthrough when the endpoint advertises native apply_patch support, otherwise falls back to OpenRouter's HITL validator. \"native\" forces native passthrough — when the endpoint does not support native, the request falls back to HITL. \"openrouter\" always runs the HITL validator. Native passthrough streams the diff incrementally via `apply_patch_call_operation_diff.delta` events; HITL buffers the diff for atomic delivery as a single delta."""
@@ -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
ApplyPatchUpdateFileOperationType = Literal["update_file",]
class ApplyPatchUpdateFileOperationTypedDict(TypedDict):
r"""The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file."""
diff: str
path: str
type: ApplyPatchUpdateFileOperationType
class ApplyPatchUpdateFileOperation(BaseModel):
r"""The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file."""
diff: str
path: str
type: ApplyPatchUpdateFileOperationType
@@ -0,0 +1,35 @@
"""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 AppRankingsItemTypedDict(TypedDict):
app_id: int
r"""Stable numeric identifier of the app on OpenRouter."""
app_name: str
r"""Public display name of the app."""
rank: int
r"""1-based position of the app within this response, per the requested `sort`."""
total_requests: int
r"""Number of requests attributed to the app inside the date window."""
total_tokens: str
r"""Sum of `prompt_tokens + completion_tokens` attributed to the app inside the date window, returned as a decimal string so 64-bit values are not truncated."""
class AppRankingsItem(BaseModel):
app_id: int
r"""Stable numeric identifier of the app on OpenRouter."""
app_name: str
r"""Public display name of the app."""
rank: int
r"""1-based position of the app within this response, per the requested `sort`."""
total_requests: int
r"""Number of requests attributed to the app inside the date window."""
total_tokens: str
r"""Sum of `prompt_tokens + completion_tokens` attributed to the app inside the date window, returned as a decimal string so 64-bit values are not truncated."""
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .apprankingsitem import AppRankingsItem, AppRankingsItemTypedDict
from .rankingsdailymeta import RankingsDailyMeta, RankingsDailyMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class AppRankingsResponseTypedDict(TypedDict):
data: List[AppRankingsItemTypedDict]
r"""Apps ranked per the requested `sort`, re-numbered 1..N after category filtering. `popular` sorts by `total_tokens` descending; `trending` sorts by absolute excess token growth descending and may return fewer than `limit` rows when few apps are growing."""
meta: RankingsDailyMetaTypedDict
class AppRankingsResponse(BaseModel):
data: List[AppRankingsItem]
r"""Apps ranked per the requested `sort`, re-numbered 1..N after category filtering. `popular` sorts by `total_tokens` descending; `trending` sorts by absolute excess token growth descending and may return fewer than `limit` rows when few apps are growing."""
meta: RankingsDailyMeta
@@ -13,6 +13,8 @@ class AutoRouterPluginTypedDict(TypedDict):
id: AutoRouterPluginID
allowed_models: NotRequired[List[str]]
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
cost_quality_tradeoff: NotRequired[int]
r"""Controls cost vs. quality routing tradeoff (010). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7."""
enabled: NotRequired[bool]
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
@@ -23,5 +25,8 @@ class AutoRouterPlugin(BaseModel):
allowed_models: Optional[List[str]] = None
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
cost_quality_tradeoff: Optional[int] = None
r"""Controls cost vs. quality routing tradeoff (010). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7."""
enabled: Optional[bool] = None
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
+23 -2
View File
@@ -1,10 +1,23 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .applypatchcallitem import ApplyPatchCallItem, ApplyPatchCallItemTypedDict
from .applypatchcalloutputitem import (
ApplyPatchCallOutputItem,
ApplyPatchCallOutputItemTypedDict,
)
from .inputaudio import InputAudio, InputAudioTypedDict
from .inputfile import InputFile, InputFileTypedDict
from .inputimage import InputImage, InputImageTypedDict
from .inputtext import InputText, InputTextTypedDict
from .openairesponsecustomtoolcall import (
OpenAIResponseCustomToolCall,
OpenAIResponseCustomToolCallTypedDict,
)
from .openairesponsecustomtoolcalloutput import (
OpenAIResponseCustomToolCallOutput,
OpenAIResponseCustomToolCallOutputTypedDict,
)
from .openairesponsefunctiontoolcall import (
OpenAIResponseFunctionToolCall,
OpenAIResponseFunctionToolCallTypedDict,
@@ -172,9 +185,13 @@ BaseInputsUnion1TypedDict = TypeAliasType(
BaseInputsMessageTypedDict,
OpenAIResponseInputMessageItemTypedDict,
OutputItemImageGenerationCallTypedDict,
OpenAIResponseCustomToolCallOutputTypedDict,
OpenAIResponseFunctionToolCallOutputTypedDict,
OpenAIResponseFunctionToolCallTypedDict,
ApplyPatchCallItemTypedDict,
ApplyPatchCallOutputItemTypedDict,
OutputMessageTypedDict,
OpenAIResponseCustomToolCallTypedDict,
OpenAIResponseFunctionToolCallTypedDict,
],
)
@@ -185,9 +202,13 @@ BaseInputsUnion1 = TypeAliasType(
BaseInputsMessage,
OpenAIResponseInputMessageItem,
OutputItemImageGenerationCall,
OpenAIResponseCustomToolCallOutput,
OpenAIResponseFunctionToolCallOutput,
OpenAIResponseFunctionToolCall,
ApplyPatchCallItem,
ApplyPatchCallOutputItem,
OutputMessage,
OpenAIResponseCustomToolCall,
OpenAIResponseFunctionToolCall,
],
)
@@ -0,0 +1,27 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .bashservertoolconfig import BashServerToolConfig, BashServerToolConfigTypedDict
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
BashServerToolType = Literal["openrouter:bash",]
class BashServerToolTypedDict(TypedDict):
r"""OpenRouter built-in server tool: runs shell commands server-side in a sandboxed container"""
type: BashServerToolType
parameters: NotRequired[BashServerToolConfigTypedDict]
r"""Configuration for the openrouter:bash server tool"""
class BashServerTool(BaseModel):
r"""OpenRouter built-in server tool: runs shell commands server-side in a sandboxed container"""
type: BashServerToolType
parameters: Optional[BashServerToolConfig] = None
r"""Configuration for the openrouter:bash server tool"""
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .bashservertoolengine import BashServerToolEngine
from .bashservertoolenvironment import (
BashServerToolEnvironment,
BashServerToolEnvironmentTypedDict,
)
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class BashServerToolConfigTypedDict(TypedDict):
r"""Configuration for the openrouter:bash server tool"""
engine: NotRequired[BashServerToolEngine]
r"""Which bash engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) and \"native\" use native passthrough, returning the tool call to your application to run client-side; OpenRouter does not execute the commands."""
environment: NotRequired[BashServerToolEnvironmentTypedDict]
r"""Execution environment for the bash server tool."""
sleep_after_seconds: NotRequired[int]
r"""How long (in seconds) the container stays warm after its last command before sleeping, freeing its capacity slot. Idle-based: each command renews the timer. Defaults to 900 (15 minutes); capped at 2592000 (30 days)."""
class BashServerToolConfig(BaseModel):
r"""Configuration for the openrouter:bash server tool"""
engine: Annotated[
Optional[BashServerToolEngine], PlainValidator(validate_open_enum(False))
] = None
r"""Which bash engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) and \"native\" use native passthrough, returning the tool call to your application to run client-side; OpenRouter does not execute the commands."""
environment: Optional[BashServerToolEnvironment] = None
r"""Execution environment for the bash server tool."""
sleep_after_seconds: Optional[int] = None
r"""How long (in seconds) the container stays warm after its last command before sleeping, freeing its capacity slot. Idle-based: each command renews the timer. Defaults to 900 (15 minutes); capped at 2592000 (30 days)."""
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
BashServerToolEngine = Union[
Literal[
"auto",
"native",
"openrouter",
],
UnrecognizedStr,
]
r"""Which bash engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) and \"native\" use native passthrough, returning the tool call to your application to run client-side; OpenRouter does not execute the commands."""
@@ -0,0 +1,32 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .containerautoenvironment import (
ContainerAutoEnvironment,
ContainerAutoEnvironmentTypedDict,
)
from .containerreferenceenvironment import (
ContainerReferenceEnvironment,
ContainerReferenceEnvironmentTypedDict,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType
BashServerToolEnvironmentTypedDict = TypeAliasType(
"BashServerToolEnvironmentTypedDict",
Union[ContainerAutoEnvironmentTypedDict, ContainerReferenceEnvironmentTypedDict],
)
r"""Execution environment for the bash server tool."""
BashServerToolEnvironment = Annotated[
Union[
Annotated[ContainerAutoEnvironment, Tag("container_auto")],
Annotated[ContainerReferenceEnvironment, Tag("container_reference")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""Execution environment for the bash server tool."""
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BulkAddWorkspaceMembersRequestTypedDict(TypedDict):
user_ids: List[str]
r"""List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization."""
class BulkAddWorkspaceMembersRequest(BaseModel):
user_ids: List[str]
r"""List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization."""
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .workspacemember import WorkspaceMember, WorkspaceMemberTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BulkAddWorkspaceMembersResponseTypedDict(TypedDict):
added_count: int
r"""Number of workspace memberships created or updated"""
data: List[WorkspaceMemberTypedDict]
r"""List of added workspace memberships"""
class BulkAddWorkspaceMembersResponse(BaseModel):
added_count: int
r"""Number of workspace memberships created or updated"""
data: List[WorkspaceMember]
r"""List of added workspace memberships"""
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BulkRemoveWorkspaceMembersRequestTypedDict(TypedDict):
user_ids: List[str]
r"""List of user IDs to remove from the workspace"""
class BulkRemoveWorkspaceMembersRequest(BaseModel):
user_ids: List[str]
r"""List of user IDs to remove from the workspace"""
@@ -0,0 +1,15 @@
"""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 BulkRemoveWorkspaceMembersResponseTypedDict(TypedDict):
removed_count: int
r"""Number of members removed"""
class BulkRemoveWorkspaceMembersResponse(BaseModel):
removed_count: int
r"""Number of members removed"""
+116
View File
@@ -0,0 +1,116 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .byokproviderslug import BYOKProviderSlug
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
from typing_extensions import Annotated, NotRequired, TypedDict
class BYOKKeyTypedDict(TypedDict):
allowed_api_key_hashes: Nullable[List[str]]
r"""Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction."""
allowed_models: Nullable[List[str]]
r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction."""
allowed_user_ids: Nullable[List[str]]
r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction."""
created_at: str
r"""ISO timestamp of when the credential was created."""
disabled: bool
r"""Whether this credential is currently disabled."""
id: str
r"""Stable public identifier for this BYOK credential."""
is_fallback: bool
r"""Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried."""
label: str
r"""Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI."""
provider: BYOKProviderSlug
r"""The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)."""
sort_order: int
r"""Position within the provider — credentials are tried in ascending sort order."""
workspace_id: str
r"""ID of the workspace this credential belongs to."""
name: NotRequired[Nullable[str]]
r"""Optional human-readable name for the credential."""
class BYOKKey(BaseModel):
allowed_api_key_hashes: Nullable[List[str]]
r"""Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction."""
allowed_models: Nullable[List[str]]
r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction."""
allowed_user_ids: Nullable[List[str]]
r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction."""
created_at: str
r"""ISO timestamp of when the credential was created."""
disabled: bool
r"""Whether this credential is currently disabled."""
id: str
r"""Stable public identifier for this BYOK credential."""
is_fallback: bool
r"""Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried."""
label: str
r"""Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI."""
provider: Annotated[BYOKProviderSlug, PlainValidator(validate_open_enum(False))]
r"""The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)."""
sort_order: int
r"""Position within the provider — credentials are tried in ascending sort order."""
workspace_id: str
r"""ID of the workspace this credential belongs to."""
name: OptionalNullable[str] = UNSET
r"""Optional human-readable name for the credential."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["name"]
nullable_fields = [
"allowed_api_key_hashes",
"allowed_models",
"allowed_user_ids",
"name",
]
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,96 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
BYOKProviderSlug = Union[
Literal[
"ai21",
"aion-labs",
"akashml",
"alibaba",
"amazon-bedrock",
"amazon-nova",
"ambient",
"anthropic",
"arcee-ai",
"atlas-cloud",
"avian",
"azure",
"baidu",
"baseten",
"black-forest-labs",
"byteplus",
"cerebras",
"chutes",
"cirrascale",
"clarifai",
"cloudflare",
"cohere",
"crusoe",
"darkbloom",
"decart",
"deepinfra",
"deepseek",
"dekallm",
"digitalocean",
"featherless",
"fireworks",
"friendli",
"gmicloud",
"google-ai-studio",
"google-vertex",
"groq",
"inception",
"inceptron",
"inference-net",
"infermatic",
"inflection",
"io-net",
"ionstream",
"liquid",
"mancer",
"mara",
"minimax",
"mistral",
"modelrun",
"modular",
"moonshotai",
"morph",
"ncompass",
"nebius",
"nex-agi",
"nextbit",
"novita",
"nvidia",
"open-inference",
"openai",
"parasail",
"perceptron",
"perplexity",
"phala",
"poolside",
"recraft",
"reka",
"relace",
"sambanova",
"seed",
"siliconflow",
"sourceful",
"stepfun",
"streamlake",
"switchpoint",
"together",
"upstage",
"venice",
"wafer",
"wandb",
"xai",
"xiaomi",
"z-ai",
],
UnrecognizedStr,
]
r"""The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)."""
@@ -1,6 +1,11 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .advisorservertool_openrouter import (
AdvisorServerToolOpenRouter,
AdvisorServerToolOpenRouterTypedDict,
)
from .bashservertool import BashServerTool, BashServerToolTypedDict
from .chatcontentcachecontrol import (
ChatContentCacheControl,
ChatContentCacheControlTypedDict,
@@ -22,6 +27,7 @@ from .openrouterwebsearchservertool import (
OpenRouterWebSearchServerTool,
OpenRouterWebSearchServerToolTypedDict,
)
from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict
from openrouter.types import (
BaseModel,
Nullable,
@@ -118,9 +124,12 @@ class ChatFunctionToolFunction(BaseModel):
ChatFunctionToolTypedDict = TypeAliasType(
"ChatFunctionToolTypedDict",
Union[
AdvisorServerToolOpenRouterTypedDict,
BashServerToolTypedDict,
DatetimeServerToolTypedDict,
ImageGenerationServerToolOpenRouterTypedDict,
ChatSearchModelsServerToolTypedDict,
WebFetchServerToolTypedDict,
OpenRouterWebSearchServerToolTypedDict,
ChatFunctionToolFunctionTypedDict,
ChatWebSearchShorthandTypedDict,
@@ -132,6 +141,8 @@ r"""Tool definition for function calling (regular function or OpenRouter built-i
ChatFunctionTool = Annotated[
Union[
Annotated[ChatFunctionToolFunction, Tag("function")],
Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")],
Annotated[BashServerTool, Tag("openrouter:bash")],
Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
Annotated[
ImageGenerationServerToolOpenRouter, Tag("openrouter:image_generation")
@@ -139,6 +150,7 @@ ChatFunctionTool = Annotated[
Annotated[
ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models")
],
Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")],
Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")],
Annotated[ChatWebSearchShorthand, Tag("web_search")],
Annotated[ChatWebSearchShorthand, Tag("web_search_preview")],
+31 -10
View File
@@ -34,11 +34,18 @@ from .formatjsonobjectconfig import (
FormatJSONObjectConfig,
FormatJSONObjectConfigTypedDict,
)
from .fusionplugin import FusionPlugin, FusionPluginTypedDict
from .imageconfig import ImageConfig, ImageConfigTypedDict
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
from .paretorouterplugin import ParetoRouterPlugin, ParetoRouterPluginTypedDict
from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict
from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict
from .stopservertoolswhencondition import (
StopServerToolsWhenCondition,
StopServerToolsWhenConditionTypedDict,
)
from .traceconfig import TraceConfig, TraceConfigTypedDict
from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict
from .websearchplugin import WebSearchPlugin, WebSearchPluginTypedDict
from openrouter.types import (
BaseModel,
@@ -70,9 +77,12 @@ ChatRequestPluginTypedDict = TypeAliasType(
Union[
ModerationPluginTypedDict,
ResponseHealingPluginTypedDict,
AutoRouterPluginTypedDict,
FileParserPluginTypedDict,
ContextCompressionPluginTypedDict,
ParetoRouterPluginTypedDict,
AutoRouterPluginTypedDict,
WebFetchPluginTypedDict,
FusionPluginTypedDict,
WebSearchPluginTypedDict,
],
)
@@ -83,15 +93,18 @@ ChatRequestPlugin = Annotated[
Annotated[AutoRouterPlugin, Tag("auto-router")],
Annotated[ContextCompressionPlugin, Tag("context-compression")],
Annotated[FileParserPlugin, Tag("file-parser")],
Annotated[FusionPlugin, Tag("fusion")],
Annotated[ModerationPlugin, Tag("moderation")],
Annotated[ParetoRouterPlugin, Tag("pareto-router")],
Annotated[ResponseHealingPlugin, Tag("response-healing")],
Annotated[WebSearchPlugin, Tag("web")],
Annotated[WebFetchPlugin, Tag("web-fetch")],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
Effort = Union[
ChatRequestEffort = Union[
Literal[
"xhigh",
"high",
@@ -105,19 +118,19 @@ Effort = Union[
r"""Constrains effort on reasoning for reasoning models"""
class ReasoningTypedDict(TypedDict):
class ChatRequestReasoningTypedDict(TypedDict):
r"""Configuration options for reasoning models"""
effort: NotRequired[Nullable[Effort]]
effort: NotRequired[Nullable[ChatRequestEffort]]
r"""Constrains effort on reasoning for reasoning models"""
summary: NotRequired[Nullable[ChatReasoningSummaryVerbosityEnum]]
class Reasoning(BaseModel):
class ChatRequestReasoning(BaseModel):
r"""Configuration options for reasoning models"""
effort: Annotated[
OptionalNullable[Effort], PlainValidator(validate_open_enum(False))
OptionalNullable[ChatRequestEffort], PlainValidator(validate_open_enum(False))
] = UNSET
r"""Constrains effort on reasoning for reasoning models"""
@@ -210,6 +223,7 @@ class ChatRequestTypedDict(TypedDict):
messages: List[ChatMessagesTypedDict]
r"""List of messages for the conversation"""
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]]
@@ -240,7 +254,7 @@ class ChatRequestTypedDict(TypedDict):
r"""Presence penalty (-2.0 to 2.0)"""
provider: NotRequired[Nullable[ProviderPreferencesTypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference."""
reasoning: NotRequired[ReasoningTypedDict]
reasoning: NotRequired[ChatRequestReasoningTypedDict]
r"""Configuration options for reasoning models"""
response_format: NotRequired[ResponseFormatTypedDict]
r"""Response format configuration"""
@@ -249,9 +263,11 @@ class ChatRequestTypedDict(TypedDict):
service_tier: NotRequired[Nullable[ChatRequestServiceTier]]
r"""The service tier to use for processing this request."""
session_id: NotRequired[str]
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters."""
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters."""
stop: NotRequired[Nullable[StopTypedDict]]
r"""Stop sequences (up to 4)"""
stop_server_tools_when: NotRequired[List[StopServerToolsWhenConditionTypedDict]]
r"""Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`."""
stream: NotRequired[bool]
r"""Enable streaming response"""
stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]]
@@ -279,6 +295,7 @@ class ChatRequest(BaseModel):
r"""List of messages for the conversation"""
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)"""
@@ -327,7 +344,7 @@ class ChatRequest(BaseModel):
provider: OptionalNullable[ProviderPreferences] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference."""
reasoning: Optional[Reasoning] = None
reasoning: Optional[ChatRequestReasoning] = None
r"""Configuration options for reasoning models"""
response_format: Optional[ResponseFormat] = None
@@ -343,11 +360,14 @@ class ChatRequest(BaseModel):
r"""The service tier to use for processing this request."""
session_id: Optional[str] = None
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters."""
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters."""
stop: OptionalNullable[Stop] = UNSET
r"""Stop sequences (up to 4)"""
stop_server_tools_when: Optional[List[StopServerToolsWhenCondition]] = None
r"""Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`."""
stream: Optional[bool] = False
r"""Enable streaming response"""
@@ -400,6 +420,7 @@ class ChatRequest(BaseModel):
"service_tier",
"session_id",
"stop",
"stop_server_tools_when",
"stream",
"stream_options",
"temperature",
+5 -1
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
from .chatchoice import ChatChoice, ChatChoiceTypedDict
from .chatusage import ChatUsage, ChatUsageTypedDict
from .openroutermetadata import OpenRouterMetadata, OpenRouterMetadataTypedDict
from openrouter.types import (
BaseModel,
Nullable,
@@ -32,6 +33,7 @@ class ChatResultTypedDict(TypedDict):
object: ChatResultObject
system_fingerprint: Nullable[str]
r"""System fingerprint"""
openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict]
service_tier: NotRequired[Nullable[str]]
r"""The service tier used by the upstream provider for this request"""
usage: NotRequired[ChatUsageTypedDict]
@@ -58,6 +60,8 @@ class ChatResult(BaseModel):
system_fingerprint: Nullable[str]
r"""System fingerprint"""
openrouter_metadata: Optional[OpenRouterMetadata] = None
service_tier: OptionalNullable[str] = UNSET
r"""The service tier used by the upstream provider for this request"""
@@ -66,7 +70,7 @@ class ChatResult(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["service_tier", "usage"]
optional_fields = ["openrouter_metadata", "service_tier", "usage"]
nullable_fields = ["service_tier", "system_fingerprint"]
null_default_fields = []
@@ -0,0 +1,19 @@
"""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 ChatServerToolChoiceTypedDict(TypedDict):
r"""OpenRouter extension: force a specific server tool by naming it directly in `tool_choice.type` instead of wrapping it in `{ type: \"function\", function: { name } }`."""
type: str
r"""OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`)."""
class ChatServerToolChoice(BaseModel):
r"""OpenRouter extension: force a specific server tool by naming it directly in `tool_choice.type` instead of wrapping it in `{ type: \"function\", function: { name } }`."""
type: str
r"""OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`)."""
+11 -1
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
from .chatstreamchoice import ChatStreamChoice, ChatStreamChoiceTypedDict
from .chatusage import ChatUsage, ChatUsageTypedDict
from .openroutermetadata import OpenRouterMetadata, OpenRouterMetadataTypedDict
from openrouter.types import (
BaseModel,
Nullable,
@@ -51,6 +52,7 @@ class ChatStreamChunkTypedDict(TypedDict):
object: ChatStreamChunkObject
error: NotRequired[ErrorTypedDict]
r"""Error information"""
openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict]
service_tier: NotRequired[Nullable[str]]
r"""The service tier used by the upstream provider for this request"""
system_fingerprint: NotRequired[str]
@@ -79,6 +81,8 @@ class ChatStreamChunk(BaseModel):
error: Optional[Error] = None
r"""Error information"""
openrouter_metadata: Optional[OpenRouterMetadata] = None
service_tier: OptionalNullable[str] = UNSET
r"""The service tier used by the upstream provider for this request"""
@@ -90,7 +94,13 @@ class ChatStreamChunk(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["error", "service_tier", "system_fingerprint", "usage"]
optional_fields = [
"error",
"openrouter_metadata",
"service_tier",
"system_fingerprint",
"usage",
]
nullable_fields = ["service_tier"]
null_default_fields = []
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatstreamchunk import ChatStreamChunk, ChatStreamChunkTypedDict
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class ChatStreamingResponseTypedDict(TypedDict):
data: ChatStreamChunkTypedDict
r"""Streaming chat completion chunk"""
class ChatStreamingResponse(BaseModel):
data: ChatStreamChunk
r"""Streaming chat completion chunk"""
@@ -2,6 +2,7 @@
from __future__ import annotations
from .chatnamedtoolchoice import ChatNamedToolChoice, ChatNamedToolChoiceTypedDict
from .chatservertoolchoice import ChatServerToolChoice, ChatServerToolChoiceTypedDict
from typing import Literal, Union
from typing_extensions import TypeAliasType
@@ -18,6 +19,7 @@ ChatToolChoiceNone = Literal["none",]
ChatToolChoiceTypedDict = TypeAliasType(
"ChatToolChoiceTypedDict",
Union[
ChatServerToolChoiceTypedDict,
ChatNamedToolChoiceTypedDict,
ChatToolChoiceNone,
ChatToolChoiceAuto,
@@ -30,6 +32,7 @@ r"""Tool choice configuration"""
ChatToolChoice = TypeAliasType(
"ChatToolChoice",
Union[
ChatServerToolChoice,
ChatNamedToolChoice,
ChatToolChoiceNone,
ChatToolChoiceAuto,
+29 -2
View File
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .costdetails import CostDetails, CostDetailsTypedDict
from openrouter.types import (
BaseModel,
Nullable,
@@ -122,6 +123,12 @@ class ChatUsageTypedDict(TypedDict):
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"""
@@ -141,13 +148,33 @@ class ChatUsage(BaseModel):
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"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["completion_tokens_details", "prompt_tokens_details"]
nullable_fields = ["completion_tokens_details", "prompt_tokens_details"]
optional_fields = [
"completion_tokens_details",
"cost",
"cost_details",
"is_byok",
"prompt_tokens_details",
]
nullable_fields = [
"completion_tokens_details",
"cost",
"cost_details",
"prompt_tokens_details",
]
null_default_fields = []
serialized = handler(self)
@@ -31,18 +31,20 @@ class ChatWebSearchShorthandTypedDict(TypedDict):
type: ChatWebSearchShorthandType
allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Firecrawl or Perplexity."""
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
engine: NotRequired[WebSearchEngineEnum]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with Firecrawl, OpenAI (silently ignored), or Perplexity."""
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
max_characters: NotRequired[int]
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
max_results: NotRequired[int]
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
max_total_results: NotRequired[int]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
parameters: NotRequired[WebSearchConfigTypedDict]
search_context_size: NotRequired[SearchQualityLevel]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
r"""Approximate user location for location-biased results."""
@@ -55,7 +57,7 @@ class ChatWebSearchShorthand(BaseModel):
]
allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Firecrawl or Perplexity."""
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
engine: Annotated[
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
@@ -63,20 +65,23 @@ class ChatWebSearchShorthand(BaseModel):
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with Firecrawl, OpenAI (silently ignored), or Perplexity."""
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
max_characters: Optional[int] = None
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
max_results: Optional[int] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
max_total_results: Optional[int] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
parameters: Optional[WebSearchConfig] = None
search_context_size: Annotated[
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
] = None
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,0004,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
user_location: Optional[WebSearchUserLocationServerTool] = None
r"""Approximate user location for location-biased results."""
@@ -0,0 +1,64 @@
"""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
CompactionItemType = Literal["compaction",]
class CompactionItemTypedDict(TypedDict):
r"""A context compaction marker with encrypted summary"""
encrypted_content: str
type: CompactionItemType
id: NotRequired[Nullable[str]]
class CompactionItem(BaseModel):
r"""A context compaction marker with encrypted summary"""
encrypted_content: str
type: CompactionItemType
id: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id"]
nullable_fields = ["id"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -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
ContainerAutoEnvironmentType = Literal["container_auto",]
class ContainerAutoEnvironmentTypedDict(TypedDict):
r"""An OpenRouter-managed, auto-provisioned ephemeral container."""
type: ContainerAutoEnvironmentType
class ContainerAutoEnvironment(BaseModel):
r"""An OpenRouter-managed, auto-provisioned ephemeral container."""
type: ContainerAutoEnvironmentType
@@ -0,0 +1,26 @@
"""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
ContainerReferenceEnvironmentType = Literal["container_reference",]
class ContainerReferenceEnvironmentTypedDict(TypedDict):
r"""Reference to a previously created container to reuse."""
container_id: str
r"""Identifier of an existing container to reuse (max 20 characters)."""
type: ContainerReferenceEnvironmentType
class ContainerReferenceEnvironment(BaseModel):
r"""Reference to a previously created container to reuse."""
container_id: str
r"""Identifier of an existing container to reuse (max 20 characters)."""
type: ContainerReferenceEnvironmentType
@@ -0,0 +1,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ContentFilterAction = Union[
Literal[
"redact",
"block",
],
UnrecognizedStr,
]
r"""Action taken when the pattern matches"""
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ContentFilterBuiltinAction = Union[
Literal[
"redact",
"block",
"flag",
],
UnrecognizedStr,
]
r"""Action taken when the builtin filter triggers"""
@@ -0,0 +1,44 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .contentfilterbuiltinaction import ContentFilterBuiltinAction
from .contentfilterbuiltinslug import ContentFilterBuiltinSlug
from .promptinjectionscanscope import PromptInjectionScanScope
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ContentFilterBuiltinEntryTypedDict(TypedDict):
r"""A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector."""
action: ContentFilterBuiltinAction
r"""Action taken when the builtin filter triggers"""
slug: ContentFilterBuiltinSlug
r"""The builtin filter identifier"""
label: NotRequired[str]
r"""Read-only, system-assigned redaction placeholder derived from the slug (e.g. \"[EMAIL]\", \"[PHONE]\"). Not settable by the caller."""
scan_scope: NotRequired[PromptInjectionScanScope]
r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""
class ContentFilterBuiltinEntry(BaseModel):
r"""A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector."""
action: Annotated[
ContentFilterBuiltinAction, PlainValidator(validate_open_enum(False))
]
r"""Action taken when the builtin filter triggers"""
slug: Annotated[ContentFilterBuiltinSlug, PlainValidator(validate_open_enum(False))]
r"""The builtin filter identifier"""
label: Optional[str] = None
r"""Read-only, system-assigned redaction placeholder derived from the slug (e.g. \"[EMAIL]\", \"[PHONE]\"). Not settable by the caller."""
scan_scope: Annotated[
Optional[PromptInjectionScanScope], PlainValidator(validate_open_enum(False))
] = None
r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""
@@ -0,0 +1,50 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .contentfilterbuiltinaction import ContentFilterBuiltinAction
from .contentfilterbuiltinslug import ContentFilterBuiltinSlug
from .promptinjectionscanscope import PromptInjectionScanScope
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
import pydantic
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ContentFilterBuiltinEntryInputTypedDict(TypedDict):
r"""A builtin content filter entry for create/update requests. Labels are system-assigned and cannot be set by the caller."""
action: ContentFilterBuiltinAction
r"""Action taken when the builtin filter triggers"""
slug: ContentFilterBuiltinSlug
r"""The builtin filter identifier"""
label: NotRequired[str]
r"""Deprecated: labels are system-assigned and cannot be set by the caller. Accepted for backward compatibility but silently ignored."""
scan_scope: NotRequired[PromptInjectionScanScope]
r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""
class ContentFilterBuiltinEntryInput(BaseModel):
r"""A builtin content filter entry for create/update requests. Labels are system-assigned and cannot be set by the caller."""
action: Annotated[
ContentFilterBuiltinAction, PlainValidator(validate_open_enum(False))
]
r"""Action taken when the builtin filter triggers"""
slug: Annotated[ContentFilterBuiltinSlug, PlainValidator(validate_open_enum(False))]
r"""The builtin filter identifier"""
label: Annotated[
Optional[str],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
),
] = None
r"""Deprecated: labels are system-assigned and cannot be set by the caller. Accepted for backward compatibility but silently ignored."""
scan_scope: Annotated[
Optional[PromptInjectionScanScope], PlainValidator(validate_open_enum(False))
] = None
r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ContentFilterBuiltinSlug = Union[
Literal[
"email",
"phone",
"ssn",
"credit-card",
"ip-address",
"person-name",
"address",
"regex-prompt-injection",
],
UnrecognizedStr,
]
r"""The builtin filter identifier"""
@@ -0,0 +1,69 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .contentfilteraction import ContentFilterAction
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing_extensions import Annotated, NotRequired, TypedDict
class ContentFilterEntryTypedDict(TypedDict):
r"""A custom regex content filter that scans request messages for matching patterns."""
action: ContentFilterAction
r"""Action taken when the pattern matches"""
pattern: str
r"""A regex pattern to match against request content"""
label: NotRequired[Nullable[str]]
r"""Optional label used in redaction placeholders or error messages"""
class ContentFilterEntry(BaseModel):
r"""A custom regex content filter that scans request messages for matching patterns."""
action: Annotated[ContentFilterAction, PlainValidator(validate_open_enum(False))]
r"""Action taken when the pattern matches"""
pattern: str
r"""A regex pattern to match against request content"""
label: OptionalNullable[str] = UNSET
r"""Optional label used in redaction placeholders or error messages"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["label"]
nullable_fields = ["label"]
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,28 @@
"""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
class AudioURLTypedDict(TypedDict):
url: str
class AudioURL(BaseModel):
url: str
ContentPartAudioType = Literal["audio_url",]
class ContentPartAudioTypedDict(TypedDict):
audio_url: AudioURLTypedDict
type: ContentPartAudioType
class ContentPartAudio(BaseModel):
audio_url: AudioURL
type: ContentPartAudioType
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .multimodalmedia import MultimodalMedia, MultimodalMediaTypedDict
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
ContentPartInputAudioType = Literal["input_audio",]
class ContentPartInputAudioTypedDict(TypedDict):
input_audio: MultimodalMediaTypedDict
type: ContentPartInputAudioType
class ContentPartInputAudio(BaseModel):
input_audio: MultimodalMedia
type: ContentPartInputAudioType
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .multimodalmedia import MultimodalMedia, MultimodalMediaTypedDict
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
ContentPartInputFileType = Literal["input_file",]
class ContentPartInputFileTypedDict(TypedDict):
input_file: MultimodalMediaTypedDict
type: ContentPartInputFileType
class ContentPartInputFile(BaseModel):
input_file: MultimodalMedia
type: ContentPartInputFileType
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .multimodalmedia import MultimodalMedia, MultimodalMediaTypedDict
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
ContentPartInputVideoType = Literal["input_video",]
class ContentPartInputVideoTypedDict(TypedDict):
input_video: MultimodalMediaTypedDict
type: ContentPartInputVideoType
class ContentPartInputVideo(BaseModel):
input_video: MultimodalMedia
type: ContentPartInputVideoType
@@ -0,0 +1,28 @@
"""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
ContentPartVideoType = Literal["video_url",]
class VideoURLTypedDict(TypedDict):
url: str
class VideoURL(BaseModel):
url: str
class ContentPartVideoTypedDict(TypedDict):
type: ContentPartVideoType
video_url: VideoURLTypedDict
class ContentPartVideo(BaseModel):
type: ContentPartVideoType
video_url: VideoURL
+60
View File
@@ -0,0 +1,60 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing_extensions import NotRequired, TypedDict
class CostDetailsTypedDict(TypedDict):
r"""Breakdown of upstream inference costs"""
upstream_inference_completions_cost: float
upstream_inference_prompt_cost: float
upstream_inference_cost: NotRequired[Nullable[float]]
class CostDetails(BaseModel):
r"""Breakdown of upstream inference costs"""
upstream_inference_completions_cost: float
upstream_inference_prompt_cost: float
upstream_inference_cost: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["upstream_inference_cost"]
nullable_fields = ["upstream_inference_cost"]
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,98 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .byokproviderslug import BYOKProviderSlug
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 CreateBYOKKeyRequestTypedDict(TypedDict):
key: str
r"""The raw provider API key or credential. This value is encrypted at rest and never returned in API responses."""
provider: BYOKProviderSlug
r"""The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)."""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction."""
allowed_user_ids: NotRequired[Nullable[List[str]]]
r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction."""
disabled: NotRequired[bool]
r"""Whether this credential should be created in a disabled state."""
is_fallback: NotRequired[bool]
r"""Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried."""
name: NotRequired[Nullable[str]]
r"""Optional human-readable name for the credential."""
workspace_id: NotRequired[str]
r"""Optional workspace ID. Defaults to the authenticated entity's default workspace."""
class CreateBYOKKeyRequest(BaseModel):
key: str
r"""The raw provider API key or credential. This value is encrypted at rest and never returned in API responses."""
provider: Annotated[BYOKProviderSlug, PlainValidator(validate_open_enum(False))]
r"""The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)."""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Optional allowlist of model slugs this credential may be used for. `null` means no restriction."""
allowed_user_ids: OptionalNullable[List[str]] = UNSET
r"""Optional allowlist of user IDs that may use this credential. `null` means no restriction."""
disabled: Optional[bool] = None
r"""Whether this credential should be created in a disabled state."""
is_fallback: Optional[bool] = None
r"""Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried."""
name: OptionalNullable[str] = UNSET
r"""Optional human-readable name for the credential."""
workspace_id: Optional[str] = None
r"""Optional workspace ID. Defaults to the authenticated entity's default workspace."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"allowed_models",
"allowed_user_ids",
"disabled",
"is_fallback",
"name",
"workspace_id",
]
nullable_fields = ["allowed_models", "allowed_user_ids", "name"]
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 .byokkey import BYOKKey, BYOKKeyTypedDict
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class CreateBYOKKeyResponseTypedDict(TypedDict):
data: BYOKKeyTypedDict
class CreateBYOKKeyResponse(BaseModel):
data: BYOKKey
@@ -1,6 +1,11 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .contentfilterbuiltinentryinput import (
ContentFilterBuiltinEntryInput,
ContentFilterBuiltinEntryInputTypedDict,
)
from .contentfilterentry import ContentFilterEntry, ContentFilterEntryTypedDict
from .guardrailinterval import GuardrailInterval
from openrouter.types import (
BaseModel,
@@ -10,9 +15,10 @@ from openrouter.types import (
UNSET_SENTINEL,
)
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -23,10 +29,24 @@ class CreateGuardrailRequestTypedDict(TypedDict):
r"""Array of model identifiers (slug or canonical_slug accepted)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
content_filter_builtins: NotRequired[
Nullable[List[ContentFilterBuiltinEntryInputTypedDict]]
]
r"""Builtin content filters to apply. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only."""
content_filters: NotRequired[Nullable[List[ContentFilterEntryTypedDict]]]
r"""Custom regex content filters to apply to request messages"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request."""
enforce_zdr_anthropic: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided."""
enforce_zdr_google: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided."""
enforce_zdr_openai: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided."""
enforce_zdr_other: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided."""
ignored_models: NotRequired[Nullable[List[str]]]
r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)"""
ignored_providers: NotRequired[Nullable[List[str]]]
@@ -35,6 +55,8 @@ class CreateGuardrailRequestTypedDict(TypedDict):
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[GuardrailInterval]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
workspace_id: NotRequired[str]
r"""The workspace to create the guardrail in. Defaults to the default workspace if not provided."""
class CreateGuardrailRequest(BaseModel):
@@ -47,11 +69,36 @@ class CreateGuardrailRequest(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
content_filter_builtins: OptionalNullable[List[ContentFilterBuiltinEntryInput]] = (
UNSET
)
r"""Builtin content filters to apply. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only."""
content_filters: OptionalNullable[List[ContentFilterEntry]] = UNSET
r"""Custom regex content filters to apply to request messages"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
enforce_zdr: Annotated[
OptionalNullable[bool],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
),
] = UNSET
r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request."""
enforce_zdr_anthropic: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided."""
enforce_zdr_google: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided."""
enforce_zdr_openai: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided."""
enforce_zdr_other: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided."""
ignored_models: OptionalNullable[List[str]] = UNSET
r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)"""
@@ -67,23 +114,39 @@ class CreateGuardrailRequest(BaseModel):
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
workspace_id: Optional[str] = None
r"""The workspace to create the guardrail in. Defaults to the default workspace if not provided."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"allowed_models",
"allowed_providers",
"content_filter_builtins",
"content_filters",
"description",
"enforce_zdr",
"enforce_zdr_anthropic",
"enforce_zdr_google",
"enforce_zdr_openai",
"enforce_zdr_other",
"ignored_models",
"ignored_providers",
"limit_usd",
"reset_interval",
"workspace_id",
]
nullable_fields = [
"allowed_models",
"allowed_providers",
"content_filter_builtins",
"content_filters",
"description",
"enforce_zdr",
"enforce_zdr_anthropic",
"enforce_zdr_google",
"enforce_zdr_openai",
"enforce_zdr_other",
"ignored_models",
"ignored_providers",
"limit_usd",
@@ -0,0 +1,135 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .observabilityfilterrulesconfig import (
ObservabilityFilterRulesConfig,
ObservabilityFilterRulesConfigTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
CreateObservabilityDestinationRequestType = Union[
Literal[
"arize",
"braintrust",
"clickhouse",
"datadog",
"grafana",
"langfuse",
"langsmith",
"newrelic",
"opik",
"otel-collector",
"posthog",
"ramp",
"s3",
"sentry",
"snowflake",
"weave",
"webhook",
],
UnrecognizedStr,
]
r"""The destination type. Only stable destination types are accepted."""
class CreateObservabilityDestinationRequestTypedDict(TypedDict):
config: Dict[str, Nullable[Any]]
r"""Provider-specific configuration. The shape depends on `type` and is validated server-side."""
name: str
r"""Human-readable name for the destination."""
type: CreateObservabilityDestinationRequestType
r"""The destination type. Only stable destination types are accepted."""
api_key_hashes: NotRequired[Nullable[List[str]]]
r"""Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided."""
enabled: NotRequired[bool]
r"""Whether this destination should be enabled immediately."""
filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigTypedDict]]
r"""Optional structured filter rules controlling which events are forwarded."""
privacy_mode: NotRequired[bool]
r"""When true, request/response bodies are not forwarded — only metadata."""
sampling_rate: NotRequired[float]
r"""Sampling rate between 0.0001 and 1 (1 = 100%)."""
workspace_id: NotRequired[str]
r"""Optional workspace ID. Defaults to the authenticated entity's default workspace."""
class CreateObservabilityDestinationRequest(BaseModel):
config: Dict[str, Nullable[Any]]
r"""Provider-specific configuration. The shape depends on `type` and is validated server-side."""
name: str
r"""Human-readable name for the destination."""
type: Annotated[
CreateObservabilityDestinationRequestType,
PlainValidator(validate_open_enum(False)),
]
r"""The destination type. Only stable destination types are accepted."""
api_key_hashes: OptionalNullable[List[str]] = UNSET
r"""Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided."""
enabled: Optional[bool] = True
r"""Whether this destination should be enabled immediately."""
filter_rules: OptionalNullable[ObservabilityFilterRulesConfig] = UNSET
r"""Optional structured filter rules controlling which events are forwarded."""
privacy_mode: Optional[bool] = False
r"""When true, request/response bodies are not forwarded — only metadata."""
sampling_rate: Optional[float] = None
r"""Sampling rate between 0.0001 and 1 (1 = 100%)."""
workspace_id: Optional[str] = None
r"""Optional workspace ID. Defaults to the authenticated entity's default workspace."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"api_key_hashes",
"enabled",
"filter_rules",
"privacy_mode",
"sampling_rate",
"workspace_id",
]
nullable_fields = ["api_key_hashes", "filter_rules"]
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 .observabilitydestination import (
ObservabilityDestination,
ObservabilityDestinationTypedDict,
)
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class CreateObservabilityDestinationResponseTypedDict(TypedDict):
data: ObservabilityDestinationTypedDict
class CreateObservabilityDestinationResponse(BaseModel):
data: ObservabilityDestination
@@ -0,0 +1,23 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .presetwithdesignatedversion import (
PresetWithDesignatedVersion,
PresetWithDesignatedVersionTypedDict,
)
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class CreatePresetFromInferenceResponseTypedDict(TypedDict):
r"""Response containing the created preset with its designated version."""
data: PresetWithDesignatedVersionTypedDict
r"""A preset with its currently designated version."""
class CreatePresetFromInferenceResponse(BaseModel):
r"""Response containing the created preset with its designated version."""
data: PresetWithDesignatedVersion
r"""A preset with its currently designated version."""
@@ -0,0 +1,119 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class CreateWorkspaceRequestTypedDict(TypedDict):
name: str
r"""Name for the new workspace"""
slug: str
r"""URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)"""
default_image_model: NotRequired[Nullable[str]]
r"""Default image model for this workspace"""
default_provider_sort: NotRequired[Nullable[str]]
r"""Default provider sort preference (price, throughput, latency, exacto)"""
default_text_model: NotRequired[Nullable[str]]
r"""Default text model for this workspace"""
description: NotRequired[Nullable[str]]
r"""Description of the workspace"""
io_logging_api_key_ids: NotRequired[Nullable[List[int]]]
r"""Optional array of API key IDs to filter I/O logging"""
io_logging_sampling_rate: NotRequired[float]
r"""Sampling rate for I/O logging (0.0001-1)"""
is_data_discount_logging_enabled: NotRequired[bool]
r"""Whether data discount logging is enabled"""
is_observability_broadcast_enabled: NotRequired[bool]
r"""Whether broadcast is enabled"""
is_observability_io_logging_enabled: NotRequired[bool]
r"""Whether private logging is enabled"""
class CreateWorkspaceRequest(BaseModel):
name: str
r"""Name for the new workspace"""
slug: str
r"""URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)"""
default_image_model: OptionalNullable[str] = UNSET
r"""Default image model for this workspace"""
default_provider_sort: OptionalNullable[str] = UNSET
r"""Default provider sort preference (price, throughput, latency, exacto)"""
default_text_model: OptionalNullable[str] = UNSET
r"""Default text model for this workspace"""
description: OptionalNullable[str] = UNSET
r"""Description of the workspace"""
io_logging_api_key_ids: OptionalNullable[List[int]] = UNSET
r"""Optional array of API key IDs to filter I/O logging"""
io_logging_sampling_rate: Optional[float] = None
r"""Sampling rate for I/O logging (0.0001-1)"""
is_data_discount_logging_enabled: Optional[bool] = None
r"""Whether data discount logging is enabled"""
is_observability_broadcast_enabled: Optional[bool] = None
r"""Whether broadcast is enabled"""
is_observability_io_logging_enabled: Optional[bool] = None
r"""Whether private logging is enabled"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"default_image_model",
"default_provider_sort",
"default_text_model",
"description",
"io_logging_api_key_ids",
"io_logging_sampling_rate",
"is_data_discount_logging_enabled",
"is_observability_broadcast_enabled",
"is_observability_io_logging_enabled",
]
nullable_fields = [
"default_image_model",
"default_provider_sort",
"default_text_model",
"description",
"io_logging_api_key_ids",
]
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 .workspace import Workspace, WorkspaceTypedDict
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class CreateWorkspaceResponseTypedDict(TypedDict):
data: WorkspaceTypedDict
class CreateWorkspaceResponse(BaseModel):
data: Workspace
+3 -3
View File
@@ -58,14 +58,14 @@ Format = Annotated[
]
TypeCustom = Literal["custom",]
CustomToolTypeCustom = Literal["custom",]
class CustomToolTypedDict(TypedDict):
r"""Custom tool configuration"""
name: str
type: TypeCustom
type: CustomToolTypeCustom
description: NotRequired[str]
format_: NotRequired[FormatTypedDict]
@@ -75,7 +75,7 @@ class CustomTool(BaseModel):
name: str
type: TypeCustom
type: CustomToolTypeCustom
description: Optional[str] = None
@@ -0,0 +1,33 @@
"""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
CustomToolCallInputDeltaEventType = Literal["response.custom_tool_call_input.delta",]
class CustomToolCallInputDeltaEventTypedDict(TypedDict):
r"""Event emitted when a custom tool call's freeform input is being streamed. Mirrors `response.function_call_arguments.delta` but for `custom` tools whose input is opaque text rather than JSON arguments."""
delta: str
item_id: str
output_index: int
sequence_number: int
type: CustomToolCallInputDeltaEventType
class CustomToolCallInputDeltaEvent(BaseModel):
r"""Event emitted when a custom tool call's freeform input is being streamed. Mirrors `response.function_call_arguments.delta` but for `custom` tools whose input is opaque text rather than JSON arguments."""
delta: str
item_id: str
output_index: int
sequence_number: int
type: CustomToolCallInputDeltaEventType
@@ -0,0 +1,33 @@
"""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
CustomToolCallInputDoneEventType = Literal["response.custom_tool_call_input.done",]
class CustomToolCallInputDoneEventTypedDict(TypedDict):
r"""Event emitted when a custom tool call's freeform input streaming is complete. Mirrors `response.function_call_arguments.done` but for `custom` tools."""
input: str
item_id: str
output_index: int
sequence_number: int
type: CustomToolCallInputDoneEventType
class CustomToolCallInputDoneEvent(BaseModel):
r"""Event emitted when a custom tool call's freeform input streaming is complete. Mirrors `response.function_call_arguments.done` but for `custom` tools."""
input: str
item_id: str
output_index: int
sequence_number: int
type: CustomToolCallInputDoneEventType
@@ -0,0 +1,38 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
CustomToolCallItemType = Literal["custom_tool_call",]
class CustomToolCallItemTypedDict(TypedDict):
r"""A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments."""
call_id: str
input: str
name: str
type: CustomToolCallItemType
id: NotRequired[str]
namespace: NotRequired[str]
r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)"""
class CustomToolCallItem(BaseModel):
r"""A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments."""
call_id: str
input: str
name: str
type: CustomToolCallItemType
id: Optional[str] = None
namespace: Optional[str] = None
r"""Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)"""
@@ -0,0 +1,138 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .inputfile import InputFile, InputFileTypedDict
from .inputtext import InputText, InputTextTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
CustomToolCallOutputItemDetail = Union[
Literal[
"auto",
"high",
"low",
"original",
],
UnrecognizedStr,
]
CustomToolCallOutputItemTypeInputImage = Literal["input_image",]
class CustomToolCallOutputItemOutputInputImageTypedDict(TypedDict):
r"""Image input content item"""
detail: CustomToolCallOutputItemDetail
type: CustomToolCallOutputItemTypeInputImage
image_url: NotRequired[Nullable[str]]
class CustomToolCallOutputItemOutputInputImage(BaseModel):
r"""Image input content item"""
detail: Annotated[
CustomToolCallOutputItemDetail, PlainValidator(validate_open_enum(False))
]
type: CustomToolCallOutputItemTypeInputImage
image_url: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["image_url"]
nullable_fields = ["image_url"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
CustomToolCallOutputItemOutputUnion1TypedDict = TypeAliasType(
"CustomToolCallOutputItemOutputUnion1TypedDict",
Union[
InputTextTypedDict,
CustomToolCallOutputItemOutputInputImageTypedDict,
InputFileTypedDict,
],
)
CustomToolCallOutputItemOutputUnion1 = Annotated[
Union[
Annotated[InputText, Tag("input_text")],
Annotated[CustomToolCallOutputItemOutputInputImage, Tag("input_image")],
Annotated[InputFile, Tag("input_file")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
CustomToolCallOutputItemOutputUnion2TypedDict = TypeAliasType(
"CustomToolCallOutputItemOutputUnion2TypedDict",
Union[str, List[CustomToolCallOutputItemOutputUnion1TypedDict]],
)
CustomToolCallOutputItemOutputUnion2 = TypeAliasType(
"CustomToolCallOutputItemOutputUnion2",
Union[str, List[CustomToolCallOutputItemOutputUnion1]],
)
CustomToolCallOutputItemTypeCustomToolCallOutput = Literal["custom_tool_call_output",]
class CustomToolCallOutputItemTypedDict(TypedDict):
r"""The output from a custom (freeform-grammar) tool call execution. Mirrors `function_call_output` but is matched to a `custom_tool_call` rather than a `function_call`."""
call_id: str
output: CustomToolCallOutputItemOutputUnion2TypedDict
type: CustomToolCallOutputItemTypeCustomToolCallOutput
id: NotRequired[str]
class CustomToolCallOutputItem(BaseModel):
r"""The output from a custom (freeform-grammar) tool call execution. Mirrors `function_call_output` but is matched to a `custom_tool_call` rather than a `function_call`."""
call_id: str
output: CustomToolCallOutputItemOutputUnion2
type: CustomToolCallOutputItemTypeCustomToolCallOutput
id: Optional[str] = None
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class DeleteBYOKKeyResponseTypedDict(TypedDict):
deleted: Literal[True]
r"""Confirmation that the BYOK credential was deleted."""
class DeleteBYOKKeyResponse(BaseModel):
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Confirmation that the BYOK credential was deleted."""
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class DeleteObservabilityDestinationResponseTypedDict(TypedDict):
deleted: Literal[True]
r"""Always `true` on success."""
class DeleteObservabilityDestinationResponse(BaseModel):
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Always `true` on success."""
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
class DeleteWorkspaceResponseTypedDict(TypedDict):
deleted: Literal[True]
r"""Confirmation that the workspace was deleted"""
class DeleteWorkspaceResponse(BaseModel):
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Confirmation that the workspace was deleted"""
@@ -25,19 +25,20 @@ EasyInputMessageDetail = Union[
"auto",
"high",
"low",
"original",
],
UnrecognizedStr,
]
EasyInputMessageContentType = Literal["input_image",]
EasyInputMessageTypeInputImage = Literal["input_image",]
class EasyInputMessageContentInputImageTypedDict(TypedDict):
r"""Image input content item"""
detail: EasyInputMessageDetail
type: EasyInputMessageContentType
type: EasyInputMessageTypeInputImage
image_url: NotRequired[Nullable[str]]
@@ -46,7 +47,7 @@ class EasyInputMessageContentInputImage(BaseModel):
detail: Annotated[EasyInputMessageDetail, PlainValidator(validate_open_enum(False))]
type: EasyInputMessageContentType
type: EasyInputMessageTypeInputImage
image_url: OptionalNullable[str] = UNSET
+19
View File
@@ -0,0 +1,19 @@
"""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 EndpointInfoTypedDict(TypedDict):
model: str
provider: str
selected: bool
class EndpointInfo(BaseModel):
model: str
provider: str
selected: bool
@@ -0,0 +1,18 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .endpointinfo import EndpointInfo, EndpointInfoTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class EndpointsMetadataTypedDict(TypedDict):
available: List[EndpointInfoTypedDict]
total: int
class EndpointsMetadata(BaseModel):
available: List[EndpointInfo]
total: int
@@ -30,24 +30,32 @@ FiltersType = Union[
]
Value1TypedDict = TypeAliasType("Value1TypedDict", Union[str, float])
Value1 = TypeAliasType("Value1", Union[str, float])
Value2TypedDict = TypeAliasType(
"Value2TypedDict", Union[str, float, bool, List[Value1TypedDict]]
FileSearchServerToolValue1TypedDict = TypeAliasType(
"FileSearchServerToolValue1TypedDict", Union[str, float]
)
Value2 = TypeAliasType("Value2", Union[str, float, bool, List[Value1]])
FileSearchServerToolValue1 = TypeAliasType(
"FileSearchServerToolValue1", Union[str, float]
)
FileSearchServerToolValue2TypedDict = TypeAliasType(
"FileSearchServerToolValue2TypedDict",
Union[str, float, bool, List[FileSearchServerToolValue1TypedDict]],
)
FileSearchServerToolValue2 = TypeAliasType(
"FileSearchServerToolValue2",
Union[str, float, bool, List[FileSearchServerToolValue1]],
)
class FiltersTypedDict(TypedDict):
key: str
type: FiltersType
value: Value2TypedDict
value: FileSearchServerToolValue2TypedDict
class Filters(BaseModel):
@@ -55,7 +63,7 @@ class Filters(BaseModel):
type: Annotated[FiltersType, PlainValidator(validate_open_enum(False))]
value: Value2
value: FileSearchServerToolValue2
FiltersUnionTypedDict = TypeAliasType(

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