Drop-in OpenAI SDK replacement that routes through Proxera
Project description
Proxera Python Client
Drop-in replacement for the OpenAI Python SDK that routes all requests through Proxera — giving you logging, cost tracking, rate-limit management, and provider failover with zero code changes.
Install
pip install proxera
Quick Start
import proxera
client = proxera.get_client() # reads PROXERA_API_KEY from env
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
That's it. Every call goes through Proxera's proxy and shows up in your dashboard.
Configuration
| Parameter | Env Variable | Default |
|---|---|---|
proxera_key |
PROXERA_API_KEY |
(required) |
base_url |
PROXERA_BASE_URL |
https://api.getproxera.com/v1 |
Constructor arguments
client = proxera.get_client(
proxera_key="px-live_...", # or set PROXERA_API_KEY
tags=["my-app", "experiment-1"], # X-Proxera-Tags header
team="research", # X-Proxera-Team header
provider="anthropic", # X-Proxera-Provider header
)
Async
import proxera
client = proxera.get_async_client()
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
Wrapper classes
If you prefer an object that holds its config:
client = proxera.Client(tags=["my-app"])
client.chat.completions.create(model="gpt-4o", messages=[...])
Usage with LangChain
from langchain_openai import ChatOpenAI
import proxera
llm = ChatOpenAI(
model="gpt-4o",
openai_api_key="px-live_...",
openai_api_base="https://api.getproxera.com/v1",
)
llm.invoke("Hello!")
Or reuse a Proxera client:
import proxera
from langchain_openai import ChatOpenAI
client = proxera.get_client()
llm = ChatOpenAI(model="gpt-4o", client=client)
Documentation
Full docs at docs.getproxera.com.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proxera-0.1.0.tar.gz.
File metadata
- Download URL: proxera-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4c1ec178212f83c8f618bb02160b0e6c2371741e7c90a2de538c4cca6d85eb
|
|
| MD5 |
a900b7f03bd76615256ebcfeb95423d1
|
|
| BLAKE2b-256 |
51ab3b1022fc8ffc204f1f93ef194ecb1ec7c28b49c67c9c3eed50fc19bd84f7
|
File details
Details for the file proxera-0.1.0-py3-none-any.whl.
File metadata
- Download URL: proxera-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a277387f17ae49f479a807112a3a67bd469ba2134016b204f107994c3a4f9118
|
|
| MD5 |
672641b388d734b67c717e794a3e1d9d
|
|
| BLAKE2b-256 |
1bcc003e243802841793e7ec20956f59426d78da2c4e3594cb5719426a4f54f8
|