Skip to main content

Obiguard Python SDK

Security Control Panel for AI Apps

pip install obiguard

Features

The Obiguard SDK is built on top of the OpenAI SDK, allowing you to seamlessly integrate Obiguard's advanced features while retaining full compatibility with OpenAI methods. With Obiguard, you can enhance your interactions with OpenAI or any other OpenAI-like provider by leveraging robust monitoring, reliability, prompt management, and more features - without modifying much of your existing code.

Obiguard AI Gateway

Unified API Signature
If you've used OpenAI, you already know how to use Obiguard with any other provider.
Interoperability
Write once, run with any provider. Switch between any model from_any provider seamlessly.
Automated Fallbacks & Retries
Ensure your application remains functional even if a primary service fails.
Load Balancing
Efficiently distribute incoming requests among multiple models.
Semantic Caching
Reduce costs and latency by intelligently caching results.
Virtual Keys
Secure your LLM API keys by storing them in Obiguard vault and using disposable virtual keys.

Observability

Logging
Keep track of all requests for monitoring and debugging.
Requests Tracing
Understand the journey of each request for optimization.
Custom Metadata
Segment and categorize requests for better insights.
Feedbacks
Coming soon - Collect and analyse weighted feedback on requests from users.
Analytics
Track your app & LLM's performance with 40+ production-critical metrics in a single place.

Usage

Prerequisites

  1. Sign up on Obiguard and grab your Obiguard API Key
  2. Add your OpenAI key to Obiguard's Virtual Keys page and keep it handy
# Installing the SDK
$ pip install obiguard
$ export OBIGUARD_API_KEY=<OBIGUARD API OR VIRTUAL KEY>

Making a Request to OpenAI

  • Obiguard fully adheres to the OpenAI SDK signature. You can instantly switch to Obiguard and start using our production features right out of the box.
  • Just replace from openai import OpenAI with from obiguard_ai import Obiguard:
from obiguard import Obiguard

obiguard = Obiguard(
    obiguard_api_key="OBIGUARD API OR VIRTUAL KEY"
)

chat_completion = obiguard.chat.completions.create(
    messages=[{"role": 'user', "content": 'Say this is a test'}],
    model='gpt-4'
)

print(chat_completion)

Async Usage

  • Use AsyncObiguard instead of Obiguard with await:
import asyncio
from obiguard import AsyncObiguard

obiguard = AsyncObiguard(
    obiguard_api_key="OBIGUARD API OR VIRTUAL KEY",
)


async def main():
    chat_completion = await obiguard.chat.completions.create(
        messages=[{'role': 'user', 'content': 'Say this is a test'}],
        model='gpt-4'
    )

    print(chat_completion)


asyncio.run(main())

Compatibility with OpenAI SDK

Obiguard currently supports all the OpenAI methods, including the legacy ones.

Methods OpenAI
V1.26.0
Obiguard
V1.0.0
Audio ✅ ✅
Chat ✅ ✅
Embeddings ✅ ✅
Images ✅ ✅
Fine-tuning ✅ ✅
Batch ✅ ✅
Files ✅ ✅
Models ✅ ✅
Moderations ✅ ✅
Assistants ✅ ✅
Threads ✅ ✅
Thread - Messages ✅ ✅
Thread - Runs ✅ ✅
Thread - Run - Steps ✅ ✅
Vector Store ✅ ✅
Vector Store - Files ✅ ✅
Vector Store - Files Batches ✅ ✅
Generations ❌ (Deprecated) ✅
Completions ❌ (Deprecated) ✅

Obiguard-Specific Methods (Coming Soon)

Methods Obiguard
1.0.X
Feedback Obiguard
Prompts Obiguard

Check out Obiguard docs for the full list of supported providers

Contributing

Get started by checking out Github issues. Email us at support@obiguard.com.

Metadata

Release files for obiguard 1.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obiguard 1.0.19
File Size Uploaded
obiguard-1.0.19.tar.gz 365.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for obiguard 1.0.19
File Interpreter ABI Platform
obiguard-1.0.19-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / obiguard-1.0.19.tar.gz

Download URL obiguard-1.0.19.tar.gz
Size 365.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4aa101fee3a6d8caac71f93ff385e77460b66d6329e38e73adf0039eca6b1fdf
BLAKE2b-256 checksum
How to use checksums
b56ff61e2798c837ba6b5df031b33977519a429576b59cb7f4be6dffec4f8acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.

Transparency log

Release files / obiguard-1.0.19-py3-none-any.whl

Download URL obiguard-1.0.19-py3-none-any.whl
Size 708.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
657ac13d87ab480035edd022e973e5c2cd706802e8103e910c0cba22f038262c
BLAKE2b-256 checksum
How to use checksums
3416a3282a10ddbde65330846c2874ddf24f648d5a6d456757f3d805b599dd36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.19 This release

2 release files

1.0.9

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page