Commits included in this export:

- f35bb49a8b788937fa61c0cf4591b14f2bc8b217
  - 08a37babde9ad8df5e24e0cd865d3292b1627464
  - 7ddc8e1ed230ca489bc11a5e14696c209ea76349
  - ad31290f38f3f02627f3e1953f1d7cf3e06159a5
  - fb7f764b500618e322f56d49997fbcfaebba7e39
  - 4306c032b9b4f3cfefeacdd3d243b0336f3b2f15

GitOrigin-RevId: f35bb49a8b788937fa61c0cf4591b14f2bc8b217
This commit is contained in:
OpenRouter Team
2026-03-11 17:28:30 +00:00
parent e72a84e82d
commit ae623ddecf
357 changed files with 14672 additions and 1900 deletions
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "openrouter"
__version__: str = "0.7.11"
__version__: str = "0.7.12"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.7.11 2.768.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.7.12 2.768.0 1.0.0 openrouter"
try:
if __package__ is not None:
+18 -8
View File
@@ -16,7 +16,8 @@ class Analytics(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
date_: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
@@ -30,7 +31,9 @@ class Analytics(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
:param retries: Override the default retry configuration for this method
@@ -50,7 +53,8 @@ class Analytics(BaseSDK):
request = operations.GetUserActivityRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
date_=date_,
)
@@ -68,7 +72,8 @@ class Analytics(BaseSDK):
http_headers=http_headers,
_globals=operations.GetUserActivityGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -138,7 +143,8 @@ class Analytics(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
date_: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
@@ -152,7 +158,9 @@ class Analytics(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
:param retries: Override the default retry configuration for this method
@@ -172,7 +180,8 @@ class Analytics(BaseSDK):
request = operations.GetUserActivityRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
date_=date_,
)
@@ -190,7 +199,8 @@ class Analytics(BaseSDK):
http_headers=http_headers,
_globals=operations.GetUserActivityGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
+108 -48
View File
@@ -17,7 +17,8 @@ class APIKeys(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
include_disabled: Optional[str] = None,
offset: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -32,7 +33,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 include_disabled: Whether to include disabled API keys in the response
:param offset: Number of API keys to skip for pagination
@@ -53,7 +56,8 @@ class APIKeys(BaseSDK):
request = operations.ListRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
include_disabled=include_disabled,
offset=offset,
)
@@ -72,7 +76,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.ListGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -137,7 +142,8 @@ class APIKeys(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
include_disabled: Optional[str] = None,
offset: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -152,7 +158,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 include_disabled: Whether to include disabled API keys in the response
:param offset: Number of API keys to skip for pagination
@@ -173,7 +181,8 @@ class APIKeys(BaseSDK):
request = operations.ListRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
include_disabled=include_disabled,
offset=offset,
)
@@ -192,7 +201,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.ListGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -258,7 +268,8 @@ class APIKeys(BaseSDK):
*,
name: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
limit: OptionalNullable[float] = UNSET,
limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
include_byok_in_limit: Optional[bool] = None,
@@ -276,7 +287,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 limit: Optional spending limit for the API key in USD
:param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
@@ -299,7 +312,8 @@ class APIKeys(BaseSDK):
request = operations.CreateKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateKeysRequestBody(
name=name,
limit=limit,
@@ -323,7 +337,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -401,7 +416,8 @@ class APIKeys(BaseSDK):
*,
name: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
limit: OptionalNullable[float] = UNSET,
limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
include_byok_in_limit: Optional[bool] = None,
@@ -419,7 +435,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 limit: Optional spending limit for the API key in USD
:param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
@@ -442,7 +460,8 @@ class APIKeys(BaseSDK):
request = operations.CreateKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateKeysRequestBody(
name=name,
limit=limit,
@@ -466,7 +485,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -544,7 +564,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
name: Optional[str] = None,
disabled: Optional[bool] = None,
limit: OptionalNullable[float] = UNSET,
@@ -563,7 +584,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 name: New name for the API key
:param disabled: Whether to disable the API key
@@ -587,7 +610,8 @@ class APIKeys(BaseSDK):
request = operations.UpdateKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
request_body=operations.UpdateKeysRequestBody(
name=name,
@@ -612,7 +636,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.UpdateKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -695,7 +720,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
name: Optional[str] = None,
disabled: Optional[bool] = None,
limit: OptionalNullable[float] = UNSET,
@@ -714,7 +740,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 name: New name for the API key
:param disabled: Whether to disable the API key
@@ -738,7 +766,8 @@ class APIKeys(BaseSDK):
request = operations.UpdateKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
request_body=operations.UpdateKeysRequestBody(
name=name,
@@ -763,7 +792,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.UpdateKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -846,7 +876,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -860,7 +891,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -879,7 +912,8 @@ class APIKeys(BaseSDK):
request = operations.DeleteKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
)
@@ -897,7 +931,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.DeleteKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -968,7 +1003,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -982,7 +1018,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -1001,7 +1039,8 @@ class APIKeys(BaseSDK):
request = operations.DeleteKeysRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
)
@@ -1019,7 +1058,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.DeleteKeysGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -1090,7 +1130,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -1104,7 +1145,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -1123,7 +1166,8 @@ class APIKeys(BaseSDK):
request = operations.GetKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
)
@@ -1141,7 +1185,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.GetKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -1212,7 +1257,8 @@ class APIKeys(BaseSDK):
*,
hash: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -1226,7 +1272,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -1245,7 +1293,8 @@ class APIKeys(BaseSDK):
request = operations.GetKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
hash=hash,
)
@@ -1263,7 +1312,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.GetKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -1333,7 +1383,8 @@ class APIKeys(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -1346,7 +1397,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -1365,7 +1418,8 @@ class APIKeys(BaseSDK):
request = operations.GetCurrentKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -1382,7 +1436,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.GetCurrentKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -1442,7 +1497,8 @@ class APIKeys(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -1455,7 +1511,9 @@ class APIKeys(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -1474,7 +1532,8 @@ class APIKeys(BaseSDK):
request = operations.GetCurrentKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -1491,7 +1550,8 @@ class APIKeys(BaseSDK):
http_headers=http_headers,
_globals=operations.GetCurrentKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
+80 -28
View File
@@ -22,7 +22,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -89,6 +90,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -102,7 +106,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -116,7 +122,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -132,7 +138,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -146,7 +153,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -213,6 +221,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -226,7 +237,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -240,7 +253,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -256,7 +269,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -269,7 +283,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -336,6 +351,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -349,7 +367,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -363,7 +383,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -379,7 +399,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -398,7 +419,8 @@ class Chat(BaseSDK):
request = operations.SendChatCompletionRequestRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
chat_generation_params=components.ChatGenerationParams(
provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider]
@@ -448,6 +470,9 @@ class Chat(BaseSDK):
),
image_config=image_config,
modalities=modalities,
cache_control=utils.get_pydantic_model(
cache_control, Optional[components.CacheControl]
),
),
)
@@ -465,7 +490,8 @@ class Chat(BaseSDK):
http_headers=http_headers,
_globals=operations.SendChatCompletionRequestGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -654,7 +680,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -721,6 +748,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -734,7 +764,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -748,7 +780,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -764,7 +796,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -778,7 +811,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -845,6 +879,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -858,7 +895,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -872,7 +911,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -888,7 +927,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -901,7 +941,8 @@ class Chat(BaseSDK):
*,
messages: Union[List[components.Message], List[components.MessageTypedDict]],
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
@@ -968,6 +1009,9 @@ class Chat(BaseSDK):
]
] = None,
modalities: Optional[List[components.Modality]] = None,
cache_control: Optional[
Union[components.CacheControl, components.CacheControlTypedDict]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -981,7 +1025,9 @@ class Chat(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
@@ -995,7 +1041,7 @@ class Chat(BaseSDK):
:param logprobs: Return log probabilities
:param top_logprobs: Number of top log probabilities to return (0-20)
:param max_completion_tokens: Maximum tokens in completion
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
: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 presence_penalty: Presence penalty (-2.0 to 2.0)
:param reasoning: Configuration options for reasoning models
@@ -1011,7 +1057,8 @@ class Chat(BaseSDK):
:param top_p: Nucleus sampling parameter (0-1)
:param debug: Debug options for inspecting request transformations (streaming only)
:param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
:param modalities: Output modalities for the response. Supported values are \"text\" and \"image\".
:param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".
:param cache_control: Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
: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
@@ -1030,7 +1077,8 @@ class Chat(BaseSDK):
request = operations.SendChatCompletionRequestRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
chat_generation_params=components.ChatGenerationParams(
provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider]
@@ -1080,6 +1128,9 @@ class Chat(BaseSDK):
),
image_config=image_config,
modalities=modalities,
cache_control=utils.get_pydantic_model(
cache_control, Optional[components.CacheControl]
),
),
)
@@ -1097,7 +1148,8 @@ class Chat(BaseSDK):
http_headers=http_headers,
_globals=operations.SendChatCompletionRequestGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
File diff suppressed because it is too large Load Diff
@@ -5,6 +5,10 @@ from .assistantmessageimages import (
AssistantMessageImages,
AssistantMessageImagesTypedDict,
)
from .chatcompletionaudiooutput import (
ChatCompletionAudioOutput,
ChatCompletionAudioOutputTypedDict,
)
from .chatmessagecontentitem import (
ChatMessageContentItem,
ChatMessageContentItemTypedDict,
@@ -57,6 +61,8 @@ class AssistantMessageTypedDict(TypedDict):
r"""Reasoning details for extended thinking models"""
images: NotRequired[List[AssistantMessageImagesTypedDict]]
r"""Generated images from image generation models"""
audio: NotRequired[ChatCompletionAudioOutputTypedDict]
r"""Audio output data or reference"""
class AssistantMessage(BaseModel):
@@ -85,6 +91,9 @@ class AssistantMessage(BaseModel):
images: Optional[List[AssistantMessageImages]] = None
r"""Generated images from image generation models"""
audio: Optional[ChatCompletionAudioOutput] = None
r"""Audio output data or reference"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -95,6 +104,7 @@ class AssistantMessage(BaseModel):
"reasoning",
"reasoning_details",
"images",
"audio",
]
nullable_fields = ["content", "refusal", "reasoning"]
null_default_fields = []
@@ -0,0 +1,35 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict
class ChatCompletionAudioOutputTypedDict(TypedDict):
r"""Audio output data or reference"""
id: NotRequired[str]
r"""Audio output identifier"""
expires_at: NotRequired[float]
r"""Audio expiration timestamp"""
data: NotRequired[str]
r"""Base64 encoded audio data"""
transcript: NotRequired[str]
r"""Audio transcript"""
class ChatCompletionAudioOutput(BaseModel):
r"""Audio output data or reference"""
id: Optional[str] = None
r"""Audio output identifier"""
expires_at: Optional[float] = None
r"""Audio expiration timestamp"""
data: Optional[str] = None
r"""Base64 encoded audio data"""
transcript: Optional[str] = None
r"""Audio transcript"""
@@ -87,6 +87,7 @@ ChatGenerationParamsSortEnum = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -96,6 +97,7 @@ ChatGenerationParamsProviderSortConfigEnum = Literal[
"price",
"throughput",
"latency",
"exacto",
]
@@ -104,6 +106,7 @@ ChatGenerationParamsBy = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -194,6 +197,7 @@ ChatGenerationParamsProviderSort = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -449,6 +453,10 @@ class ChatGenerationParamsPluginWebTypedDict(TypedDict):
search_prompt: NotRequired[str]
engine: NotRequired[WebSearchEngine]
r"""The search engine to use for web search."""
include_domains: NotRequired[List[str]]
r"""A list of domains to restrict web search results to. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
exclude_domains: NotRequired[List[str]]
r"""A list of domains to exclude from web search results. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
class ChatGenerationParamsPluginWeb(BaseModel):
@@ -466,6 +474,12 @@ class ChatGenerationParamsPluginWeb(BaseModel):
] = None
r"""The search engine to use for web search."""
include_domains: Optional[List[str]] = None
r"""A list of domains to restrict web search results to. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
exclude_domains: Optional[List[str]] = None
r"""A list of domains to exclude from web search results. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
ChatGenerationParamsIDModeration = Literal["moderation",]
@@ -671,11 +685,41 @@ Modality = Union[
Literal[
"text",
"image",
"audio",
],
UnrecognizedStr,
]
ChatGenerationParamsType = Literal["ephemeral",]
ChatGenerationParamsTTL = Union[
Literal[
"5m",
"1h",
],
UnrecognizedStr,
]
class CacheControlTypedDict(TypedDict):
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
type: ChatGenerationParamsType
ttl: NotRequired[ChatGenerationParamsTTL]
class CacheControl(BaseModel):
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
type: ChatGenerationParamsType
ttl: Annotated[
Optional[ChatGenerationParamsTTL], PlainValidator(validate_open_enum(False))
] = None
class ChatGenerationParamsTypedDict(TypedDict):
r"""Chat completion request parameters"""
@@ -706,7 +750,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
max_completion_tokens: NotRequired[Nullable[float]]
r"""Maximum tokens in completion"""
max_tokens: NotRequired[Nullable[float]]
r"""Maximum tokens (deprecated, use max_completion_tokens)"""
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)"""
presence_penalty: NotRequired[Nullable[float]]
@@ -737,7 +781,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
image_config: NotRequired[Dict[str, ChatGenerationParamsImageConfigTypedDict]]
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details."""
modalities: NotRequired[List[Modality]]
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"."""
cache_control: NotRequired[CacheControlTypedDict]
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
class ChatGenerationParams(BaseModel):
@@ -783,7 +829,7 @@ class ChatGenerationParams(BaseModel):
r"""Maximum tokens in completion"""
max_tokens: OptionalNullable[float] = UNSET
r"""Maximum tokens (deprecated, use max_completion_tokens)"""
r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16."""
metadata: Optional[Dict[str, str]] = None
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
@@ -832,7 +878,10 @@ class ChatGenerationParams(BaseModel):
modalities: Optional[
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
] = None
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"."""
cache_control: Optional[CacheControl] = None
r"""Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -866,6 +915,7 @@ class ChatGenerationParams(BaseModel):
"debug",
"image_config",
"modalities",
"cache_control",
]
nullable_fields = [
"provider",
@@ -5,6 +5,10 @@ from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio,
ChatMessageContentItemAudioTypedDict,
)
from .chatmessagecontentitemfile import (
ChatMessageContentItemFile,
ChatMessageContentItemFileTypedDict,
)
from .chatmessagecontentitemimage import (
ChatMessageContentItemImage,
ChatMessageContentItemImageTypedDict,
@@ -49,6 +53,7 @@ ChatMessageContentItemTypedDict = TypeAliasType(
Union[
ChatMessageContentItemImageTypedDict,
ChatMessageContentItemAudioTypedDict,
ChatMessageContentItemFileTypedDict,
ChatMessageContentItemTextTypedDict,
ChatMessageContentItem1TypedDict,
],
@@ -61,6 +66,7 @@ ChatMessageContentItem = TypeAliasType(
Union[
ChatMessageContentItemImage,
ChatMessageContentItemAudio,
ChatMessageContentItemFile,
ChatMessageContentItemText,
ChatMessageContentItem1,
],
@@ -11,7 +11,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
ChatMessageContentItemCacheControlType = Literal["ephemeral",]
TTL = Union[
ChatMessageContentItemCacheControlTTL = Union[
Literal[
"5m",
"1h",
@@ -24,7 +24,7 @@ class ChatMessageContentItemCacheControlTypedDict(TypedDict):
r"""Cache control for the content part"""
type: ChatMessageContentItemCacheControlType
ttl: NotRequired[TTL]
ttl: NotRequired[ChatMessageContentItemCacheControlTTL]
class ChatMessageContentItemCacheControl(BaseModel):
@@ -32,4 +32,7 @@ class ChatMessageContentItemCacheControl(BaseModel):
type: ChatMessageContentItemCacheControlType
ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None
ttl: Annotated[
Optional[ChatMessageContentItemCacheControlTTL],
PlainValidator(validate_open_enum(False)),
] = None
@@ -0,0 +1,44 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
ChatMessageContentItemFileType = Literal["file",]
class FileTypedDict(TypedDict):
file_data: NotRequired[str]
r"""File content as base64 data URL or URL"""
file_id: NotRequired[str]
r"""File ID for previously uploaded files"""
filename: NotRequired[str]
r"""Original filename"""
class File(BaseModel):
file_data: Optional[str] = None
r"""File content as base64 data URL or URL"""
file_id: Optional[str] = None
r"""File ID for previously uploaded files"""
filename: Optional[str] = None
r"""Original filename"""
class ChatMessageContentItemFileTypedDict(TypedDict):
r"""File content part for document processing"""
type: ChatMessageContentItemFileType
file: FileTypedDict
class ChatMessageContentItemFile(BaseModel):
r"""File content part for document processing"""
type: ChatMessageContentItemFileType
file: File
@@ -5,10 +5,16 @@ from .chatmessagetokenlogprob import (
ChatMessageTokenLogprob,
ChatMessageTokenLogprobTypedDict,
)
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import List
from typing_extensions import TypedDict
from typing_extensions import NotRequired, TypedDict
class ChatMessageTokenLogprobsTypedDict(TypedDict):
@@ -16,7 +22,7 @@ class ChatMessageTokenLogprobsTypedDict(TypedDict):
content: Nullable[List[ChatMessageTokenLogprobTypedDict]]
r"""Log probabilities for content tokens"""
refusal: Nullable[List[ChatMessageTokenLogprobTypedDict]]
refusal: NotRequired[Nullable[List[ChatMessageTokenLogprobTypedDict]]]
r"""Log probabilities for refusal tokens"""
@@ -26,12 +32,12 @@ class ChatMessageTokenLogprobs(BaseModel):
content: Nullable[List[ChatMessageTokenLogprob]]
r"""Log probabilities for content tokens"""
refusal: Nullable[List[ChatMessageTokenLogprob]]
refusal: OptionalNullable[List[ChatMessageTokenLogprob]] = UNSET
r"""Log probabilities for refusal tokens"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
optional_fields = ["refusal"]
nullable_fields = ["content", "refusal"]
null_default_fields = []
+4 -10
View File
@@ -6,13 +6,7 @@ from .chatgenerationtokenusage import (
ChatGenerationTokenUsageTypedDict,
)
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict
@@ -33,7 +27,7 @@ class ChatResponseTypedDict(TypedDict):
model: str
r"""Model used for completion"""
object: ChatResponseObject
system_fingerprint: NotRequired[Nullable[str]]
system_fingerprint: Nullable[str]
r"""System fingerprint"""
usage: NotRequired[ChatGenerationTokenUsageTypedDict]
r"""Token usage statistics"""
@@ -56,7 +50,7 @@ class ChatResponse(BaseModel):
object: ChatResponseObject
system_fingerprint: OptionalNullable[str] = UNSET
system_fingerprint: Nullable[str]
r"""System fingerprint"""
usage: Optional[ChatGenerationTokenUsage] = None
@@ -64,7 +58,7 @@ class ChatResponse(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["system_fingerprint", "usage"]
optional_fields = ["usage"]
nullable_fields = ["system_fingerprint"]
null_default_fields = []
@@ -1,6 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatcompletionaudiooutput import (
ChatCompletionAudioOutput,
ChatCompletionAudioOutputTypedDict,
)
from .chatstreamingmessagetoolcall import (
ChatStreamingMessageToolCall,
ChatStreamingMessageToolCallTypedDict,
@@ -37,6 +41,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
r"""Tool calls delta"""
reasoning_details: NotRequired[List[ReasoningDetailUnionTypedDict]]
r"""Reasoning details for extended thinking models"""
audio: NotRequired[ChatCompletionAudioOutputTypedDict]
class ChatStreamingMessageChunk(BaseModel):
@@ -60,6 +65,8 @@ class ChatStreamingMessageChunk(BaseModel):
reasoning_details: Optional[List[ReasoningDetailUnion]] = None
r"""Reasoning details for extended thinking models"""
audio: Optional[ChatCompletionAudioOutput] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -69,6 +76,7 @@ class ChatStreamingMessageChunk(BaseModel):
"refusal",
"tool_calls",
"reasoning_details",
"audio",
]
nullable_fields = ["content", "reasoning", "refusal"]
null_default_fields = []
@@ -6,14 +6,7 @@ from .chatgenerationtokenusage import (
ChatGenerationTokenUsageTypedDict,
)
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from openrouter.types import BaseModel
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict
@@ -52,7 +45,7 @@ class ChatStreamingResponseChunkTypedDict(TypedDict):
model: str
r"""Model used for completion"""
object: ChatStreamingResponseChunkObject
system_fingerprint: NotRequired[Nullable[str]]
system_fingerprint: NotRequired[str]
r"""System fingerprint"""
error: NotRequired[ErrorTypedDict]
r"""Error information"""
@@ -77,7 +70,7 @@ class ChatStreamingResponseChunk(BaseModel):
object: ChatStreamingResponseChunkObject
system_fingerprint: OptionalNullable[str] = UNSET
system_fingerprint: Optional[str] = None
r"""System fingerprint"""
error: Optional[Error] = None
@@ -85,33 +78,3 @@ class ChatStreamingResponseChunk(BaseModel):
usage: Optional[ChatGenerationTokenUsage] = None
r"""Token usage statistics"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["system_fingerprint", "error", "usage"]
nullable_fields = ["system_fingerprint"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,32 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, List, Literal, Union
from typing_extensions import Annotated, TypedDict
CompoundFilterType = Union[
Literal[
"and",
"or",
],
UnrecognizedStr,
]
class CompoundFilterTypedDict(TypedDict):
r"""A compound filter that combines multiple comparison or compound filters"""
type: CompoundFilterType
filters: List[Dict[str, Nullable[Any]]]
class CompoundFilter(BaseModel):
r"""A compound filter that combines multiple comparison or compound filters"""
type: Annotated[CompoundFilterType, PlainValidator(validate_open_enum(False))]
filters: List[Dict[str, Nullable[Any]]]
+25 -2
View File
@@ -17,7 +17,10 @@ class DefaultParametersTypedDict(TypedDict):
temperature: NotRequired[Nullable[float]]
top_p: NotRequired[Nullable[float]]
top_k: NotRequired[Nullable[int]]
frequency_penalty: NotRequired[Nullable[float]]
presence_penalty: NotRequired[Nullable[float]]
repetition_penalty: NotRequired[Nullable[float]]
class DefaultParameters(BaseModel):
@@ -27,12 +30,32 @@ class DefaultParameters(BaseModel):
top_p: OptionalNullable[float] = UNSET
top_k: OptionalNullable[int] = UNSET
frequency_penalty: OptionalNullable[float] = UNSET
presence_penalty: OptionalNullable[float] = UNSET
repetition_penalty: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["temperature", "top_p", "frequency_penalty"]
nullable_fields = ["temperature", "top_p", "frequency_penalty"]
optional_fields = [
"temperature",
"top_p",
"top_k",
"frequency_penalty",
"presence_penalty",
"repetition_penalty",
]
nullable_fields = [
"temperature",
"top_p",
"top_k",
"frequency_penalty",
"presence_penalty",
"repetition_penalty",
]
null_default_fields = []
serialized = handler(self)
@@ -86,10 +86,41 @@ class OpenAIResponsesInputFunctionCall(BaseModel):
OpenAIResponsesInputTypeFunctionCallOutput = Literal["function_call_output",]
OpenAIResponsesInputOutput1TypedDict = TypeAliasType(
"OpenAIResponsesInputOutput1TypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenAIResponsesInputOutput1 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenAIResponsesInputOutput2TypedDict = TypeAliasType(
"OpenAIResponsesInputOutput2TypedDict",
Union[str, List[OpenAIResponsesInputOutput1TypedDict]],
)
OpenAIResponsesInputOutput2 = TypeAliasType(
"OpenAIResponsesInputOutput2", Union[str, List[OpenAIResponsesInputOutput1]]
)
class OpenAIResponsesInputFunctionCallOutputTypedDict(TypedDict):
type: OpenAIResponsesInputTypeFunctionCallOutput
call_id: str
output: str
output: OpenAIResponsesInputOutput2TypedDict
id: NotRequired[Nullable[str]]
status: NotRequired[Nullable[ToolCallStatus]]
@@ -99,7 +130,7 @@ class OpenAIResponsesInputFunctionCallOutput(BaseModel):
call_id: str
output: str
output: OpenAIResponsesInputOutput2
id: OptionalNullable[str] = UNSET
@@ -279,10 +310,33 @@ OpenAIResponsesInputContent2 = TypeAliasType(
)
OpenAIResponsesInputPhaseFinalAnswer = Literal["final_answer",]
OpenAIResponsesInputPhaseCommentary = Literal["commentary",]
OpenAIResponsesInputPhaseUnionTypedDict = TypeAliasType(
"OpenAIResponsesInputPhaseUnionTypedDict",
Union[
OpenAIResponsesInputPhaseCommentary, OpenAIResponsesInputPhaseFinalAnswer, Any
],
)
OpenAIResponsesInputPhaseUnion = TypeAliasType(
"OpenAIResponsesInputPhaseUnion",
Union[
OpenAIResponsesInputPhaseCommentary, OpenAIResponsesInputPhaseFinalAnswer, Any
],
)
class OpenAIResponsesInputMessage1TypedDict(TypedDict):
role: OpenAIResponsesInputRoleUnion1TypedDict
content: OpenAIResponsesInputContent2TypedDict
type: NotRequired[OpenAIResponsesInputTypeMessage1]
phase: NotRequired[Nullable[OpenAIResponsesInputPhaseUnionTypedDict]]
class OpenAIResponsesInputMessage1(BaseModel):
@@ -292,6 +346,38 @@ class OpenAIResponsesInputMessage1(BaseModel):
type: Optional[OpenAIResponsesInputTypeMessage1] = None
phase: OptionalNullable[OpenAIResponsesInputPhaseUnion] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["type", "phase"]
nullable_fields = ["phase"]
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
OpenAIResponsesInputUnion1TypedDict = TypeAliasType(
"OpenAIResponsesInputUnion1TypedDict",
@@ -300,8 +386,8 @@ OpenAIResponsesInputUnion1TypedDict = TypeAliasType(
OpenAIResponsesInputMessage2TypedDict,
OutputItemImageGenerationCallTypedDict,
OpenAIResponsesInputFunctionCallOutputTypedDict,
OutputMessageTypedDict,
OpenAIResponsesInputFunctionCallTypedDict,
OutputMessageTypedDict,
],
)
@@ -313,8 +399,8 @@ OpenAIResponsesInputUnion1 = TypeAliasType(
OpenAIResponsesInputMessage2,
OutputItemImageGenerationCall,
OpenAIResponsesInputFunctionCallOutput,
OutputMessage,
OpenAIResponsesInputFunctionCall,
OutputMessage,
],
)
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesApplyPatchToolType = Literal["apply_patch",]
class OpenResponsesApplyPatchToolTypedDict(TypedDict):
r"""Apply patch tool configuration"""
type: OpenResponsesApplyPatchToolType
class OpenResponsesApplyPatchTool(BaseModel):
r"""Apply patch tool configuration"""
type: OpenResponsesApplyPatchToolType
@@ -0,0 +1,102 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
TypeCodeInterpreter = Literal["code_interpreter",]
ContainerType = Literal["auto",]
MemoryLimit = Union[
Literal[
"1g",
"4g",
"16g",
"64g",
],
UnrecognizedStr,
]
class ContainerAutoTypedDict(TypedDict):
type: ContainerType
file_ids: NotRequired[List[str]]
memory_limit: NotRequired[Nullable[MemoryLimit]]
class ContainerAuto(BaseModel):
type: ContainerType
file_ids: Optional[List[str]] = None
memory_limit: Annotated[
OptionalNullable[MemoryLimit], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["file_ids", "memory_limit"]
nullable_fields = ["memory_limit"]
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
ContainerTypedDict = TypeAliasType(
"ContainerTypedDict", Union[ContainerAutoTypedDict, str]
)
Container = TypeAliasType("Container", Union[ContainerAuto, str])
class OpenResponsesCodeInterpreterToolTypedDict(TypedDict):
r"""Code interpreter tool configuration"""
type: TypeCodeInterpreter
container: ContainerTypedDict
class OpenResponsesCodeInterpreterTool(BaseModel):
r"""Code interpreter tool configuration"""
type: TypeCodeInterpreter
container: Container
@@ -0,0 +1,44 @@
"""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, Union
from typing_extensions import Annotated, TypedDict
OpenResponsesComputerToolType = Literal["computer_use_preview",]
Environment = Union[
Literal[
"windows",
"mac",
"linux",
"ubuntu",
"browser",
],
UnrecognizedStr,
]
class OpenResponsesComputerToolTypedDict(TypedDict):
r"""Computer use preview tool configuration"""
type: OpenResponsesComputerToolType
display_height: float
display_width: float
environment: Environment
class OpenResponsesComputerTool(BaseModel):
r"""Computer use preview tool configuration"""
type: OpenResponsesComputerToolType
display_height: float
display_width: float
environment: Annotated[Environment, PlainValidator(validate_open_enum(False))]
@@ -0,0 +1,82 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import get_discriminator, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
TypeCustom = Literal["custom",]
FormatTypeGrammar = Literal["grammar",]
Syntax = Union[
Literal[
"lark",
"regex",
],
UnrecognizedStr,
]
class FormatGrammarTypedDict(TypedDict):
type: FormatTypeGrammar
definition: str
syntax: Syntax
class FormatGrammar(BaseModel):
type: FormatTypeGrammar
definition: str
syntax: Annotated[Syntax, PlainValidator(validate_open_enum(False))]
FormatTypeText = Literal["text",]
class FormatTextTypedDict(TypedDict):
type: FormatTypeText
class FormatText(BaseModel):
type: FormatTypeText
FormatTypedDict = TypeAliasType(
"FormatTypedDict", Union[FormatTextTypedDict, FormatGrammarTypedDict]
)
Format = Annotated[
Union[Annotated[FormatText, Tag("text")], Annotated[FormatGrammar, Tag("grammar")]],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
class OpenResponsesCustomToolTypedDict(TypedDict):
r"""Custom tool configuration"""
type: TypeCustom
name: str
description: NotRequired[str]
format_: NotRequired[FormatTypedDict]
class OpenResponsesCustomTool(BaseModel):
r"""Custom tool configuration"""
type: TypeCustom
name: str
description: Optional[str] = None
format_: Annotated[Optional[Format], pydantic.Field(alias="format")] = None
@@ -16,7 +16,7 @@ from openrouter.types import (
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -146,25 +146,88 @@ OpenResponsesEasyInputMessageContentUnion1 = Annotated[
OpenResponsesEasyInputMessageContentUnion2TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContentUnion2TypedDict",
Union[List[OpenResponsesEasyInputMessageContentUnion1TypedDict], str],
Union[List[OpenResponsesEasyInputMessageContentUnion1TypedDict], str, Any],
)
OpenResponsesEasyInputMessageContentUnion2 = TypeAliasType(
"OpenResponsesEasyInputMessageContentUnion2",
Union[List[OpenResponsesEasyInputMessageContentUnion1], str],
Union[List[OpenResponsesEasyInputMessageContentUnion1], str, Any],
)
OpenResponsesEasyInputMessagePhaseFinalAnswer = Literal["final_answer",]
OpenResponsesEasyInputMessagePhaseCommentary = Literal["commentary",]
OpenResponsesEasyInputMessagePhaseUnionTypedDict = TypeAliasType(
"OpenResponsesEasyInputMessagePhaseUnionTypedDict",
Union[
OpenResponsesEasyInputMessagePhaseCommentary,
OpenResponsesEasyInputMessagePhaseFinalAnswer,
Any,
],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
OpenResponsesEasyInputMessagePhaseUnion = TypeAliasType(
"OpenResponsesEasyInputMessagePhaseUnion",
Union[
OpenResponsesEasyInputMessagePhaseCommentary,
OpenResponsesEasyInputMessagePhaseFinalAnswer,
Any,
],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OpenResponsesEasyInputMessageTypedDict(TypedDict):
role: OpenResponsesEasyInputMessageRoleUnionTypedDict
content: OpenResponsesEasyInputMessageContentUnion2TypedDict
type: NotRequired[OpenResponsesEasyInputMessageTypeMessage]
content: NotRequired[Nullable[OpenResponsesEasyInputMessageContentUnion2TypedDict]]
phase: NotRequired[Nullable[OpenResponsesEasyInputMessagePhaseUnionTypedDict]]
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OpenResponsesEasyInputMessage(BaseModel):
role: OpenResponsesEasyInputMessageRoleUnion
content: OpenResponsesEasyInputMessageContentUnion2
type: Optional[OpenResponsesEasyInputMessageTypeMessage] = None
content: OptionalNullable[OpenResponsesEasyInputMessageContentUnion2] = UNSET
phase: OptionalNullable[OpenResponsesEasyInputMessagePhaseUnion] = UNSET
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["type", "content", "phase"]
nullable_fields = ["content", "phase"]
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,148 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .compoundfilter import CompoundFilter, CompoundFilterTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
TypeFileSearch = Literal["file_search",]
FiltersType = Union[
Literal[
"eq",
"ne",
"gt",
"gte",
"lt",
"lte",
],
UnrecognizedStr,
]
Value1TypedDict = TypeAliasType("Value1TypedDict", Union[str, float])
Value1 = TypeAliasType("Value1", Union[str, float])
Value2TypedDict = TypeAliasType(
"Value2TypedDict", Union[str, float, bool, List[Value1TypedDict]]
)
Value2 = TypeAliasType("Value2", Union[str, float, bool, List[Value1]])
class OpenResponsesFileSearchToolFiltersTypedDict(TypedDict):
key: str
type: FiltersType
value: Value2TypedDict
class OpenResponsesFileSearchToolFilters(BaseModel):
key: str
type: Annotated[FiltersType, PlainValidator(validate_open_enum(False))]
value: Value2
FiltersTypedDict = TypeAliasType(
"FiltersTypedDict",
Union[CompoundFilterTypedDict, OpenResponsesFileSearchToolFiltersTypedDict, Any],
)
Filters = TypeAliasType(
"Filters", Union[CompoundFilter, OpenResponsesFileSearchToolFilters, Any]
)
Ranker = Union[
Literal[
"auto",
"default-2024-11-15",
],
UnrecognizedStr,
]
class RankingOptionsTypedDict(TypedDict):
ranker: NotRequired[Ranker]
score_threshold: NotRequired[float]
class RankingOptions(BaseModel):
ranker: Annotated[Optional[Ranker], PlainValidator(validate_open_enum(False))] = (
None
)
score_threshold: Optional[float] = None
class OpenResponsesFileSearchToolTypedDict(TypedDict):
r"""File search tool configuration"""
type: TypeFileSearch
vector_store_ids: List[str]
filters: NotRequired[Nullable[FiltersTypedDict]]
max_num_results: NotRequired[int]
ranking_options: NotRequired[RankingOptionsTypedDict]
class OpenResponsesFileSearchTool(BaseModel):
r"""File search tool configuration"""
type: TypeFileSearch
vector_store_ids: List[str]
filters: OptionalNullable[Filters] = UNSET
max_num_results: Optional[int] = None
ranking_options: Optional[RankingOptions] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["filters", "max_num_results", "ranking_options"]
nullable_fields = ["filters"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,6 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from .toolcallstatus import ToolCallStatus
from openrouter.types import (
BaseModel,
@@ -8,23 +10,119 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, NotRequired, TypedDict
from typing import List, Literal, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesFunctionCallOutputType = Literal["function_call_output",]
OpenResponsesFunctionCallOutputTypeFunctionCallOutput = Literal["function_call_output",]
OutputType = Literal["input_image",]
OpenResponsesFunctionCallOutputDetail = Union[
Literal[
"auto",
"high",
"low",
],
UnrecognizedStr,
]
class OutputInputImageTypedDict(TypedDict):
r"""Image input content item"""
type: OutputType
detail: OpenResponsesFunctionCallOutputDetail
image_url: NotRequired[Nullable[str]]
class OutputInputImage(BaseModel):
r"""Image input content item"""
type: OutputType
detail: Annotated[
OpenResponsesFunctionCallOutputDetail, PlainValidator(validate_open_enum(False))
]
image_url: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["image_url"]
nullable_fields = ["image_url"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
OpenResponsesFunctionCallOutputOutputUnion1TypedDict = TypeAliasType(
"OpenResponsesFunctionCallOutputOutputUnion1TypedDict",
Union[
ResponseInputTextTypedDict,
OutputInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenResponsesFunctionCallOutputOutputUnion1 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[OutputInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenResponsesFunctionCallOutputOutputUnion2TypedDict = TypeAliasType(
"OpenResponsesFunctionCallOutputOutputUnion2TypedDict",
Union[str, List[OpenResponsesFunctionCallOutputOutputUnion1TypedDict]],
)
OpenResponsesFunctionCallOutputOutputUnion2 = TypeAliasType(
"OpenResponsesFunctionCallOutputOutputUnion2",
Union[str, List[OpenResponsesFunctionCallOutputOutputUnion1]],
)
class OpenResponsesFunctionCallOutputTypedDict(TypedDict):
r"""The output from a function call execution"""
type: OpenResponsesFunctionCallOutputType
type: OpenResponsesFunctionCallOutputTypeFunctionCallOutput
call_id: str
output: str
output: OpenResponsesFunctionCallOutputOutputUnion2TypedDict
id: NotRequired[Nullable[str]]
status: NotRequired[Nullable[ToolCallStatus]]
@@ -32,11 +130,11 @@ class OpenResponsesFunctionCallOutputTypedDict(TypedDict):
class OpenResponsesFunctionCallOutput(BaseModel):
r"""The output from a function call execution"""
type: OpenResponsesFunctionCallOutputType
type: OpenResponsesFunctionCallOutputTypeFunctionCallOutput
call_id: str
output: str
output: OpenResponsesFunctionCallOutputOutputUnion2
id: OptionalNullable[str] = UNSET
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesFunctionShellToolType = Literal["shell",]
class OpenResponsesFunctionShellToolTypedDict(TypedDict):
r"""Shell tool configuration"""
type: OpenResponsesFunctionShellToolType
class OpenResponsesFunctionShellTool(BaseModel):
r"""Shell tool configuration"""
type: OpenResponsesFunctionShellToolType
@@ -0,0 +1,194 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesImageGenerationToolType = Literal["image_generation",]
Background = Union[
Literal[
"transparent",
"opaque",
"auto",
],
UnrecognizedStr,
]
InputFidelity = Union[
Literal[
"high",
"low",
],
UnrecognizedStr,
]
class InputImageMaskTypedDict(TypedDict):
image_url: NotRequired[str]
file_id: NotRequired[str]
class InputImageMask(BaseModel):
image_url: Optional[str] = None
file_id: Optional[str] = None
ModelEnum = Union[
Literal[
"gpt-image-1",
"gpt-image-1-mini",
],
UnrecognizedStr,
]
Moderation = Union[
Literal[
"auto",
"low",
],
UnrecognizedStr,
]
OutputFormat = Union[
Literal[
"png",
"webp",
"jpeg",
],
UnrecognizedStr,
]
Quality = Union[
Literal[
"low",
"medium",
"high",
"auto",
],
UnrecognizedStr,
]
Size = Union[
Literal[
"1024x1024",
"1024x1536",
"1536x1024",
"auto",
],
UnrecognizedStr,
]
class OpenResponsesImageGenerationToolTypedDict(TypedDict):
r"""Image generation tool configuration"""
type: OpenResponsesImageGenerationToolType
background: NotRequired[Background]
input_fidelity: NotRequired[Nullable[InputFidelity]]
input_image_mask: NotRequired[InputImageMaskTypedDict]
model: NotRequired[ModelEnum]
moderation: NotRequired[Moderation]
output_compression: NotRequired[float]
output_format: NotRequired[OutputFormat]
partial_images: NotRequired[float]
quality: NotRequired[Quality]
size: NotRequired[Size]
class OpenResponsesImageGenerationTool(BaseModel):
r"""Image generation tool configuration"""
type: OpenResponsesImageGenerationToolType
background: Annotated[
Optional[Background], PlainValidator(validate_open_enum(False))
] = None
input_fidelity: Annotated[
OptionalNullable[InputFidelity], PlainValidator(validate_open_enum(False))
] = UNSET
input_image_mask: Optional[InputImageMask] = None
model: Annotated[Optional[ModelEnum], PlainValidator(validate_open_enum(False))] = (
None
)
moderation: Annotated[
Optional[Moderation], PlainValidator(validate_open_enum(False))
] = None
output_compression: Optional[float] = None
output_format: Annotated[
Optional[OutputFormat], PlainValidator(validate_open_enum(False))
] = None
partial_images: Optional[float] = None
quality: Annotated[Optional[Quality], PlainValidator(validate_open_enum(False))] = (
None
)
size: Annotated[Optional[Size], PlainValidator(validate_open_enum(False))] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"background",
"input_fidelity",
"input_image_mask",
"model",
"moderation",
"output_compression",
"output_format",
"partial_images",
"quality",
"size",
]
nullable_fields = ["input_fidelity"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,97 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openresponseseasyinputmessage import (
OpenResponsesEasyInputMessage,
OpenResponsesEasyInputMessageTypedDict,
)
from .openresponsesfunctioncalloutput import (
OpenResponsesFunctionCallOutput,
OpenResponsesFunctionCallOutputTypedDict,
)
from .openresponsesfunctiontoolcall import (
OpenResponsesFunctionToolCall,
OpenResponsesFunctionToolCallTypedDict,
)
from .openresponsesinputmessageitem import (
OpenResponsesInputMessageItem,
OpenResponsesInputMessageItemTypedDict,
)
from .openresponsesreasoning import (
OpenResponsesReasoning,
OpenResponsesReasoningTypedDict,
)
from .responsesimagegenerationcall import (
ResponsesImageGenerationCall,
ResponsesImageGenerationCallTypedDict,
)
from .responsesoutputitemfilesearchcall import (
ResponsesOutputItemFileSearchCall,
ResponsesOutputItemFileSearchCallTypedDict,
)
from .responsesoutputitemfunctioncall import (
ResponsesOutputItemFunctionCall,
ResponsesOutputItemFunctionCallTypedDict,
)
from .responsesoutputitemreasoning import (
ResponsesOutputItemReasoning,
ResponsesOutputItemReasoningTypedDict,
)
from .responsesoutputmessage import (
ResponsesOutputMessage,
ResponsesOutputMessageTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
)
from typing import List, Union
from typing_extensions import TypeAliasType
OpenResponsesInput1TypedDict = TypeAliasType(
"OpenResponsesInput1TypedDict",
Union[
OpenResponsesEasyInputMessageTypedDict,
ResponsesWebSearchCallOutputTypedDict,
OpenResponsesInputMessageItemTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
OpenResponsesFunctionCallOutputTypedDict,
ResponsesOutputMessageTypedDict,
OpenResponsesFunctionToolCallTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
OpenResponsesReasoningTypedDict,
ResponsesOutputItemReasoningTypedDict,
],
)
OpenResponsesInput1 = TypeAliasType(
"OpenResponsesInput1",
Union[
OpenResponsesEasyInputMessage,
ResponsesWebSearchCallOutput,
OpenResponsesInputMessageItem,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
OpenResponsesFunctionCallOutput,
ResponsesOutputMessage,
OpenResponsesFunctionToolCall,
ResponsesOutputItemFunctionCall,
OpenResponsesReasoning,
ResponsesOutputItemReasoning,
],
)
OpenResponsesInputTypedDict = TypeAliasType(
"OpenResponsesInputTypedDict", Union[str, List[OpenResponsesInput1TypedDict]]
)
r"""Input for a response request - can be a string or array of items"""
OpenResponsesInput = TypeAliasType(
"OpenResponsesInput", Union[str, List[OpenResponsesInput1]]
)
r"""Input for a response request - can be a string or array of items"""
@@ -0,0 +1,380 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openairesponsesrefusalcontent import (
OpenAIResponsesRefusalContent,
OpenAIResponsesRefusalContentTypedDict,
)
from .openresponseseasyinputmessage import (
OpenResponsesEasyInputMessage,
OpenResponsesEasyInputMessageTypedDict,
)
from .openresponsesfunctioncalloutput import (
OpenResponsesFunctionCallOutput,
OpenResponsesFunctionCallOutputTypedDict,
)
from .openresponsesfunctiontoolcall import (
OpenResponsesFunctionToolCall,
OpenResponsesFunctionToolCallTypedDict,
)
from .openresponsesinputmessageitem import (
OpenResponsesInputMessageItem,
OpenResponsesInputMessageItemTypedDict,
)
from .openresponsesreasoning import (
OpenResponsesReasoning,
OpenResponsesReasoningTypedDict,
)
from .reasoningsummarytext import ReasoningSummaryText, ReasoningSummaryTextTypedDict
from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentTypedDict
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
from .responsesimagegenerationcall import (
ResponsesImageGenerationCall,
ResponsesImageGenerationCallTypedDict,
)
from .responsesoutputitemfilesearchcall import (
ResponsesOutputItemFileSearchCall,
ResponsesOutputItemFileSearchCallTypedDict,
)
from .responsesoutputitemfunctioncall import (
ResponsesOutputItemFunctionCall,
ResponsesOutputItemFunctionCallTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
)
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesInputTypeReasoning = Literal["reasoning",]
OpenResponsesInputStatusInProgress2 = Literal["in_progress",]
OpenResponsesInputStatusIncomplete2 = Literal["incomplete",]
OpenResponsesInputStatusCompleted2 = Literal["completed",]
OpenResponsesInputStatusUnion2TypedDict = TypeAliasType(
"OpenResponsesInputStatusUnion2TypedDict",
Union[
OpenResponsesInputStatusCompleted2,
OpenResponsesInputStatusIncomplete2,
OpenResponsesInputStatusInProgress2,
],
)
OpenResponsesInputStatusUnion2 = TypeAliasType(
"OpenResponsesInputStatusUnion2",
Union[
OpenResponsesInputStatusCompleted2,
OpenResponsesInputStatusIncomplete2,
OpenResponsesInputStatusInProgress2,
],
)
OpenResponsesInputFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
],
UnrecognizedStr,
]
r"""The format of the reasoning content"""
class OpenResponsesInputReasoningTypedDict(TypedDict):
r"""An output item containing reasoning"""
type: OpenResponsesInputTypeReasoning
id: str
summary: Nullable[List[ReasoningSummaryTextTypedDict]]
content: NotRequired[Nullable[List[ReasoningTextContentTypedDict]]]
encrypted_content: NotRequired[Nullable[str]]
status: NotRequired[OpenResponsesInputStatusUnion2TypedDict]
signature: NotRequired[Nullable[str]]
r"""A signature for the reasoning content, used for verification"""
format_: NotRequired[Nullable[OpenResponsesInputFormat]]
r"""The format of the reasoning content"""
class OpenResponsesInputReasoning(BaseModel):
r"""An output item containing reasoning"""
type: OpenResponsesInputTypeReasoning
id: str
summary: Nullable[List[ReasoningSummaryText]]
content: OptionalNullable[List[ReasoningTextContent]] = UNSET
encrypted_content: OptionalNullable[str] = UNSET
status: Optional[OpenResponsesInputStatusUnion2] = None
signature: OptionalNullable[str] = UNSET
r"""A signature for the reasoning content, used for verification"""
format_: Annotated[
Annotated[
OptionalNullable[OpenResponsesInputFormat],
PlainValidator(validate_open_enum(False)),
],
pydantic.Field(alias="format"),
] = UNSET
r"""The format of the reasoning content"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"content",
"encrypted_content",
"status",
"signature",
"format",
]
nullable_fields = [
"content",
"summary",
"encrypted_content",
"signature",
"format",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
OpenResponsesInputRole = Literal["assistant",]
OpenResponsesInputTypeMessage = Literal["message",]
OpenResponsesInputStatusInProgress1 = Literal["in_progress",]
OpenResponsesInputStatusIncomplete1 = Literal["incomplete",]
OpenResponsesInputStatusCompleted1 = Literal["completed",]
OpenResponsesInputStatusUnion1TypedDict = TypeAliasType(
"OpenResponsesInputStatusUnion1TypedDict",
Union[
OpenResponsesInputStatusCompleted1,
OpenResponsesInputStatusIncomplete1,
OpenResponsesInputStatusInProgress1,
],
)
OpenResponsesInputStatusUnion1 = TypeAliasType(
"OpenResponsesInputStatusUnion1",
Union[
OpenResponsesInputStatusCompleted1,
OpenResponsesInputStatusIncomplete1,
OpenResponsesInputStatusInProgress1,
],
)
OpenResponsesInputContent1TypedDict = TypeAliasType(
"OpenResponsesInputContent1TypedDict",
Union[OpenAIResponsesRefusalContentTypedDict, ResponseOutputTextTypedDict],
)
OpenResponsesInputContent1 = Annotated[
Union[
Annotated[ResponseOutputText, Tag("output_text")],
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenResponsesInputContent2TypedDict = TypeAliasType(
"OpenResponsesInputContent2TypedDict",
Union[List[OpenResponsesInputContent1TypedDict], str, Any],
)
OpenResponsesInputContent2 = TypeAliasType(
"OpenResponsesInputContent2", Union[List[OpenResponsesInputContent1], str, Any]
)
OpenResponsesInputPhaseFinalAnswer = Literal["final_answer",]
OpenResponsesInputPhaseCommentary = Literal["commentary",]
OpenResponsesInputPhaseUnionTypedDict = TypeAliasType(
"OpenResponsesInputPhaseUnionTypedDict",
Union[OpenResponsesInputPhaseCommentary, OpenResponsesInputPhaseFinalAnswer, Any],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
OpenResponsesInputPhaseUnion = TypeAliasType(
"OpenResponsesInputPhaseUnion",
Union[OpenResponsesInputPhaseCommentary, OpenResponsesInputPhaseFinalAnswer, Any],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OpenResponsesInputMessageTypedDict(TypedDict):
r"""An output message item"""
id: str
role: OpenResponsesInputRole
type: OpenResponsesInputTypeMessage
content: Nullable[OpenResponsesInputContent2TypedDict]
status: NotRequired[OpenResponsesInputStatusUnion1TypedDict]
phase: NotRequired[Nullable[OpenResponsesInputPhaseUnionTypedDict]]
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OpenResponsesInputMessage(BaseModel):
r"""An output message item"""
id: str
role: OpenResponsesInputRole
type: OpenResponsesInputTypeMessage
content: Nullable[OpenResponsesInputContent2]
status: Optional[OpenResponsesInputStatusUnion1] = None
phase: OptionalNullable[OpenResponsesInputPhaseUnion] = UNSET
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["status", "phase"]
nullable_fields = ["content", "phase"]
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
OpenResponsesInputUnion1TypedDict = TypeAliasType(
"OpenResponsesInputUnion1TypedDict",
Union[
OpenResponsesEasyInputMessageTypedDict,
OpenResponsesInputMessageItemTypedDict,
ResponsesWebSearchCallOutputTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
OpenResponsesFunctionCallOutputTypedDict,
OpenResponsesFunctionToolCallTypedDict,
OpenResponsesInputMessageTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
OpenResponsesReasoningTypedDict,
OpenResponsesInputReasoningTypedDict,
],
)
OpenResponsesInputUnion1 = TypeAliasType(
"OpenResponsesInputUnion1",
Union[
OpenResponsesEasyInputMessage,
OpenResponsesInputMessageItem,
ResponsesWebSearchCallOutput,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
OpenResponsesFunctionCallOutput,
OpenResponsesFunctionToolCall,
OpenResponsesInputMessage,
ResponsesOutputItemFunctionCall,
OpenResponsesReasoning,
OpenResponsesInputReasoning,
],
)
OpenResponsesInputUnionTypedDict = TypeAliasType(
"OpenResponsesInputUnionTypedDict",
Union[str, List[OpenResponsesInputUnion1TypedDict]],
)
r"""Input for a response request - can be a string or array of items"""
OpenResponsesInputUnion = TypeAliasType(
"OpenResponsesInputUnion", Union[str, List[OpenResponsesInputUnion1]]
)
r"""Input for a response request - can be a string or array of items"""
@@ -141,16 +141,48 @@ OpenResponsesInputMessageItemContentUnion = Annotated[
class OpenResponsesInputMessageItemTypedDict(TypedDict):
role: OpenResponsesInputMessageItemRoleUnionTypedDict
content: List[OpenResponsesInputMessageItemContentUnionTypedDict]
id: NotRequired[str]
type: NotRequired[OpenResponsesInputMessageItemTypeMessage]
content: NotRequired[
Nullable[List[OpenResponsesInputMessageItemContentUnionTypedDict]]
]
class OpenResponsesInputMessageItem(BaseModel):
role: OpenResponsesInputMessageItemRoleUnion
content: List[OpenResponsesInputMessageItemContentUnion]
id: Optional[str] = None
type: Optional[OpenResponsesInputMessageItemTypeMessage] = None
content: OptionalNullable[List[OpenResponsesInputMessageItemContentUnion]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "type", "content"]
nullable_fields = ["content"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesLocalShellToolType = Literal["local_shell",]
class OpenResponsesLocalShellToolTypedDict(TypedDict):
r"""Local shell tool configuration"""
type: OpenResponsesLocalShellToolType
class OpenResponsesLocalShellTool(BaseModel):
r"""Local shell tool configuration"""
type: OpenResponsesLocalShellToolType
@@ -1,28 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .openresponsestoplogprobs import (
OpenResponsesTopLogprobs,
OpenResponsesTopLogprobsTypedDict,
)
from openrouter.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class OpenResponsesLogProbsTypedDict(TypedDict):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: NotRequired[List[OpenResponsesTopLogprobsTypedDict]]
class OpenResponsesLogProbs(BaseModel):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: Optional[List[OpenResponsesTopLogprobs]] = None
@@ -0,0 +1,154 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesMcpToolType = Literal["mcp",]
class AllowedToolsTypedDict(TypedDict):
tool_names: NotRequired[List[str]]
read_only: NotRequired[bool]
class AllowedTools(BaseModel):
tool_names: Optional[List[str]] = None
read_only: Optional[bool] = None
ConnectorID = Union[
Literal[
"connector_dropbox",
"connector_gmail",
"connector_googlecalendar",
"connector_googledrive",
"connector_microsoftteams",
"connector_outlookcalendar",
"connector_outlookemail",
"connector_sharepoint",
],
UnrecognizedStr,
]
RequireApprovalNever = Literal["never",]
RequireApprovalAlways = Literal["always",]
class NeverTypedDict(TypedDict):
tool_names: NotRequired[List[str]]
class Never(BaseModel):
tool_names: Optional[List[str]] = None
class AlwaysTypedDict(TypedDict):
tool_names: NotRequired[List[str]]
class Always(BaseModel):
tool_names: Optional[List[str]] = None
class RequireApprovalTypedDict(TypedDict):
never: NotRequired[NeverTypedDict]
always: NotRequired[AlwaysTypedDict]
class RequireApproval(BaseModel):
never: Optional[Never] = None
always: Optional[Always] = None
class OpenResponsesMcpToolTypedDict(TypedDict):
r"""MCP (Model Context Protocol) tool configuration"""
type: OpenResponsesMcpToolType
server_label: str
allowed_tools: NotRequired[Nullable[Any]]
authorization: NotRequired[str]
connector_id: NotRequired[ConnectorID]
headers: NotRequired[Nullable[Dict[str, str]]]
require_approval: NotRequired[Nullable[Any]]
server_description: NotRequired[str]
server_url: NotRequired[str]
class OpenResponsesMcpTool(BaseModel):
r"""MCP (Model Context Protocol) tool configuration"""
type: OpenResponsesMcpToolType
server_label: str
allowed_tools: OptionalNullable[Any] = UNSET
authorization: Optional[str] = None
connector_id: Annotated[
Optional[ConnectorID], PlainValidator(validate_open_enum(False))
] = None
headers: OptionalNullable[Dict[str, str]] = UNSET
require_approval: OptionalNullable[Any] = UNSET
server_description: Optional[str] = None
server_url: Optional[str] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"allowed_tools",
"authorization",
"connector_id",
"headers",
"require_approval",
"server_description",
"server_url",
]
nullable_fields = ["allowed_tools", "headers", "require_approval"]
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
@@ -21,6 +21,39 @@ from .openairesponsestoolchoice_union import (
OpenAIResponsesToolChoiceUnionTypedDict,
)
from .openairesponsestruncation import OpenAIResponsesTruncation
from .openresponsesapplypatchtool import (
OpenResponsesApplyPatchTool,
OpenResponsesApplyPatchToolTypedDict,
)
from .openresponsescodeinterpretertool import (
OpenResponsesCodeInterpreterTool,
OpenResponsesCodeInterpreterToolTypedDict,
)
from .openresponsescomputertool import (
OpenResponsesComputerTool,
OpenResponsesComputerToolTypedDict,
)
from .openresponsescustomtool import (
OpenResponsesCustomTool,
OpenResponsesCustomToolTypedDict,
)
from .openresponsesfilesearchtool import (
OpenResponsesFileSearchTool,
OpenResponsesFileSearchToolTypedDict,
)
from .openresponsesfunctionshelltool import (
OpenResponsesFunctionShellTool,
OpenResponsesFunctionShellToolTypedDict,
)
from .openresponsesimagegenerationtool import (
OpenResponsesImageGenerationTool,
OpenResponsesImageGenerationToolTypedDict,
)
from .openresponseslocalshelltool import (
OpenResponsesLocalShellTool,
OpenResponsesLocalShellToolTypedDict,
)
from .openresponsesmcptool import OpenResponsesMcpTool, OpenResponsesMcpToolTypedDict
from .openresponsesusage import OpenResponsesUsage, OpenResponsesUsageTypedDict
from .openresponseswebsearch20250826tool import (
OpenResponsesWebSearch20250826Tool,
@@ -118,11 +151,20 @@ class OpenResponsesNonStreamingResponseToolFunction(BaseModel):
OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType(
"OpenResponsesNonStreamingResponseToolUnionTypedDict",
Union[
OpenResponsesApplyPatchToolTypedDict,
OpenResponsesFunctionShellToolTypedDict,
OpenResponsesLocalShellToolTypedDict,
OpenResponsesCodeInterpreterToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesNonStreamingResponseToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
)
@@ -137,6 +179,15 @@ OpenResponsesNonStreamingResponseToolUnion = Annotated[
],
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
Annotated[OpenResponsesFileSearchTool, Tag("file_search")],
Annotated[OpenResponsesComputerTool, Tag("computer_use_preview")],
Annotated[OpenResponsesCodeInterpreterTool, Tag("code_interpreter")],
Annotated[OpenResponsesMcpTool, Tag("mcp")],
Annotated[OpenResponsesImageGenerationTool, Tag("image_generation")],
Annotated[OpenResponsesLocalShellTool, Tag("local_shell")],
Annotated[OpenResponsesFunctionShellTool, Tag("shell")],
Annotated[OpenResponsesApplyPatchTool, Tag("apply_patch")],
Annotated[OpenResponsesCustomTool, Tag("custom")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -8,7 +8,43 @@ from .openairesponsestoolchoice_union import (
OpenAIResponsesToolChoiceUnion,
OpenAIResponsesToolChoiceUnionTypedDict,
)
from .openresponsesinput import OpenResponsesInput, OpenResponsesInputTypedDict
from .openresponsesapplypatchtool import (
OpenResponsesApplyPatchTool,
OpenResponsesApplyPatchToolTypedDict,
)
from .openresponsescodeinterpretertool import (
OpenResponsesCodeInterpreterTool,
OpenResponsesCodeInterpreterToolTypedDict,
)
from .openresponsescomputertool import (
OpenResponsesComputerTool,
OpenResponsesComputerToolTypedDict,
)
from .openresponsescustomtool import (
OpenResponsesCustomTool,
OpenResponsesCustomToolTypedDict,
)
from .openresponsesfilesearchtool import (
OpenResponsesFileSearchTool,
OpenResponsesFileSearchToolTypedDict,
)
from .openresponsesfunctionshelltool import (
OpenResponsesFunctionShellTool,
OpenResponsesFunctionShellToolTypedDict,
)
from .openresponsesimagegenerationtool import (
OpenResponsesImageGenerationTool,
OpenResponsesImageGenerationToolTypedDict,
)
from .openresponsesinput_union import (
OpenResponsesInputUnion,
OpenResponsesInputUnionTypedDict,
)
from .openresponseslocalshelltool import (
OpenResponsesLocalShellTool,
OpenResponsesLocalShellToolTypedDict,
)
from .openresponsesmcptool import OpenResponsesMcpTool, OpenResponsesMcpToolTypedDict
from .openresponsesreasoningconfig import (
OpenResponsesReasoningConfig,
OpenResponsesReasoningConfigTypedDict,
@@ -121,11 +157,20 @@ class OpenResponsesRequestToolFunction(BaseModel):
OpenResponsesRequestToolUnionTypedDict = TypeAliasType(
"OpenResponsesRequestToolUnionTypedDict",
Union[
OpenResponsesApplyPatchToolTypedDict,
OpenResponsesFunctionShellToolTypedDict,
OpenResponsesLocalShellToolTypedDict,
OpenResponsesCodeInterpreterToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
)
@@ -140,6 +185,15 @@ OpenResponsesRequestToolUnion = Annotated[
],
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
Annotated[OpenResponsesFileSearchTool, Tag("file_search")],
Annotated[OpenResponsesComputerTool, Tag("computer_use_preview")],
Annotated[OpenResponsesCodeInterpreterTool, Tag("code_interpreter")],
Annotated[OpenResponsesMcpTool, Tag("mcp")],
Annotated[OpenResponsesImageGenerationTool, Tag("image_generation")],
Annotated[OpenResponsesLocalShellTool, Tag("local_shell")],
Annotated[OpenResponsesFunctionShellTool, Tag("shell")],
Annotated[OpenResponsesApplyPatchTool, Tag("apply_patch")],
Annotated[OpenResponsesCustomTool, Tag("custom")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -443,6 +497,10 @@ class OpenResponsesRequestPluginWebTypedDict(TypedDict):
search_prompt: NotRequired[str]
engine: NotRequired[WebSearchEngine]
r"""The search engine to use for web search."""
include_domains: NotRequired[List[str]]
r"""A list of domains to restrict web search results to. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
exclude_domains: NotRequired[List[str]]
r"""A list of domains to exclude from web search results. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
class OpenResponsesRequestPluginWeb(BaseModel):
@@ -460,6 +518,12 @@ class OpenResponsesRequestPluginWeb(BaseModel):
] = None
r"""The search engine to use for web search."""
include_domains: Optional[List[str]] = None
r"""A list of domains to restrict web search results to. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
exclude_domains: Optional[List[str]] = None
r"""A list of domains to exclude from web search results. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")."""
OpenResponsesRequestIDModeration = Literal["moderation",]
@@ -557,7 +621,7 @@ class OpenResponsesRequestTrace(BaseModel):
class OpenResponsesRequestTypedDict(TypedDict):
r"""Request schema for Responses endpoint"""
input: NotRequired[OpenResponsesInputTypedDict]
input: NotRequired[OpenResponsesInputUnionTypedDict]
r"""Input for a response request - can be a string or array of items"""
instructions: NotRequired[Nullable[str]]
metadata: NotRequired[Nullable[Dict[str, str]]]
@@ -608,7 +672,7 @@ class OpenResponsesRequestTypedDict(TypedDict):
class OpenResponsesRequest(BaseModel):
r"""Request schema for Responses endpoint"""
input: Optional[OpenResponsesInput] = None
input: Optional[OpenResponsesInputUnion] = None
r"""Input for a response request - can be a string or array of items"""
instructions: OptionalNullable[str] = UNSET
@@ -29,7 +29,6 @@ from .openresponsesimagegencallpartialimage import (
OpenResponsesImageGenCallPartialImage,
OpenResponsesImageGenCallPartialImageTypedDict,
)
from .openresponseslogprobs import OpenResponsesLogProbs, OpenResponsesLogProbsTypedDict
from .openresponsesnonstreamingresponse import (
OpenResponsesNonStreamingResponse,
OpenResponsesNonStreamingResponseTypedDict,
@@ -60,9 +59,10 @@ from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
import pydantic
from pydantic import Discriminator, Tag
from typing import List, Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
TypeResponseReasoningSummaryPartDone = Literal["response.reasoning_summary_part.done",]
@@ -254,6 +254,45 @@ class OpenResponsesStreamEventResponseRefusalDelta(BaseModel):
TypeResponseOutputTextDone = Literal["response.output_text.done",]
class OpenResponsesStreamEventTopLogprob2TypedDict(TypedDict):
r"""Alternative token with its log probability"""
token: NotRequired[str]
logprob: NotRequired[float]
bytes_: NotRequired[List[float]]
class OpenResponsesStreamEventTopLogprob2(BaseModel):
r"""Alternative token with its log probability"""
token: Optional[str] = None
logprob: Optional[float] = None
bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None
class OpenResponsesStreamEventLogprob2TypedDict(TypedDict):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: NotRequired[List[OpenResponsesStreamEventTopLogprob2TypedDict]]
bytes_: NotRequired[List[float]]
class OpenResponsesStreamEventLogprob2(BaseModel):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: Optional[List[OpenResponsesStreamEventTopLogprob2]] = None
bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None
class OpenResponsesStreamEventResponseOutputTextDoneTypedDict(TypedDict):
r"""Event emitted when text streaming is complete"""
@@ -263,7 +302,7 @@ class OpenResponsesStreamEventResponseOutputTextDoneTypedDict(TypedDict):
content_index: float
text: str
sequence_number: float
logprobs: List[OpenResponsesLogProbsTypedDict]
logprobs: List[OpenResponsesStreamEventLogprob2TypedDict]
class OpenResponsesStreamEventResponseOutputTextDone(BaseModel):
@@ -281,17 +320,56 @@ class OpenResponsesStreamEventResponseOutputTextDone(BaseModel):
sequence_number: float
logprobs: List[OpenResponsesLogProbs]
logprobs: List[OpenResponsesStreamEventLogprob2]
TypeResponseOutputTextDelta = Literal["response.output_text.delta",]
class OpenResponsesStreamEventTopLogprob1TypedDict(TypedDict):
r"""Alternative token with its log probability"""
token: NotRequired[str]
logprob: NotRequired[float]
bytes_: NotRequired[List[float]]
class OpenResponsesStreamEventTopLogprob1(BaseModel):
r"""Alternative token with its log probability"""
token: Optional[str] = None
logprob: Optional[float] = None
bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None
class OpenResponsesStreamEventLogprob1TypedDict(TypedDict):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: NotRequired[List[OpenResponsesStreamEventTopLogprob1TypedDict]]
bytes_: NotRequired[List[float]]
class OpenResponsesStreamEventLogprob1(BaseModel):
r"""Log probability information for a token"""
logprob: float
token: str
top_logprobs: Optional[List[OpenResponsesStreamEventTopLogprob1]] = None
bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None
class OpenResponsesStreamEventResponseOutputTextDeltaTypedDict(TypedDict):
r"""Event emitted when a text delta is streamed"""
type: TypeResponseOutputTextDelta
logprobs: List[OpenResponsesLogProbsTypedDict]
logprobs: List[OpenResponsesStreamEventLogprob1TypedDict]
output_index: float
item_id: str
content_index: float
@@ -304,7 +382,7 @@ class OpenResponsesStreamEventResponseOutputTextDelta(BaseModel):
type: TypeResponseOutputTextDelta
logprobs: List[OpenResponsesLogProbs]
logprobs: List[OpenResponsesStreamEventLogprob1]
output_index: float
@@ -1,21 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict
class OpenResponsesTopLogprobsTypedDict(TypedDict):
r"""Alternative token with its log probability"""
token: NotRequired[str]
logprob: NotRequired[float]
class OpenResponsesTopLogprobs(BaseModel):
r"""Alternative token with its log probability"""
token: Optional[str] = None
logprob: Optional[float] = None
+64 -3
View File
@@ -6,10 +6,16 @@ from .openairesponsesrefusalcontent import (
OpenAIResponsesRefusalContentTypedDict,
)
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
from openrouter.types import BaseModel
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Literal, Optional, Union
from pydantic import Discriminator, Tag, model_serializer
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -63,12 +69,34 @@ OutputMessageContent = Annotated[
]
OutputMessagePhaseFinalAnswer = Literal["final_answer",]
OutputMessagePhaseCommentary = Literal["commentary",]
OutputMessagePhaseUnionTypedDict = TypeAliasType(
"OutputMessagePhaseUnionTypedDict",
Union[OutputMessagePhaseCommentary, OutputMessagePhaseFinalAnswer, Any],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
OutputMessagePhaseUnion = TypeAliasType(
"OutputMessagePhaseUnion",
Union[OutputMessagePhaseCommentary, OutputMessagePhaseFinalAnswer, Any],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OutputMessageTypedDict(TypedDict):
id: str
role: OutputMessageRole
type: OutputMessageType
content: List[OutputMessageContentTypedDict]
status: NotRequired[OutputMessageStatusUnionTypedDict]
phase: NotRequired[Nullable[OutputMessagePhaseUnionTypedDict]]
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class OutputMessage(BaseModel):
@@ -81,3 +109,36 @@ class OutputMessage(BaseModel):
content: List[OutputMessageContent]
status: Optional[OutputMessageStatusUnion] = None
phase: OptionalNullable[OutputMessagePhaseUnion] = UNSET
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["status", "phase"]
nullable_fields = ["phase"]
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
@@ -11,6 +11,7 @@ OutputModality = Union[
"image",
"embeddings",
"audio",
"video",
],
UnrecognizedStr,
]
@@ -7,6 +7,7 @@ from typing import Literal, Union
ProviderName = Union[
Literal[
"Akash",
"AI21",
"AionLabs",
"Alibaba",
@@ -62,6 +62,7 @@ ProviderPreferencesSortEnum = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -71,6 +72,7 @@ ProviderPreferencesProviderSortConfigEnum = Literal[
"price",
"throughput",
"latency",
"exacto",
]
@@ -79,6 +81,7 @@ ProviderPreferencesBy = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -168,6 +171,7 @@ ProviderPreferencesProviderSort = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -10,6 +10,7 @@ ProviderSort = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -21,6 +21,7 @@ By = Union[
"price",
"throughput",
"latency",
"exacto",
],
UnrecognizedStr,
]
@@ -28,14 +28,14 @@ class ResponseOutputTextTopLogprob(BaseModel):
logprob: float
class LogprobTypedDict(TypedDict):
class ResponseOutputTextLogprobTypedDict(TypedDict):
token: str
bytes_: List[float]
logprob: float
top_logprobs: List[ResponseOutputTextTopLogprobTypedDict]
class Logprob(BaseModel):
class ResponseOutputTextLogprob(BaseModel):
token: str
bytes_: Annotated[List[float], pydantic.Field(alias="bytes")]
@@ -49,7 +49,7 @@ class ResponseOutputTextTypedDict(TypedDict):
type: ResponseOutputTextType
text: str
annotations: NotRequired[List[OpenAIResponsesAnnotationTypedDict]]
logprobs: NotRequired[List[LogprobTypedDict]]
logprobs: NotRequired[List[ResponseOutputTextLogprobTypedDict]]
class ResponseOutputText(BaseModel):
@@ -59,4 +59,4 @@ class ResponseOutputText(BaseModel):
annotations: Optional[List[OpenAIResponsesAnnotation]] = None
logprobs: Optional[List[Logprob]] = None
logprobs: Optional[List[ResponseOutputTextLogprob]] = None
@@ -6,10 +6,16 @@ from .openairesponsesrefusalcontent import (
OpenAIResponsesRefusalContentTypedDict,
)
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
from openrouter.types import BaseModel
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Literal, Optional, Union
from pydantic import Discriminator, Tag, model_serializer
from typing import Any, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -63,6 +69,34 @@ ResponsesOutputMessageContent = Annotated[
]
ResponsesOutputMessagePhaseFinalAnswer = Literal["final_answer",]
ResponsesOutputMessagePhaseCommentary = Literal["commentary",]
ResponsesOutputMessagePhaseUnionTypedDict = TypeAliasType(
"ResponsesOutputMessagePhaseUnionTypedDict",
Union[
ResponsesOutputMessagePhaseCommentary,
ResponsesOutputMessagePhaseFinalAnswer,
Any,
],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
ResponsesOutputMessagePhaseUnion = TypeAliasType(
"ResponsesOutputMessagePhaseUnion",
Union[
ResponsesOutputMessagePhaseCommentary,
ResponsesOutputMessagePhaseFinalAnswer,
Any,
],
)
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class ResponsesOutputMessageTypedDict(TypedDict):
r"""An output message item"""
@@ -71,6 +105,8 @@ class ResponsesOutputMessageTypedDict(TypedDict):
type: ResponsesOutputMessageType
content: List[ResponsesOutputMessageContentTypedDict]
status: NotRequired[ResponsesOutputMessageStatusUnionTypedDict]
phase: NotRequired[Nullable[ResponsesOutputMessagePhaseUnionTypedDict]]
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
class ResponsesOutputMessage(BaseModel):
@@ -85,3 +121,36 @@ class ResponsesOutputMessage(BaseModel):
content: List[ResponsesOutputMessageContent]
status: Optional[ResponsesOutputMessageStatusUnion] = None
phase: OptionalNullable[ResponsesOutputMessagePhaseUnion] = UNSET
r"""The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["status", "phase"]
nullable_fields = ["phase"]
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
@@ -2,25 +2,146 @@
from __future__ import annotations
from .websearchstatus import WebSearchStatus
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ResponsesWebSearchCallOutputType = Literal["web_search_call",]
TypeWebSearchCall = Literal["web_search_call",]
TypeFindInPage = Literal["find_in_page",]
class ActionFindInPageTypedDict(TypedDict):
type: TypeFindInPage
pattern: str
url: str
class ActionFindInPage(BaseModel):
type: TypeFindInPage
pattern: str
url: str
TypeOpenPage = Literal["open_page",]
class ActionOpenPageTypedDict(TypedDict):
type: TypeOpenPage
url: NotRequired[Nullable[str]]
class ActionOpenPage(BaseModel):
type: TypeOpenPage
url: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["url"]
nullable_fields = ["url"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
TypeSearch = Literal["search",]
TypeURL = Literal["url",]
class SourceTypedDict(TypedDict):
type: TypeURL
url: str
class Source(BaseModel):
type: TypeURL
url: str
class ActionSearchTypedDict(TypedDict):
type: TypeSearch
query: str
queries: NotRequired[List[str]]
sources: NotRequired[List[SourceTypedDict]]
class ActionSearch(BaseModel):
type: TypeSearch
query: str
queries: Optional[List[str]] = None
sources: Optional[List[Source]] = None
ActionTypedDict = TypeAliasType(
"ActionTypedDict",
Union[ActionOpenPageTypedDict, ActionFindInPageTypedDict, ActionSearchTypedDict],
)
Action = Annotated[
Union[
Annotated[ActionSearch, Tag("search")],
Annotated[ActionOpenPage, Tag("open_page")],
Annotated[ActionFindInPage, Tag("find_in_page")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
class ResponsesWebSearchCallOutputTypedDict(TypedDict):
type: ResponsesWebSearchCallOutputType
type: TypeWebSearchCall
id: str
action: ActionTypedDict
status: WebSearchStatus
class ResponsesWebSearchCallOutput(BaseModel):
type: ResponsesWebSearchCallOutputType
type: TypeWebSearchCall
id: str
action: Action
status: Annotated[WebSearchStatus, PlainValidator(validate_open_enum(False))]
@@ -9,6 +9,8 @@ WebSearchEngine = Union[
Literal[
"native",
"exa",
"firecrawl",
"parallel",
],
UnrecognizedStr,
]
+36 -16
View File
@@ -16,7 +16,8 @@ class Credits(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -29,7 +30,9 @@ class Credits(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -48,7 +51,8 @@ class Credits(BaseSDK):
request = operations.GetCreditsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -65,7 +69,8 @@ class Credits(BaseSDK):
http_headers=http_headers,
_globals=operations.GetCreditsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -130,7 +135,8 @@ class Credits(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -143,7 +149,9 @@ class Credits(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -162,7 +170,8 @@ class Credits(BaseSDK):
request = operations.GetCreditsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -179,7 +188,8 @@ class Credits(BaseSDK):
http_headers=http_headers,
_globals=operations.GetCreditsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -251,7 +261,8 @@ class Credits(BaseSDK):
sender: str,
chain_id: components.ChainID,
http_referer: Optional[str] = None,
x_title: 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,
@@ -268,7 +279,9 @@ class Credits(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -287,7 +300,8 @@ class Credits(BaseSDK):
request = operations.CreateCoinbaseChargeRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
create_charge_request=components.CreateChargeRequest(
amount=amount,
sender=sender,
@@ -309,7 +323,8 @@ class Credits(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateCoinbaseChargeGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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=utils.get_pydantic_model(
security, operations.CreateCoinbaseChargeSecurity
@@ -395,7 +410,8 @@ class Credits(BaseSDK):
sender: str,
chain_id: components.ChainID,
http_referer: Optional[str] = None,
x_title: 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,
@@ -412,7 +428,9 @@ class Credits(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -431,7 +449,8 @@ class Credits(BaseSDK):
request = operations.CreateCoinbaseChargeRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
create_charge_request=components.CreateChargeRequest(
amount=amount,
sender=sender,
@@ -453,7 +472,8 @@ class Credits(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateCoinbaseChargeGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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=utils.get_pydantic_model(
security, operations.CreateCoinbaseChargeSecurity
+36 -16
View File
@@ -24,7 +24,8 @@ class Embeddings(BaseSDK):
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
model: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
encoding_format: Optional[operations.EncodingFormat] = None,
dimensions: Optional[int] = None,
user: Optional[str] = None,
@@ -49,7 +50,9 @@ class Embeddings(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 encoding_format:
:param dimensions:
@@ -74,7 +77,8 @@ class Embeddings(BaseSDK):
request = operations.CreateEmbeddingsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateEmbeddingsRequestBody(
input=utils.get_pydantic_model(input, operations.InputUnion),
model=model,
@@ -104,7 +108,8 @@ class Embeddings(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateEmbeddingsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -230,7 +235,8 @@ class Embeddings(BaseSDK):
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
model: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
encoding_format: Optional[operations.EncodingFormat] = None,
dimensions: Optional[int] = None,
user: Optional[str] = None,
@@ -255,7 +261,9 @@ class Embeddings(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 encoding_format:
:param dimensions:
@@ -280,7 +288,8 @@ class Embeddings(BaseSDK):
request = operations.CreateEmbeddingsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateEmbeddingsRequestBody(
input=utils.get_pydantic_model(input, operations.InputUnion),
model=model,
@@ -310,7 +319,8 @@ class Embeddings(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateEmbeddingsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -434,7 +444,8 @@ class Embeddings(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -447,7 +458,9 @@ class Embeddings(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -466,7 +479,8 @@ class Embeddings(BaseSDK):
request = operations.ListEmbeddingsModelsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -483,7 +497,8 @@ class Embeddings(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEmbeddingsModelsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -543,7 +558,8 @@ class Embeddings(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -556,7 +572,9 @@ class Embeddings(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -575,7 +593,8 @@ class Embeddings(BaseSDK):
request = operations.ListEmbeddingsModelsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -592,7 +611,8 @@ class Embeddings(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEmbeddingsModelsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
+36 -16
View File
@@ -18,7 +18,8 @@ class Endpoints(BaseSDK):
author: str,
slug: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -31,7 +32,9 @@ class Endpoints(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -50,7 +53,8 @@ class Endpoints(BaseSDK):
request = operations.ListEndpointsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
author=author,
slug=slug,
)
@@ -69,7 +73,8 @@ class Endpoints(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEndpointsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -131,7 +136,8 @@ class Endpoints(BaseSDK):
author: str,
slug: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -144,7 +150,9 @@ class Endpoints(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -163,7 +171,8 @@ class Endpoints(BaseSDK):
request = operations.ListEndpointsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
author=author,
slug=slug,
)
@@ -182,7 +191,8 @@ class Endpoints(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEndpointsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -242,7 +252,8 @@ class Endpoints(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -253,7 +264,9 @@ class Endpoints(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -272,7 +285,8 @@ class Endpoints(BaseSDK):
request = operations.ListEndpointsZdrRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -289,7 +303,8 @@ class Endpoints(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEndpointsZdrGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -346,7 +361,8 @@ class Endpoints(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -357,7 +373,9 @@ class Endpoints(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -376,7 +394,8 @@ class Endpoints(BaseSDK):
request = operations.ListEndpointsZdrRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -393,7 +412,8 @@ class Endpoints(BaseSDK):
http_headers=http_headers,
_globals=operations.ListEndpointsZdrGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
+18 -8
View File
@@ -17,7 +17,8 @@ class Generations(BaseSDK):
*,
id: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -29,7 +30,9 @@ class Generations(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -48,7 +51,8 @@ class Generations(BaseSDK):
request = operations.GetGenerationRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
)
@@ -66,7 +70,8 @@ class Generations(BaseSDK):
http_headers=http_headers,
_globals=operations.GetGenerationGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -168,7 +173,8 @@ class Generations(BaseSDK):
*,
id: str,
http_referer: Optional[str] = None,
x_title: 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,
@@ -180,7 +186,9 @@ class Generations(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -199,7 +207,8 @@ class Generations(BaseSDK):
request = operations.GetGenerationRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
id=id,
)
@@ -217,7 +226,8 @@ class Generations(BaseSDK):
http_headers=http_headers,
_globals=operations.GetGenerationGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
File diff suppressed because it is too large Load Diff
+16 -3
View File
@@ -14,10 +14,14 @@ class GlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 Globals(BaseModel):
@@ -31,11 +35,20 @@ class Globals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
+78 -26
View File
@@ -16,7 +16,9 @@ class Models(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
output_modality: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -27,8 +29,11 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 output_modality: 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 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
@@ -46,7 +51,9 @@ class Models(BaseSDK):
request = operations.ListModelsCountRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
output_modality=output_modality,
)
req = self._build_request(
@@ -63,7 +70,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.ListModelsCountGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -89,13 +97,18 @@ class Models(BaseSDK):
),
),
request=req,
error_status_codes=["4XX", "500", "5XX"],
error_status_codes=["400", "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.ModelsCountResponse, 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, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
@@ -118,7 +131,9 @@ class Models(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
output_modality: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -129,8 +144,11 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 output_modality: 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 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
@@ -148,7 +166,9 @@ class Models(BaseSDK):
request = operations.ListModelsCountRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
output_modality=output_modality,
)
req = self._build_request_async(
@@ -165,7 +185,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.ListModelsCountGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -191,13 +212,18 @@ class Models(BaseSDK):
),
),
request=req,
error_status_codes=["4XX", "500", "5XX"],
error_status_codes=["400", "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.ModelsCountResponse, 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, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
@@ -220,9 +246,11 @@ class Models(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
category: Optional[operations.Category] = None,
supported_parameters: Optional[str] = None,
output_modality: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -233,10 +261,13 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 category: Filter models by use case category
:param supported_parameters:
:param output_modality: 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 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
@@ -254,9 +285,11 @@ class Models(BaseSDK):
request = operations.GetModelsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
category=category,
supported_parameters=supported_parameters,
output_modality=output_modality,
)
req = self._build_request(
@@ -273,7 +306,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.GetModelsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -333,9 +367,11 @@ class Models(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
category: Optional[operations.Category] = None,
supported_parameters: Optional[str] = None,
output_modality: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -346,10 +382,13 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 category: Filter models by use case category
:param supported_parameters:
:param output_modality: 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 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
@@ -367,9 +406,11 @@ class Models(BaseSDK):
request = operations.GetModelsRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
category=category,
supported_parameters=supported_parameters,
output_modality=output_modality,
)
req = self._build_request_async(
@@ -386,7 +427,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.GetModelsGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -450,7 +492,8 @@ class Models(BaseSDK):
operations.ListModelsUserSecurityTypedDict,
],
http_referer: Optional[str] = None,
x_title: 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,
@@ -464,7 +507,9 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -483,7 +528,8 @@ class Models(BaseSDK):
request = operations.ListModelsUserRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -500,7 +546,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.ListModelsUserGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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=utils.get_pydantic_model(
security, operations.ListModelsUserSecurity
@@ -569,7 +616,8 @@ class Models(BaseSDK):
operations.ListModelsUserSecurityTypedDict,
],
http_referer: Optional[str] = None,
x_title: 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,
@@ -583,7 +631,9 @@ class Models(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -602,7 +652,8 @@ class Models(BaseSDK):
request = operations.ListModelsUserRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -619,7 +670,8 @@ class Models(BaseSDK):
http_headers=http_headers,
_globals=operations.ListModelsUserGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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=utils.get_pydantic_model(
security, operations.ListModelsUserSecurity
+36 -16
View File
@@ -18,7 +18,8 @@ class OAuth(BaseSDK):
*,
code: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
code_verifier: Optional[str] = None,
code_challenge_method: OptionalNullable[
operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod
@@ -36,7 +37,9 @@ class OAuth(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 code_verifier: The code verifier if code_challenge was used in the authorization request
:param code_challenge_method: The method used to generate the code challenge
@@ -57,7 +60,8 @@ class OAuth(BaseSDK):
request = operations.ExchangeAuthCodeForAPIKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.ExchangeAuthCodeForAPIKeyRequestBody(
code=code,
code_verifier=code_verifier,
@@ -79,7 +83,8 @@ class OAuth(BaseSDK):
http_headers=http_headers,
_globals=operations.ExchangeAuthCodeForAPIKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -154,7 +159,8 @@ class OAuth(BaseSDK):
*,
code: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
code_verifier: Optional[str] = None,
code_challenge_method: OptionalNullable[
operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod
@@ -172,7 +178,9 @@ class OAuth(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 code_verifier: The code verifier if code_challenge was used in the authorization request
:param code_challenge_method: The method used to generate the code challenge
@@ -193,7 +201,8 @@ class OAuth(BaseSDK):
request = operations.ExchangeAuthCodeForAPIKeyRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.ExchangeAuthCodeForAPIKeyRequestBody(
code=code,
code_verifier=code_verifier,
@@ -215,7 +224,8 @@ class OAuth(BaseSDK):
http_headers=http_headers,
_globals=operations.ExchangeAuthCodeForAPIKeyGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -290,7 +300,8 @@ class OAuth(BaseSDK):
*,
callback_url: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
code_challenge: Optional[str] = None,
code_challenge_method: Optional[
operations.CreateAuthKeysCodeCodeChallengeMethod
@@ -312,7 +323,9 @@ class OAuth(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 code_challenge: PKCE code challenge for enhanced security
:param code_challenge_method: The method used to generate the code challenge
@@ -337,7 +350,8 @@ class OAuth(BaseSDK):
request = operations.CreateAuthKeysCodeRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateAuthKeysCodeRequestBody(
callback_url=callback_url,
code_challenge=code_challenge,
@@ -363,7 +377,8 @@ class OAuth(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateAuthKeysCodeGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -438,7 +453,8 @@ class OAuth(BaseSDK):
*,
callback_url: str,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
code_challenge: Optional[str] = None,
code_challenge_method: Optional[
operations.CreateAuthKeysCodeCodeChallengeMethod
@@ -460,7 +476,9 @@ class OAuth(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 code_challenge: PKCE code challenge for enhanced security
:param code_challenge_method: The method used to generate the code challenge
@@ -485,7 +503,8 @@ class OAuth(BaseSDK):
request = operations.CreateAuthKeysCodeRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
request_body=operations.CreateAuthKeysCodeRequestBody(
callback_url=callback_url,
code_challenge=code_challenge,
@@ -511,7 +530,8 @@ class OAuth(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateAuthKeysCodeGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -19,10 +19,14 @@ class BulkAssignKeysToGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkAssignKeysToGuardrailGlobals(BaseModel):
@@ -36,15 +40,24 @@ class BulkAssignKeysToGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkAssignKeysToGuardrailRequestBodyTypedDict(TypedDict):
key_hashes: List[str]
@@ -65,10 +78,14 @@ class BulkAssignKeysToGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkAssignKeysToGuardrailRequest(BaseModel):
@@ -92,15 +109,24 @@ class BulkAssignKeysToGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkAssignKeysToGuardrailResponseTypedDict(TypedDict):
r"""Assignment result"""
@@ -19,10 +19,14 @@ class BulkAssignMembersToGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkAssignMembersToGuardrailGlobals(BaseModel):
@@ -36,15 +40,24 @@ class BulkAssignMembersToGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkAssignMembersToGuardrailRequestBodyTypedDict(TypedDict):
member_user_ids: List[str]
@@ -65,10 +78,14 @@ class BulkAssignMembersToGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkAssignMembersToGuardrailRequest(BaseModel):
@@ -92,15 +109,24 @@ class BulkAssignMembersToGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkAssignMembersToGuardrailResponseTypedDict(TypedDict):
r"""Assignment result"""
@@ -19,10 +19,14 @@ class BulkUnassignKeysFromGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkUnassignKeysFromGuardrailGlobals(BaseModel):
@@ -36,15 +40,24 @@ class BulkUnassignKeysFromGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkUnassignKeysFromGuardrailRequestBodyTypedDict(TypedDict):
key_hashes: List[str]
@@ -65,10 +78,14 @@ class BulkUnassignKeysFromGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkUnassignKeysFromGuardrailRequest(BaseModel):
@@ -92,15 +109,24 @@ class BulkUnassignKeysFromGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkUnassignKeysFromGuardrailResponseTypedDict(TypedDict):
r"""Unassignment result"""
@@ -19,10 +19,14 @@ class BulkUnassignMembersFromGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkUnassignMembersFromGuardrailGlobals(BaseModel):
@@ -36,15 +40,24 @@ class BulkUnassignMembersFromGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkUnassignMembersFromGuardrailRequestBodyTypedDict(TypedDict):
member_user_ids: List[str]
@@ -65,10 +78,14 @@ class BulkUnassignMembersFromGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 BulkUnassignMembersFromGuardrailRequest(BaseModel):
@@ -92,15 +109,24 @@ class BulkUnassignMembersFromGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 BulkUnassignMembersFromGuardrailResponseTypedDict(TypedDict):
r"""Unassignment result"""
@@ -29,10 +29,14 @@ class CreateAuthKeysCodeGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateAuthKeysCodeGlobals(BaseModel):
@@ -46,15 +50,24 @@ class CreateAuthKeysCodeGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
CreateAuthKeysCodeCodeChallengeMethod = Union[
Literal[
@@ -166,10 +179,14 @@ class CreateAuthKeysCodeRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateAuthKeysCodeRequest(BaseModel):
@@ -188,15 +205,24 @@ class CreateAuthKeysCodeRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CreateAuthKeysCodeDataTypedDict(TypedDict):
r"""Auth code data"""
@@ -20,10 +20,14 @@ class CreateCoinbaseChargeGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateCoinbaseChargeGlobals(BaseModel):
@@ -37,15 +41,24 @@ class CreateCoinbaseChargeGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CreateCoinbaseChargeSecurityTypedDict(TypedDict):
bearer: str
@@ -72,10 +85,14 @@ class CreateCoinbaseChargeRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateCoinbaseChargeRequest(BaseModel):
@@ -94,15 +111,24 @@ class CreateCoinbaseChargeRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CallDataTypedDict(TypedDict):
deadline: str
+32 -6
View File
@@ -23,10 +23,14 @@ class CreateEmbeddingsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateEmbeddingsGlobals(BaseModel):
@@ -40,15 +44,24 @@ class CreateEmbeddingsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
TypeImageURL = Literal["image_url",]
@@ -165,10 +178,14 @@ class CreateEmbeddingsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateEmbeddingsRequest(BaseModel):
@@ -187,15 +204,24 @@ class CreateEmbeddingsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
Object = Literal["list",]
+46 -6
View File
@@ -28,10 +28,14 @@ class CreateGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateGuardrailGlobals(BaseModel):
@@ -45,15 +49,24 @@ class CreateGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
CreateGuardrailResetIntervalRequest = Union[
Literal[
@@ -77,6 +90,8 @@ class CreateGuardrailRequestBodyTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -102,6 +117,9 @@ class CreateGuardrailRequestBody(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model identifiers (slug or canonical_slug accepted)"""
@@ -115,6 +133,7 @@ class CreateGuardrailRequestBody(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
@@ -123,6 +142,7 @@ class CreateGuardrailRequestBody(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
@@ -160,10 +180,14 @@ class CreateGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateGuardrailRequest(BaseModel):
@@ -182,15 +206,24 @@ class CreateGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
CreateGuardrailResetIntervalResponse = Union[
Literal[
@@ -220,6 +253,8 @@ class CreateGuardrailDataTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -255,6 +290,9 @@ class CreateGuardrailData(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
@@ -271,6 +309,7 @@ class CreateGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
@@ -280,6 +319,7 @@ class CreateGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
+32 -6
View File
@@ -29,10 +29,14 @@ class CreateKeysGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateKeysGlobals(BaseModel):
@@ -46,15 +50,24 @@ class CreateKeysGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
CreateKeysLimitReset = Union[
Literal[
@@ -142,10 +155,14 @@ class CreateKeysRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateKeysRequest(BaseModel):
@@ -164,15 +181,24 @@ class CreateKeysRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CreateKeysDataTypedDict(TypedDict):
r"""The created API key information"""
+32 -6
View File
@@ -24,10 +24,14 @@ class CreateResponsesGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateResponsesGlobals(BaseModel):
@@ -41,15 +45,24 @@ class CreateResponsesGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CreateResponsesRequestTypedDict(TypedDict):
open_responses_request: (
@@ -60,10 +73,14 @@ class CreateResponsesRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 CreateResponsesRequest(BaseModel):
@@ -82,15 +99,24 @@ class CreateResponsesRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 CreateResponsesResponseBodyTypedDict(TypedDict):
r"""Successful response"""
+32 -6
View File
@@ -20,10 +20,14 @@ class DeleteGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 DeleteGuardrailGlobals(BaseModel):
@@ -37,15 +41,24 @@ class DeleteGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 DeleteGuardrailRequestTypedDict(TypedDict):
id: str
@@ -55,10 +68,14 @@ class DeleteGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 DeleteGuardrailRequest(BaseModel):
@@ -77,15 +94,24 @@ class DeleteGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 DeleteGuardrailResponseTypedDict(TypedDict):
r"""Guardrail deleted successfully"""
+32 -6
View File
@@ -20,10 +20,14 @@ class DeleteKeysGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 DeleteKeysGlobals(BaseModel):
@@ -37,15 +41,24 @@ class DeleteKeysGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 DeleteKeysRequestTypedDict(TypedDict):
hash: str
@@ -55,10 +68,14 @@ class DeleteKeysRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 DeleteKeysRequest(BaseModel):
@@ -77,15 +94,24 @@ class DeleteKeysRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 DeleteKeysResponseTypedDict(TypedDict):
r"""API key deleted successfully"""
@@ -28,10 +28,14 @@ class ExchangeAuthCodeForAPIKeyGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ExchangeAuthCodeForAPIKeyGlobals(BaseModel):
@@ -45,15 +49,24 @@ class ExchangeAuthCodeForAPIKeyGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[
Literal[
@@ -127,10 +140,14 @@ class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ExchangeAuthCodeForAPIKeyRequest(BaseModel):
@@ -149,15 +166,24 @@ class ExchangeAuthCodeForAPIKeyRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ExchangeAuthCodeForAPIKeyResponseTypedDict(TypedDict):
r"""Successfully exchanged code for an API key"""
+32 -6
View File
@@ -14,10 +14,14 @@ class GetCreditsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetCreditsGlobals(BaseModel):
@@ -31,15 +35,24 @@ class GetCreditsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetCreditsRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -47,10 +60,14 @@ class GetCreditsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetCreditsRequest(BaseModel):
@@ -64,15 +81,24 @@ class GetCreditsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetCreditsDataTypedDict(TypedDict):
total_credits: float
+32 -6
View File
@@ -22,10 +22,14 @@ class GetCurrentKeyGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetCurrentKeyGlobals(BaseModel):
@@ -39,15 +43,24 @@ class GetCurrentKeyGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetCurrentKeyRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -55,10 +68,14 @@ class GetCurrentKeyRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetCurrentKeyRequest(BaseModel):
@@ -72,15 +89,24 @@ class GetCurrentKeyRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
@deprecated(
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
+45 -6
View File
@@ -21,10 +21,14 @@ class GetGenerationGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetGenerationGlobals(BaseModel):
@@ -38,15 +42,24 @@ class GetGenerationGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetGenerationRequestTypedDict(TypedDict):
id: str
@@ -55,10 +68,14 @@ class GetGenerationRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetGenerationRequest(BaseModel):
@@ -76,15 +93,24 @@ class GetGenerationRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
APIType = Union[
Literal[
@@ -126,6 +152,7 @@ ProviderName = Union[
"Together 2",
"Ubicloud",
"01.AI",
"Akash",
"AI21",
"AionLabs",
"Alibaba",
@@ -341,6 +368,10 @@ class GetGenerationDataTypedDict(TypedDict):
r"""Router used for the request (e.g., openrouter/auto)"""
provider_responses: Nullable[List[ProviderResponseTypedDict]]
r"""List of provider responses for this generation, including fallback attempts"""
user_agent: Nullable[str]
r"""User-Agent header from the request"""
http_referer: Nullable[str]
r"""Referer header from the request"""
class GetGenerationData(BaseModel):
@@ -448,6 +479,12 @@ class GetGenerationData(BaseModel):
provider_responses: Nullable[List[ProviderResponse]]
r"""List of provider responses for this generation, including fallback attempts"""
user_agent: Nullable[str]
r"""User-Agent header from the request"""
http_referer: Nullable[str]
r"""Referer header from the request"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
@@ -479,6 +516,8 @@ class GetGenerationData(BaseModel):
"api_type",
"router",
"provider_responses",
"user_agent",
"http_referer",
]
null_default_fields = []
+39 -6
View File
@@ -28,10 +28,14 @@ class GetGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetGuardrailGlobals(BaseModel):
@@ -45,15 +49,24 @@ class GetGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetGuardrailRequestTypedDict(TypedDict):
id: str
@@ -63,10 +76,14 @@ class GetGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetGuardrailRequest(BaseModel):
@@ -85,15 +102,24 @@ class GetGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
GetGuardrailResetInterval = Union[
Literal[
@@ -123,6 +149,8 @@ class GetGuardrailDataTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -158,6 +186,9 @@ class GetGuardrailData(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
@@ -174,6 +205,7 @@ class GetGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
@@ -183,6 +215,7 @@ class GetGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
+32 -6
View File
@@ -22,10 +22,14 @@ class GetKeyGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetKeyGlobals(BaseModel):
@@ -39,15 +43,24 @@ class GetKeyGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetKeyRequestTypedDict(TypedDict):
hash: str
@@ -57,10 +70,14 @@ class GetKeyRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetKeyRequest(BaseModel):
@@ -79,15 +96,24 @@ class GetKeyRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetKeyDataTypedDict(TypedDict):
r"""The API key information"""
+40 -6
View File
@@ -20,10 +20,14 @@ class GetModelsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetModelsGlobals(BaseModel):
@@ -37,15 +41,24 @@ class GetModelsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
Category = Union[
Literal[
@@ -73,13 +86,19 @@ class GetModelsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
category: NotRequired[Category]
r"""Filter models by use case category"""
supported_parameters: NotRequired[str]
output_modality: NotRequired[str]
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\"."""
class GetModelsRequest(BaseModel):
@@ -93,15 +112,24 @@ class GetModelsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
category: Annotated[
Annotated[Optional[Category], PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
@@ -112,3 +140,9 @@ class GetModelsRequest(BaseModel):
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
output_modality: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
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\"."""
+32 -6
View File
@@ -15,10 +15,14 @@ class GetUserActivityGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 GetUserActivityGlobals(BaseModel):
@@ -32,15 +36,24 @@ class GetUserActivityGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 GetUserActivityRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -48,9 +61,13 @@ class GetUserActivityRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
date_: NotRequired[str]
r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)."""
@@ -67,15 +84,24 @@ class GetUserActivityRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
date_: Annotated[
Optional[str],
pydantic.Field(alias="date"),
+32 -6
View File
@@ -22,10 +22,14 @@ class ListGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListGlobals(BaseModel):
@@ -39,15 +43,24 @@ class ListGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -55,9 +68,13 @@ class ListRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
include_disabled: NotRequired[str]
r"""Whether to include disabled API keys in the response"""
@@ -76,15 +93,24 @@ class ListRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
include_disabled: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
@@ -14,10 +14,14 @@ class ListEmbeddingsModelsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEmbeddingsModelsGlobals(BaseModel):
@@ -31,15 +35,24 @@ class ListEmbeddingsModelsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListEmbeddingsModelsRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -47,10 +60,14 @@ class ListEmbeddingsModelsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEmbeddingsModelsRequest(BaseModel):
@@ -64,11 +81,20 @@ class ListEmbeddingsModelsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
+32 -6
View File
@@ -17,10 +17,14 @@ class ListEndpointsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEndpointsGlobals(BaseModel):
@@ -34,15 +38,24 @@ class ListEndpointsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListEndpointsRequestTypedDict(TypedDict):
author: str
@@ -52,10 +65,14 @@ class ListEndpointsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEndpointsRequest(BaseModel):
@@ -77,15 +94,24 @@ class ListEndpointsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListEndpointsResponseTypedDict(TypedDict):
r"""Returns a list of endpoints"""
+32 -6
View File
@@ -15,10 +15,14 @@ class ListEndpointsZdrGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEndpointsZdrGlobals(BaseModel):
@@ -32,15 +36,24 @@ class ListEndpointsZdrGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListEndpointsZdrRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -48,10 +61,14 @@ class ListEndpointsZdrRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListEndpointsZdrRequest(BaseModel):
@@ -65,15 +82,24 @@ class ListEndpointsZdrRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListEndpointsZdrResponseTypedDict(TypedDict):
r"""Returns a list of endpoints"""
@@ -20,10 +20,14 @@ class ListGuardrailKeyAssignmentsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListGuardrailKeyAssignmentsGlobals(BaseModel):
@@ -37,15 +41,24 @@ class ListGuardrailKeyAssignmentsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListGuardrailKeyAssignmentsRequestTypedDict(TypedDict):
id: str
@@ -55,9 +68,13 @@ class ListGuardrailKeyAssignmentsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
offset: NotRequired[str]
r"""Number of records to skip for pagination"""
@@ -81,15 +98,24 @@ class ListGuardrailKeyAssignmentsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
@@ -20,10 +20,14 @@ class ListGuardrailMemberAssignmentsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListGuardrailMemberAssignmentsGlobals(BaseModel):
@@ -37,15 +41,24 @@ class ListGuardrailMemberAssignmentsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListGuardrailMemberAssignmentsRequestTypedDict(TypedDict):
id: str
@@ -55,9 +68,13 @@ class ListGuardrailMemberAssignmentsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
offset: NotRequired[str]
r"""Number of records to skip for pagination"""
@@ -81,15 +98,24 @@ class ListGuardrailMemberAssignmentsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
+39 -6
View File
@@ -28,10 +28,14 @@ class ListGuardrailsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListGuardrailsGlobals(BaseModel):
@@ -45,15 +49,24 @@ class ListGuardrailsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListGuardrailsRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -61,9 +74,13 @@ class ListGuardrailsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
offset: NotRequired[str]
r"""Number of records to skip for pagination"""
@@ -82,15 +99,24 @@ class ListGuardrailsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
@@ -130,6 +156,8 @@ class ListGuardrailsDataTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -163,6 +191,9 @@ class ListGuardrailsData(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
@@ -179,6 +210,7 @@ class ListGuardrailsData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
@@ -188,6 +220,7 @@ class ListGuardrailsData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
@@ -15,10 +15,14 @@ class ListKeyAssignmentsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListKeyAssignmentsGlobals(BaseModel):
@@ -32,15 +36,24 @@ class ListKeyAssignmentsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListKeyAssignmentsRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -48,9 +61,13 @@ class ListKeyAssignmentsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
offset: NotRequired[str]
r"""Number of records to skip for pagination"""
@@ -69,15 +86,24 @@ class ListKeyAssignmentsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
@@ -15,10 +15,14 @@ class ListMemberAssignmentsGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListMemberAssignmentsGlobals(BaseModel):
@@ -32,15 +36,24 @@ class ListMemberAssignmentsGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListMemberAssignmentsRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -48,9 +61,13 @@ class ListMemberAssignmentsRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
offset: NotRequired[str]
r"""Number of records to skip for pagination"""
@@ -69,15 +86,24 @@ class ListMemberAssignmentsRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
offset: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
+41 -7
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -14,10 +14,14 @@ class ListModelsCountGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListModelsCountGlobals(BaseModel):
@@ -31,15 +35,24 @@ class ListModelsCountGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListModelsCountRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -47,10 +60,16 @@ class ListModelsCountRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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.
"""
output_modality: NotRequired[str]
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\"."""
class ListModelsCountRequest(BaseModel):
@@ -64,11 +83,26 @@ class ListModelsCountRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
output_modality: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
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\"."""
+32 -6
View File
@@ -14,10 +14,14 @@ class ListModelsUserGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListModelsUserGlobals(BaseModel):
@@ -31,15 +35,24 @@ class ListModelsUserGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListModelsUserSecurityTypedDict(TypedDict):
bearer: str
@@ -65,10 +78,14 @@ class ListModelsUserRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListModelsUserRequest(BaseModel):
@@ -82,11 +99,20 @@ class ListModelsUserRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
+32 -6
View File
@@ -21,10 +21,14 @@ class ListProvidersGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListProvidersGlobals(BaseModel):
@@ -38,15 +42,24 @@ class ListProvidersGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListProvidersRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
@@ -54,10 +67,14 @@ class ListProvidersRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 ListProvidersRequest(BaseModel):
@@ -71,15 +88,24 @@ class ListProvidersRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 ListProvidersDataTypedDict(TypedDict):
name: str
@@ -24,10 +24,14 @@ class SendChatCompletionRequestGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 SendChatCompletionRequestGlobals(BaseModel):
@@ -41,15 +45,24 @@ class SendChatCompletionRequestGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 SendChatCompletionRequestRequestTypedDict(TypedDict):
chat_generation_params: (
@@ -60,10 +73,14 @@ class SendChatCompletionRequestRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 SendChatCompletionRequestRequest(BaseModel):
@@ -82,15 +99,24 @@ class SendChatCompletionRequestRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 SendChatCompletionRequestResponseBodyTypedDict(TypedDict):
r"""Successful chat completion response"""
+46 -6
View File
@@ -29,10 +29,14 @@ class UpdateGuardrailGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 UpdateGuardrailGlobals(BaseModel):
@@ -46,15 +50,24 @@ class UpdateGuardrailGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
UpdateGuardrailResetIntervalRequest = Union[
Literal[
@@ -78,6 +91,8 @@ class UpdateGuardrailRequestBodyTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""New list of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -103,6 +118,9 @@ class UpdateGuardrailRequestBody(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""New list of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model identifiers (slug or canonical_slug accepted)"""
@@ -117,6 +135,7 @@ class UpdateGuardrailRequestBody(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
@@ -125,6 +144,7 @@ class UpdateGuardrailRequestBody(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
@@ -164,10 +184,14 @@ class UpdateGuardrailRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 UpdateGuardrailRequest(BaseModel):
@@ -191,15 +215,24 @@ class UpdateGuardrailRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
UpdateGuardrailResetIntervalResponse = Union[
Literal[
@@ -229,6 +262,8 @@ class UpdateGuardrailDataTypedDict(TypedDict):
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
@@ -264,6 +299,9 @@ class UpdateGuardrailData(BaseModel):
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
@@ -280,6 +318,7 @@ class UpdateGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
@@ -289,6 +328,7 @@ class UpdateGuardrailData(BaseModel):
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
+32 -6
View File
@@ -30,10 +30,14 @@ class UpdateKeysGlobalsTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 UpdateKeysGlobals(BaseModel):
@@ -47,15 +51,24 @@ class UpdateKeysGlobals(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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.
"""
UpdateKeysLimitReset = Union[
Literal[
@@ -146,10 +159,14 @@ class UpdateKeysRequestTypedDict(TypedDict):
This is used to track API usage per application.
"""
x_title: NotRequired[str]
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 UpdateKeysRequest(BaseModel):
@@ -173,15 +190,24 @@ class UpdateKeysRequest(BaseModel):
"""
x_title: Annotated[
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-Title"),
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 UpdateKeysDataTypedDict(TypedDict):
r"""The updated API key information"""
+18 -8
View File
@@ -16,7 +16,8 @@ class Providers(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -27,7 +28,9 @@ class Providers(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -46,7 +49,8 @@ class Providers(BaseSDK):
request = operations.ListProvidersRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request(
@@ -63,7 +67,8 @@ class Providers(BaseSDK):
http_headers=http_headers,
_globals=operations.ListProvidersGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
@@ -118,7 +123,8 @@ class Providers(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: 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,
@@ -129,7 +135,9 @@ class Providers(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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
@@ -148,7 +156,8 @@ class Providers(BaseSDK):
request = operations.ListProvidersRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
)
req = self._build_request_async(
@@ -165,7 +174,8 @@ class Providers(BaseSDK):
http_headers=http_headers,
_globals=operations.ListProvidersGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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,
+64 -24
View File
@@ -23,9 +23,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -117,7 +121,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -165,9 +171,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -259,7 +269,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -306,9 +318,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -400,7 +416,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -454,10 +472,11 @@ class Responses(BaseSDK):
request = operations.CreateResponsesRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
open_responses_request=components.OpenResponsesRequest(
input=utils.get_pydantic_model(
input, Optional[components.OpenResponsesInput]
input, Optional[components.OpenResponsesInputUnion]
),
instructions=instructions,
metadata=metadata,
@@ -525,7 +544,8 @@ class Responses(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateResponsesGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
@@ -713,9 +733,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -807,7 +831,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -855,9 +881,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -949,7 +979,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -996,9 +1028,13 @@ class Responses(BaseSDK):
self,
*,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
input: Optional[
Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict]
Union[
components.OpenResponsesInputUnion,
components.OpenResponsesInputUnionTypedDict,
]
] = None,
instructions: OptionalNullable[str] = UNSET,
metadata: OptionalNullable[Dict[str, str]] = UNSET,
@@ -1090,7 +1126,9 @@ class Responses(BaseSDK):
: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_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
: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 input: Input for a response request - can be a string or array of items
:param instructions:
@@ -1144,10 +1182,11 @@ class Responses(BaseSDK):
request = operations.CreateResponsesRequest(
http_referer=http_referer,
x_title=x_title,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
open_responses_request=components.OpenResponsesRequest(
input=utils.get_pydantic_model(
input, Optional[components.OpenResponsesInput]
input, Optional[components.OpenResponsesInputUnion]
),
instructions=instructions,
metadata=metadata,
@@ -1215,7 +1254,8 @@ class Responses(BaseSDK):
http_headers=http_headers,
_globals=operations.CreateResponsesGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_title=self.sdk_configuration.globals.x_title,
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(
+10 -3
View File
@@ -76,7 +76,8 @@ class OpenRouter(BaseSDK):
self,
api_key: Optional[Union[Optional[str], Callable[[], Optional[str]]]] = None,
http_referer: Optional[str] = None,
x_title: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
server: Optional[str] = None,
server_url: Optional[str] = None,
url_params: Optional[Dict[str, str]] = None,
@@ -90,7 +91,8 @@ class OpenRouter(BaseSDK):
:param api_key: The api_key required for authentication
:param http_referer: Configures the http_referer parameter for all supported operations
:param x_title: Configures the x_title parameter for all supported operations
:param x_open_router_title: Configures the x_open_router_title parameter for all supported operations
:param x_open_router_categories: Configures the x_open_router_categories parameter for all supported operations
:param server: The server by name to use for all methods
:param server_url: The server URL to use for all methods
:param url_params: Parameters to optionally template the server URL with
@@ -135,7 +137,12 @@ class OpenRouter(BaseSDK):
http_referer=utils.get_global_from_env(
http_referer, "OPENROUTER_HTTP_REFERER", str
),
x_title=utils.get_global_from_env(x_title, "OPENROUTER_X_TITLE", str),
x_open_router_title=utils.get_global_from_env(
x_open_router_title, "OPENROUTER_X_OPEN_ROUTER_TITLE", str
),
x_open_router_categories=utils.get_global_from_env(
x_open_router_categories, "OPENROUTER_X_OPEN_ROUTER_CATEGORIES", str
),
)
BaseSDK.__init__(