Python SDK for Aura LLM Gateway - Open Responses API
Project description
Aura LLM Gateway Python SDK
Python SDK for the Aura LLM Gateway, implementing the Open Responses API.
Installation
Using uv (recommended):
uv add aura-llm
Using pip:
pip install aura-llm
From Source
cd sdks/python
# With uv
uv sync
# With pip
pip install -e .
Quick Start
from aura import AuraClient
# Initialize the client
client = AuraClient(
api_key="your-api-key", # or set AURA_API_KEY env var
base_url="http://localhost:8080", # or set AURA_BASE_URL env var
)
# Simple completion
response = client.responses.create(
model="gpt-5.4-mini",
input="What is the capital of France?"
)
print(response.output_text)
# Output: The capital of France is Paris.
Streaming
for event in client.responses.create(
model="gpt-5.4-mini",
input="Tell me a short story about a robot",
stream=True
):
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
Async Client
import asyncio
from aura import AsyncAuraClient
async def main():
async with AsyncAuraClient() as client:
response = await client.responses.create(
model="gpt-5.4-mini",
input="Hello, world!"
)
print(response.output_text)
asyncio.run(main())
Async Streaming
async def stream_example():
async with AsyncAuraClient() as client:
stream = await client.responses.create(
model="gpt-5.4-mini",
input="Tell me a joke",
stream=True
)
async for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
Conversation Threading
Continue a conversation using previous_response_id:
# First message
response1 = client.responses.create(
model="gpt-5.4-mini",
input="My name is Alice."
)
# Continue the conversation
response2 = client.responses.create(
model="gpt-5.4-mini",
input="What is my name?",
previous_response_id=response1.id
)
print(response2.output_text)
# Output: Your name is Alice.
Using Tools
from aura import Tool
# Define a tool
weather_tool = Tool.function_tool(
name="get_weather",
description="Get the current weather for a location",
parameters={
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
)
# Use the tool
response = client.responses.create(
model="gpt-5.4-mini",
input="What's the weather in Tokyo?",
tools=[weather_tool]
)
# Check for tool calls
if response.has_tool_calls:
for tool_call in response.tool_calls:
print(f"Tool: {tool_call.name}")
print(f"Arguments: {tool_call.arguments}")
System Instructions
response = client.responses.create(
model="gpt-5.4-mini",
input="Who are you?",
instructions="You are a helpful pirate assistant. Always respond in pirate speak."
)
Configuration Options
client = AuraClient(
api_key="your-api-key",
base_url="http://localhost:8080",
timeout=120.0, # Request timeout in seconds
headers={"X-Custom-Header": "value"}, # Additional headers
)
Response Object
The Response object contains:
response.id # Unique response ID
response.status # ResponseStatus enum (completed, failed, etc.)
response.model # Model used
response.output # List of output items
response.output_text # Convenience property for text content
response.usage # Token usage information
response.usage.cost_usd # Cost in USD (if available)
response.tool_calls # List of function call items
response.has_tool_calls # Boolean check for tool calls
response.is_complete # Check if response completed successfully
response.metadata # Gateway metadata (provider, latency, etc.)
Stream Events
When streaming, you receive these event types:
| Event Type | Description |
|---|---|
response.created |
Response started |
response.in_progress |
Response is being generated |
response.output_text.delta |
Text chunk (use event.delta) |
response.output_text.done |
Text complete (use event.text) |
response.function_call.delta |
Function arguments chunk |
response.function_call.done |
Function call complete |
response.output_item.added |
New item added to output |
response.output_item.done |
Item complete |
response.completed |
Response finished |
response.failed |
Response failed |
error |
Error occurred |
Error Handling
from aura import (
AuraError,
AuthenticationError,
BadRequestError,
RateLimitError,
NotFoundError,
APIConnectionError,
APITimeoutError,
)
try:
response = client.responses.create(
model="gpt-5.4-mini",
input="Hello"
)
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after: {e.retry_after}")
except BadRequestError as e:
print(f"Bad request: {e.message}, param: {e.param}")
except NotFoundError:
print("Model not found")
except APIConnectionError:
print("Failed to connect to Aura gateway")
except APITimeoutError:
print("Request timed out")
except AuraError as e:
print(f"API error: {e}")
Environment Variables
| Variable | Description | Default |
|---|---|---|
AURA_API_KEY |
API key for authentication | None |
AURA_BASE_URL |
Base URL for the gateway | http://localhost:8080 |
Development
We use uv for fast, reliable Python package management.
Setup
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
cd sdks/python
uv sync
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=aura --cov-report=term-missing
# Run specific test file
uv run pytest tests/test_types.py -v
Code Quality
# Linting
uv run ruff check src/aura tests
# Auto-fix lint issues
uv run ruff check --fix src/aura tests
# Format code
uv run ruff format src/aura tests
# Type checking
uv run mypy src/aura
All Checks (CI equivalent)
uv run ruff check src/aura tests
uv run ruff format --check src/aura tests
uv run mypy src/aura
uv run pytest --cov=aura
License
MIT
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 aura_llm-0.7.2.tar.gz.
File metadata
- Download URL: aura_llm-0.7.2.tar.gz
- Upload date:
- Size: 60.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dae0acbe7b0db7b549bb9cd06420d905d12a12f65618e4cbc19c1deb3f17eb2b
|
|
| MD5 |
e206bcd3455369a9871cd098470703c8
|
|
| BLAKE2b-256 |
39ca0c791deb6e4570648d52ffc88c6cf6ed608f069c53eda2cdf51649950af9
|
Provenance
The following attestation bundles were made for aura_llm-0.7.2.tar.gz:
Publisher:
python-sdk.yml on UmaiTech/aura-llm-gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aura_llm-0.7.2.tar.gz -
Subject digest:
dae0acbe7b0db7b549bb9cd06420d905d12a12f65618e4cbc19c1deb3f17eb2b - Sigstore transparency entry: 1572906076
- Sigstore integration time:
-
Permalink:
UmaiTech/aura-llm-gateway@b4a15204cb23b0550d0ec335c88a5670a7d325f4 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/UmaiTech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk.yml@b4a15204cb23b0550d0ec335c88a5670a7d325f4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aura_llm-0.7.2-py3-none-any.whl.
File metadata
- Download URL: aura_llm-0.7.2-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20693d3c722f99de71cf3534b5f15b78a08aa0495be63198c37dc4ff68999296
|
|
| MD5 |
30df7af044e67068bea277c30048e244
|
|
| BLAKE2b-256 |
90686a80aee47ed06bba0aa8d0a568d8ee8bfd141f975eddf2cda6d0faabcbfd
|
Provenance
The following attestation bundles were made for aura_llm-0.7.2-py3-none-any.whl:
Publisher:
python-sdk.yml on UmaiTech/aura-llm-gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aura_llm-0.7.2-py3-none-any.whl -
Subject digest:
20693d3c722f99de71cf3534b5f15b78a08aa0495be63198c37dc4ff68999296 - Sigstore transparency entry: 1572906105
- Sigstore integration time:
-
Permalink:
UmaiTech/aura-llm-gateway@b4a15204cb23b0550d0ec335c88a5670a7d325f4 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/UmaiTech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk.yml@b4a15204cb23b0550d0ec335c88a5670a7d325f4 -
Trigger Event:
release
-
Statement type: