From 6895d9d45be95d53eb186cb856b1370649686758 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Sat, 15 Nov 2025 18:17:32 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.658.1 --- .devcontainer/README.md | 5 + .speakeasy/gen.lock | 13 +- .speakeasy/gen.yaml | 3 +- .speakeasy/workflow.lock | 3 +- README-PYPI.md | 249 ++++++++++++++++++ RELEASES.md | 11 + pyproject.toml | 5 +- scripts/prepare_readme.py | 35 +++ scripts/publish.sh | 2 + src/openrouter/_version.py | 6 +- src/openrouter/analytics.py | 6 +- src/openrouter/api_keys.py | 22 +- src/openrouter/credits.py | 4 +- src/openrouter/embeddings.py | 6 +- src/openrouter/endpoints.py | 10 +- src/openrouter/generations.py | 4 +- src/openrouter/models_.py | 14 +- src/openrouter/oauth.py | 4 +- src/openrouter/parameters.py | 4 +- src/openrouter/providers.py | 6 +- .../utils/unmarshal_json_response.py | 16 +- uv.lock | 2 +- 22 files changed, 376 insertions(+), 54 deletions(-) create mode 100644 README-PYPI.md create mode 100644 RELEASES.md create mode 100644 scripts/prepare_readme.py diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 396929a..c7d8d27 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,4 +1,9 @@ +
+ +
+
+ > **Remember to shutdown a GitHub Codespace when it is not in use!** # Dev Containers Quick Start diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ec7722c..6ec78ad 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,17 +3,19 @@ id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: docChecksum: b1b97e85c6e3464e1fd6e2163c4ebc87 docVersion: 1.0.0 - speakeasyVersion: 1.656.2 - generationVersion: 2.753.6 - releaseVersion: 0.0.15 - configChecksum: ef777b42ca5f6690075cb13d061364fd + speakeasyVersion: 1.658.1 + generationVersion: 2.755.6 + releaseVersion: 0.0.16 + configChecksum: bccceb456c96a46bcbe65fdff6bd5e1f + repoURL: https://github.com/OpenRouterTeam/python-sdk.git + installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true features: python: acceptHeaders: 3.0.0 additionalDependencies: 1.0.0 constsAndDefaults: 1.0.5 - core: 5.23.6 + core: 5.23.8 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 devContainers: 3.0.0 @@ -523,6 +525,7 @@ generatedFiles: - docs/sdks/responses/README.md - py.typed - pyproject.toml + - scripts/prepare_readme.py - scripts/publish.sh - src/openrouter/__init__.py - src/openrouter/_hooks/__init__.py diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 3d6c31a..db8247b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.0.15 + version: 0.0.16 additionalDependencies: dev: {} main: {} @@ -64,6 +64,7 @@ python: webhooks: "" inputModelSuffix: input legacyPyright: false + license: "" maxMethodParams: 999 methodArguments: infer-optional-args moduleName: "" diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e284b15..270ff94 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.656.2 +speakeasyVersion: 1.658.1 sources: -OAS: sourceNamespace: open-router-chat-completions-api @@ -6,6 +6,7 @@ sources: sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23 tags: - latest + - speakeasy-sdk-regen-1763230596 targets: open-router: source: -OAS diff --git a/README-PYPI.md b/README-PYPI.md new file mode 100644 index 0000000..a15ae66 --- /dev/null +++ b/README-PYPI.md @@ -0,0 +1,249 @@ +# OpenRouter SDK (Beta) + +The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way. + +To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python). + + + + + + +## SDK Installation + +> [!NOTE] +> **Python version upgrade policy** +> +> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated. + +The SDK can be installed with *uv*, *pip*, or *poetry* package managers. + +### uv + +*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities. + +```bash +uv add openrouter +``` + +### PIP + +*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line. + +```bash +pip install openrouter +``` + +### Poetry + +*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies. + +```bash +poetry add openrouter +``` + +### Shell and script usage with `uv` + +You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so: + +```shell +uvx --from openrouter python +``` + +It's also possible to write a standalone Python script without needing to set up a whole project like so: + +```python +#!/usr/bin/env -S uv run --script +# /// script +# requires-python = ">=3.9" +# dependencies = [ +# "openrouter", +# ] +# /// + +from openrouter import OpenRouter + +sdk = OpenRouter( + # SDK arguments +) + +# Rest of script here... +``` + +Once that is saved to a file, you can run it with `uv run script.py` where +`script.py` can be replaced with the actual file name. + + + +## Requirements + +This SDK requires Python 3.9 or higher. For Python version support policy, see the SDK Installation section above. + + + +## IDE Support + +### PyCharm + +Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin. + +- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/) + + + +## SDK Usage + +```python +# Synchronous Example +from openrouter import OpenRouter +import os + + +with OpenRouter( + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.chat.send(messages=[ + { + "role": "user", + "content": "Hello, how are you?", + }, + ], model="anthropic/claude-4.5-sonnet", provider={ + "zdr": True, + "sort": "price", + }, stream=True) + + for event in event_stream: + # handle event + print(event, flush=True) +``` + +
+ +The same SDK client can also be used to make asynchronous requests by importing asyncio. + +```python +# Asynchronous Example +import asyncio +from openrouter import OpenRouter +import os + +async def main(): + + async with OpenRouter( + api_key=os.getenv("OPENROUTER_API_KEY", ""), + ) as open_router: + + res = await open_router.chat.send_async(messages=[ + { + "role": "user", + "content": "Hello, how are you?", + }, + ], model="anthropic/claude-4.5-sonnet", provider={ + "zdr": True, + "sort": "price", + }, stream=True) + + async for event in event_stream: + # handle event + print(event, flush=True) + +asyncio.run(main()) +``` + + + + + + + + + + + + + + + + + + + + +## Resource Management + +The `OpenRouter` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application. + +[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers + +```python +from openrouter import OpenRouter +import os +def main(): + + with OpenRouter( + api_key=os.getenv("OPENROUTER_API_KEY", ""), + ) as open_router: + # Rest of application here... + + +# Or when using async: +async def amain(): + + async with OpenRouter( + api_key=os.getenv("OPENROUTER_API_KEY", ""), + ) as open_router: + # Rest of application here... +``` + + + +## Debugging + +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass your own logger class directly into your SDK. +```python +from openrouter import OpenRouter +import logging + +logging.basicConfig(level=logging.DEBUG) +s = OpenRouter(debug_logger=logging.getLogger("openrouter")) +``` + +You can also enable a default debug logger by setting an environment variable `OPENROUTER_DEBUG` to true. + + + + +# Development + +## Running Tests + +To run the test suite, you'll need to set up your environment with an OpenRouter API key. + +### Local Development + +1. Copy the example environment file: + + ```bash + cp .env.example .env + ``` + +2. Edit `.env` and add your OpenRouter API key: + + ```bash + OPENROUTER_API_KEY=your_api_key_here + ``` + +3. Run the tests: + + ```bash + pytest + ``` + +## Maturity + +This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage +to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally +looking for the latest version. \ No newline at end of file diff --git a/RELEASES.md b/RELEASES.md new file mode 100644 index 0000000..0d0d01f --- /dev/null +++ b/RELEASES.md @@ -0,0 +1,11 @@ + + +## 2025-11-15 18:16:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.658.1 (2.755.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.0.16] . +### Releases +- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - . \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9e39b76..e4e024b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,16 @@ [project] name = "openrouter" -version = "0.0.15" +version = "0.0.16" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] -readme = "README.md" +readme = "README-PYPI.md" requires-python = ">=3.9.2" dependencies = [ "httpcore >=1.0.9", "httpx >=0.28.1", "pydantic >=2.11.2", ] +urls.repository = "https://github.com/OpenRouterTeam/python-sdk.git" [dependency-groups] dev = [ diff --git a/scripts/prepare_readme.py b/scripts/prepare_readme.py new file mode 100644 index 0000000..03e9f9b --- /dev/null +++ b/scripts/prepare_readme.py @@ -0,0 +1,35 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import re +import shutil + +try: + with open("README.md", "r", encoding="utf-8") as rh: + readme_contents = rh.read() + GITHUB_URL = "https://github.com/OpenRouterTeam/python-sdk.git" + GITHUB_URL = ( + GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL + ) + REPO_SUBDIR = "" + # links on PyPI should have absolute URLs + readme_contents = re.sub( + r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))", + lambda m: m.group(1) + + GITHUB_URL + + "/blob/master/" + + REPO_SUBDIR + + m.group(2) + + m.group(3), + readme_contents, + ) + + with open("README-PYPI.md", "w", encoding="utf-8") as wh: + wh.write(readme_contents) +except Exception as e: + try: + print("Failed to rewrite README.md to README-PYPI.md, copying original instead") + print(e) + shutil.copyfile("README.md", "README-PYPI.md") + except Exception as ie: + print("Failed to copy README.md to README-PYPI.md") + print(ie) diff --git a/scripts/publish.sh b/scripts/publish.sh index ef28dc1..c35748f 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +uv run python scripts/prepare_readme.py + uv build uv publish --token $PYPI_TOKEN diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index bc07c28..a2d0013 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.0.15" +__version__: str = "0.0.16" __openapi_doc_version__: str = "1.0.0" -__gen_version__: str = "2.753.6" -__user_agent__: str = "speakeasy-sdk/python 0.0.15 2.753.6 1.0.0 openrouter" +__gen_version__: str = "2.755.6" +__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.755.6 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/analytics.py b/src/openrouter/analytics.py index c121816..181e1da 100644 --- a/src/openrouter/analytics.py +++ b/src/openrouter/analytics.py @@ -6,7 +6,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional +from typing import Any, Mapping, Optional class Analytics(BaseSDK): @@ -20,7 +20,7 @@ def get_user_activity( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.ActivityItem]: + ) -> operations.GetUserActivityResponse: r"""Get user activity grouped by endpoint Returns user activity data grouped by endpoint for the last 30 (completed) UTC days @@ -128,7 +128,7 @@ async def get_user_activity_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.ActivityItem]: + ) -> operations.GetUserActivityResponse: r"""Get user activity grouped by endpoint Returns user activity data grouped by endpoint for the last 30 (completed) UTC days diff --git a/src/openrouter/api_keys.py b/src/openrouter/api_keys.py index a1e13cb..0906aa8 100644 --- a/src/openrouter/api_keys.py +++ b/src/openrouter/api_keys.py @@ -7,7 +7,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional +from typing import Any, Mapping, Optional class APIKeys(BaseSDK): @@ -22,7 +22,7 @@ def list( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[operations.ListData]: + ) -> operations.ListResponse: r"""List API keys :param include_disabled: Whether to include disabled API keys in the response @@ -126,7 +126,7 @@ async def list_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[operations.ListData]: + ) -> operations.ListResponse: r"""List API keys :param include_disabled: Whether to include disabled API keys in the response @@ -233,7 +233,7 @@ def create( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateKeysData: + ) -> operations.CreateKeysResponse: r"""Create a new API key :param name: Name for the new API key @@ -354,7 +354,7 @@ async def create_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateKeysData: + ) -> operations.CreateKeysResponse: r"""Create a new API key :param name: Name for the new API key @@ -476,7 +476,7 @@ def update( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.UpdateKeysData: + ) -> operations.UpdateKeysResponse: r"""Update an API key :param hash: The hash identifier of the API key to update @@ -607,7 +607,7 @@ async def update_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.UpdateKeysData: + ) -> operations.UpdateKeysResponse: r"""Update an API key :param hash: The hash identifier of the API key to update @@ -945,7 +945,7 @@ def get( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetKeyData: + ) -> operations.GetKeyResponse: r"""Get a single API key :param hash: The hash identifier of the API key to retrieve @@ -1051,7 +1051,7 @@ async def get_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetKeyData: + ) -> operations.GetKeyResponse: r"""Get a single API key :param hash: The hash identifier of the API key to retrieve @@ -1156,7 +1156,7 @@ def get_current_key_metadata( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetCurrentKeyData: + ) -> operations.GetCurrentKeyResponse: r"""Get current API key Get information on the API key associated with the current authentication session @@ -1247,7 +1247,7 @@ async def get_current_key_metadata_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetCurrentKeyData: + ) -> operations.GetCurrentKeyResponse: r"""Get current API key Get information on the API key associated with the current authentication session diff --git a/src/openrouter/credits.py b/src/openrouter/credits.py index 81921f0..ee3cb92 100644 --- a/src/openrouter/credits.py +++ b/src/openrouter/credits.py @@ -218,7 +218,7 @@ def create_coinbase_charge( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateCoinbaseChargeData: + ) -> operations.CreateCoinbaseChargeResponse: r"""Create a Coinbase charge for crypto payment Create a Coinbase charge for crypto payment @@ -342,7 +342,7 @@ async def create_coinbase_charge_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateCoinbaseChargeData: + ) -> operations.CreateCoinbaseChargeResponse: r"""Create a Coinbase charge for crypto payment Create a Coinbase charge for crypto payment diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index ec1b5a8..7057c9d 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -7,7 +7,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Mapping, Optional, Union class GenerateAcceptEnum(str, Enum): @@ -391,7 +391,7 @@ def list_models( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List all embeddings models Returns a list of all available embeddings models and their properties @@ -482,7 +482,7 @@ async def list_models_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List all embeddings models Returns a list of all available embeddings models and their properties diff --git a/src/openrouter/endpoints.py b/src/openrouter/endpoints.py index 432e11b..c6d8824 100644 --- a/src/openrouter/endpoints.py +++ b/src/openrouter/endpoints.py @@ -6,7 +6,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional +from typing import Any, Mapping, Optional class Endpoints(BaseSDK): @@ -21,7 +21,7 @@ def list( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ListEndpointsResponse: + ) -> operations.ListEndpointsResponse: r"""List all endpoints for a model :param author: @@ -120,7 +120,7 @@ async def list_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ListEndpointsResponse: + ) -> operations.ListEndpointsResponse: r"""List all endpoints for a model :param author: @@ -217,7 +217,7 @@ def list_zdr_endpoints( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.PublicEndpoint]: + ) -> operations.ListEndpointsZdrResponse: r"""Preview the impact of ZDR on the available endpoints :param retries: Override the default retry configuration for this method @@ -303,7 +303,7 @@ async def list_zdr_endpoints_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.PublicEndpoint]: + ) -> operations.ListEndpointsZdrResponse: r"""Preview the impact of ZDR on the available endpoints :param retries: Override the default retry configuration for this method diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index bcd11fe..2f75494 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -20,7 +20,7 @@ def get_generation( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetGenerationData: + ) -> operations.GetGenerationResponse: r"""Get request & usage metadata for a generation :param id: @@ -157,7 +157,7 @@ async def get_generation_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetGenerationData: + ) -> operations.GetGenerationResponse: r"""Get request & usage metadata for a generation :param id: diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index 0eb5f27..6ba885b 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -6,7 +6,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Mapping, Optional, Union class Models(BaseSDK): @@ -19,7 +19,7 @@ def count( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsCountResponseData: + ) -> components.ModelsCountResponse: r"""Get total count of available models :param retries: Override the default retry configuration for this method @@ -103,7 +103,7 @@ async def count_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsCountResponseData: + ) -> components.ModelsCountResponse: r"""Get total count of available models :param retries: Override the default retry configuration for this method @@ -189,7 +189,7 @@ def list( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List all models and their properties :param category: @@ -288,7 +288,7 @@ async def list_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List all models and their properties :param category: @@ -389,7 +389,7 @@ def list_for_user( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List models filtered by user provider preferences :param security: @@ -483,7 +483,7 @@ async def list_for_user_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[components.Model]: + ) -> components.ModelsListResponse: r"""List models filtered by user provider preferences :param security: diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index 0bbf0de..50d2395 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -267,7 +267,7 @@ def create_auth_code( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateAuthKeysCodeData: + ) -> operations.CreateAuthKeysCodeResponse: r"""Create authorization code Create an authorization code for the PKCE flow to generate a user-controlled API key @@ -389,7 +389,7 @@ async def create_auth_code_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateAuthKeysCodeData: + ) -> operations.CreateAuthKeysCodeResponse: r"""Create authorization code Create an authorization code for the PKCE flow to generate a user-controlled API key diff --git a/src/openrouter/parameters.py b/src/openrouter/parameters.py index c57023c..5b4008a 100644 --- a/src/openrouter/parameters.py +++ b/src/openrouter/parameters.py @@ -25,7 +25,7 @@ def get_parameters( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetParametersData: + ) -> operations.GetParametersResponse: r"""Get a model's supported parameters and data about which are most popular :param security: @@ -136,7 +136,7 @@ async def get_parameters_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetParametersData: + ) -> operations.GetParametersResponse: r"""Get a model's supported parameters and data about which are most popular :param security: diff --git a/src/openrouter/providers.py b/src/openrouter/providers.py index a32817e..a5f8066 100644 --- a/src/openrouter/providers.py +++ b/src/openrouter/providers.py @@ -6,7 +6,7 @@ from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional +from typing import Any, Mapping, Optional class Providers(BaseSDK): @@ -19,7 +19,7 @@ def list( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[operations.ListProvidersData]: + ) -> operations.ListProvidersResponse: r"""List all providers :param retries: Override the default retry configuration for this method @@ -103,7 +103,7 @@ async def list_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> List[operations.ListProvidersData]: + ) -> operations.ListProvidersResponse: r"""List all providers :param retries: Override the default retry configuration for this method diff --git a/src/openrouter/utils/unmarshal_json_response.py b/src/openrouter/utils/unmarshal_json_response.py index 079836c..f036c3a 100644 --- a/src/openrouter/utils/unmarshal_json_response.py +++ b/src/openrouter/utils/unmarshal_json_response.py @@ -1,12 +1,26 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from typing import Any, Optional +from typing import Any, Optional, Type, TypeVar, overload import httpx from .serializers import unmarshal_json from openrouter import errors +T = TypeVar("T") + + +@overload +def unmarshal_json_response( + typ: Type[T], http_res: httpx.Response, body: Optional[str] = None +) -> T: ... + + +@overload +def unmarshal_json_response( + typ: Any, http_res: httpx.Response, body: Optional[str] = None +) -> Any: ... + def unmarshal_json_response( typ: Any, http_res: httpx.Response, body: Optional[str] = None diff --git a/uv.lock b/uv.lock index 3a8b31b..d506269 100644 --- a/uv.lock +++ b/uv.lock @@ -211,7 +211,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.0.15" +version = "0.0.16" source = { editable = "." } dependencies = [ { name = "httpcore" }, From afbf99e8bf43b27f16e29dc5df4d6863eaa0ab32 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:17:41 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow