v0.0.1
OpenRouter Python Client (Unofficial) v0.0.1 π
The first official release of the unofficial Python client for OpenRouter! This comprehensive library provides a fully-typed, feature-rich interface for interacting with large
language models through the OpenRouter API.
π Key Features
- Complete API Coverage: Support for all major OpenRouter endpoints including chat completions, text completions, model information, generations, credits, and API key management
- Streaming Support: Real-time streaming for chat and completion responses
- Automatic Rate Limiting: SmartSurge integration automatically configures rate limits based on your API key's limits
- Type Safety: Fully typed interfaces with Pydantic models for all request and response data
- Tool Calling: Built-in support for function calling with decorators and helper functions
- Secure Key Management: In-memory encryption and extensible secrets management
- Smart Retries: Built-in retry logic with exponential backoff for reliable API communication
π¦ Installation
pip install openrouter-client-unofficial
π Quick Start
from openrouter_client import OpenRouterClient
client = OpenRouterClient(api_key="your-api-key")
response = client.chat.create(
model="anthropic/claude-3-opus",
messages=[
{"role": "user", "content": "Hello, world!"}
]
)
print(response.choices[0].message.content)
π Documentation
Check out the comprehensive documentation in the repository, including:
- Getting started guide
- API reference
- Advanced features
- Example implementations
- Configuration options
π§ͺ Testing
This release includes extensive testing coverage with both local unit tests and remote integration tests, ensuring reliability and stability.
- This is an unofficial client, not affiliated with OpenRouter, Inc.
- Currently in Alpha stage - expect some breaking changes in future releases
- Requires Python 3.9 or higher
- Your usage is subject to OpenRouter's Terms of Service
Full Changelog: Initial release