boldrouter
Official BoldRouter SDK for Python. It is the OpenAI SDK, preconfigured for BoldRouter, plus typed BoldRouter options and a few helpers. One API key, 170+ models across 30+ providers, automatic routing and failover, prompt caching and PII anonymization.
Install
pip install boldrouter
Python 3.10+.
Usage
from boldrouter import BoldRouter
client = BoldRouter(api_key="sk-bold-...") # or omit and set BOLDROUTER_API_KEY
# Everything from the OpenAI SDK works unchanged:
res = client.chat.completions.create(
model="bold/auto",
messages=[{"role": "user", "content": "What is an API gateway?"}],
)
print(res.choices[0].message.content)
Streaming, tools, structured outputs and embeddings are the same calls you already know. Image generation goes through chat completions: pass modalities=["image", "text"] with an image-capable model such as bold/image and read choices[0].message.images. AsyncBoldRouter is the async variant.
BoldRouter options
client.bold.chat takes the same parameters as chat.completions.create plus typed BoldRouter options, and returns the reply together with which provider served it:
r = client.bold.chat(
model="anthropic/claude-sonnet-4.6",
messages=[{"role": "user", "content": "Summarize this..."}],
routing="price", # x-bold-routing header
provider={"order": ["anthropic", "openai"], "allow_fallbacks": True},
models=["openai/gpt-5.5", "google/gemini-2.5-pro"], # cross-model fallback chain
reasoning={"enabled": True, "effort": "high"},
anonymize=True,
cache=False,
)
print(r.text, r.provider, r.bold["model"], r.completion.usage)
Defaults for every client.bold call: BoldRouter(defaults={"routing": "latency"}).
To use the options with the plain OpenAI methods, or with streaming:
from boldrouter import bold_options
stream = client.chat.completions.create(
model="bold/auto", messages=msgs, stream=True,
**bold_options(model="bold/auto", routing="latency", models=["openai/gpt-5.5"]),
)
| Option | Sent as | Docs |
|---|---|---|
routing |
x-bold-routing header: balanced (default), price, latency, uptime |
Routing |
provider |
provider body field: order, only, ignore, allow_fallbacks, sort |
Routing |
models |
models body field. The primary model is prepended automatically. |
Routing |
reasoning |
reasoning body field: enabled, effort |
Chat completions |
anonymize |
anonymize body field, True or {"enabled", "reverse", "entities"} |
Anonymization |
cache |
cache body field. On by default; False disables. |
Prompt caching |
Helpers
client.bold.models(kind="chat") # bold/* first, then alphabetical
client.bold.compare(["openai/gpt-5.5", "anthropic/claude-sonnet-4.6"], messages=msgs)
# [CompareResult(model=..., ok=True, text=..., bold={"provider": ...}, usage=..., latency_ms=...), ...]
read_bold_headers(raw.headers) extracts the x-bold-* headers from any with_raw_response result.
Configuration
| Option | Default | Description |
|---|---|---|
api_key |
BOLDROUTER_API_KEY |
Keys start with sk-bold-. Create one at boldrouter.com/dashboard/keys. |
base_url |
https://boldrouter.com/v1 or BOLDROUTER_BASE_URL |
Override for proxies or testing. |
defaults |
{} |
BoldRouter options applied to every client.bold call. |
| anything else | Passed to the OpenAI client: timeout, max_retries, http_client, default_headers, ... |
Errors
BoldRouter returns OpenAI-shaped errors, so the OpenAI SDK's exceptions apply: AuthenticationError (401), RateLimitError (429), NotFoundError (404 unknown model), APIStatusError with status 402 for insufficient credit and 502 when all providers failed. The SDK retries 429 and 5xx with backoff by default.
License
MIT. Project: BoldRouter. Author: GentleBulldozer (GentleDozer on X). Owner: Cybrient Technologies SA.
Metadata
Release files for boldrouter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boldrouter-0.1.0.tar.gz | 8.7 kB | With provenance | Details for boldrouter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boldrouter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for boldrouter-0.1.0-py3-none-any.whl |
Total release size: 16.9 kB
Release files / boldrouter-0.1.0.tar.gz
| Download URL | boldrouter-0.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2de3bf1a2a832078730a2058033b5c885804d09fdd5a2a1c3264a8b17192ff5c
|
|
BLAKE2b-256 checksum How to use checksums |
bf5741191736741abe12324841b708b0fcf7859e8472925d12dd36e5f1c3cae7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / boldrouter-0.1.0-py3-none-any.whl
| Download URL | boldrouter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2e8a890a1a94c1bfc51f4e400b2081714e12adfa48ff1b000b855e19cd96a86
|
|
BLAKE2b-256 checksum How to use checksums |
62206db73830dd933b6400c9d52785fd958c5685627cad51ce660028120ea7bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for boldrouter 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for boldrouter-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.