Python SDK
SDK reference
A native Python management SDK is coming soon. Until then, call account APIs with httpx or requests and your Orqen API key. For chat completions, use the OpenAI SDK with base_url="https://api.orqen.app/v1".
Note on the orqen PyPI package
The published orqen package is the Orqen FastAPI server, not a client SDK. Do not install it for agent or management scripts.
REST endpoints
| GET | /v1/account/usage/summary | Current month requests, token savings, and billing estimate. |
| GET | /v1/account/usage/daily | Daily token savings and request counts. |
| GET | /v1/account/requests | Paginated request log. |
| GET | /v1/account/keys | List API keys. |
| POST | /v1/account/keys | Create an API key; secret returned once. |
| DELETE | /v1/account/keys/{id} | Revoke an API key. |
| PUT | /v1/account/providers | Store or update encrypted provider credentials. |
| PUT | /v1/account/routing/preferences | Set passthrough, auto, cheap, fast, or capable routing. |
See the API reference for the full endpoint list.
Examples
import httpx
ORQEN_KEY = "sk-orq-YOUR_KEY"
BASE = "https://api.orqen.app"
def orqen(method: str, path: str, **kwargs):
with httpx.Client() as client:
r = client.request(
method, BASE + path,
headers={"Authorization": f"Bearer {ORQEN_KEY}"},
**kwargs,
)
r.raise_for_status()
return r.json() if r.content else None
summary = orqen("GET", "/v1/account/usage/summary")
print(summary["tokens_saved_estimate"])
new_key = orqen("POST", "/v1/account/keys", json={"name": "ci-agent"})
print(new_key["key"]) # shown onceError handling
REST calls return standard HTTP status codes. Check response.status_code and parse JSON error bodies. Store API keys securely and rotate them from the dashboard or API.