Official Obiguard Python SDK to help take your AI apps to production
The official Python SDK makes it easy to integrate Obiguard into any Python application. Enjoy unified access to 250+ LLMs, advanced observability, routing, governance, and enterprise features with just a few lines of code.
from obiguard import Obiguardclient = Obiguard( obiguard_api_key="sk-obg***", # Your Obiguard API or virtual key)response = client.chat.completions.create( messages=[{"role": "user", "content": "Hello, world!"}], model="gpt-4o" # Example provider/model)
You can use either a Virtual Key or a Config object to select your AI provider.
Find more info on different authentication mechanisms
here.
If you need to customize HTTP networking—for example,
to disable SSL verification due to VPNs like Zscaler or to use custom proxies—you can pass your own httpx.Client to the Obiguard SDK.
Disabling SSL certificate verification is insecure and should only be used for debugging or in trusted internal
environments. Never use this in production.
Here’s how you can use these headers with the Python SDK:
Copy
portkey = Obiguard( obiguard_api_key="vk-obg***", # Your Obiguard virtual key # Add any other headers from the reference)# Or at runtimecompletion = portkey.with_options( metadata={"_user": "user_id"}, # Add any other headers as needed).chat.completions.create( messages=[{"role": "user", "content": "Hello!"}], model="gpt-4o")
Yes! Obiguard’s Python SDK is OpenAI-compatible. You can also use any OpenAI-compatible library by pointing it to
the Obiguard API endpoint and using your Obiguard API key.
If you are behind a VPN (like Zscaler) or a corporate proxy and see SSL/certificate errors, you can pass a custom
httpx.Client to the Obiguard SDK with SSL verification disabled. See the docs above for an example. Warning:
Disabling SSL verification is insecure—only use this as a last resort or for debugging.