Features
The Unbound SDK is built on top of the OpenAI SDK, allowing you to seamlessly integrate Unbound's advanced features while retaining full compatibility with OpenAI methods. With Unbound, 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.
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 OpenAI
- Unbound fully adheres to the OpenAI SDK signature. You can instantly switch to Unbound and start using our production features right out of the box.
- Just replace
from openai import OpenAIwithfrom unbound import Unbound:
from unbound import Unbound
unbound = Unbound(
base_url="UNBOUND_BASE_URL",
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
AsyncUnboundinstead ofUnboundwithawait:
import asyncio
from unbound import AsyncUnbound
unbound = AsyncUnbound(
base_url="UNBOUND_BASE_URL",
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())
Release files for unbound-gateway 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unbound_gateway-0.1.7.tar.gz | 251.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unbound_gateway-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 691.9 kB
Release files / unbound_gateway-0.1.7.tar.gz
| Download URL | unbound_gateway-0.1.7.tar.gz |
|---|---|
| Size | 251.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c8c2a6f62302b12a71e6fd6fc5e398035327ee7941f35aac278ef3fda3bdd5b
|
|
BLAKE2b-256 checksum How to use checksums |
92c7b121e59dfdf72bb4563e3c1c9b15db68d58b0f063d911636772c0caf1950
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / unbound_gateway-0.1.7-py3-none-any.whl
| Download URL | unbound_gateway-0.1.7-py3-none-any.whl |
|---|---|
| Size | 440.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e851ee041d6013747b313bbbbd0bd67c6503231bf911eaf0eaeb6dbb2a3d439
|
|
BLAKE2b-256 checksum How to use checksums |
2704c487a0a8d319ede8d7288a9af59aa62c5cf7202e8133e5a7b3f2358211b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|