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
str
required
Your
orb_ key. Falls back to ORBITRAGE_API_KEY if omitted.str
End-user id to attribute calls to (sets
x-orbitrage-end-user-id).str
Override the gateway URL. Defaults to
https://api.orbitrage.ai/v1 (or
ORBITRAGE_BASE_URL).bool
default:"True"
Set
False to make init() a no-op (e.g. in tests).bool
default:"False"
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.
Pinning a frontier model (
claude-*, gpt-*, gemini-*, grok-*) requires an
enabled key for that vendor — the call runs on your provider account and
Orbitrage bills $0. Without one it raises a 403 with code byok_key_required.
See BYOK.API surface
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.