Un-Official Python SDK for the Open Responses standard
Project description
OpenResponses Python
OpenResponses Python provides a robust, typed interface for interacting with LLMs that adhere to the Open Responses standard. It includes a high-performance async client, Pydantic V2 models, and utilities for building compliant providers.
✨ Features
- Standardization: Strict Pydantic V2 models for
InputText,MessageItem,ReasoningItem,ToolCallItem, ensuring type safety and validation. - High Performance: Built on
httpxwith full async/await support and efficient streaming. - Semantic Streaming: First-class support for streaming reasoning (thinking) and text deltas separately.
- Provider Agnostic: Seamlessly switch between OpenRouter, OpenAI, Ollama, LM Studio, and HuggingFace TGI.
- Developer-First: Fully typed, thoroughly tested, and ready for production.
📦 Installation
Install via pip:
pip install openresponses-python
We recommend using uv for modern dependency management:
uv add openresponses-python
🚀 Quick Start
Here's how to send a request to a compliant provider (e.g., OpenRouter or a local proxy).
1. Simple Request
import asyncio
from openresponses.client import AsyncOpenResponsesClient
async def main():
# Initialize client (defaults to local proxy if base_url not set)
# Ensure you have a provider running (see Examples below)
client = AsyncOpenResponsesClient(base_url="http://localhost:8001")
response = await client.create(
model="deepseek/deepseek-r1",
input="Explain semantic streaming.",
)
# Access the output items directly
for item in response.output:
if item.type == "message":
print(f"Answer: {item.content}")
if __name__ == "__main__":
asyncio.run(main())
2. Semantic Streaming
Stream reasoning ("thinking") and the final response in real-time.
stream = await client.create(
model="deepseek/deepseek-r1",
input="Why is the sky blue?",
stream=True
)
async for event in stream:
if event.event == "response.reasoning.delta":
print(f"🧠 {event.data['delta']}", end="", flush=True)
elif event.event == "response.text.delta":
print(f"🤖 {event.data['delta']}", end="", flush=True)
🔌 Supported Providers
This package includes proxy examples to adapt popular providers to the Open Responses standard.
| Provider | Command | Port | Description |
|---|---|---|---|
| OpenRouter | make run-openrouter |
8001 |
Access DeepSeek R1, Claude 3.5, Gemini via OpenRouter. |
| OpenAI | make run-openai |
8002 |
Standard OpenAI API proxy. |
| Ollama | make run-ollama |
8003 |
Local AI models (Llama 3, Mistral). |
| LM Studio | make run-lmstudio |
8004 |
Local inference server. |
| HuggingFace | make run-huggingface |
8005 |
TGI / Inference Endpoints. |
🛠️ Development
We use uv for dependency management and make for task automation.
git clone https://github.com/uday/openresponses-python.git
cd openresponses-python
make install # Sync dependencies
make test # Run tests
make lint # Run linters
make docs-serve # Preview documentation
🤝 Contributing
We welcome contributions! Please see CONTRIBUTION.md for guidelines.
📄 License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openresponses_python-0.1.1.tar.gz.
File metadata
- Download URL: openresponses_python-0.1.1.tar.gz
- Upload date:
- Size: 90.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8944ba473f3f2ea8faaf14a71b52243e24e5f71c889f02be2e2845559c85ee2
|
|
| MD5 |
85e412585e9730effbccccdbee961fe2
|
|
| BLAKE2b-256 |
56a7343ece3f9ab6b4c2c65cb0c0faddd89c33db1c1c7ad255e0bd9a6d5d0ab2
|
File details
Details for the file openresponses_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openresponses_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d4020322a9875185d3325cb015d6dff4bd351d054bc9466e88e40fd5007619a
|
|
| MD5 |
c4ae088b4a17c3df2ec7509940d26346
|
|
| BLAKE2b-256 |
43625fb3be899e4dfd4d1cefc813834ed34dc722e5afe93697d5dab0a0c20f29
|