Initial commit: OpenRouter Python SDK

Auto-generated Python SDK for OpenRouter API, providing comprehensive client library with:
- Chat completions and streaming support
- Embeddings API
- Model and provider information
- API key management
- Analytics and usage tracking
- OAuth authentication flows
- Full type hints and error handling
This commit is contained in:
Matt Apperson
2025-11-13 10:56:25 -05:00
commit 5fc522c72f
721 changed files with 45654 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
> **Remember to shutdown a GitHub Codespace when it is not in use!**
# Dev Containers Quick Start
The default location for usage snippets is the `samples` directory.
## Running a Usage Sample
A sample usage example has been provided in a `root.py` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
```
python root.py
```
## Generating Additional Usage Samples
The speakeasy CLI allows you to generate more usage snippets. Here's how:
- To generate a sample for a specific operation by providing an operation ID, use:
```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples
```
- To generate samples for an entire namespace (like a tag or group name), use:
```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -n {INPUT_TAG_NAME} -o ./samples
```
+40
View File
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/images/tree/main/src/python
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/astral-sh/devcontainer-features/uv:latest": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"github.vscode-pull-request-github"
],
"settings": {
"files.eol": "\n",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.banditEnabled": true,
"python.testing.pytestEnabled": true
}
},
"codespaces": {
"openFiles": [
".devcontainer/README.md"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Install the speakeasy CLI
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
# Setup samples directory
rmdir samples || true
mkdir samples
uv sync --dev
# Generate starter usage sample with speakeasy
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -o samples/root.py