PyPI
pip install orbitrageLicense
Apache-2.0 · Python 3.9–3.13
Install
openai (>=1.0) is the only peer you need — Orbitrage speaks OpenAI format:
Initialize
Callinit() once, at the very top of your program, before importing your LLM
client.
What init() does
- Generates a stable trace id for the process and adds it to every request
as
x-orbitrage-run-id, so all your calls group into one run. - Patches the
OpenAIandAsyncOpenAIconstructors to defaultbase_urltohttps://api.orbitrage.ai/v1and inject the trace headers. Your explicitbase_urlorapi_keyalways wins. - Sets
OPENAI_BASE_URLas a safety net for clients constructed with no arguments.
init() parameters
Your
orb_ key. Falls back to ORBITRAGE_API_KEY if omitted.End-user id to attribute calls to (sets
x-orbitrage-end-user-id).Override the gateway URL. Defaults to
https://api.orbitrage.ai/v1 (or
ORBITRAGE_BASE_URL).Set
False to make init() a no-op (e.g. in tests).Suppress the startup log line.
init() is idempotent — calling it more than once is safe and has no effect
after the first call. Legacy v0.4 keyword arguments (disable_batch,
capture_content, instruments, …) are accepted and ignored.Per-end-user attribution
Forcing a model
auto, router, default, and orbitrage all trigger routing. See
Routing.
API surface
| Symbol | Purpose |
|---|---|
init(api_key, *, user_id=None, base_url=None, enabled=True, quiet=False) | Set up the SDK. |
set_user(user_id) | Bind/unbind the end-user id for subsequent clients. |
set_association_properties(props) | v0.4 compat — extracts user_id and calls set_user. |
flush(timeout_ms=5000) / shutdown() | No-ops — the gateway persists synchronously. |
workflow, task, tool, agent | No-op decorators kept for v0.4 compatibility. |
The decorators and lifecycle functions exist so code written for v0.4 keeps
importing without changes. The gateway captures the same data regardless of
decorator markup.