mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
## Python SDK Changes:
* `open_router.beta.responses.send()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.presets.create_presets_responses()`: `request` **Changed** **Breaking** ⚠️ * `open_router.presets.create_presets_chat_completions()`: `request` **Changed** **Breaking** ⚠️ * `open_router.chat.send()`: `request` **Changed** **Breaking** ⚠️ * `open_router.workspaces.set_budget()`: **Added** * `open_router.o_auth.create_auth_code()`: * `request.workspace_id` **Added** * `error.status[403]` **Added** * `open_router.files.download()`: **Added** * `open_router.models.get()`: **Added** * `open_router.workspaces.list_budgets()`: **Added** * `open_router.workspaces.delete_budget()`: **Added** * `open_router.datasets.get_benchmarks_artificial_analysis()`: **Added** * `open_router.beta.analytics.query_analytics()`: `response.data.warnings` **Added** * `open_router.files.delete()`: **Added** * `open_router.files.retrieve()`: **Added** * `open_router.files.upload()`: **Added** * `open_router.embeddings.list_models()`: `response.data.[].benchmarks` **Added** * `open_router.models.list()`: * `request` **Changed** * `response.data.[].benchmarks` **Added** * `open_router.models.list_for_user()`: `response.data.[].benchmarks` **Added** * `open_router.files.list()`: **Added** * `open_router.presets.create_presets_messages()`: `request` **Changed** * `open_router.datasets.get_benchmarks_design_arena()`: **Added**
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.9.2"
|
||||
__version__: str = "0.10.0"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.788.4"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.9.2 2.788.4 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.10.0 2.788.4 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -302,7 +302,7 @@ class BetaAnalytics(BaseSDK):
|
||||
:param dimensions:
|
||||
:param filters:
|
||||
:param granularity: Time granularity
|
||||
:param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
|
||||
:param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
|
||||
:param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.
|
||||
:param order_by:
|
||||
:param time_range:
|
||||
@@ -480,7 +480,7 @@ class BetaAnalytics(BaseSDK):
|
||||
:param dimensions:
|
||||
:param filters:
|
||||
:param granularity: Time granularity
|
||||
:param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
|
||||
:param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.
|
||||
:param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.
|
||||
:param order_by:
|
||||
:param time_range:
|
||||
|
||||
@@ -48,6 +48,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -70,6 +71,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -99,6 +104,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -132,6 +139,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -140,6 +148,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -151,6 +161,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -194,6 +206,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -216,6 +229,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -245,6 +262,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -278,6 +297,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -286,6 +306,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -297,6 +319,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -339,6 +363,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -361,6 +386,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -390,6 +419,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -423,6 +454,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -431,6 +463,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -442,6 +476,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -484,6 +520,7 @@ class Chat(BaseSDK):
|
||||
messages, List[components.ChatMessages]
|
||||
),
|
||||
metadata=metadata,
|
||||
min_p=min_p,
|
||||
modalities=modalities,
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -498,6 +535,8 @@ class Chat(BaseSDK):
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, Optional[components.ChatRequestReasoning]
|
||||
),
|
||||
reasoning_effort=reasoning_effort,
|
||||
repetition_penalty=repetition_penalty,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
@@ -520,6 +559,8 @@ class Chat(BaseSDK):
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ChatFunctionTool]]
|
||||
),
|
||||
top_a=top_a,
|
||||
top_k=top_k,
|
||||
top_logprobs=top_logprobs,
|
||||
top_p=top_p,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
|
||||
@@ -764,6 +805,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -786,6 +828,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -815,6 +861,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -848,6 +896,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -856,6 +905,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -867,6 +918,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -910,6 +963,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -932,6 +986,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -961,6 +1019,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -994,6 +1054,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -1002,6 +1063,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -1013,6 +1076,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -1055,6 +1120,7 @@ class Chat(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -1077,6 +1143,10 @@ class Chat(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -1106,6 +1176,8 @@ class Chat(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -1139,6 +1211,7 @@ class Chat(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -1147,6 +1220,8 @@ class Chat(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -1158,6 +1233,8 @@ class Chat(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -1200,6 +1277,7 @@ class Chat(BaseSDK):
|
||||
messages, List[components.ChatMessages]
|
||||
),
|
||||
metadata=metadata,
|
||||
min_p=min_p,
|
||||
modalities=modalities,
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -1214,6 +1292,8 @@ class Chat(BaseSDK):
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, Optional[components.ChatRequestReasoning]
|
||||
),
|
||||
reasoning_effort=reasoning_effort,
|
||||
repetition_penalty=repetition_penalty,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
@@ -1236,6 +1316,8 @@ class Chat(BaseSDK):
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ChatFunctionTool]]
|
||||
),
|
||||
top_a=top_a,
|
||||
top_k=top_k,
|
||||
top_logprobs=top_logprobs,
|
||||
top_p=top_p,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
|
||||
|
||||
@@ -6,6 +6,7 @@ import builtins
|
||||
import sys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
from .activityresponse import ActivityResponse, ActivityResponseTypedDict
|
||||
from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict
|
||||
@@ -87,6 +88,11 @@ if TYPE_CHECKING:
|
||||
SourceType,
|
||||
TypeDocument,
|
||||
)
|
||||
from .anthropicfiledocumentsource import (
|
||||
AnthropicFileDocumentSource,
|
||||
AnthropicFileDocumentSourceType,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
)
|
||||
from .anthropicimageblockparam import (
|
||||
AnthropicImageBlockParam,
|
||||
AnthropicImageBlockParamSource,
|
||||
@@ -270,6 +276,38 @@ if TYPE_CHECKING:
|
||||
BashServerToolEnvironment,
|
||||
BashServerToolEnvironmentTypedDict,
|
||||
)
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
|
||||
from .benchmarksaameta import (
|
||||
BenchmarksAAMeta,
|
||||
BenchmarksAAMetaSource,
|
||||
BenchmarksAAMetaSourceURL,
|
||||
BenchmarksAAMetaTypedDict,
|
||||
BenchmarksAAMetaVersion,
|
||||
)
|
||||
from .benchmarksaaresponse import (
|
||||
BenchmarksAAResponse,
|
||||
BenchmarksAAResponseTypedDict,
|
||||
)
|
||||
from .benchmarksdaitem import (
|
||||
BenchmarksDAItem,
|
||||
BenchmarksDAItemTypedDict,
|
||||
TournamentStats,
|
||||
TournamentStatsTypedDict,
|
||||
)
|
||||
from .benchmarksdameta import (
|
||||
BenchmarksDAMeta,
|
||||
BenchmarksDAMetaSource,
|
||||
BenchmarksDAMetaSourceURL,
|
||||
BenchmarksDAMetaTypedDict,
|
||||
BenchmarksDAMetaVersion,
|
||||
EloBounds,
|
||||
EloBoundsTypedDict,
|
||||
)
|
||||
from .benchmarksdaresponse import (
|
||||
BenchmarksDAResponse,
|
||||
BenchmarksDAResponseTypedDict,
|
||||
)
|
||||
from .bulkaddworkspacemembersrequest import (
|
||||
BulkAddWorkspaceMembersRequest,
|
||||
BulkAddWorkspaceMembersRequestTypedDict,
|
||||
@@ -434,6 +472,7 @@ if TYPE_CHECKING:
|
||||
ChatRequestPlugin,
|
||||
ChatRequestPluginTypedDict,
|
||||
ChatRequestReasoning,
|
||||
ChatRequestReasoningEffort,
|
||||
ChatRequestReasoningTypedDict,
|
||||
ChatRequestServiceTier,
|
||||
ChatRequestTypedDict,
|
||||
@@ -727,6 +766,7 @@ if TYPE_CHECKING:
|
||||
CustomToolCallOutputItemTypeInputImage,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
)
|
||||
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
|
||||
from .datetimeservertool import (
|
||||
DatetimeServerTool,
|
||||
DatetimeServerToolType,
|
||||
@@ -749,6 +789,10 @@ if TYPE_CHECKING:
|
||||
DeleteObservabilityDestinationResponse,
|
||||
DeleteObservabilityDestinationResponseTypedDict,
|
||||
)
|
||||
from .deleteworkspacebudgetresponse import (
|
||||
DeleteWorkspaceBudgetResponse,
|
||||
DeleteWorkspaceBudgetResponseTypedDict,
|
||||
)
|
||||
from .deleteworkspaceresponse import (
|
||||
DeleteWorkspaceResponse,
|
||||
DeleteWorkspaceResponseTypedDict,
|
||||
@@ -785,6 +829,13 @@ if TYPE_CHECKING:
|
||||
from .endpointstatus import EndpointStatus
|
||||
from .errorevent import ErrorEvent, ErrorEventType, ErrorEventTypedDict
|
||||
from .filecitation import FileCitation, FileCitationType, FileCitationTypedDict
|
||||
from .filedeleteresponse import (
|
||||
FileDeleteResponse,
|
||||
FileDeleteResponseType,
|
||||
FileDeleteResponseTypedDict,
|
||||
)
|
||||
from .filelistresponse import FileListResponse, FileListResponseTypedDict
|
||||
from .filemetadata import FileMetadata, FileMetadataType, FileMetadataTypedDict
|
||||
from .fileparserplugin import (
|
||||
FileParserPlugin,
|
||||
FileParserPluginID,
|
||||
@@ -928,6 +979,7 @@ if TYPE_CHECKING:
|
||||
FusionPluginTool,
|
||||
FusionPluginToolTypedDict,
|
||||
FusionPluginTypedDict,
|
||||
PresetEnum,
|
||||
)
|
||||
from .fusionservertool_openrouter import (
|
||||
FusionServerToolOpenRouter,
|
||||
@@ -1156,6 +1208,10 @@ if TYPE_CHECKING:
|
||||
ListPresetVersionsResponse,
|
||||
ListPresetVersionsResponseTypedDict,
|
||||
)
|
||||
from .listworkspacebudgetsresponse import (
|
||||
ListWorkspaceBudgetsResponse,
|
||||
ListWorkspaceBudgetsResponseTypedDict,
|
||||
)
|
||||
from .listworkspacesresponse import (
|
||||
ListWorkspacesResponse,
|
||||
ListWorkspacesResponseTypedDict,
|
||||
@@ -1218,6 +1274,10 @@ if TYPE_CHECKING:
|
||||
MessagesAdvisorToolResultBlockType,
|
||||
MessagesAdvisorToolResultBlockTypedDict,
|
||||
)
|
||||
from .messagesfallbackparam import (
|
||||
MessagesFallbackParam,
|
||||
MessagesFallbackParamTypedDict,
|
||||
)
|
||||
from .messagesmessageparam import (
|
||||
ContentCompaction,
|
||||
ContentCompactionTypedDict,
|
||||
@@ -1373,8 +1433,10 @@ if TYPE_CHECKING:
|
||||
ModelArchitectureInstructType,
|
||||
ModelArchitectureTypedDict,
|
||||
)
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modelgroup import ModelGroup
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
from .modelresponse import ModelResponse, ModelResponseTypedDict
|
||||
from .modelscountresponse import (
|
||||
ModelsCountResponse,
|
||||
ModelsCountResponseData,
|
||||
@@ -1820,6 +1882,11 @@ if TYPE_CHECKING:
|
||||
TypeExit,
|
||||
TypeTimeout,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemType,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
Command,
|
||||
OutputTextEditorServerToolItem,
|
||||
@@ -1973,7 +2040,7 @@ if TYPE_CHECKING:
|
||||
from .rankingsdailymeta import (
|
||||
RankingsDailyMeta,
|
||||
RankingsDailyMetaTypedDict,
|
||||
Version,
|
||||
RankingsDailyMetaVersion,
|
||||
)
|
||||
from .rankingsdailyresponse import (
|
||||
RankingsDailyResponse,
|
||||
@@ -2234,6 +2301,21 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .sttresponse import STTResponse, STTResponseTypedDict
|
||||
from .sttusage import STTUsage, STTUsageTypedDict
|
||||
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
|
||||
from .subagentreasoning import (
|
||||
SubagentReasoning,
|
||||
SubagentReasoningEffort,
|
||||
SubagentReasoningTypedDict,
|
||||
)
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterType,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .subagentservertoolconfig import (
|
||||
SubagentServerToolConfig,
|
||||
SubagentServerToolConfigTypedDict,
|
||||
)
|
||||
from .textdeltaevent import (
|
||||
TextDeltaEvent,
|
||||
TextDeltaEventType,
|
||||
@@ -2302,6 +2384,14 @@ if TYPE_CHECKING:
|
||||
UpdateWorkspaceResponse,
|
||||
UpdateWorkspaceResponseTypedDict,
|
||||
)
|
||||
from .upsertworkspacebudgetrequest import (
|
||||
UpsertWorkspaceBudgetRequest,
|
||||
UpsertWorkspaceBudgetRequestTypedDict,
|
||||
)
|
||||
from .upsertworkspacebudgetresponse import (
|
||||
UpsertWorkspaceBudgetResponse,
|
||||
UpsertWorkspaceBudgetResponseTypedDict,
|
||||
)
|
||||
from .urlcitation import URLCitation, URLCitationType, URLCitationTypedDict
|
||||
from .usage import (
|
||||
InputTokensDetails,
|
||||
@@ -2420,6 +2510,12 @@ if TYPE_CHECKING:
|
||||
WebSearchUserLocationServerToolTypedDict,
|
||||
)
|
||||
from .workspace import Workspace, WorkspaceTypedDict
|
||||
from .workspacebudget import (
|
||||
ResetInterval,
|
||||
WorkspaceBudget,
|
||||
WorkspaceBudgetTypedDict,
|
||||
)
|
||||
from .workspacebudgetinterval import WorkspaceBudgetInterval
|
||||
from .workspacemember import (
|
||||
WorkspaceMember,
|
||||
WorkspaceMemberRole,
|
||||
@@ -2427,6 +2523,8 @@ if TYPE_CHECKING:
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"AABenchmarkEntry",
|
||||
"AABenchmarkEntryTypedDict",
|
||||
"APIType",
|
||||
"Action",
|
||||
"ActionEnum",
|
||||
@@ -2496,6 +2594,9 @@ __all__ = [
|
||||
"AnthropicDocumentBlockParamSourceUnion",
|
||||
"AnthropicDocumentBlockParamSourceUnionTypedDict",
|
||||
"AnthropicDocumentBlockParamTypedDict",
|
||||
"AnthropicFileDocumentSource",
|
||||
"AnthropicFileDocumentSourceType",
|
||||
"AnthropicFileDocumentSourceTypedDict",
|
||||
"AnthropicImageBlockParam",
|
||||
"AnthropicImageBlockParamSource",
|
||||
"AnthropicImageBlockParamSourceTypedDict",
|
||||
@@ -2627,6 +2728,26 @@ __all__ = [
|
||||
"BashServerToolEnvironmentTypedDict",
|
||||
"BashServerToolType",
|
||||
"BashServerToolTypedDict",
|
||||
"BenchmarkPricing",
|
||||
"BenchmarkPricingTypedDict",
|
||||
"BenchmarksAAItem",
|
||||
"BenchmarksAAItemTypedDict",
|
||||
"BenchmarksAAMeta",
|
||||
"BenchmarksAAMetaSource",
|
||||
"BenchmarksAAMetaSourceURL",
|
||||
"BenchmarksAAMetaTypedDict",
|
||||
"BenchmarksAAMetaVersion",
|
||||
"BenchmarksAAResponse",
|
||||
"BenchmarksAAResponseTypedDict",
|
||||
"BenchmarksDAItem",
|
||||
"BenchmarksDAItemTypedDict",
|
||||
"BenchmarksDAMeta",
|
||||
"BenchmarksDAMetaSource",
|
||||
"BenchmarksDAMetaSourceURL",
|
||||
"BenchmarksDAMetaTypedDict",
|
||||
"BenchmarksDAMetaVersion",
|
||||
"BenchmarksDAResponse",
|
||||
"BenchmarksDAResponseTypedDict",
|
||||
"BulkAddWorkspaceMembersRequest",
|
||||
"BulkAddWorkspaceMembersRequestTypedDict",
|
||||
"BulkAddWorkspaceMembersResponse",
|
||||
@@ -2736,6 +2857,7 @@ __all__ = [
|
||||
"ChatRequestPlugin",
|
||||
"ChatRequestPluginTypedDict",
|
||||
"ChatRequestReasoning",
|
||||
"ChatRequestReasoningEffort",
|
||||
"ChatRequestReasoningTypedDict",
|
||||
"ChatRequestServiceTier",
|
||||
"ChatRequestTypedDict",
|
||||
@@ -2945,6 +3067,8 @@ __all__ = [
|
||||
"CustomToolCallOutputItemTypedDict",
|
||||
"CustomToolTypeCustom",
|
||||
"CustomToolTypedDict",
|
||||
"DABenchmarkEntry",
|
||||
"DABenchmarkEntryTypedDict",
|
||||
"DataCollection",
|
||||
"DataRegion",
|
||||
"DatetimeServerTool",
|
||||
@@ -2960,6 +3084,8 @@ __all__ = [
|
||||
"DeleteGuardrailResponseTypedDict",
|
||||
"DeleteObservabilityDestinationResponse",
|
||||
"DeleteObservabilityDestinationResponseTypedDict",
|
||||
"DeleteWorkspaceBudgetResponse",
|
||||
"DeleteWorkspaceBudgetResponseTypedDict",
|
||||
"DeleteWorkspaceResponse",
|
||||
"DeleteWorkspaceResponseTypedDict",
|
||||
"EasyInputMessage",
|
||||
@@ -2994,6 +3120,8 @@ __all__ = [
|
||||
"EditCompact20260112TypedDict",
|
||||
"EditTypeInputTokens",
|
||||
"EditTypedDict",
|
||||
"EloBounds",
|
||||
"EloBoundsTypedDict",
|
||||
"EndpointInfo",
|
||||
"EndpointInfoTypedDict",
|
||||
"EndpointStatus",
|
||||
@@ -3013,6 +3141,14 @@ __all__ = [
|
||||
"FileCitation",
|
||||
"FileCitationType",
|
||||
"FileCitationTypedDict",
|
||||
"FileDeleteResponse",
|
||||
"FileDeleteResponseType",
|
||||
"FileDeleteResponseTypedDict",
|
||||
"FileListResponse",
|
||||
"FileListResponseTypedDict",
|
||||
"FileMetadata",
|
||||
"FileMetadataType",
|
||||
"FileMetadataTypedDict",
|
||||
"FileParserPlugin",
|
||||
"FileParserPluginID",
|
||||
"FileParserPluginTypedDict",
|
||||
@@ -3293,6 +3429,8 @@ __all__ = [
|
||||
"ListPresetVersionsResponseTypedDict",
|
||||
"ListPresetsResponse",
|
||||
"ListPresetsResponseTypedDict",
|
||||
"ListWorkspaceBudgetsResponse",
|
||||
"ListWorkspaceBudgetsResponseTypedDict",
|
||||
"ListWorkspacesResponse",
|
||||
"ListWorkspacesResponseTypedDict",
|
||||
"LocalShellCallItem",
|
||||
@@ -3331,6 +3469,8 @@ __all__ = [
|
||||
"MessagesAdvisorToolResultBlock",
|
||||
"MessagesAdvisorToolResultBlockType",
|
||||
"MessagesAdvisorToolResultBlockTypedDict",
|
||||
"MessagesFallbackParam",
|
||||
"MessagesFallbackParamTypedDict",
|
||||
"MessagesMessageParam",
|
||||
"MessagesMessageParamContentUnion1",
|
||||
"MessagesMessageParamContentUnion1TypedDict",
|
||||
@@ -3372,10 +3512,14 @@ __all__ = [
|
||||
"ModelArchitecture",
|
||||
"ModelArchitectureInstructType",
|
||||
"ModelArchitectureTypedDict",
|
||||
"ModelBenchmarks",
|
||||
"ModelBenchmarksTypedDict",
|
||||
"ModelEnum",
|
||||
"ModelGroup",
|
||||
"ModelLinks",
|
||||
"ModelLinksTypedDict",
|
||||
"ModelResponse",
|
||||
"ModelResponseTypedDict",
|
||||
"ModelTypedDict",
|
||||
"ModelsCountResponse",
|
||||
"ModelsCountResponseData",
|
||||
@@ -3702,6 +3846,9 @@ __all__ = [
|
||||
"OutputShellCallOutputItemOutputTypedDict",
|
||||
"OutputShellCallOutputItemTypeShellCallOutput",
|
||||
"OutputShellCallOutputItemTypedDict",
|
||||
"OutputSubagentServerToolItem",
|
||||
"OutputSubagentServerToolItemType",
|
||||
"OutputSubagentServerToolItemTypedDict",
|
||||
"OutputTextEditorServerToolItem",
|
||||
"OutputTextEditorServerToolItemType",
|
||||
"OutputTextEditorServerToolItemTypedDict",
|
||||
@@ -3763,6 +3910,7 @@ __all__ = [
|
||||
"Preset",
|
||||
"PresetDesignatedVersion",
|
||||
"PresetDesignatedVersionTypedDict",
|
||||
"PresetEnum",
|
||||
"PresetStatus",
|
||||
"PresetTypedDict",
|
||||
"PresetWithDesignatedVersion",
|
||||
@@ -3808,6 +3956,7 @@ __all__ = [
|
||||
"RankingsDailyItemTypedDict",
|
||||
"RankingsDailyMeta",
|
||||
"RankingsDailyMetaTypedDict",
|
||||
"RankingsDailyMetaVersion",
|
||||
"RankingsDailyResponse",
|
||||
"RankingsDailyResponseTypedDict",
|
||||
"Reason",
|
||||
@@ -3874,6 +4023,7 @@ __all__ = [
|
||||
"RequireApprovalTypedDict",
|
||||
"RequireApprovalUnion",
|
||||
"RequireApprovalUnionTypedDict",
|
||||
"ResetInterval",
|
||||
"Resolution",
|
||||
"Response",
|
||||
"ResponseFormat",
|
||||
@@ -4007,6 +4157,16 @@ __all__ = [
|
||||
"StreamLogprobTopLogprob",
|
||||
"StreamLogprobTopLogprobTypedDict",
|
||||
"StreamLogprobTypedDict",
|
||||
"SubagentNestedTool",
|
||||
"SubagentNestedToolTypedDict",
|
||||
"SubagentReasoning",
|
||||
"SubagentReasoningEffort",
|
||||
"SubagentReasoningTypedDict",
|
||||
"SubagentServerToolConfig",
|
||||
"SubagentServerToolConfigTypedDict",
|
||||
"SubagentServerToolOpenRouter",
|
||||
"SubagentServerToolOpenRouterType",
|
||||
"SubagentServerToolOpenRouterTypedDict",
|
||||
"SupportedAspectRatio",
|
||||
"SupportedFrameImage",
|
||||
"SupportedResolution",
|
||||
@@ -4066,6 +4226,8 @@ __all__ = [
|
||||
"ToolWebSearch20260209TypedDict",
|
||||
"TopProviderInfo",
|
||||
"TopProviderInfoTypedDict",
|
||||
"TournamentStats",
|
||||
"TournamentStatsTypedDict",
|
||||
"TraceConfig",
|
||||
"TraceConfigTypedDict",
|
||||
"Trigger",
|
||||
@@ -4135,6 +4297,10 @@ __all__ = [
|
||||
"UpdateWorkspaceRequestTypedDict",
|
||||
"UpdateWorkspaceResponse",
|
||||
"UpdateWorkspaceResponseTypedDict",
|
||||
"UpsertWorkspaceBudgetRequest",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict",
|
||||
"UpsertWorkspaceBudgetResponse",
|
||||
"UpsertWorkspaceBudgetResponseTypedDict",
|
||||
"Usage",
|
||||
"UsageCostDetails",
|
||||
"UsageCostDetailsTypedDict",
|
||||
@@ -4144,7 +4310,6 @@ __all__ = [
|
||||
"Variables",
|
||||
"VariablesTypedDict",
|
||||
"Verbosity",
|
||||
"Version",
|
||||
"VideoGenerationRequest",
|
||||
"VideoGenerationRequestProvider",
|
||||
"VideoGenerationRequestProviderTypedDict",
|
||||
@@ -4207,6 +4372,9 @@ __all__ = [
|
||||
"WebSearchUserLocationType",
|
||||
"WebSearchUserLocationTypedDict",
|
||||
"Workspace",
|
||||
"WorkspaceBudget",
|
||||
"WorkspaceBudgetInterval",
|
||||
"WorkspaceBudgetTypedDict",
|
||||
"WorkspaceMember",
|
||||
"WorkspaceMemberRole",
|
||||
"WorkspaceMemberTypedDict",
|
||||
@@ -4214,6 +4382,8 @@ __all__ = [
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"AABenchmarkEntry": ".aabenchmarkentry",
|
||||
"AABenchmarkEntryTypedDict": ".aabenchmarkentry",
|
||||
"ActivityItem": ".activityitem",
|
||||
"ActivityItemTypedDict": ".activityitem",
|
||||
"ActivityResponse": ".activityresponse",
|
||||
@@ -4272,6 +4442,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"SourceContentTypedDict": ".anthropicdocumentblockparam",
|
||||
"SourceType": ".anthropicdocumentblockparam",
|
||||
"TypeDocument": ".anthropicdocumentblockparam",
|
||||
"AnthropicFileDocumentSource": ".anthropicfiledocumentsource",
|
||||
"AnthropicFileDocumentSourceType": ".anthropicfiledocumentsource",
|
||||
"AnthropicFileDocumentSourceTypedDict": ".anthropicfiledocumentsource",
|
||||
"AnthropicImageBlockParam": ".anthropicimageblockparam",
|
||||
"AnthropicImageBlockParamSource": ".anthropicimageblockparam",
|
||||
"AnthropicImageBlockParamSourceTypedDict": ".anthropicimageblockparam",
|
||||
@@ -4396,6 +4569,30 @@ _dynamic_imports: dict[str, str] = {
|
||||
"BashServerToolEngine": ".bashservertoolengine",
|
||||
"BashServerToolEnvironment": ".bashservertoolenvironment",
|
||||
"BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment",
|
||||
"BenchmarkPricing": ".benchmarkpricing",
|
||||
"BenchmarkPricingTypedDict": ".benchmarkpricing",
|
||||
"BenchmarksAAItem": ".benchmarksaaitem",
|
||||
"BenchmarksAAItemTypedDict": ".benchmarksaaitem",
|
||||
"BenchmarksAAMeta": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaSource": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaSourceURL": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaTypedDict": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaVersion": ".benchmarksaameta",
|
||||
"BenchmarksAAResponse": ".benchmarksaaresponse",
|
||||
"BenchmarksAAResponseTypedDict": ".benchmarksaaresponse",
|
||||
"BenchmarksDAItem": ".benchmarksdaitem",
|
||||
"BenchmarksDAItemTypedDict": ".benchmarksdaitem",
|
||||
"TournamentStats": ".benchmarksdaitem",
|
||||
"TournamentStatsTypedDict": ".benchmarksdaitem",
|
||||
"BenchmarksDAMeta": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaSource": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaSourceURL": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaTypedDict": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaVersion": ".benchmarksdameta",
|
||||
"EloBounds": ".benchmarksdameta",
|
||||
"EloBoundsTypedDict": ".benchmarksdameta",
|
||||
"BenchmarksDAResponse": ".benchmarksdaresponse",
|
||||
"BenchmarksDAResponseTypedDict": ".benchmarksdaresponse",
|
||||
"BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest",
|
||||
"BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest",
|
||||
"BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse",
|
||||
@@ -4507,6 +4704,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatRequestPlugin": ".chatrequest",
|
||||
"ChatRequestPluginTypedDict": ".chatrequest",
|
||||
"ChatRequestReasoning": ".chatrequest",
|
||||
"ChatRequestReasoningEffort": ".chatrequest",
|
||||
"ChatRequestReasoningTypedDict": ".chatrequest",
|
||||
"ChatRequestServiceTier": ".chatrequest",
|
||||
"ChatRequestTypedDict": ".chatrequest",
|
||||
@@ -4712,6 +4910,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem",
|
||||
"CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem",
|
||||
"CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem",
|
||||
"DABenchmarkEntry": ".dabenchmarkentry",
|
||||
"DABenchmarkEntryTypedDict": ".dabenchmarkentry",
|
||||
"DatetimeServerTool": ".datetimeservertool",
|
||||
"DatetimeServerToolType": ".datetimeservertool",
|
||||
"DatetimeServerToolTypedDict": ".datetimeservertool",
|
||||
@@ -4725,6 +4925,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse",
|
||||
"DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse",
|
||||
"DeleteObservabilityDestinationResponseTypedDict": ".deleteobservabilitydestinationresponse",
|
||||
"DeleteWorkspaceBudgetResponse": ".deleteworkspacebudgetresponse",
|
||||
"DeleteWorkspaceBudgetResponseTypedDict": ".deleteworkspacebudgetresponse",
|
||||
"DeleteWorkspaceResponse": ".deleteworkspaceresponse",
|
||||
"DeleteWorkspaceResponseTypedDict": ".deleteworkspaceresponse",
|
||||
"EasyInputMessage": ".easyinputmessage",
|
||||
@@ -4761,6 +4963,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"FileCitation": ".filecitation",
|
||||
"FileCitationType": ".filecitation",
|
||||
"FileCitationTypedDict": ".filecitation",
|
||||
"FileDeleteResponse": ".filedeleteresponse",
|
||||
"FileDeleteResponseType": ".filedeleteresponse",
|
||||
"FileDeleteResponseTypedDict": ".filedeleteresponse",
|
||||
"FileListResponse": ".filelistresponse",
|
||||
"FileListResponseTypedDict": ".filelistresponse",
|
||||
"FileMetadata": ".filemetadata",
|
||||
"FileMetadataType": ".filemetadata",
|
||||
"FileMetadataTypedDict": ".filemetadata",
|
||||
"FileParserPlugin": ".fileparserplugin",
|
||||
"FileParserPluginID": ".fileparserplugin",
|
||||
"FileParserPluginTypedDict": ".fileparserplugin",
|
||||
@@ -4864,6 +5074,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"FusionPluginTool": ".fusionplugin",
|
||||
"FusionPluginToolTypedDict": ".fusionplugin",
|
||||
"FusionPluginTypedDict": ".fusionplugin",
|
||||
"PresetEnum": ".fusionplugin",
|
||||
"FusionServerToolOpenRouter": ".fusionservertool_openrouter",
|
||||
"FusionServerToolOpenRouterType": ".fusionservertool_openrouter",
|
||||
"FusionServerToolOpenRouterTypedDict": ".fusionservertool_openrouter",
|
||||
@@ -5042,6 +5253,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListPresetsResponseTypedDict": ".listpresetsresponse",
|
||||
"ListPresetVersionsResponse": ".listpresetversionsresponse",
|
||||
"ListPresetVersionsResponseTypedDict": ".listpresetversionsresponse",
|
||||
"ListWorkspaceBudgetsResponse": ".listworkspacebudgetsresponse",
|
||||
"ListWorkspaceBudgetsResponseTypedDict": ".listworkspacebudgetsresponse",
|
||||
"ListWorkspacesResponse": ".listworkspacesresponse",
|
||||
"ListWorkspacesResponseTypedDict": ".listworkspacesresponse",
|
||||
"LocalShellCallItem": ".localshellcallitem",
|
||||
@@ -5091,6 +5304,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock",
|
||||
"MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock",
|
||||
"MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock",
|
||||
"MessagesFallbackParam": ".messagesfallbackparam",
|
||||
"MessagesFallbackParamTypedDict": ".messagesfallbackparam",
|
||||
"ContentCompaction": ".messagesmessageparam",
|
||||
"ContentCompactionTypedDict": ".messagesmessageparam",
|
||||
"ContentRedactedThinking": ".messagesmessageparam",
|
||||
@@ -5239,9 +5454,13 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ModelArchitecture": ".modelarchitecture",
|
||||
"ModelArchitectureInstructType": ".modelarchitecture",
|
||||
"ModelArchitectureTypedDict": ".modelarchitecture",
|
||||
"ModelBenchmarks": ".modelbenchmarks",
|
||||
"ModelBenchmarksTypedDict": ".modelbenchmarks",
|
||||
"ModelGroup": ".modelgroup",
|
||||
"ModelLinks": ".modellinks",
|
||||
"ModelLinksTypedDict": ".modellinks",
|
||||
"ModelResponse": ".modelresponse",
|
||||
"ModelResponseTypedDict": ".modelresponse",
|
||||
"ModelsCountResponse": ".modelscountresponse",
|
||||
"ModelsCountResponseData": ".modelscountresponse",
|
||||
"ModelsCountResponseDataTypedDict": ".modelscountresponse",
|
||||
@@ -5573,6 +5792,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem",
|
||||
"TypeExit": ".outputshellcalloutputitem",
|
||||
"TypeTimeout": ".outputshellcalloutputitem",
|
||||
"OutputSubagentServerToolItem": ".outputsubagentservertoolitem",
|
||||
"OutputSubagentServerToolItemType": ".outputsubagentservertoolitem",
|
||||
"OutputSubagentServerToolItemTypedDict": ".outputsubagentservertoolitem",
|
||||
"Command": ".outputtexteditorservertoolitem",
|
||||
"OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem",
|
||||
"OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem",
|
||||
@@ -5690,7 +5912,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"RankingsDailyItemTypedDict": ".rankingsdailyitem",
|
||||
"RankingsDailyMeta": ".rankingsdailymeta",
|
||||
"RankingsDailyMetaTypedDict": ".rankingsdailymeta",
|
||||
"Version": ".rankingsdailymeta",
|
||||
"RankingsDailyMetaVersion": ".rankingsdailymeta",
|
||||
"RankingsDailyResponse": ".rankingsdailyresponse",
|
||||
"RankingsDailyResponseTypedDict": ".rankingsdailyresponse",
|
||||
"ReasoningConfig": ".reasoningconfig",
|
||||
@@ -5869,6 +6091,16 @@ _dynamic_imports: dict[str, str] = {
|
||||
"STTResponseTypedDict": ".sttresponse",
|
||||
"STTUsage": ".sttusage",
|
||||
"STTUsageTypedDict": ".sttusage",
|
||||
"SubagentNestedTool": ".subagentnestedtool",
|
||||
"SubagentNestedToolTypedDict": ".subagentnestedtool",
|
||||
"SubagentReasoning": ".subagentreasoning",
|
||||
"SubagentReasoningEffort": ".subagentreasoning",
|
||||
"SubagentReasoningTypedDict": ".subagentreasoning",
|
||||
"SubagentServerToolOpenRouter": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolOpenRouterType": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolOpenRouterTypedDict": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolConfig": ".subagentservertoolconfig",
|
||||
"SubagentServerToolConfigTypedDict": ".subagentservertoolconfig",
|
||||
"TextDeltaEvent": ".textdeltaevent",
|
||||
"TextDeltaEventType": ".textdeltaevent",
|
||||
"TextDeltaEventTypedDict": ".textdeltaevent",
|
||||
@@ -5913,6 +6145,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest",
|
||||
"UpdateWorkspaceResponse": ".updateworkspaceresponse",
|
||||
"UpdateWorkspaceResponseTypedDict": ".updateworkspaceresponse",
|
||||
"UpsertWorkspaceBudgetRequest": ".upsertworkspacebudgetrequest",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict": ".upsertworkspacebudgetrequest",
|
||||
"UpsertWorkspaceBudgetResponse": ".upsertworkspacebudgetresponse",
|
||||
"UpsertWorkspaceBudgetResponseTypedDict": ".upsertworkspacebudgetresponse",
|
||||
"URLCitation": ".urlcitation",
|
||||
"URLCitationType": ".urlcitation",
|
||||
"URLCitationTypedDict": ".urlcitation",
|
||||
@@ -5995,6 +6231,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"WebSearchUserLocationServerToolTypedDict": ".websearchuserlocationservertool",
|
||||
"Workspace": ".workspace",
|
||||
"WorkspaceTypedDict": ".workspace",
|
||||
"ResetInterval": ".workspacebudget",
|
||||
"WorkspaceBudget": ".workspacebudget",
|
||||
"WorkspaceBudgetTypedDict": ".workspacebudget",
|
||||
"WorkspaceBudgetInterval": ".workspacebudgetinterval",
|
||||
"WorkspaceMember": ".workspacemember",
|
||||
"WorkspaceMemberRole": ".workspacemember",
|
||||
"WorkspaceMemberTypedDict": ".workspacemember",
|
||||
|
||||
@@ -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_extensions import TypedDict
|
||||
|
||||
|
||||
class AABenchmarkEntryTypedDict(TypedDict):
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index score"""
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index score"""
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index score"""
|
||||
|
||||
|
||||
class AABenchmarkEntry(BaseModel):
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index score"""
|
||||
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index score"""
|
||||
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index score"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["agentic_index", "coding_index", "intelligence_index"]
|
||||
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
|
||||
@@ -9,15 +9,14 @@ 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."""
|
||||
r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. 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."""
|
||||
r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
@@ -26,8 +25,6 @@ class AdvisorNestedTool(BaseModel):
|
||||
|
||||
type: str
|
||||
|
||||
function: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
parameters: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
@property
|
||||
|
||||
@@ -30,7 +30,7 @@ class AdvisorServerToolConfigTypedDict(TypedDict):
|
||||
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."""
|
||||
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. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
|
||||
|
||||
|
||||
class AdvisorServerToolConfig(BaseModel):
|
||||
@@ -64,4 +64,4 @@ class AdvisorServerToolConfig(BaseModel):
|
||||
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."""
|
||||
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. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
|
||||
|
||||
@@ -9,6 +9,10 @@ from .anthropiccachecontroldirective import (
|
||||
AnthropicCacheControlDirective,
|
||||
AnthropicCacheControlDirectiveTypedDict,
|
||||
)
|
||||
from .anthropicfiledocumentsource import (
|
||||
AnthropicFileDocumentSource,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
)
|
||||
from .anthropicimageblockparam import (
|
||||
AnthropicImageBlockParam,
|
||||
AnthropicImageBlockParamTypedDict,
|
||||
@@ -89,6 +93,7 @@ AnthropicDocumentBlockParamSourceUnionTypedDict = TypeAliasType(
|
||||
Union[
|
||||
SourceContentTypedDict,
|
||||
AnthropicURLPdfSourceTypedDict,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
AnthropicBase64PdfSourceTypedDict,
|
||||
AnthropicPlainTextSourceTypedDict,
|
||||
],
|
||||
@@ -101,6 +106,7 @@ AnthropicDocumentBlockParamSourceUnion = Annotated[
|
||||
Annotated[AnthropicPlainTextSource, Tag("text")],
|
||||
Annotated[SourceContent, Tag("content")],
|
||||
Annotated[AnthropicURLPdfSource, Tag("url")],
|
||||
Annotated[AnthropicFileDocumentSource, Tag("file")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
AnthropicFileDocumentSourceType = Literal["file",]
|
||||
|
||||
|
||||
class AnthropicFileDocumentSourceTypedDict(TypedDict):
|
||||
file_id: str
|
||||
type: AnthropicFileDocumentSourceType
|
||||
|
||||
|
||||
class AnthropicFileDocumentSource(BaseModel):
|
||||
file_id: str
|
||||
|
||||
type: AnthropicFileDocumentSourceType
|
||||
@@ -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_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarkPricingTypedDict(TypedDict):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
r"""Cost per output token (USD, decimal string)."""
|
||||
prompt: str
|
||||
r"""Cost per input token (USD, decimal string)."""
|
||||
|
||||
|
||||
class BenchmarkPricing(BaseModel):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
r"""Cost per output token (USD, decimal string)."""
|
||||
|
||||
prompt: str
|
||||
r"""Cost per input token (USD, decimal string)."""
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAItemTypedDict(TypedDict):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
|
||||
class BenchmarksAAItem(BaseModel):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = [
|
||||
"agentic_index",
|
||||
"coding_index",
|
||||
"intelligence_index",
|
||||
"pricing",
|
||||
]
|
||||
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,53 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
BenchmarksAAMetaSource = Literal["artificial-analysis",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksAAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMetaTypedDict(TypedDict):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMeta(BaseModel):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
|
||||
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksAAItemTypedDict]
|
||||
meta: BenchmarksAAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponse(BaseModel):
|
||||
data: List[BenchmarksAAItem]
|
||||
|
||||
meta: BenchmarksAAMeta
|
||||
@@ -0,0 +1,147 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class TournamentStatsTypedDict(TypedDict):
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
first_place: Nullable[int]
|
||||
fourth_place: Nullable[int]
|
||||
second_place: Nullable[int]
|
||||
third_place: Nullable[int]
|
||||
total: Nullable[int]
|
||||
|
||||
|
||||
class TournamentStats(BaseModel):
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
first_place: Nullable[int]
|
||||
|
||||
fourth_place: Nullable[int]
|
||||
|
||||
second_place: Nullable[int]
|
||||
|
||||
third_place: Nullable[int]
|
||||
|
||||
total: Nullable[int]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = [
|
||||
"first_place",
|
||||
"fourth_place",
|
||||
"second_place",
|
||||
"third_place",
|
||||
"total",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class BenchmarksDAItemTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
avg_generation_time_ms: Nullable[float]
|
||||
r"""Average generation time in milliseconds."""
|
||||
category: str
|
||||
r"""Category within the arena."""
|
||||
display_name: str
|
||||
r"""Human-readable model name from Design Arena."""
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
tournament_stats: TournamentStatsTypedDict
|
||||
r"""Placement distribution from tournament matches."""
|
||||
win_rate: float
|
||||
r"""Win rate as a percentage (0–100)."""
|
||||
|
||||
|
||||
class BenchmarksDAItem(BaseModel):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
|
||||
avg_generation_time_ms: Nullable[float]
|
||||
r"""Average generation time in milliseconds."""
|
||||
|
||||
category: str
|
||||
r"""Category within the arena."""
|
||||
|
||||
display_name: str
|
||||
r"""Human-readable model name from Design Arena."""
|
||||
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
tournament_stats: TournamentStats
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
win_rate: float
|
||||
r"""Win rate as a percentage (0–100)."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["avg_generation_time_ms", "pricing"]
|
||||
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,118 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class EloBoundsTypedDict(TypedDict):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
class EloBounds(BaseModel):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSource = Literal["design-arena",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksDAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMetaTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
elo_bounds: EloBoundsTypedDict
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMeta(BaseModel):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
elo_bounds: EloBounds
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["category"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
|
||||
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksDAItemTypedDict]
|
||||
meta: BenchmarksDAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponse(BaseModel):
|
||||
data: List[BenchmarksDAItem]
|
||||
|
||||
meta: BenchmarksDAMeta
|
||||
@@ -27,6 +27,10 @@ from .openrouterwebsearchservertool import (
|
||||
OpenRouterWebSearchServerTool,
|
||||
OpenRouterWebSearchServerToolTypedDict,
|
||||
)
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -129,6 +133,7 @@ ChatFunctionToolTypedDict = TypeAliasType(
|
||||
DatetimeServerToolTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
OpenRouterWebSearchServerToolTypedDict,
|
||||
ChatFunctionToolFunctionTypedDict,
|
||||
@@ -150,6 +155,7 @@ ChatFunctionTool = Annotated[
|
||||
Annotated[
|
||||
ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models")
|
||||
],
|
||||
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
|
||||
Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")],
|
||||
Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")],
|
||||
Annotated[ChatWebSearchShorthand, Tag("web_search")],
|
||||
|
||||
@@ -170,6 +170,20 @@ class ChatRequestReasoning(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
ChatRequestReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
|
||||
|
||||
ResponseFormatTypedDict = TypeAliasType(
|
||||
"ResponseFormatTypedDict",
|
||||
Union[
|
||||
@@ -240,6 +254,8 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16."""
|
||||
metadata: NotRequired[Dict[str, str]]
|
||||
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
|
||||
min_p: NotRequired[Nullable[float]]
|
||||
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
|
||||
modalities: NotRequired[List[Modality]]
|
||||
r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"."""
|
||||
model: NotRequired[str]
|
||||
@@ -256,6 +272,10 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
reasoning: NotRequired[ChatRequestReasoningTypedDict]
|
||||
r"""Configuration options for reasoning models"""
|
||||
reasoning_effort: NotRequired[Nullable[ChatRequestReasoningEffort]]
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
repetition_penalty: NotRequired[Nullable[float]]
|
||||
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
|
||||
response_format: NotRequired[ResponseFormatTypedDict]
|
||||
r"""Response format configuration"""
|
||||
seed: NotRequired[Nullable[int]]
|
||||
@@ -278,6 +298,10 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""Tool choice configuration"""
|
||||
tools: NotRequired[List[ChatFunctionToolTypedDict]]
|
||||
r"""Available tools for function calling"""
|
||||
top_a: NotRequired[Nullable[float]]
|
||||
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
|
||||
top_k: NotRequired[Nullable[int]]
|
||||
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
|
||||
top_logprobs: NotRequired[Nullable[int]]
|
||||
r"""Number of top log probabilities to return (0-20)"""
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
@@ -321,6 +345,9 @@ class ChatRequest(BaseModel):
|
||||
metadata: Optional[Dict[str, str]] = None
|
||||
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
|
||||
|
||||
min_p: OptionalNullable[float] = UNSET
|
||||
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
|
||||
|
||||
modalities: Optional[
|
||||
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
|
||||
] = None
|
||||
@@ -347,6 +374,15 @@ class ChatRequest(BaseModel):
|
||||
reasoning: Optional[ChatRequestReasoning] = None
|
||||
r"""Configuration options for reasoning models"""
|
||||
|
||||
reasoning_effort: Annotated[
|
||||
OptionalNullable[ChatRequestReasoningEffort],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = UNSET
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
|
||||
repetition_penalty: OptionalNullable[float] = UNSET
|
||||
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
|
||||
|
||||
response_format: Optional[ResponseFormat] = None
|
||||
r"""Response format configuration"""
|
||||
|
||||
@@ -383,6 +419,12 @@ class ChatRequest(BaseModel):
|
||||
tools: Optional[List[ChatFunctionTool]] = None
|
||||
r"""Available tools for function calling"""
|
||||
|
||||
top_a: OptionalNullable[float] = UNSET
|
||||
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
|
||||
|
||||
top_k: OptionalNullable[int] = UNSET
|
||||
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
|
||||
|
||||
top_logprobs: OptionalNullable[int] = UNSET
|
||||
r"""Number of top log probabilities to return (0-20)"""
|
||||
|
||||
@@ -407,6 +449,7 @@ class ChatRequest(BaseModel):
|
||||
"max_completion_tokens",
|
||||
"max_tokens",
|
||||
"metadata",
|
||||
"min_p",
|
||||
"modalities",
|
||||
"model",
|
||||
"models",
|
||||
@@ -415,6 +458,8 @@ class ChatRequest(BaseModel):
|
||||
"presence_penalty",
|
||||
"provider",
|
||||
"reasoning",
|
||||
"reasoning_effort",
|
||||
"repetition_penalty",
|
||||
"response_format",
|
||||
"seed",
|
||||
"service_tier",
|
||||
@@ -426,6 +471,8 @@ class ChatRequest(BaseModel):
|
||||
"temperature",
|
||||
"tool_choice",
|
||||
"tools",
|
||||
"top_a",
|
||||
"top_k",
|
||||
"top_logprobs",
|
||||
"top_p",
|
||||
"trace",
|
||||
@@ -437,14 +484,19 @@ class ChatRequest(BaseModel):
|
||||
"logprobs",
|
||||
"max_completion_tokens",
|
||||
"max_tokens",
|
||||
"min_p",
|
||||
"parallel_tool_calls",
|
||||
"presence_penalty",
|
||||
"provider",
|
||||
"reasoning_effort",
|
||||
"repetition_penalty",
|
||||
"seed",
|
||||
"service_tier",
|
||||
"stop",
|
||||
"stream_options",
|
||||
"temperature",
|
||||
"top_a",
|
||||
"top_k",
|
||||
"top_logprobs",
|
||||
"top_p",
|
||||
]
|
||||
|
||||
@@ -31,20 +31,20 @@ class ChatWebSearchShorthandTypedDict(TypedDict):
|
||||
|
||||
type: ChatWebSearchShorthandType
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). 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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
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. Defaults to 50 when not specified."""
|
||||
parameters: NotRequired[WebSearchConfigTypedDict]
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -57,21 +57,21 @@ class ChatWebSearchShorthand(BaseModel):
|
||||
]
|
||||
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
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. Defaults to 50 when not specified."""
|
||||
@@ -81,7 +81,7 @@ class ChatWebSearchShorthand(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
"""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 DABenchmarkEntryTypedDict(TypedDict):
|
||||
r"""A single Design Arena benchmark entry for a specific arena+category"""
|
||||
|
||||
arena: str
|
||||
r"""Arena type (e.g. models, builders, agents)"""
|
||||
category: str
|
||||
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles"""
|
||||
rank: int
|
||||
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
|
||||
win_rate: float
|
||||
r"""Win rate percentage in arena battles"""
|
||||
|
||||
|
||||
class DABenchmarkEntry(BaseModel):
|
||||
r"""A single Design Arena benchmark entry for a specific arena+category"""
|
||||
|
||||
arena: str
|
||||
r"""Arena type (e.g. models, builders, agents)"""
|
||||
|
||||
category: str
|
||||
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
|
||||
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles"""
|
||||
|
||||
rank: int
|
||||
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
|
||||
|
||||
win_rate: float
|
||||
r"""Win rate percentage in arena battles"""
|
||||
@@ -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 DeleteWorkspaceBudgetResponseTypedDict(TypedDict):
|
||||
deleted: Literal[True]
|
||||
r"""Confirmation that the budget was deleted (or did not exist)"""
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetResponse(BaseModel):
|
||||
DELETED: Annotated[
|
||||
Annotated[Literal[True], AfterValidator(validate_const(True))],
|
||||
pydantic.Field(alias="deleted"),
|
||||
] = True
|
||||
r"""Confirmation that the budget was deleted (or did not exist)"""
|
||||
@@ -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
|
||||
|
||||
|
||||
FileDeleteResponseType = Literal["file_deleted",]
|
||||
|
||||
|
||||
class FileDeleteResponseTypedDict(TypedDict):
|
||||
r"""Confirmation that a file was deleted."""
|
||||
|
||||
id: str
|
||||
type: FileDeleteResponseType
|
||||
|
||||
|
||||
class FileDeleteResponse(BaseModel):
|
||||
r"""Confirmation that a file was deleted."""
|
||||
|
||||
id: str
|
||||
|
||||
type: FileDeleteResponseType
|
||||
@@ -0,0 +1,64 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .filemetadata import FileMetadata, FileMetadataTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class FileListResponseTypedDict(TypedDict):
|
||||
r"""A page of files belonging to the requesting workspace."""
|
||||
|
||||
cursor: Nullable[str]
|
||||
r"""Opaque cursor for the next page; null when there are no more results."""
|
||||
data: List[FileMetadataTypedDict]
|
||||
first_id: Nullable[str]
|
||||
has_more: bool
|
||||
last_id: Nullable[str]
|
||||
|
||||
|
||||
class FileListResponse(BaseModel):
|
||||
r"""A page of files belonging to the requesting workspace."""
|
||||
|
||||
cursor: Nullable[str]
|
||||
r"""Opaque cursor for the next page; null when there are no more results."""
|
||||
|
||||
data: List[FileMetadata]
|
||||
|
||||
first_id: Nullable[str]
|
||||
|
||||
has_more: bool
|
||||
|
||||
last_id: Nullable[str]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["cursor", "first_id", "last_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,39 @@
|
||||
"""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
|
||||
|
||||
|
||||
FileMetadataType = Literal["file",]
|
||||
|
||||
|
||||
class FileMetadataTypedDict(TypedDict):
|
||||
r"""Metadata describing a stored file."""
|
||||
|
||||
created_at: str
|
||||
downloadable: bool
|
||||
filename: str
|
||||
id: str
|
||||
mime_type: str
|
||||
size_bytes: int
|
||||
type: FileMetadataType
|
||||
|
||||
|
||||
class FileMetadata(BaseModel):
|
||||
r"""Metadata describing a stored file."""
|
||||
|
||||
created_at: str
|
||||
|
||||
downloadable: bool
|
||||
|
||||
filename: str
|
||||
|
||||
id: str
|
||||
|
||||
mime_type: str
|
||||
|
||||
size_bytes: int
|
||||
|
||||
type: FileMetadataType
|
||||
@@ -1,14 +1,26 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
FusionPluginID = Literal["fusion",]
|
||||
|
||||
|
||||
PresetEnum = Union[
|
||||
Literal[
|
||||
"general-high",
|
||||
"general-budget",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
|
||||
|
||||
class FusionPluginToolTypedDict(TypedDict):
|
||||
type: str
|
||||
r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\")."""
|
||||
@@ -34,6 +46,8 @@ class FusionPluginTypedDict(TypedDict):
|
||||
r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16."""
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
||||
preset: NotRequired[PresetEnum]
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
tools: NotRequired[List[FusionPluginToolTypedDict]]
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -53,5 +67,10 @@ class FusionPlugin(BaseModel):
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
||||
|
||||
preset: Annotated[
|
||||
Optional[PresetEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
|
||||
tools: Optional[List[FusionPluginTool]] = None
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -84,6 +84,10 @@ from .outputfunctioncallitem import (
|
||||
OutputFunctionCallItem,
|
||||
OutputFunctionCallItemTypedDict,
|
||||
)
|
||||
from .outputfusionservertoolitem import (
|
||||
OutputFusionServerToolItem,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
)
|
||||
from .outputimagegenerationcallitem import (
|
||||
OutputImageGenerationCallItem,
|
||||
OutputImageGenerationCallItemTypedDict,
|
||||
@@ -104,6 +108,10 @@ from .outputsearchmodelsservertoolitem import (
|
||||
OutputSearchModelsServerToolItem,
|
||||
OutputSearchModelsServerToolItemTypedDict,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
@@ -388,44 +396,46 @@ InputsUnion1TypedDict = TypeAliasType(
|
||||
OutputFileSearchCallItemTypedDict,
|
||||
EasyInputMessageTypedDict,
|
||||
InputMessageItemTypedDict,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
LocalShellCallOutputItemTypedDict,
|
||||
OutputToolSearchServerToolItemTypedDict,
|
||||
OutputFileSearchServerToolItemTypedDict,
|
||||
OutputWebSearchServerToolItemTypedDict,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
OutputImageGenerationCallItemTypedDict,
|
||||
OutputWebSearchCallItemTypedDict,
|
||||
OutputDatetimeItemTypedDict,
|
||||
OutputMcpServerToolItemTypedDict,
|
||||
FunctionCallOutputItemTypedDict,
|
||||
LocalShellCallItemTypedDict,
|
||||
OutputSearchModelsServerToolItemTypedDict,
|
||||
FunctionCallOutputItemTypedDict,
|
||||
ApplyPatchCallItemTypedDict,
|
||||
OutputDatetimeItemTypedDict,
|
||||
McpApprovalResponseItemTypedDict,
|
||||
McpApprovalRequestItemTypedDict,
|
||||
McpListToolsItemTypedDict,
|
||||
ApplyPatchCallOutputItemTypedDict,
|
||||
McpApprovalResponseItemTypedDict,
|
||||
OutputBrowserUseServerToolItemTypedDict,
|
||||
McpApprovalRequestItemTypedDict,
|
||||
OutputMcpServerToolItemTypedDict,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
OutputApplyPatchServerToolItemTypedDict,
|
||||
CustomToolCallItemTypedDict,
|
||||
ShellCallItemTypedDict,
|
||||
InputsMessageTypedDict,
|
||||
OutputMemoryServerToolItemTypedDict,
|
||||
OutputCustomToolCallItemTypedDict,
|
||||
ShellCallItemTypedDict,
|
||||
ShellCallOutputItemTypedDict,
|
||||
OutputComputerCallItemTypedDict,
|
||||
OutputCodeInterpreterCallItemTypedDict,
|
||||
OutputImageGenerationServerToolItemTypedDict,
|
||||
OutputBashServerToolItemTypedDict,
|
||||
OutputCustomToolCallItemTypedDict,
|
||||
OutputComputerCallItemTypedDict,
|
||||
CustomToolCallItemTypedDict,
|
||||
ShellCallOutputItemTypedDict,
|
||||
McpCallItemTypedDict,
|
||||
OutputImageGenerationServerToolItemTypedDict,
|
||||
OutputFunctionCallItemTypedDict,
|
||||
OutputBashServerToolItemTypedDict,
|
||||
FunctionCallItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputWebFetchServerToolItemTypedDict,
|
||||
ReasoningItemTypedDict,
|
||||
OutputCodeInterpreterServerToolItemTypedDict,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
InputsReasoningTypedDict,
|
||||
OutputCodeInterpreterServerToolItemTypedDict,
|
||||
OutputWebFetchServerToolItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -438,44 +448,46 @@ InputsUnion1 = TypeAliasType(
|
||||
OutputFileSearchCallItem,
|
||||
EasyInputMessage,
|
||||
InputMessageItem,
|
||||
CustomToolCallOutputItem,
|
||||
LocalShellCallOutputItem,
|
||||
OutputToolSearchServerToolItem,
|
||||
OutputFileSearchServerToolItem,
|
||||
OutputWebSearchServerToolItem,
|
||||
CustomToolCallOutputItem,
|
||||
OutputImageGenerationCallItem,
|
||||
OutputWebSearchCallItem,
|
||||
OutputDatetimeItem,
|
||||
OutputMcpServerToolItem,
|
||||
FunctionCallOutputItem,
|
||||
LocalShellCallItem,
|
||||
OutputSearchModelsServerToolItem,
|
||||
FunctionCallOutputItem,
|
||||
ApplyPatchCallItem,
|
||||
OutputDatetimeItem,
|
||||
McpApprovalResponseItem,
|
||||
McpApprovalRequestItem,
|
||||
McpListToolsItem,
|
||||
ApplyPatchCallOutputItem,
|
||||
McpApprovalResponseItem,
|
||||
OutputBrowserUseServerToolItem,
|
||||
McpApprovalRequestItem,
|
||||
OutputMcpServerToolItem,
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputApplyPatchServerToolItem,
|
||||
CustomToolCallItem,
|
||||
ShellCallItem,
|
||||
InputsMessage,
|
||||
OutputMemoryServerToolItem,
|
||||
OutputCustomToolCallItem,
|
||||
ShellCallItem,
|
||||
ShellCallOutputItem,
|
||||
OutputComputerCallItem,
|
||||
OutputCodeInterpreterCallItem,
|
||||
OutputImageGenerationServerToolItem,
|
||||
OutputBashServerToolItem,
|
||||
OutputCustomToolCallItem,
|
||||
OutputComputerCallItem,
|
||||
CustomToolCallItem,
|
||||
ShellCallOutputItem,
|
||||
McpCallItem,
|
||||
OutputImageGenerationServerToolItem,
|
||||
OutputFunctionCallItem,
|
||||
OutputBashServerToolItem,
|
||||
FunctionCallItem,
|
||||
OutputAdvisorServerToolItem,
|
||||
OutputWebFetchServerToolItem,
|
||||
ReasoningItem,
|
||||
OutputCodeInterpreterServerToolItem,
|
||||
OutputSubagentServerToolItem,
|
||||
InputsReasoning,
|
||||
OutputCodeInterpreterServerToolItem,
|
||||
OutputWebFetchServerToolItem,
|
||||
OutputAdvisorServerToolItem,
|
||||
OutputFusionServerToolItem,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ class LegacyWebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: LegacyWebSearchServerToolType
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
|
||||
@@ -45,12 +45,12 @@ class LegacyWebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsResponseTypedDict(TypedDict):
|
||||
data: List[WorkspaceBudgetTypedDict]
|
||||
r"""List of budgets configured for the workspace"""
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsResponse(BaseModel):
|
||||
data: List[WorkspaceBudget]
|
||||
r"""List of budgets configured for the workspace"""
|
||||
@@ -0,0 +1,33 @@
|
||||
"""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
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class MessagesFallbackParamTypedDict(TypedDict):
|
||||
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
|
||||
|
||||
model: str
|
||||
|
||||
|
||||
class MessagesFallbackParam(BaseModel):
|
||||
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
)
|
||||
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
|
||||
|
||||
model: str
|
||||
|
||||
@property
|
||||
def additional_properties(self):
|
||||
return self.__pydantic_extra__
|
||||
|
||||
@additional_properties.setter
|
||||
def additional_properties(self, value):
|
||||
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
@@ -50,6 +50,7 @@ from .imagegenerationservertool_openrouter import (
|
||||
ImageGenerationServerToolOpenRouter,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict
|
||||
from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict
|
||||
from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict
|
||||
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
|
||||
@@ -1046,6 +1047,8 @@ class MessagesRequestTypedDict(TypedDict):
|
||||
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."""
|
||||
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."""
|
||||
max_tokens: NotRequired[int]
|
||||
metadata: NotRequired[MetadataTypedDict]
|
||||
models: NotRequired[List[str]]
|
||||
@@ -1088,6 +1091,9 @@ class MessagesRequest(BaseModel):
|
||||
|
||||
context_management: OptionalNullable[ContextManagement] = UNSET
|
||||
|
||||
fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET
|
||||
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
|
||||
|
||||
max_tokens: Optional[int] = None
|
||||
|
||||
metadata: Optional[Metadata] = None
|
||||
@@ -1144,6 +1150,7 @@ class MessagesRequest(BaseModel):
|
||||
optional_fields = [
|
||||
"cache_control",
|
||||
"context_management",
|
||||
"fallbacks",
|
||||
"max_tokens",
|
||||
"metadata",
|
||||
"models",
|
||||
@@ -1166,7 +1173,13 @@ class MessagesRequest(BaseModel):
|
||||
"trace",
|
||||
"user",
|
||||
]
|
||||
nullable_fields = ["context_management", "messages", "provider", "speed"]
|
||||
nullable_fields = [
|
||||
"context_management",
|
||||
"fallbacks",
|
||||
"messages",
|
||||
"provider",
|
||||
"speed",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
from .parameter import Parameter
|
||||
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
|
||||
@@ -51,6 +52,8 @@ class ModelTypedDict(TypedDict):
|
||||
r"""List of supported voice identifiers for TTS models. Null for non-TTS models."""
|
||||
top_provider: TopProviderInfoTypedDict
|
||||
r"""Information about the top provider for this model"""
|
||||
benchmarks: NotRequired[ModelBenchmarksTypedDict]
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
description: NotRequired[str]
|
||||
r"""Description of the model"""
|
||||
expiration_date: NotRequired[Nullable[str]]
|
||||
@@ -105,6 +108,9 @@ class Model(BaseModel):
|
||||
top_provider: TopProviderInfo
|
||||
r"""Information about the top provider for this model"""
|
||||
|
||||
benchmarks: Optional[ModelBenchmarks] = None
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
description: Optional[str] = None
|
||||
r"""Description of the model"""
|
||||
|
||||
@@ -120,6 +126,7 @@ class Model(BaseModel):
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"benchmarks",
|
||||
"description",
|
||||
"expiration_date",
|
||||
"hugging_face_id",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
|
||||
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ModelBenchmarksTypedDict(TypedDict):
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
design_arena: List[DABenchmarkEntryTypedDict]
|
||||
r"""Design Arena ELO rankings across arena+category pairs."""
|
||||
artificial_analysis: NotRequired[AABenchmarkEntryTypedDict]
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
|
||||
class ModelBenchmarks(BaseModel):
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
design_arena: List[DABenchmarkEntry]
|
||||
r"""Design Arena ELO rankings across arena+category pairs."""
|
||||
|
||||
artificial_analysis: Optional[AABenchmarkEntry] = None
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .model import Model, ModelTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ModelResponseTypedDict(TypedDict):
|
||||
r"""Single model response"""
|
||||
|
||||
data: ModelTypedDict
|
||||
r"""Information about an AI model available on OpenRouter"""
|
||||
|
||||
|
||||
class ModelResponse(BaseModel):
|
||||
r"""Single model response"""
|
||||
|
||||
data: Model
|
||||
r"""Information about an AI model available on OpenRouter"""
|
||||
@@ -81,6 +81,10 @@ from .outputshellcalloutputitem import (
|
||||
OutputShellCallOutputItem,
|
||||
OutputShellCallOutputItemTypedDict,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
@@ -138,6 +142,7 @@ OutputItemsTypedDict = TypeAliasType(
|
||||
OutputReasoningItemTypedDict,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
],
|
||||
)
|
||||
r"""An output item from the response"""
|
||||
@@ -172,6 +177,7 @@ OutputItems = Annotated[
|
||||
],
|
||||
Annotated[OutputMcpServerToolItem, Tag("openrouter:mcp")],
|
||||
Annotated[OutputMemoryServerToolItem, Tag("openrouter:memory")],
|
||||
Annotated[OutputSubagentServerToolItem, Tag("openrouter:subagent")],
|
||||
Annotated[OutputTextEditorServerToolItem, Tag("openrouter:text_editor")],
|
||||
Annotated[OutputToolSearchServerToolItem, Tag("openrouter:tool_search")],
|
||||
Annotated[OutputWebFetchServerToolItem, Tag("openrouter:web_fetch")],
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .toolcallstatus import ToolCallStatus
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
OutputSubagentServerToolItemType = Literal["openrouter:subagent",]
|
||||
|
||||
|
||||
class OutputSubagentServerToolItemTypedDict(TypedDict):
|
||||
r"""An openrouter:subagent server tool output item"""
|
||||
|
||||
status: ToolCallStatus
|
||||
type: OutputSubagentServerToolItemType
|
||||
error: NotRequired[str]
|
||||
r"""Error message when the subagent task did not produce an outcome."""
|
||||
id: NotRequired[str]
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the worker model that executed the task."""
|
||||
outcome: NotRequired[str]
|
||||
r"""The worker model's result (the outcome text returned to the delegating model)."""
|
||||
task_description: NotRequired[str]
|
||||
r"""The task description the delegating model sent to the worker."""
|
||||
task_name: NotRequired[str]
|
||||
r"""The short task identifier the delegating model supplied."""
|
||||
|
||||
|
||||
class OutputSubagentServerToolItem(BaseModel):
|
||||
r"""An openrouter:subagent server tool output item"""
|
||||
|
||||
status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))]
|
||||
|
||||
type: OutputSubagentServerToolItemType
|
||||
|
||||
error: Optional[str] = None
|
||||
r"""Error message when the subagent task did not produce an outcome."""
|
||||
|
||||
id: Optional[str] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the worker model that executed the task."""
|
||||
|
||||
outcome: Optional[str] = None
|
||||
r"""The worker model's result (the outcome text returned to the delegating model)."""
|
||||
|
||||
task_description: Optional[str] = None
|
||||
r"""The task description the delegating model sent to the worker."""
|
||||
|
||||
task_name: Optional[str] = None
|
||||
r"""The short task identifier the delegating model supplied."""
|
||||
@@ -30,10 +30,10 @@ class Preview20250311WebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: Preview20250311WebSearchServerToolType
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
|
||||
@@ -47,12 +47,12 @@ class Preview20250311WebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -30,10 +30,10 @@ class PreviewWebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: PreviewWebSearchServerToolType
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
|
||||
@@ -47,12 +47,12 @@ class PreviewWebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ProviderOptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ai21: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -128,7 +128,7 @@ class ProviderOptionsTypedDict(TypedDict):
|
||||
|
||||
|
||||
class ProviderOptions(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
Version = Literal["v1",]
|
||||
RankingsDailyMetaVersion = Literal["v1",]
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class RankingsDailyMetaTypedDict(TypedDict):
|
||||
r"""Resolved end of the date window (UTC, inclusive)."""
|
||||
start_date: str
|
||||
r"""Resolved start of the date window (UTC, inclusive)."""
|
||||
version: Version
|
||||
version: RankingsDailyMetaVersion
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
|
||||
@@ -31,5 +31,5 @@ class RankingsDailyMeta(BaseModel):
|
||||
start_date: str
|
||||
r"""Resolved start of the date window (UTC, inclusive)."""
|
||||
|
||||
version: Version
|
||||
version: RankingsDailyMetaVersion
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
@@ -84,6 +84,10 @@ from .stopservertoolswhencondition import (
|
||||
StopServerToolsWhenConditionTypedDict,
|
||||
)
|
||||
from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict
|
||||
from .traceconfig import TraceConfig, TraceConfigTypedDict
|
||||
from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict
|
||||
@@ -217,16 +221,17 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
CodexLocalShellToolTypedDict,
|
||||
ApplyPatchServerToolTypedDict,
|
||||
ShellServerToolTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
ShellServerToolOpenRouterTypedDict,
|
||||
BashServerToolTypedDict,
|
||||
CodeInterpreterServerToolTypedDict,
|
||||
ApplyPatchServerToolOpenRouterTypedDict,
|
||||
WebSearchServerToolOpenRouterTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
FusionServerToolOpenRouterTypedDict,
|
||||
DatetimeServerToolTypedDict,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
AdvisorServerToolOpenRouterTypedDict,
|
||||
CustomToolTypedDict,
|
||||
ComputerUseServerToolTypedDict,
|
||||
@@ -234,8 +239,8 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
FileSearchServerToolTypedDict,
|
||||
PreviewWebSearchServerToolTypedDict,
|
||||
Preview20250311WebSearchServerToolTypedDict,
|
||||
LegacyWebSearchServerToolTypedDict,
|
||||
WebSearchServerToolTypedDict,
|
||||
LegacyWebSearchServerToolTypedDict,
|
||||
McpServerToolTypedDict,
|
||||
ImageGenerationServerToolTypedDict,
|
||||
],
|
||||
@@ -261,6 +266,7 @@ ResponsesRequestToolUnion = Annotated[
|
||||
Annotated[ApplyPatchServerTool, Tag("apply_patch")],
|
||||
Annotated[CustomTool, Tag("custom")],
|
||||
Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")],
|
||||
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
|
||||
Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
|
||||
Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")],
|
||||
Annotated[
|
||||
|
||||
@@ -13,4 +13,4 @@ SearchQualityLevel = Union[
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
@@ -13,14 +13,14 @@ class SpeechRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[ProviderOptionsTypedDict]
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class SpeechRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[ProviderOptions] = None
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
ResponseFormatEnum = Union[
|
||||
|
||||
@@ -12,14 +12,14 @@ class STTRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[ProviderOptionsTypedDict]
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class STTRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[ProviderOptions] = None
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class STTRequestTypedDict(TypedDict):
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""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 SubagentNestedToolTypedDict(TypedDict):
|
||||
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself."""
|
||||
|
||||
type: str
|
||||
parameters: NotRequired[Dict[str, Nullable[Any]]]
|
||||
|
||||
|
||||
class SubagentNestedTool(BaseModel):
|
||||
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent 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
|
||||
|
||||
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
|
||||
|
||||
|
||||
SubagentReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
|
||||
|
||||
class SubagentReasoningTypedDict(TypedDict):
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
effort: NotRequired[SubagentReasoningEffort]
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
max_tokens: NotRequired[int]
|
||||
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
|
||||
|
||||
|
||||
class SubagentReasoning(BaseModel):
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
effort: Annotated[
|
||||
Optional[SubagentReasoningEffort], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
|
||||
max_tokens: Optional[int] = None
|
||||
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .subagentservertoolconfig import (
|
||||
SubagentServerToolConfig,
|
||||
SubagentServerToolConfigTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
SubagentServerToolOpenRouterType = Literal["openrouter:subagent",]
|
||||
|
||||
|
||||
class SubagentServerToolOpenRouterTypedDict(TypedDict):
|
||||
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
|
||||
|
||||
type: SubagentServerToolOpenRouterType
|
||||
parameters: NotRequired[SubagentServerToolConfigTypedDict]
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
|
||||
class SubagentServerToolOpenRouter(BaseModel):
|
||||
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
|
||||
|
||||
type: SubagentServerToolOpenRouterType
|
||||
|
||||
parameters: Optional[SubagentServerToolConfig] = None
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
@@ -0,0 +1,52 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
|
||||
from .subagentreasoning import SubagentReasoning, SubagentReasoningTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class SubagentServerToolConfigTypedDict(TypedDict):
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
instructions: NotRequired[str]
|
||||
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
|
||||
max_completion_tokens: NotRequired[int]
|
||||
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
|
||||
max_tool_calls: NotRequired[int]
|
||||
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
|
||||
reasoning: NotRequired[SubagentReasoningTypedDict]
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
temperature: NotRequired[float]
|
||||
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
|
||||
tools: NotRequired[List[SubagentNestedToolTypedDict]]
|
||||
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
|
||||
|
||||
|
||||
class SubagentServerToolConfig(BaseModel):
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
instructions: Optional[str] = None
|
||||
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
|
||||
|
||||
max_completion_tokens: Optional[int] = None
|
||||
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
|
||||
|
||||
max_tool_calls: Optional[int] = None
|
||||
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
|
||||
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
|
||||
|
||||
reasoning: Optional[SubagentReasoning] = None
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
temperature: Optional[float] = None
|
||||
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
|
||||
|
||||
tools: Optional[List[SubagentNestedTool]] = None
|
||||
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
|
||||
@@ -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 UpsertWorkspaceBudgetRequestTypedDict(TypedDict):
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD. Must be greater than 0."""
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetRequest(BaseModel):
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD. Must be greater than 0."""
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetResponseTypedDict(TypedDict):
|
||||
data: WorkspaceBudgetTypedDict
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetResponse(BaseModel):
|
||||
data: WorkspaceBudget
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
URLCitationType = Literal["url_citation",]
|
||||
@@ -15,6 +15,7 @@ class URLCitationTypedDict(TypedDict):
|
||||
title: str
|
||||
type: URLCitationType
|
||||
url: str
|
||||
content: NotRequired[str]
|
||||
|
||||
|
||||
class URLCitation(BaseModel):
|
||||
@@ -27,3 +28,5 @@ class URLCitation(BaseModel):
|
||||
type: URLCitationType
|
||||
|
||||
url: str
|
||||
|
||||
content: Optional[str] = None
|
||||
|
||||
@@ -29,7 +29,7 @@ r"""Aspect ratio of the generated video"""
|
||||
|
||||
|
||||
class OptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ai21: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -149,7 +149,7 @@ class OptionsTypedDict(TypedDict):
|
||||
|
||||
|
||||
class Options(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
|
||||
|
||||
@@ -16,40 +16,40 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
class WebSearchConfigTypedDict(TypedDict):
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). 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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
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. Defaults to 50 when not specified."""
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
|
||||
class WebSearchConfig(BaseModel):
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
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. Defaults to 50 when not specified."""
|
||||
@@ -57,7 +57,7 @@ class WebSearchConfig(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -11,6 +11,7 @@ WebSearchEngine = Union[
|
||||
"exa",
|
||||
"firecrawl",
|
||||
"parallel",
|
||||
"perplexity",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -7,12 +7,13 @@ from typing import Literal, Union
|
||||
|
||||
WebSearchEngineEnum = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"native",
|
||||
"exa",
|
||||
"parallel",
|
||||
"firecrawl",
|
||||
"perplexity",
|
||||
"auto",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
@@ -27,10 +27,10 @@ class WebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: WebSearchServerToolType
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
|
||||
@@ -45,12 +45,12 @@ class WebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -18,19 +18,19 @@ class WebSearchServerToolConfigTypedDict(TypedDict):
|
||||
r"""Configuration for the openrouter:web_search server tool"""
|
||||
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). 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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
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. Defaults to 50 when not specified."""
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -39,21 +39,21 @@ class WebSearchServerToolConfig(BaseModel):
|
||||
r"""Configuration for the openrouter:web_search server tool"""
|
||||
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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."""
|
||||
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. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
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."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). 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)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity 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). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
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."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
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. Defaults to 50 when not specified."""
|
||||
@@ -61,7 +61,7 @@ class WebSearchServerToolConfig(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
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,000–4,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."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity 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,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
ResetInterval = Union[
|
||||
Literal[
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
|
||||
|
||||
class WorkspaceBudgetTypedDict(TypedDict):
|
||||
created_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was created"""
|
||||
id: str
|
||||
r"""Unique identifier for the budget"""
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD for this interval"""
|
||||
reset_interval: Nullable[ResetInterval]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
updated_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was last updated"""
|
||||
workspace_id: str
|
||||
r"""ID of the workspace the budget belongs to"""
|
||||
|
||||
|
||||
class WorkspaceBudget(BaseModel):
|
||||
created_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was created"""
|
||||
|
||||
id: str
|
||||
r"""Unique identifier for the budget"""
|
||||
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD for this interval"""
|
||||
|
||||
reset_interval: Annotated[
|
||||
Nullable[ResetInterval], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
|
||||
updated_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was last updated"""
|
||||
|
||||
workspace_id: str
|
||||
r"""ID of the workspace the budget belongs to"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["reset_interval"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
WorkspaceBudgetInterval = Union[
|
||||
Literal[
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
"lifetime",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
@@ -426,6 +426,542 @@ class Datasets(BaseSDK):
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def get_benchmarks_artificial_analysis(
|
||||
self,
|
||||
*,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
max_results: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.BenchmarksAAResponse:
|
||||
r"""Artificial Analysis Benchmark Indices
|
||||
|
||||
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param max_results: Max results to return (1–100, default 50).
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetBenchmarksArtificialAnalysisRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
max_results=max_results,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="GET",
|
||||
path="/datasets/benchmarks/artificial-analysis",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getBenchmarksArtificialAnalysis",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "429", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.TooManyRequestsResponseErrorData, http_res
|
||||
)
|
||||
raise errors.TooManyRequestsResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def get_benchmarks_artificial_analysis_async(
|
||||
self,
|
||||
*,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
max_results: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.BenchmarksAAResponse:
|
||||
r"""Artificial Analysis Benchmark Indices
|
||||
|
||||
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param max_results: Max results to return (1–100, default 50).
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetBenchmarksArtificialAnalysisRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
max_results=max_results,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="GET",
|
||||
path="/datasets/benchmarks/artificial-analysis",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getBenchmarksArtificialAnalysis",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "429", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.TooManyRequestsResponseErrorData, http_res
|
||||
)
|
||||
raise errors.TooManyRequestsResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def get_benchmarks_design_arena(
|
||||
self,
|
||||
*,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
arena: Optional[operations.Arena] = "models",
|
||||
category: Optional[str] = None,
|
||||
max_results: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.BenchmarksDAResponse:
|
||||
r"""Design Arena Benchmark Rankings
|
||||
|
||||
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param arena: Arena to query. Defaults to `models`.
|
||||
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
|
||||
:param max_results: Max results to return: per category when no category filter is applied (1–100, default 50).
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetBenchmarksDesignArenaRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
arena=arena,
|
||||
category=category,
|
||||
max_results=max_results,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="GET",
|
||||
path="/datasets/benchmarks/design-arena",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetBenchmarksDesignArenaGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getBenchmarksDesignArena",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "429", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.TooManyRequestsResponseErrorData, http_res
|
||||
)
|
||||
raise errors.TooManyRequestsResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def get_benchmarks_design_arena_async(
|
||||
self,
|
||||
*,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
arena: Optional[operations.Arena] = "models",
|
||||
category: Optional[str] = None,
|
||||
max_results: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.BenchmarksDAResponse:
|
||||
r"""Design Arena Benchmark Rankings
|
||||
|
||||
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param arena: Arena to query. Defaults to `models`.
|
||||
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
|
||||
:param max_results: Max results to return: per category when no category filter is applied (1–100, default 50).
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetBenchmarksDesignArenaRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
arena=arena,
|
||||
category=category,
|
||||
max_results=max_results,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="GET",
|
||||
path="/datasets/benchmarks/design-arena",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetBenchmarksDesignArenaGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getBenchmarksDesignArena",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "429", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.TooManyRequestsResponseErrorData, http_res
|
||||
)
|
||||
raise errors.TooManyRequestsResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def get_rankings_daily(
|
||||
self,
|
||||
*,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,254 @@ from typing import Any, Mapping, Optional, Union
|
||||
class Models(BaseSDK):
|
||||
r"""Model information endpoints"""
|
||||
|
||||
def get(
|
||||
self,
|
||||
*,
|
||||
author: str,
|
||||
slug: str,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelResponse:
|
||||
r"""Get a model by its slug
|
||||
|
||||
Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
|
||||
|
||||
:param author: The author/organization of the model
|
||||
:param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetModelRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
author=author,
|
||||
slug=slug,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="GET",
|
||||
path="/model/{author}/{slug}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetModelGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getModel",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelResponse, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def get_async(
|
||||
self,
|
||||
*,
|
||||
author: str,
|
||||
slug: str,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelResponse:
|
||||
r"""Get a model by its slug
|
||||
|
||||
Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.
|
||||
|
||||
:param author: The author/organization of the model
|
||||
:param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.GetModelRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
author=author,
|
||||
slug=slug,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="GET",
|
||||
path="/model/{author}/{slug}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.GetModelGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="getModel",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelResponse, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
@@ -22,6 +270,17 @@ class Models(BaseSDK):
|
||||
supported_parameters: Optional[str] = None,
|
||||
output_modalities: Optional[str] = None,
|
||||
sort: Optional[operations.GetModelsSort] = None,
|
||||
q: Optional[str] = None,
|
||||
input_modalities: Optional[str] = None,
|
||||
context: Optional[int] = None,
|
||||
min_price: OptionalNullable[float] = UNSET,
|
||||
max_price: OptionalNullable[float] = UNSET,
|
||||
arch: Optional[str] = None,
|
||||
model_authors: Optional[str] = None,
|
||||
providers: Optional[str] = None,
|
||||
distillable: Optional[operations.Distillable] = None,
|
||||
zdr: Optional[operations.Zdr] = None,
|
||||
region: Optional[operations.Region] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -40,6 +299,17 @@ class Models(BaseSDK):
|
||||
:param supported_parameters: Filter models by supported parameter (comma-separated)
|
||||
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
|
||||
:param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.
|
||||
:param q: Free-text search by model name or slug.
|
||||
:param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file.
|
||||
:param context: Minimum context length (tokens). Models with smaller context are excluded.
|
||||
:param min_price: Minimum prompt price in $/M tokens.
|
||||
:param max_price: Maximum prompt price in $/M tokens.
|
||||
:param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).
|
||||
:param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs.
|
||||
:param providers: Filter models by hosting provider. Comma-separated list of provider names.
|
||||
:param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.
|
||||
:param zdr: When set to \"true\", return only models with zero data retention endpoints.
|
||||
:param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -63,6 +333,17 @@ class Models(BaseSDK):
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
sort=sort,
|
||||
q=q,
|
||||
input_modalities=input_modalities,
|
||||
context=context,
|
||||
min_price=min_price,
|
||||
max_price=max_price,
|
||||
arch=arch,
|
||||
model_authors=model_authors,
|
||||
providers=providers,
|
||||
distillable=distillable,
|
||||
zdr=zdr,
|
||||
region=region,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -150,6 +431,17 @@ class Models(BaseSDK):
|
||||
supported_parameters: Optional[str] = None,
|
||||
output_modalities: Optional[str] = None,
|
||||
sort: Optional[operations.GetModelsSort] = None,
|
||||
q: Optional[str] = None,
|
||||
input_modalities: Optional[str] = None,
|
||||
context: Optional[int] = None,
|
||||
min_price: OptionalNullable[float] = UNSET,
|
||||
max_price: OptionalNullable[float] = UNSET,
|
||||
arch: Optional[str] = None,
|
||||
model_authors: Optional[str] = None,
|
||||
providers: Optional[str] = None,
|
||||
distillable: Optional[operations.Distillable] = None,
|
||||
zdr: Optional[operations.Zdr] = None,
|
||||
region: Optional[operations.Region] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -168,6 +460,17 @@ class Models(BaseSDK):
|
||||
:param supported_parameters: Filter models by supported parameter (comma-separated)
|
||||
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
|
||||
:param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.
|
||||
:param q: Free-text search by model name or slug.
|
||||
:param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file.
|
||||
:param context: Minimum context length (tokens). Models with smaller context are excluded.
|
||||
:param min_price: Minimum prompt price in $/M tokens.
|
||||
:param max_price: Maximum prompt price in $/M tokens.
|
||||
:param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).
|
||||
:param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs.
|
||||
:param providers: Filter models by hosting provider. Comma-separated list of provider names.
|
||||
:param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.
|
||||
:param zdr: When set to \"true\", return only models with zero data retention endpoints.
|
||||
:param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -191,6 +494,17 @@ class Models(BaseSDK):
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
sort=sort,
|
||||
q=q,
|
||||
input_modalities=input_modalities,
|
||||
context=context,
|
||||
min_price=min_price,
|
||||
max_price=max_price,
|
||||
arch=arch,
|
||||
model_authors=model_authors,
|
||||
providers=providers,
|
||||
distillable=distillable,
|
||||
zdr=zdr,
|
||||
region=region,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
|
||||
+20
-4
@@ -318,6 +318,7 @@ class OAuth(BaseSDK):
|
||||
key_label: Optional[str] = None,
|
||||
limit: Optional[float] = None,
|
||||
usage_limit_type: Optional[operations.UsageLimitType] = None,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -327,7 +328,7 @@ class OAuth(BaseSDK):
|
||||
|
||||
Create an authorization code for the PKCE flow to generate a user-controlled API key
|
||||
|
||||
:param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.
|
||||
:param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
@@ -341,6 +342,7 @@ class OAuth(BaseSDK):
|
||||
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
:param limit: Credit limit for the API key to be created
|
||||
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
:param workspace_id: Optional workspace ID to associate the API key with
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -368,6 +370,7 @@ class OAuth(BaseSDK):
|
||||
key_label=key_label,
|
||||
limit=limit,
|
||||
usage_limit_type=usage_limit_type,
|
||||
workspace_id=workspace_id,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -423,7 +426,7 @@ class OAuth(BaseSDK):
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
|
||||
error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
@@ -442,6 +445,11 @@ class OAuth(BaseSDK):
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "403", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ForbiddenResponseErrorData, http_res
|
||||
)
|
||||
raise errors.ForbiddenResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "409", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ConflictResponseErrorData, http_res
|
||||
@@ -480,6 +488,7 @@ class OAuth(BaseSDK):
|
||||
key_label: Optional[str] = None,
|
||||
limit: Optional[float] = None,
|
||||
usage_limit_type: Optional[operations.UsageLimitType] = None,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -489,7 +498,7 @@ class OAuth(BaseSDK):
|
||||
|
||||
Create an authorization code for the PKCE flow to generate a user-controlled API key
|
||||
|
||||
:param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.
|
||||
:param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
@@ -503,6 +512,7 @@ class OAuth(BaseSDK):
|
||||
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
:param limit: Credit limit for the API key to be created
|
||||
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
:param workspace_id: Optional workspace ID to associate the API key with
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -530,6 +540,7 @@ class OAuth(BaseSDK):
|
||||
key_label=key_label,
|
||||
limit=limit,
|
||||
usage_limit_type=usage_limit_type,
|
||||
workspace_id=workspace_id,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -585,7 +596,7 @@ class OAuth(BaseSDK):
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
|
||||
error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
@@ -604,6 +615,11 @@ class OAuth(BaseSDK):
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "403", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ForbiddenResponseErrorData, http_res
|
||||
)
|
||||
raise errors.ForbiddenResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "409", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ConflictResponseErrorData, http_res
|
||||
|
||||
@@ -202,6 +202,12 @@ if TYPE_CHECKING:
|
||||
DeleteBYOKKeyRequest,
|
||||
DeleteBYOKKeyRequestTypedDict,
|
||||
)
|
||||
from .deletefile import (
|
||||
DeleteFileGlobals,
|
||||
DeleteFileGlobalsTypedDict,
|
||||
DeleteFileRequest,
|
||||
DeleteFileRequestTypedDict,
|
||||
)
|
||||
from .deleteguardrail import (
|
||||
DeleteGuardrailGlobals,
|
||||
DeleteGuardrailGlobalsTypedDict,
|
||||
@@ -228,6 +234,18 @@ if TYPE_CHECKING:
|
||||
DeleteWorkspaceRequest,
|
||||
DeleteWorkspaceRequestTypedDict,
|
||||
)
|
||||
from .deleteworkspacebudget import (
|
||||
DeleteWorkspaceBudgetGlobals,
|
||||
DeleteWorkspaceBudgetGlobalsTypedDict,
|
||||
DeleteWorkspaceBudgetRequest,
|
||||
DeleteWorkspaceBudgetRequestTypedDict,
|
||||
)
|
||||
from .downloadfilecontent import (
|
||||
DownloadFileContentGlobals,
|
||||
DownloadFileContentGlobalsTypedDict,
|
||||
DownloadFileContentRequest,
|
||||
DownloadFileContentRequestTypedDict,
|
||||
)
|
||||
from .exchangeauthcodeforapikey import (
|
||||
ExchangeAuthCodeForAPIKeyCodeChallengeMethod,
|
||||
ExchangeAuthCodeForAPIKeyGlobals,
|
||||
@@ -272,6 +290,19 @@ if TYPE_CHECKING:
|
||||
GetAppRankingsSort,
|
||||
Subcategory,
|
||||
)
|
||||
from .getbenchmarksartificialanalysis import (
|
||||
GetBenchmarksArtificialAnalysisGlobals,
|
||||
GetBenchmarksArtificialAnalysisGlobalsTypedDict,
|
||||
GetBenchmarksArtificialAnalysisRequest,
|
||||
GetBenchmarksArtificialAnalysisRequestTypedDict,
|
||||
)
|
||||
from .getbenchmarksdesignarena import (
|
||||
Arena,
|
||||
GetBenchmarksDesignArenaGlobals,
|
||||
GetBenchmarksDesignArenaGlobalsTypedDict,
|
||||
GetBenchmarksDesignArenaRequest,
|
||||
GetBenchmarksDesignArenaRequestTypedDict,
|
||||
)
|
||||
from .getbyokkey import (
|
||||
GetBYOKKeyGlobals,
|
||||
GetBYOKKeyGlobalsTypedDict,
|
||||
@@ -300,6 +331,12 @@ if TYPE_CHECKING:
|
||||
RateLimit,
|
||||
RateLimitTypedDict,
|
||||
)
|
||||
from .getfilemetadata import (
|
||||
GetFileMetadataGlobals,
|
||||
GetFileMetadataGlobalsTypedDict,
|
||||
GetFileMetadataRequest,
|
||||
GetFileMetadataRequestTypedDict,
|
||||
)
|
||||
from .getgeneration import (
|
||||
GetGenerationGlobals,
|
||||
GetGenerationGlobalsTypedDict,
|
||||
@@ -322,13 +359,22 @@ if TYPE_CHECKING:
|
||||
GetKeyResponse,
|
||||
GetKeyResponseTypedDict,
|
||||
)
|
||||
from .getmodel import (
|
||||
GetModelGlobals,
|
||||
GetModelGlobalsTypedDict,
|
||||
GetModelRequest,
|
||||
GetModelRequestTypedDict,
|
||||
)
|
||||
from .getmodels import (
|
||||
Distillable,
|
||||
GetModelsCategory,
|
||||
GetModelsGlobals,
|
||||
GetModelsGlobalsTypedDict,
|
||||
GetModelsRequest,
|
||||
GetModelsRequestTypedDict,
|
||||
GetModelsSort,
|
||||
Region,
|
||||
Zdr,
|
||||
)
|
||||
from .getobservabilitydestination import (
|
||||
GetObservabilityDestinationGlobals,
|
||||
@@ -413,6 +459,14 @@ if TYPE_CHECKING:
|
||||
ListEndpointsZdrResponse,
|
||||
ListEndpointsZdrResponseTypedDict,
|
||||
)
|
||||
from .listfiles import (
|
||||
ListFilesGlobals,
|
||||
ListFilesGlobalsTypedDict,
|
||||
ListFilesRequest,
|
||||
ListFilesRequestTypedDict,
|
||||
ListFilesResponse,
|
||||
ListFilesResponseTypedDict,
|
||||
)
|
||||
from .listgenerationcontent import (
|
||||
ListGenerationContentGlobals,
|
||||
ListGenerationContentGlobalsTypedDict,
|
||||
@@ -534,6 +588,12 @@ if TYPE_CHECKING:
|
||||
ListVideosModelsRequest,
|
||||
ListVideosModelsRequestTypedDict,
|
||||
)
|
||||
from .listworkspacebudgets import (
|
||||
ListWorkspaceBudgetsGlobals,
|
||||
ListWorkspaceBudgetsGlobalsTypedDict,
|
||||
ListWorkspaceBudgetsRequest,
|
||||
ListWorkspaceBudgetsRequestTypedDict,
|
||||
)
|
||||
from .listworkspaces import (
|
||||
ListWorkspacesGlobals,
|
||||
ListWorkspacesGlobalsTypedDict,
|
||||
@@ -614,8 +674,25 @@ if TYPE_CHECKING:
|
||||
UpdateWorkspaceRequest,
|
||||
UpdateWorkspaceRequestTypedDict,
|
||||
)
|
||||
from .uploadfile import (
|
||||
File,
|
||||
FileTypedDict,
|
||||
UploadFileGlobals,
|
||||
UploadFileGlobalsTypedDict,
|
||||
UploadFileRequest,
|
||||
UploadFileRequestBody,
|
||||
UploadFileRequestBodyTypedDict,
|
||||
UploadFileRequestTypedDict,
|
||||
)
|
||||
from .upsertworkspacebudget import (
|
||||
UpsertWorkspaceBudgetGlobals,
|
||||
UpsertWorkspaceBudgetGlobalsTypedDict,
|
||||
UpsertWorkspaceBudgetRequest,
|
||||
UpsertWorkspaceBudgetRequestTypedDict,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Arena",
|
||||
"BulkAddWorkspaceMembersGlobals",
|
||||
"BulkAddWorkspaceMembersGlobalsTypedDict",
|
||||
"BulkAddWorkspaceMembersRequest",
|
||||
@@ -745,6 +822,10 @@ __all__ = [
|
||||
"DeleteBYOKKeyGlobalsTypedDict",
|
||||
"DeleteBYOKKeyRequest",
|
||||
"DeleteBYOKKeyRequestTypedDict",
|
||||
"DeleteFileGlobals",
|
||||
"DeleteFileGlobalsTypedDict",
|
||||
"DeleteFileRequest",
|
||||
"DeleteFileRequestTypedDict",
|
||||
"DeleteGuardrailGlobals",
|
||||
"DeleteGuardrailGlobalsTypedDict",
|
||||
"DeleteGuardrailRequest",
|
||||
@@ -759,6 +840,10 @@ __all__ = [
|
||||
"DeleteObservabilityDestinationGlobalsTypedDict",
|
||||
"DeleteObservabilityDestinationRequest",
|
||||
"DeleteObservabilityDestinationRequestTypedDict",
|
||||
"DeleteWorkspaceBudgetGlobals",
|
||||
"DeleteWorkspaceBudgetGlobalsTypedDict",
|
||||
"DeleteWorkspaceBudgetRequest",
|
||||
"DeleteWorkspaceBudgetRequestTypedDict",
|
||||
"DeleteWorkspaceGlobals",
|
||||
"DeleteWorkspaceGlobalsTypedDict",
|
||||
"DeleteWorkspaceRequest",
|
||||
@@ -767,12 +852,17 @@ __all__ = [
|
||||
"DimensionTypedDict",
|
||||
"Direction",
|
||||
"DisplayFormat",
|
||||
"Distillable",
|
||||
"Document",
|
||||
"DocumentRequest",
|
||||
"DocumentRequestTypedDict",
|
||||
"DocumentResponse",
|
||||
"DocumentResponseTypedDict",
|
||||
"DocumentTypedDict",
|
||||
"DownloadFileContentGlobals",
|
||||
"DownloadFileContentGlobalsTypedDict",
|
||||
"DownloadFileContentRequest",
|
||||
"DownloadFileContentRequestTypedDict",
|
||||
"Embedding",
|
||||
"EmbeddingTypedDict",
|
||||
"EncodingFormat",
|
||||
@@ -785,6 +875,8 @@ __all__ = [
|
||||
"ExchangeAuthCodeForAPIKeyRequestTypedDict",
|
||||
"ExchangeAuthCodeForAPIKeyResponse",
|
||||
"ExchangeAuthCodeForAPIKeyResponseTypedDict",
|
||||
"File",
|
||||
"FileTypedDict",
|
||||
"Filter",
|
||||
"FilterTypedDict",
|
||||
"GetAnalyticsMetaData",
|
||||
@@ -807,6 +899,14 @@ __all__ = [
|
||||
"GetBYOKKeyGlobalsTypedDict",
|
||||
"GetBYOKKeyRequest",
|
||||
"GetBYOKKeyRequestTypedDict",
|
||||
"GetBenchmarksArtificialAnalysisGlobals",
|
||||
"GetBenchmarksArtificialAnalysisGlobalsTypedDict",
|
||||
"GetBenchmarksArtificialAnalysisRequest",
|
||||
"GetBenchmarksArtificialAnalysisRequestTypedDict",
|
||||
"GetBenchmarksDesignArenaGlobals",
|
||||
"GetBenchmarksDesignArenaGlobalsTypedDict",
|
||||
"GetBenchmarksDesignArenaRequest",
|
||||
"GetBenchmarksDesignArenaRequestTypedDict",
|
||||
"GetCreditsData",
|
||||
"GetCreditsDataTypedDict",
|
||||
"GetCreditsGlobals",
|
||||
@@ -823,6 +923,10 @@ __all__ = [
|
||||
"GetCurrentKeyRequestTypedDict",
|
||||
"GetCurrentKeyResponse",
|
||||
"GetCurrentKeyResponseTypedDict",
|
||||
"GetFileMetadataGlobals",
|
||||
"GetFileMetadataGlobalsTypedDict",
|
||||
"GetFileMetadataRequest",
|
||||
"GetFileMetadataRequestTypedDict",
|
||||
"GetGenerationGlobals",
|
||||
"GetGenerationGlobalsTypedDict",
|
||||
"GetGenerationRequest",
|
||||
@@ -839,6 +943,10 @@ __all__ = [
|
||||
"GetKeyRequestTypedDict",
|
||||
"GetKeyResponse",
|
||||
"GetKeyResponseTypedDict",
|
||||
"GetModelGlobals",
|
||||
"GetModelGlobalsTypedDict",
|
||||
"GetModelRequest",
|
||||
"GetModelRequestTypedDict",
|
||||
"GetModelsCategory",
|
||||
"GetModelsGlobals",
|
||||
"GetModelsGlobalsTypedDict",
|
||||
@@ -907,6 +1015,12 @@ __all__ = [
|
||||
"ListEndpointsZdrRequestTypedDict",
|
||||
"ListEndpointsZdrResponse",
|
||||
"ListEndpointsZdrResponseTypedDict",
|
||||
"ListFilesGlobals",
|
||||
"ListFilesGlobalsTypedDict",
|
||||
"ListFilesRequest",
|
||||
"ListFilesRequestTypedDict",
|
||||
"ListFilesResponse",
|
||||
"ListFilesResponseTypedDict",
|
||||
"ListGenerationContentGlobals",
|
||||
"ListGenerationContentGlobalsTypedDict",
|
||||
"ListGenerationContentRequest",
|
||||
@@ -1001,6 +1115,10 @@ __all__ = [
|
||||
"ListVideosModelsGlobalsTypedDict",
|
||||
"ListVideosModelsRequest",
|
||||
"ListVideosModelsRequestTypedDict",
|
||||
"ListWorkspaceBudgetsGlobals",
|
||||
"ListWorkspaceBudgetsGlobalsTypedDict",
|
||||
"ListWorkspaceBudgetsRequest",
|
||||
"ListWorkspaceBudgetsRequestTypedDict",
|
||||
"ListWorkspacesGlobals",
|
||||
"ListWorkspacesGlobalsTypedDict",
|
||||
"ListWorkspacesRequest",
|
||||
@@ -1035,6 +1153,7 @@ __all__ = [
|
||||
"QueryAnalyticsResponseTypedDict",
|
||||
"RateLimit",
|
||||
"RateLimitTypedDict",
|
||||
"Region",
|
||||
"Result",
|
||||
"ResultTypedDict",
|
||||
"Role",
|
||||
@@ -1076,12 +1195,23 @@ __all__ = [
|
||||
"UpdateWorkspaceGlobalsTypedDict",
|
||||
"UpdateWorkspaceRequest",
|
||||
"UpdateWorkspaceRequestTypedDict",
|
||||
"UploadFileGlobals",
|
||||
"UploadFileGlobalsTypedDict",
|
||||
"UploadFileRequest",
|
||||
"UploadFileRequestBody",
|
||||
"UploadFileRequestBodyTypedDict",
|
||||
"UploadFileRequestTypedDict",
|
||||
"UpsertWorkspaceBudgetGlobals",
|
||||
"UpsertWorkspaceBudgetGlobalsTypedDict",
|
||||
"UpsertWorkspaceBudgetRequest",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict",
|
||||
"UsageLimitType",
|
||||
"Value1",
|
||||
"Value1TypedDict",
|
||||
"Value2",
|
||||
"Value2TypedDict",
|
||||
"ValueType",
|
||||
"Zdr",
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
@@ -1237,6 +1367,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"DeleteBYOKKeyGlobalsTypedDict": ".deletebyokkey",
|
||||
"DeleteBYOKKeyRequest": ".deletebyokkey",
|
||||
"DeleteBYOKKeyRequestTypedDict": ".deletebyokkey",
|
||||
"DeleteFileGlobals": ".deletefile",
|
||||
"DeleteFileGlobalsTypedDict": ".deletefile",
|
||||
"DeleteFileRequest": ".deletefile",
|
||||
"DeleteFileRequestTypedDict": ".deletefile",
|
||||
"DeleteGuardrailGlobals": ".deleteguardrail",
|
||||
"DeleteGuardrailGlobalsTypedDict": ".deleteguardrail",
|
||||
"DeleteGuardrailRequest": ".deleteguardrail",
|
||||
@@ -1255,6 +1389,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"DeleteWorkspaceGlobalsTypedDict": ".deleteworkspace",
|
||||
"DeleteWorkspaceRequest": ".deleteworkspace",
|
||||
"DeleteWorkspaceRequestTypedDict": ".deleteworkspace",
|
||||
"DeleteWorkspaceBudgetGlobals": ".deleteworkspacebudget",
|
||||
"DeleteWorkspaceBudgetGlobalsTypedDict": ".deleteworkspacebudget",
|
||||
"DeleteWorkspaceBudgetRequest": ".deleteworkspacebudget",
|
||||
"DeleteWorkspaceBudgetRequestTypedDict": ".deleteworkspacebudget",
|
||||
"DownloadFileContentGlobals": ".downloadfilecontent",
|
||||
"DownloadFileContentGlobalsTypedDict": ".downloadfilecontent",
|
||||
"DownloadFileContentRequest": ".downloadfilecontent",
|
||||
"DownloadFileContentRequestTypedDict": ".downloadfilecontent",
|
||||
"ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey",
|
||||
"ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey",
|
||||
"ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey",
|
||||
@@ -1293,6 +1435,15 @@ _dynamic_imports: dict[str, str] = {
|
||||
"GetAppRankingsResponseTypedDict": ".getapprankings",
|
||||
"GetAppRankingsSort": ".getapprankings",
|
||||
"Subcategory": ".getapprankings",
|
||||
"GetBenchmarksArtificialAnalysisGlobals": ".getbenchmarksartificialanalysis",
|
||||
"GetBenchmarksArtificialAnalysisGlobalsTypedDict": ".getbenchmarksartificialanalysis",
|
||||
"GetBenchmarksArtificialAnalysisRequest": ".getbenchmarksartificialanalysis",
|
||||
"GetBenchmarksArtificialAnalysisRequestTypedDict": ".getbenchmarksartificialanalysis",
|
||||
"Arena": ".getbenchmarksdesignarena",
|
||||
"GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena",
|
||||
"GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena",
|
||||
"GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena",
|
||||
"GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena",
|
||||
"GetBYOKKeyGlobals": ".getbyokkey",
|
||||
"GetBYOKKeyGlobalsTypedDict": ".getbyokkey",
|
||||
"GetBYOKKeyRequest": ".getbyokkey",
|
||||
@@ -1315,6 +1466,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"GetCurrentKeyResponseTypedDict": ".getcurrentkey",
|
||||
"RateLimit": ".getcurrentkey",
|
||||
"RateLimitTypedDict": ".getcurrentkey",
|
||||
"GetFileMetadataGlobals": ".getfilemetadata",
|
||||
"GetFileMetadataGlobalsTypedDict": ".getfilemetadata",
|
||||
"GetFileMetadataRequest": ".getfilemetadata",
|
||||
"GetFileMetadataRequestTypedDict": ".getfilemetadata",
|
||||
"GetGenerationGlobals": ".getgeneration",
|
||||
"GetGenerationGlobalsTypedDict": ".getgeneration",
|
||||
"GetGenerationRequest": ".getgeneration",
|
||||
@@ -1331,12 +1486,19 @@ _dynamic_imports: dict[str, str] = {
|
||||
"GetKeyRequestTypedDict": ".getkey",
|
||||
"GetKeyResponse": ".getkey",
|
||||
"GetKeyResponseTypedDict": ".getkey",
|
||||
"GetModelGlobals": ".getmodel",
|
||||
"GetModelGlobalsTypedDict": ".getmodel",
|
||||
"GetModelRequest": ".getmodel",
|
||||
"GetModelRequestTypedDict": ".getmodel",
|
||||
"Distillable": ".getmodels",
|
||||
"GetModelsCategory": ".getmodels",
|
||||
"GetModelsGlobals": ".getmodels",
|
||||
"GetModelsGlobalsTypedDict": ".getmodels",
|
||||
"GetModelsRequest": ".getmodels",
|
||||
"GetModelsRequestTypedDict": ".getmodels",
|
||||
"GetModelsSort": ".getmodels",
|
||||
"Region": ".getmodels",
|
||||
"Zdr": ".getmodels",
|
||||
"GetObservabilityDestinationGlobals": ".getobservabilitydestination",
|
||||
"GetObservabilityDestinationGlobalsTypedDict": ".getobservabilitydestination",
|
||||
"GetObservabilityDestinationRequest": ".getobservabilitydestination",
|
||||
@@ -1396,6 +1558,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListEndpointsZdrRequestTypedDict": ".listendpointszdr",
|
||||
"ListEndpointsZdrResponse": ".listendpointszdr",
|
||||
"ListEndpointsZdrResponseTypedDict": ".listendpointszdr",
|
||||
"ListFilesGlobals": ".listfiles",
|
||||
"ListFilesGlobalsTypedDict": ".listfiles",
|
||||
"ListFilesRequest": ".listfiles",
|
||||
"ListFilesRequestTypedDict": ".listfiles",
|
||||
"ListFilesResponse": ".listfiles",
|
||||
"ListFilesResponseTypedDict": ".listfiles",
|
||||
"ListGenerationContentGlobals": ".listgenerationcontent",
|
||||
"ListGenerationContentGlobalsTypedDict": ".listgenerationcontent",
|
||||
"ListGenerationContentRequest": ".listgenerationcontent",
|
||||
@@ -1487,6 +1655,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListVideosModelsGlobalsTypedDict": ".listvideosmodels",
|
||||
"ListVideosModelsRequest": ".listvideosmodels",
|
||||
"ListVideosModelsRequestTypedDict": ".listvideosmodels",
|
||||
"ListWorkspaceBudgetsGlobals": ".listworkspacebudgets",
|
||||
"ListWorkspaceBudgetsGlobalsTypedDict": ".listworkspacebudgets",
|
||||
"ListWorkspaceBudgetsRequest": ".listworkspacebudgets",
|
||||
"ListWorkspaceBudgetsRequestTypedDict": ".listworkspacebudgets",
|
||||
"ListWorkspacesGlobals": ".listworkspaces",
|
||||
"ListWorkspacesGlobalsTypedDict": ".listworkspaces",
|
||||
"ListWorkspacesRequest": ".listworkspaces",
|
||||
@@ -1551,6 +1723,18 @@ _dynamic_imports: dict[str, str] = {
|
||||
"UpdateWorkspaceGlobalsTypedDict": ".updateworkspace",
|
||||
"UpdateWorkspaceRequest": ".updateworkspace",
|
||||
"UpdateWorkspaceRequestTypedDict": ".updateworkspace",
|
||||
"File": ".uploadfile",
|
||||
"FileTypedDict": ".uploadfile",
|
||||
"UploadFileGlobals": ".uploadfile",
|
||||
"UploadFileGlobalsTypedDict": ".uploadfile",
|
||||
"UploadFileRequest": ".uploadfile",
|
||||
"UploadFileRequestBody": ".uploadfile",
|
||||
"UploadFileRequestBodyTypedDict": ".uploadfile",
|
||||
"UploadFileRequestTypedDict": ".uploadfile",
|
||||
"UpsertWorkspaceBudgetGlobals": ".upsertworkspacebudget",
|
||||
"UpsertWorkspaceBudgetGlobalsTypedDict": ".upsertworkspacebudget",
|
||||
"UpsertWorkspaceBudgetRequest": ".upsertworkspacebudget",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict": ".upsertworkspacebudget",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ r"""Optional credit limit reset interval. When set, the credit limit resets on t
|
||||
|
||||
class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
|
||||
callback_url: str
|
||||
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed."""
|
||||
r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools."""
|
||||
code_challenge: NotRequired[str]
|
||||
r"""PKCE code challenge for enhanced security"""
|
||||
code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod]
|
||||
@@ -105,11 +105,13 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
|
||||
r"""Credit limit for the API key to be created"""
|
||||
usage_limit_type: NotRequired[UsageLimitType]
|
||||
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Optional workspace ID to associate the API key with"""
|
||||
|
||||
|
||||
class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
callback_url: str
|
||||
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed."""
|
||||
r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools."""
|
||||
|
||||
code_challenge: Optional[str] = None
|
||||
r"""PKCE code challenge for enhanced security"""
|
||||
@@ -134,6 +136,9 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
] = None
|
||||
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
|
||||
|
||||
workspace_id: Optional[str] = None
|
||||
r"""Optional workspace ID to associate the API key with"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
@@ -143,6 +148,7 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
"key_label",
|
||||
"limit",
|
||||
"usage_limit_type",
|
||||
"workspace_id",
|
||||
]
|
||||
nullable_fields = ["expires_at"]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
PathParamMetadata,
|
||||
QueryParamMetadata,
|
||||
)
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class DeleteFileGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DeleteFileGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DeleteFileRequestTypedDict(TypedDict):
|
||||
file_id: str
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class DeleteFileRequest(BaseModel):
|
||||
file_id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
@@ -0,0 +1,127 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import (
|
||||
workspacebudgetinterval as components_workspacebudgetinterval,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
PathParamMetadata,
|
||||
validate_open_enum,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetRequestTypedDict(TypedDict):
|
||||
id: str
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
interval: components_workspacebudgetinterval.WorkspaceBudgetInterval
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetRequest(BaseModel):
|
||||
id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
|
||||
interval: Annotated[
|
||||
Annotated[
|
||||
components_workspacebudgetinterval.WorkspaceBudgetInterval,
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
],
|
||||
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
|
||||
]
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
PathParamMetadata,
|
||||
QueryParamMetadata,
|
||||
)
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class DownloadFileContentGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DownloadFileContentGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class DownloadFileContentRequestTypedDict(TypedDict):
|
||||
file_id: str
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class DownloadFileContentRequest(BaseModel):
|
||||
file_id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
@@ -0,0 +1,108 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class GetBenchmarksArtificialAnalysisGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetBenchmarksArtificialAnalysisGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetBenchmarksArtificialAnalysisRequestTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
max_results: NotRequired[int]
|
||||
r"""Max results to return (1–100, default 50)."""
|
||||
|
||||
|
||||
class GetBenchmarksArtificialAnalysisRequest(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
max_results: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 50
|
||||
r"""Max results to return (1–100, default 50)."""
|
||||
@@ -0,0 +1,141 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
QueryParamMetadata,
|
||||
validate_open_enum,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetBenchmarksDesignArenaGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Arena = Union[
|
||||
Literal[
|
||||
"models",
|
||||
"builders",
|
||||
"agents",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Arena to query. Defaults to `models`."""
|
||||
|
||||
|
||||
class GetBenchmarksDesignArenaRequestTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
arena: NotRequired[Arena]
|
||||
r"""Arena to query. Defaults to `models`."""
|
||||
category: NotRequired[str]
|
||||
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
|
||||
max_results: NotRequired[int]
|
||||
r"""Max results to return: per category when no category filter is applied (1–100, default 50)."""
|
||||
|
||||
|
||||
class GetBenchmarksDesignArenaRequest(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
arena: Annotated[
|
||||
Annotated[Optional[Arena], PlainValidator(validate_open_enum(False))],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = "models"
|
||||
r"""Arena to query. Defaults to `models`."""
|
||||
|
||||
category: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
|
||||
|
||||
max_results: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 50
|
||||
r"""Max results to return: per category when no category filter is applied (1–100, default 50)."""
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
PathParamMetadata,
|
||||
QueryParamMetadata,
|
||||
)
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class GetFileMetadataGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetFileMetadataGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetFileMetadataRequestTypedDict(TypedDict):
|
||||
file_id: str
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class GetFileMetadataRequest(BaseModel):
|
||||
file_id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
@@ -0,0 +1,114 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class GetModelGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetModelGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetModelRequestTypedDict(TypedDict):
|
||||
author: str
|
||||
r"""The author/organization of the model"""
|
||||
slug: str
|
||||
r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)"""
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class GetModelRequest(BaseModel):
|
||||
author: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
r"""The author/organization of the model"""
|
||||
|
||||
slug: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)"""
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
@@ -1,7 +1,14 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
@@ -9,6 +16,7 @@ from openrouter.utils import (
|
||||
validate_open_enum,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
@@ -96,6 +104,24 @@ GetModelsSort = Union[
|
||||
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
|
||||
|
||||
|
||||
Distillable = Union[
|
||||
Literal[
|
||||
"true",
|
||||
"false",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
|
||||
|
||||
|
||||
Zdr = Literal["true",]
|
||||
r"""When set to \"true\", return only models with zero data retention endpoints."""
|
||||
|
||||
|
||||
Region = Literal["eu",]
|
||||
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
|
||||
|
||||
|
||||
class GetModelsRequestTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
@@ -118,6 +144,28 @@ class GetModelsRequestTypedDict(TypedDict):
|
||||
r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"."""
|
||||
sort: NotRequired[GetModelsSort]
|
||||
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
|
||||
q: NotRequired[str]
|
||||
r"""Free-text search by model name or slug."""
|
||||
input_modalities: NotRequired[str]
|
||||
r"""Filter models by input modality. Comma-separated list of: text, image, audio, file."""
|
||||
context: NotRequired[int]
|
||||
r"""Minimum context length (tokens). Models with smaller context are excluded."""
|
||||
min_price: NotRequired[Nullable[float]]
|
||||
r"""Minimum prompt price in $/M tokens."""
|
||||
max_price: NotRequired[Nullable[float]]
|
||||
r"""Maximum prompt price in $/M tokens."""
|
||||
arch: NotRequired[str]
|
||||
r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama)."""
|
||||
model_authors: NotRequired[str]
|
||||
r"""Filter models by the organization that created the model. Comma-separated list of author slugs."""
|
||||
providers: NotRequired[str]
|
||||
r"""Filter models by hosting provider. Comma-separated list of provider names."""
|
||||
distillable: NotRequired[Distillable]
|
||||
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
|
||||
zdr: NotRequired[Zdr]
|
||||
r"""When set to \"true\", return only models with zero data retention endpoints."""
|
||||
region: NotRequired[Region]
|
||||
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
|
||||
|
||||
|
||||
class GetModelsRequest(BaseModel):
|
||||
@@ -174,3 +222,118 @@ class GetModelsRequest(BaseModel):
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved."""
|
||||
|
||||
q: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Free-text search by model name or slug."""
|
||||
|
||||
input_modalities: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter models by input modality. Comma-separated list of: text, image, audio, file."""
|
||||
|
||||
context: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Minimum context length (tokens). Models with smaller context are excluded."""
|
||||
|
||||
min_price: Annotated[
|
||||
OptionalNullable[float],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = UNSET
|
||||
r"""Minimum prompt price in $/M tokens."""
|
||||
|
||||
max_price: Annotated[
|
||||
OptionalNullable[float],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = UNSET
|
||||
r"""Maximum prompt price in $/M tokens."""
|
||||
|
||||
arch: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama)."""
|
||||
|
||||
model_authors: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter models by the organization that created the model. Comma-separated list of author slugs."""
|
||||
|
||||
providers: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter models by hosting provider. Comma-separated list of provider names."""
|
||||
|
||||
distillable: Annotated[
|
||||
Annotated[Optional[Distillable], PlainValidator(validate_open_enum(False))],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them."""
|
||||
|
||||
zdr: Annotated[
|
||||
Optional[Zdr],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""When set to \"true\", return only models with zero data retention endpoints."""
|
||||
|
||||
region: Annotated[
|
||||
Optional[Region],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"HTTP-Referer",
|
||||
"X-OpenRouter-Title",
|
||||
"X-OpenRouter-Categories",
|
||||
"category",
|
||||
"supported_parameters",
|
||||
"output_modalities",
|
||||
"sort",
|
||||
"q",
|
||||
"input_modalities",
|
||||
"context",
|
||||
"min_price",
|
||||
"max_price",
|
||||
"arch",
|
||||
"model_authors",
|
||||
"providers",
|
||||
"distillable",
|
||||
"zdr",
|
||||
"region",
|
||||
]
|
||||
nullable_fields = ["min_price", "max_price"]
|
||||
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,138 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import filelistresponse as components_filelistresponse
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
||||
import pydantic
|
||||
from typing import Awaitable, Callable, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ListFilesGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class ListFilesGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class ListFilesRequestTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
limit: NotRequired[int]
|
||||
r"""Maximum number of files to return (1–1000)."""
|
||||
cursor: NotRequired[str]
|
||||
r"""Opaque pagination cursor from a previous response."""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class ListFilesRequest(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Maximum number of files to return (1–1000)."""
|
||||
|
||||
cursor: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Opaque pagination cursor from a previous response."""
|
||||
|
||||
workspace_id: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class ListFilesResponseTypedDict(TypedDict):
|
||||
result: components_filelistresponse.FileListResponseTypedDict
|
||||
|
||||
|
||||
class ListFilesResponse(BaseModel):
|
||||
next: Union[
|
||||
Callable[[], Optional[ListFilesResponse]],
|
||||
Callable[[], Awaitable[Optional[ListFilesResponse]]],
|
||||
]
|
||||
|
||||
result: components_filelistresponse.FileListResponse
|
||||
@@ -0,0 +1,107 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
|
||||
import pydantic
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsRequestTypedDict(TypedDict):
|
||||
id: str
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsRequest(BaseModel):
|
||||
id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
@@ -70,31 +70,31 @@ Value2 = TypeAliasType("Value2", Union[str, float])
|
||||
Value1TypedDict = TypeAliasType(
|
||||
"Value1TypedDict", Union[str, float, List[Value2TypedDict]]
|
||||
)
|
||||
r"""Filter value (scalar or array depending on operator)"""
|
||||
r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
|
||||
|
||||
|
||||
Value1 = TypeAliasType("Value1", Union[str, float, List[Value2]])
|
||||
r"""Filter value (scalar or array depending on operator)"""
|
||||
r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
|
||||
|
||||
|
||||
class FilterTypedDict(TypedDict):
|
||||
field: str
|
||||
r"""Dimension to filter on"""
|
||||
r"""Dimension to filter on. Use the /meta endpoint for available dimensions."""
|
||||
operator: str
|
||||
r"""Filter operator"""
|
||||
value: Value1TypedDict
|
||||
r"""Filter value (scalar or array depending on operator)"""
|
||||
r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
|
||||
|
||||
|
||||
class Filter(BaseModel):
|
||||
field: str
|
||||
r"""Dimension to filter on"""
|
||||
r"""Dimension to filter on. Use the /meta endpoint for available dimensions."""
|
||||
|
||||
operator: str
|
||||
r"""Filter operator"""
|
||||
|
||||
value: Value1
|
||||
r"""Filter value (scalar or array depending on operator)"""
|
||||
r"""Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. \"user_abc123\"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. \"openai/gpt-4o\"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned."""
|
||||
|
||||
|
||||
Direction = Union[
|
||||
@@ -137,7 +137,7 @@ class QueryAnalyticsRequestBodyTypedDict(TypedDict):
|
||||
granularity: NotRequired[str]
|
||||
r"""Time granularity"""
|
||||
group_limit: NotRequired[int]
|
||||
r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
|
||||
r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
|
||||
limit: NotRequired[int]
|
||||
r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations."""
|
||||
order_by: NotRequired[OrderByTypedDict]
|
||||
@@ -155,7 +155,7 @@ class QueryAnalyticsRequestBody(BaseModel):
|
||||
r"""Time granularity"""
|
||||
|
||||
group_limit: Optional[int] = None
|
||||
r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
|
||||
r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified."""
|
||||
|
||||
limit: Optional[int] = None
|
||||
r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations."""
|
||||
@@ -243,6 +243,8 @@ class QueryAnalyticsData2TypedDict(TypedDict):
|
||||
data: List[QueryAnalyticsData1TypedDict]
|
||||
metadata: MetadataTypedDict
|
||||
cached_at: NotRequired[float]
|
||||
warnings: NotRequired[List[str]]
|
||||
r"""Warnings about filter resolution issues (e.g. unresolvable api_key_id hashes). The query still runs normally; these inform the caller that some filter values could not be resolved."""
|
||||
|
||||
|
||||
class QueryAnalyticsData2(BaseModel):
|
||||
@@ -252,6 +254,9 @@ class QueryAnalyticsData2(BaseModel):
|
||||
|
||||
cached_at: Annotated[Optional[float], pydantic.Field(alias="cachedAt")] = None
|
||||
|
||||
warnings: Optional[List[str]] = None
|
||||
r"""Warnings about filter resolution issues (e.g. unresolvable api_key_id hashes). The query still runs normally; these inform the caller that some filter values could not be resolved."""
|
||||
|
||||
|
||||
class QueryAnalyticsResponseTypedDict(TypedDict):
|
||||
r"""Analytics query results"""
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
import io
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
MultipartFormMetadata,
|
||||
QueryParamMetadata,
|
||||
RequestMetadata,
|
||||
)
|
||||
import pydantic
|
||||
from typing import IO, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class UploadFileGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class UploadFileGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class FileTypedDict(TypedDict):
|
||||
file_name: str
|
||||
content: Union[bytes, IO[bytes], io.BufferedReader]
|
||||
content_type: NotRequired[str]
|
||||
|
||||
|
||||
class File(BaseModel):
|
||||
file_name: Annotated[
|
||||
str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True)
|
||||
]
|
||||
|
||||
content: Annotated[
|
||||
Union[bytes, IO[bytes], io.BufferedReader],
|
||||
pydantic.Field(alias=""),
|
||||
FieldMetadata(multipart=MultipartFormMetadata(content=True)),
|
||||
]
|
||||
|
||||
content_type: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="Content-Type"),
|
||||
FieldMetadata(multipart=True),
|
||||
] = None
|
||||
|
||||
|
||||
class UploadFileRequestBodyTypedDict(TypedDict):
|
||||
file: FileTypedDict
|
||||
|
||||
|
||||
class UploadFileRequestBody(BaseModel):
|
||||
file: Annotated[File, FieldMetadata(multipart=MultipartFormMetadata(file=True))]
|
||||
|
||||
|
||||
class UploadFileRequestTypedDict(TypedDict):
|
||||
request_body: UploadFileRequestBodyTypedDict
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
workspace_id: NotRequired[str]
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
|
||||
|
||||
class UploadFileRequest(BaseModel):
|
||||
request_body: Annotated[
|
||||
UploadFileRequestBody,
|
||||
FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")),
|
||||
]
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
r"""Workspace to scope the request to. Defaults to the caller’s default workspace."""
|
||||
@@ -0,0 +1,137 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import (
|
||||
upsertworkspacebudgetrequest as components_upsertworkspacebudgetrequest,
|
||||
workspacebudgetinterval as components_workspacebudgetinterval,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
PathParamMetadata,
|
||||
RequestMetadata,
|
||||
validate_open_enum,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetGlobalsTypedDict(TypedDict):
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetGlobals(BaseModel):
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetRequestTypedDict(TypedDict):
|
||||
id: str
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
interval: components_workspacebudgetinterval.WorkspaceBudgetInterval
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
upsert_workspace_budget_request: (
|
||||
components_upsertworkspacebudgetrequest.UpsertWorkspaceBudgetRequestTypedDict
|
||||
)
|
||||
http_referer: NotRequired[str]
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
x_open_router_title: NotRequired[str]
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
x_open_router_categories: NotRequired[str]
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetRequest(BaseModel):
|
||||
id: Annotated[
|
||||
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
||||
]
|
||||
r"""The workspace ID (UUID) or slug"""
|
||||
|
||||
interval: Annotated[
|
||||
Annotated[
|
||||
components_workspacebudgetinterval.WorkspaceBudgetInterval,
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
],
|
||||
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
|
||||
]
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
|
||||
upsert_workspace_budget_request: Annotated[
|
||||
components_upsertworkspacebudgetrequest.UpsertWorkspaceBudgetRequest,
|
||||
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
||||
]
|
||||
|
||||
http_referer: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="HTTP-Referer"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_title: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Title"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
"""
|
||||
|
||||
x_open_router_categories: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="X-OpenRouter-Categories"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = None
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
@@ -625,6 +625,7 @@ class Presets(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -647,6 +648,10 @@ class Presets(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -676,6 +681,8 @@ class Presets(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -709,6 +716,7 @@ class Presets(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -717,6 +725,8 @@ class Presets(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -728,6 +738,8 @@ class Presets(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -769,6 +781,7 @@ class Presets(BaseSDK):
|
||||
messages, List[components.ChatMessages]
|
||||
),
|
||||
metadata=metadata,
|
||||
min_p=min_p,
|
||||
modalities=modalities,
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -783,6 +796,8 @@ class Presets(BaseSDK):
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, Optional[components.ChatRequestReasoning]
|
||||
),
|
||||
reasoning_effort=reasoning_effort,
|
||||
repetition_penalty=repetition_penalty,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
@@ -805,6 +820,8 @@ class Presets(BaseSDK):
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ChatFunctionTool]]
|
||||
),
|
||||
top_a=top_a,
|
||||
top_k=top_k,
|
||||
top_logprobs=top_logprobs,
|
||||
top_p=top_p,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
|
||||
@@ -943,6 +960,7 @@ class Presets(BaseSDK):
|
||||
max_completion_tokens: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
min_p: OptionalNullable[float] = UNSET,
|
||||
modalities: Optional[List[components.Modality]] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
@@ -965,6 +983,10 @@ class Presets(BaseSDK):
|
||||
components.ChatRequestReasoningTypedDict,
|
||||
]
|
||||
] = None,
|
||||
reasoning_effort: OptionalNullable[
|
||||
components.ChatRequestReasoningEffort
|
||||
] = UNSET,
|
||||
repetition_penalty: OptionalNullable[float] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
@@ -994,6 +1016,8 @@ class Presets(BaseSDK):
|
||||
List[components.ChatFunctionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_a: OptionalNullable[float] = UNSET,
|
||||
top_k: OptionalNullable[int] = UNSET,
|
||||
top_logprobs: OptionalNullable[int] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
trace: Optional[
|
||||
@@ -1027,6 +1051,7 @@ class Presets(BaseSDK):
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
|
||||
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
|
||||
:param model: Model to use for completion
|
||||
:param models: Models to use for completion
|
||||
@@ -1035,6 +1060,8 @@ class Presets(BaseSDK):
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param reasoning: Configuration options for reasoning models
|
||||
:param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
||||
:param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param service_tier: The service tier to use for processing this request.
|
||||
@@ -1046,6 +1073,8 @@ class Presets(BaseSDK):
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.
|
||||
:param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
||||
@@ -1087,6 +1116,7 @@ class Presets(BaseSDK):
|
||||
messages, List[components.ChatMessages]
|
||||
),
|
||||
metadata=metadata,
|
||||
min_p=min_p,
|
||||
modalities=modalities,
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -1101,6 +1131,8 @@ class Presets(BaseSDK):
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, Optional[components.ChatRequestReasoning]
|
||||
),
|
||||
reasoning_effort=reasoning_effort,
|
||||
repetition_penalty=repetition_penalty,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
@@ -1123,6 +1155,8 @@ class Presets(BaseSDK):
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ChatFunctionTool]]
|
||||
),
|
||||
top_a=top_a,
|
||||
top_k=top_k,
|
||||
top_logprobs=top_logprobs,
|
||||
top_p=top_p,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]),
|
||||
@@ -1253,6 +1287,12 @@ class Presets(BaseSDK):
|
||||
context_management: OptionalNullable[
|
||||
Union[components.ContextManagement, components.ContextManagementTypedDict]
|
||||
] = UNSET,
|
||||
fallbacks: OptionalNullable[
|
||||
Union[
|
||||
List[components.MessagesFallbackParam],
|
||||
List[components.MessagesFallbackParamTypedDict],
|
||||
]
|
||||
] = UNSET,
|
||||
max_tokens: Optional[int] = None,
|
||||
metadata: Optional[
|
||||
Union[components.Metadata, components.MetadataTypedDict]
|
||||
@@ -1327,6 +1367,7 @@ class Presets(BaseSDK):
|
||||
|
||||
:param cache_control: 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.
|
||||
:param context_management:
|
||||
:param fallbacks: 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.
|
||||
:param max_tokens:
|
||||
:param metadata:
|
||||
:param models:
|
||||
@@ -1375,6 +1416,9 @@ class Presets(BaseSDK):
|
||||
context_management=utils.get_pydantic_model(
|
||||
context_management, OptionalNullable[components.ContextManagement]
|
||||
),
|
||||
fallbacks=utils.get_pydantic_model(
|
||||
fallbacks, OptionalNullable[List[components.MessagesFallbackParam]]
|
||||
),
|
||||
max_tokens=max_tokens,
|
||||
messages=utils.get_pydantic_model(
|
||||
messages, Nullable[List[components.MessagesMessageParam]]
|
||||
@@ -1547,6 +1591,12 @@ class Presets(BaseSDK):
|
||||
context_management: OptionalNullable[
|
||||
Union[components.ContextManagement, components.ContextManagementTypedDict]
|
||||
] = UNSET,
|
||||
fallbacks: OptionalNullable[
|
||||
Union[
|
||||
List[components.MessagesFallbackParam],
|
||||
List[components.MessagesFallbackParamTypedDict],
|
||||
]
|
||||
] = UNSET,
|
||||
max_tokens: Optional[int] = None,
|
||||
metadata: Optional[
|
||||
Union[components.Metadata, components.MetadataTypedDict]
|
||||
@@ -1621,6 +1671,7 @@ class Presets(BaseSDK):
|
||||
|
||||
:param cache_control: 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.
|
||||
:param context_management:
|
||||
:param fallbacks: 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.
|
||||
:param max_tokens:
|
||||
:param metadata:
|
||||
:param models:
|
||||
@@ -1669,6 +1720,9 @@ class Presets(BaseSDK):
|
||||
context_management=utils.get_pydantic_model(
|
||||
context_management, OptionalNullable[components.ContextManagement]
|
||||
),
|
||||
fallbacks=utils.get_pydantic_model(
|
||||
fallbacks, OptionalNullable[List[components.MessagesFallbackParam]]
|
||||
),
|
||||
max_tokens=max_tokens,
|
||||
messages=utils.get_pydantic_model(
|
||||
messages, Nullable[List[components.MessagesMessageParam]]
|
||||
|
||||
@@ -25,6 +25,7 @@ if TYPE_CHECKING:
|
||||
from openrouter.datasets import Datasets
|
||||
from openrouter.embeddings import Embeddings
|
||||
from openrouter.endpoints import Endpoints
|
||||
from openrouter.files import Files
|
||||
from openrouter.generations import Generations
|
||||
from openrouter.guardrails import Guardrails
|
||||
from openrouter.models_ import Models
|
||||
@@ -65,6 +66,8 @@ class OpenRouter(BaseSDK):
|
||||
r"""Text embedding endpoints"""
|
||||
endpoints: "Endpoints"
|
||||
r"""Endpoint information"""
|
||||
files: "Files"
|
||||
r"""Files endpoints"""
|
||||
generations: "Generations"
|
||||
r"""Generation history endpoints"""
|
||||
guardrails: "Guardrails"
|
||||
@@ -99,6 +102,7 @@ class OpenRouter(BaseSDK):
|
||||
"datasets": ("openrouter.datasets", "Datasets"),
|
||||
"embeddings": ("openrouter.embeddings", "Embeddings"),
|
||||
"endpoints": ("openrouter.endpoints", "Endpoints"),
|
||||
"files": ("openrouter.files", "Files"),
|
||||
"generations": ("openrouter.generations", "Generations"),
|
||||
"guardrails": ("openrouter.guardrails", "Guardrails"),
|
||||
"api_keys": ("openrouter.api_keys", "APIKeys"),
|
||||
|
||||
@@ -1542,6 +1542,820 @@ class Workspaces(BaseSDK):
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def list_budgets(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ListWorkspaceBudgetsResponse:
|
||||
r"""List workspace budgets
|
||||
|
||||
List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.ListWorkspaceBudgetsRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="GET",
|
||||
path="/workspaces/{id}/budgets",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.ListWorkspaceBudgetsGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="listWorkspaceBudgets",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.ListWorkspaceBudgetsResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def list_budgets_async(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ListWorkspaceBudgetsResponse:
|
||||
r"""List workspace budgets
|
||||
|
||||
List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.ListWorkspaceBudgetsRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="GET",
|
||||
path="/workspaces/{id}/budgets",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.ListWorkspaceBudgetsGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="listWorkspaceBudgets",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.ListWorkspaceBudgetsResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def delete_budget(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
interval: components.WorkspaceBudgetInterval,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.DeleteWorkspaceBudgetResponse:
|
||||
r"""Delete a workspace budget
|
||||
|
||||
Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.DeleteWorkspaceBudgetRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
interval=interval,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="DELETE",
|
||||
path="/workspaces/{id}/budgets/{interval}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.DeleteWorkspaceBudgetGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="deleteWorkspaceBudget",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.DeleteWorkspaceBudgetResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def delete_budget_async(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
interval: components.WorkspaceBudgetInterval,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.DeleteWorkspaceBudgetResponse:
|
||||
r"""Delete a workspace budget
|
||||
|
||||
Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.DeleteWorkspaceBudgetRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
interval=interval,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="DELETE",
|
||||
path="/workspaces/{id}/budgets/{interval}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=False,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.DeleteWorkspaceBudgetGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="deleteWorkspaceBudget",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.DeleteWorkspaceBudgetResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def set_budget(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
interval: components.WorkspaceBudgetInterval,
|
||||
limit_usd: float,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.UpsertWorkspaceBudgetResponse:
|
||||
r"""Create or update a workspace budget
|
||||
|
||||
Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
|
||||
:param limit_usd: Spending limit in USD. Must be greater than 0.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.UpsertWorkspaceBudgetRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
interval=interval,
|
||||
upsert_workspace_budget_request=components.UpsertWorkspaceBudgetRequest(
|
||||
limit_usd=limit_usd,
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="PUT",
|
||||
path="/workspaces/{id}/budgets/{interval}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.UpsertWorkspaceBudgetGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.upsert_workspace_budget_request,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
components.UpsertWorkspaceBudgetRequest,
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="upsertWorkspaceBudget",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.UpsertWorkspaceBudgetResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def set_budget_async(
|
||||
self,
|
||||
*,
|
||||
id: str,
|
||||
interval: components.WorkspaceBudgetInterval,
|
||||
limit_usd: float,
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.UpsertWorkspaceBudgetResponse:
|
||||
r"""Create or update a workspace budget
|
||||
|
||||
Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
:param id: The workspace ID (UUID) or slug
|
||||
:param interval: Budget reset interval. Use \"lifetime\" for a one-time budget that never resets.
|
||||
:param limit_usd: Spending limit in USD. Must be greater than 0.
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
|
||||
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.UpsertWorkspaceBudgetRequest(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
id=id,
|
||||
interval=interval,
|
||||
upsert_workspace_budget_request=components.UpsertWorkspaceBudgetRequest(
|
||||
limit_usd=limit_usd,
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="PUT",
|
||||
path="/workspaces/{id}/budgets/{interval}",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=True,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
_globals=operations.UpsertWorkspaceBudgetGlobals(
|
||||
http_referer=self.sdk_configuration.globals.http_referer,
|
||||
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
|
||||
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
|
||||
),
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.upsert_workspace_budget_request,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
components.UpsertWorkspaceBudgetRequest,
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
else:
|
||||
retries = utils.RetryConfig(
|
||||
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
||||
)
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["5XX"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="upsertWorkspaceBudget",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "404", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
components.UpsertWorkspaceBudgetResponse, http_res
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
)
|
||||
raise errors.BadRequestResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
)
|
||||
raise errors.UnauthorizedResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "404", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.NotFoundResponseErrorData, http_res
|
||||
)
|
||||
raise errors.NotFoundResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.InternalServerResponseErrorData, http_res
|
||||
)
|
||||
raise errors.InternalServerResponseError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
def bulk_add_members(
|
||||
self,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user