chore: 🐝 Update SDK - Generate (spec change merged) 0.11.32 (#452)

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-07-14 21:31:07 +00:00
committed by GitHub
co-authored by speakeasybot speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent f07b760c24
commit a3d8d7084d
55 changed files with 473 additions and 334 deletions
@@ -12,14 +12,14 @@ AnthropicCacheControlDirectiveType = Literal["ephemeral",]
class AnthropicCacheControlDirectiveTypedDict(TypedDict):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
type: AnthropicCacheControlDirectiveType
ttl: NotRequired[AnthropicCacheControlTTL]
class AnthropicCacheControlDirective(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
type: AnthropicCacheControlDirectiveType
@@ -135,7 +135,7 @@ 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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: NotRequired[Nullable[AnthropicDocumentBlockParamCitationsTypedDict]]
context: NotRequired[Nullable[str]]
title: NotRequired[Nullable[str]]
@@ -147,7 +147,7 @@ class AnthropicDocumentBlockParam(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: OptionalNullable[AnthropicDocumentBlockParamCitations] = UNSET
@@ -42,7 +42,7 @@ 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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
class AnthropicImageBlockParam(BaseModel):
@@ -51,7 +51,7 @@ class AnthropicImageBlockParam(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -48,7 +48,7 @@ class AnthropicSearchResultBlockParamTypedDict(TypedDict):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: NotRequired[AnthropicSearchResultBlockParamCitationsTypedDict]
@@ -62,7 +62,7 @@ class AnthropicSearchResultBlockParam(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: Optional[AnthropicSearchResultBlockParamCitations] = None
@@ -76,7 +76,7 @@ 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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: NotRequired[Nullable[List[CitationTypedDict]]]
@@ -86,7 +86,7 @@ class AnthropicTextBlockParam(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
citations: OptionalNullable[List[Citation]] = UNSET
@@ -12,14 +12,14 @@ ChatContentCacheControlType = Literal["ephemeral",]
class ChatContentCacheControlTypedDict(TypedDict):
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
type: ChatContentCacheControlType
ttl: NotRequired[AnthropicCacheControlTTL]
class ChatContentCacheControl(BaseModel):
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
type: ChatContentCacheControlType
+26 -5
View File
@@ -5,7 +5,14 @@ from .chatcontentcachecontrol import (
ChatContentCacheControl,
ChatContentCacheControlTypedDict,
)
from openrouter.types import BaseModel, UNSET_SENTINEL
from .promptcachebreakpoint import PromptCacheBreakpoint, PromptCacheBreakpointTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
@@ -20,7 +27,9 @@ class ChatContentTextTypedDict(TypedDict):
text: str
type: ChatContentTextType
cache_control: NotRequired[ChatContentCacheControlTypedDict]
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]]
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
class ChatContentText(BaseModel):
@@ -31,20 +40,32 @@ class ChatContentText(BaseModel):
type: ChatContentTextType
cache_control: Optional[ChatContentCacheControl] = None
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["cache_control"])
optional_fields = set(["cache_control", "prompt_cache_breakpoint"])
nullable_fields = set(["prompt_cache_breakpoint"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
is_nullable_and_explicitly_set = (
k in nullable_fields
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
)
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
if (
val is not None
or k not in optional_fields
or is_nullable_and_explicitly_set
):
m[k] = val
return m
@@ -111,7 +111,7 @@ class ChatFunctionToolFunctionTypedDict(TypedDict):
r"""Function definition for tool calling"""
type: ChatFunctionToolType
cache_control: NotRequired[ChatContentCacheControlTypedDict]
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
class ChatFunctionToolFunction(BaseModel):
@@ -121,7 +121,7 @@ class ChatFunctionToolFunction(BaseModel):
type: ChatFunctionToolType
cache_control: Optional[ChatContentCacheControl] = None
r"""Cache control for the content part"""
r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
+15 -2
View File
@@ -38,6 +38,7 @@ from .fusionplugin import FusionPlugin, FusionPluginTypedDict
from .imageconfig import ImageConfig, ImageConfigTypedDict
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
from .paretorouterplugin import ParetoRouterPlugin, ParetoRouterPluginTypedDict
from .promptcacheoptions import PromptCacheOptions, PromptCacheOptionsTypedDict
from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict
from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict
from .stopservertoolswhencondition import (
@@ -228,7 +229,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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
debug: NotRequired[ChatDebugOptionsTypedDict]
r"""Debug options for inspecting request transformations (streaming only)"""
frequency_penalty: NotRequired[Nullable[float]]
@@ -259,6 +260,9 @@ class ChatRequestTypedDict(TypedDict):
r"""Plugins you want to enable for this request, including their settings."""
presence_penalty: NotRequired[Nullable[float]]
r"""Presence penalty (-2.0 to 2.0)"""
prompt_cache_key: NotRequired[Nullable[str]]
prompt_cache_options: NotRequired[Nullable[PromptCacheOptionsTypedDict]]
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
provider: NotRequired[Nullable[ProviderPreferencesTypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference."""
reasoning: NotRequired[ChatRequestReasoningTypedDict]
@@ -310,7 +314,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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
debug: Optional[ChatDebugOptions] = None
r"""Debug options for inspecting request transformations (streaming only)"""
@@ -357,6 +361,11 @@ class ChatRequest(BaseModel):
presence_penalty: OptionalNullable[float] = UNSET
r"""Presence penalty (-2.0 to 2.0)"""
prompt_cache_key: OptionalNullable[str] = UNSET
prompt_cache_options: OptionalNullable[PromptCacheOptions] = UNSET
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
provider: OptionalNullable[ProviderPreferences] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference."""
@@ -440,6 +449,8 @@ class ChatRequest(BaseModel):
"parallel_tool_calls",
"plugins",
"presence_penalty",
"prompt_cache_key",
"prompt_cache_options",
"provider",
"reasoning",
"reasoning_effort",
@@ -473,6 +484,8 @@ class ChatRequest(BaseModel):
"min_p",
"parallel_tool_calls",
"presence_penalty",
"prompt_cache_key",
"prompt_cache_options",
"provider",
"reasoning_effort",
"repetition_penalty",
@@ -98,7 +98,7 @@ class FusionServerToolConfigTypedDict(TypedDict):
analysis_models: NotRequired[List[str]]
r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion."""
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_completion_tokens: NotRequired[int]
r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000."""
max_tool_calls: NotRequired[int]
@@ -120,7 +120,7 @@ class FusionServerToolConfig(BaseModel):
r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion."""
cache_control: Optional[AnthropicCacheControlDirective] = None
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_completion_tokens: Optional[int] = None
r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000."""
+2 -2
View File
@@ -23,7 +23,7 @@ class InputTextTypedDict(TypedDict):
text: str
type: InputTextType
prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]]
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
class InputText(BaseModel):
@@ -34,7 +34,7 @@ class InputText(BaseModel):
type: InputTextType
prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -50,7 +50,7 @@ class ContentCompactionTypedDict(TypedDict):
content: Nullable[str]
type: MessagesMessageParamTypeCompaction
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
class ContentCompaction(BaseModel):
@@ -59,7 +59,7 @@ class ContentCompaction(BaseModel):
type: MessagesMessageParamTypeCompaction
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -136,7 +136,7 @@ class ContentWebSearchToolResultTypedDict(TypedDict):
tool_use_id: str
type: TypeWebSearchToolResult
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
class ContentWebSearchToolResult(BaseModel):
@@ -147,7 +147,7 @@ class ContentWebSearchToolResult(BaseModel):
type: TypeWebSearchToolResult
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -174,7 +174,7 @@ class ContentServerToolUseTypedDict(TypedDict):
name: str
type: TypeServerToolUse
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
input: NotRequired[Nullable[Any]]
@@ -186,7 +186,7 @@ class ContentServerToolUse(BaseModel):
type: TypeServerToolUse
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
input: OptionalNullable[Any] = UNSET
@@ -304,7 +304,7 @@ class ContentToolResultTypedDict(TypedDict):
tool_use_id: str
type: TypeToolResult
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
content: NotRequired[MessagesMessageParamContentUnion2TypedDict]
is_error: NotRequired[bool]
@@ -315,7 +315,7 @@ class ContentToolResult(BaseModel):
type: TypeToolResult
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
content: Optional[MessagesMessageParamContentUnion2] = None
@@ -346,7 +346,7 @@ class ContentToolUseTypedDict(TypedDict):
name: str
type: TypeToolUse
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
input: NotRequired[Nullable[Any]]
@@ -358,7 +358,7 @@ class ContentToolUse(BaseModel):
type: TypeToolUse
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
input: OptionalNullable[Any] = UNSET
+16 -16
View File
@@ -659,14 +659,14 @@ ToolTypeEphemeral = Literal["ephemeral",]
class CachingTypedDict(TypedDict):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
type: ToolTypeEphemeral
ttl: NotRequired[AnthropicCacheControlTTL]
class Caching(BaseModel):
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
type: ToolTypeEphemeral
@@ -701,7 +701,7 @@ class ToolAdvisor20260301TypedDict(TypedDict):
type: TypeAdvisor20260301
allowed_callers: NotRequired[List[AnthropicAllowedCallers]]
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
caching: NotRequired[Nullable[CachingTypedDict]]
defer_loading: NotRequired[bool]
max_uses: NotRequired[int]
@@ -717,7 +717,7 @@ class ToolAdvisor20260301(BaseModel):
allowed_callers: Optional[List[AnthropicAllowedCallers]] = None
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
caching: OptionalNullable[Caching] = UNSET
@@ -766,7 +766,7 @@ class ToolWebSearch20260209TypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
blocked_domains: NotRequired[Nullable[List[str]]]
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_uses: NotRequired[Nullable[int]]
user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]]
@@ -783,7 +783,7 @@ class ToolWebSearch20260209(BaseModel):
blocked_domains: OptionalNullable[List[str]] = UNSET
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_uses: OptionalNullable[int] = UNSET
@@ -838,7 +838,7 @@ class ToolWebSearch20250305TypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
blocked_domains: NotRequired[Nullable[List[str]]]
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_uses: NotRequired[Nullable[int]]
user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]]
@@ -853,7 +853,7 @@ class ToolWebSearch20250305(BaseModel):
blocked_domains: OptionalNullable[List[str]] = UNSET
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
max_uses: OptionalNullable[int] = UNSET
@@ -905,7 +905,7 @@ class ToolTextEditor20250124TypedDict(TypedDict):
name: NameStrReplaceEditor
type: TypeTextEditor20250124
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
class ToolTextEditor20250124(BaseModel):
@@ -914,7 +914,7 @@ class ToolTextEditor20250124(BaseModel):
type: TypeTextEditor20250124
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -943,7 +943,7 @@ class ToolBash20250124TypedDict(TypedDict):
name: NameBash
type: TypeBash20250124
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
class ToolBash20250124(BaseModel):
@@ -952,7 +952,7 @@ class ToolBash20250124(BaseModel):
type: TypeBash20250124
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -1033,7 +1033,7 @@ class ToolCustomTypedDict(TypedDict):
input_schema: InputSchemaTypedDict
name: str
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
description: NotRequired[str]
type: NotRequired[ToolTypeCustom]
@@ -1044,7 +1044,7 @@ class ToolCustom(BaseModel):
name: str
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
description: Optional[str] = None
@@ -1113,7 +1113,7 @@ class MessagesRequestTypedDict(TypedDict):
messages: Nullable[List[MessagesMessageParamTypedDict]]
model: str
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
context_management: NotRequired[Nullable[ContextManagementTypedDict]]
fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]]
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
@@ -1155,7 +1155,7 @@ class MessagesRequest(BaseModel):
model: str
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
context_management: OptionalNullable[ContextManagement] = UNSET
@@ -10,12 +10,12 @@ PromptCacheBreakpointMode = Literal["explicit",]
class PromptCacheBreakpointTypedDict(TypedDict):
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
mode: PromptCacheBreakpointMode
class PromptCacheBreakpoint(BaseModel):
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically."""
mode: PromptCacheBreakpointMode
@@ -291,7 +291,7 @@ class ResponsesRequestTypedDict(TypedDict):
background: NotRequired[Nullable[bool]]
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
debug: NotRequired[ChatDebugOptionsTypedDict]
r"""Debug options for inspecting request transformations (streaming only)"""
frequency_penalty: NotRequired[Nullable[float]]
@@ -351,7 +351,7 @@ class ResponsesRequest(BaseModel):
background: OptionalNullable[bool] = UNSET
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."""
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. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format."""
debug: Optional[ChatDebugOptions] = None
r"""Debug options for inspecting request transformations (streaming only)"""