The Unbound SDK is built on top of a compatible SDK interface, allowing you to seamlessly integrate Unbound’s advanced features while retaining full compatibility with existing methods. With Unbound, you can enhance your interactions with AI providers by leveraging robust monitoring, reliability, prompt management, and more features - without modifying much of your existing code.

Usage

Prerequisites

  • Sign up on Unbound and grab your Unbound API Key
  • Add your API Keys to Unbound’s API Keys page and keep it handy

Installing the SDK

pip install unbound-gateway

Making a Request to Unbound

Unbound fully adheres to a familiar SDK signature. You can instantly switch to Unbound and start using our production features right out of the box. Just replace your existing import with from unbound import Unbound:
from unbound import Unbound

unbound = Unbound(
    base_url="https://api.getunbound.ai",
    api_key="UNBOUND_API_KEY",
)

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

print(chat_completion)

Async Usage

Use AsyncUnbound instead of Unbound with await:
import asyncio
from unbound import AsyncUnbound

unbound = AsyncUnbound(
    base_url="https://api.getunbound.ai",
    api_key="UNBOUND_API_KEY"
)

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

    print(chat_completion)

asyncio.run(main())