Python SDK
OpenAI Python wrapper with SignalVault guardrails.
Installation
pip install signalvault openai
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
| api_key | str | — | Your SignalVault API key |
| openai_api_key | str | — | Your OpenAI API key |
| base_url | str | localhost:4000 | SignalVault API URL |
| environment | str | production | development, staging, production |
| debug | bool | False | Enable debug logging |
| mirror_mode | bool | False | Monitor-only (no blocking) |
Usage
from signalvault import SignalVaultClient
import os
client = SignalVaultClient(
api_key="sk_live_...",
openai_api_key=os.environ["OPENAI_API_KEY"],
base_url="https://api.signalvault.io",
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Mirror Mode
In mirror mode, requests go directly to OpenAI and are audited asynchronously. Zero latency added, never blocks:
client = SignalVaultClient(
api_key="sk_live_...",
openai_api_key=os.environ["OPENAI_API_KEY"],
base_url="https://api.signalvault.io",
mirror_mode=True,
)
Note: Streaming is not yet supported in the Python SDK. Use the Node.js SDK for streaming support.