Working config (wrap_openai + base_url /v1)
Pointing OpenAI(base_url=...) at https://api.braintrust.dev/v1/proxy or https://gateway.braintrust.dev/v1 sends traffic to Braintrust's proxy/gateway, not a Chat Completions host. BRAINTRUST_API_KEY authenticates Braintrust logging. It is not the upstream Bearer.
A Chat Completions host whose public catalog is GET https://api.pzero.studio/v1/models (no key) fits wrap_openai if base_url is the /v1 root and api_key is that host's Bearer. init_logger still uses BRAINTRUST_API_KEY.
from braintrust import init_logger, wrap_openai
from openai import OpenAI
init_logger(project="chat-completions-host")
client = wrap_openai(
OpenAI(api_key="<Bearer key for that host>", base_url="https://api.pzero.studio/v1"),
)
r = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Say hello"}],
)
Keep embeddings off this host.
Working config (
wrap_openai+base_url/v1)Pointing
OpenAI(base_url=...)athttps://api.braintrust.dev/v1/proxyorhttps://gateway.braintrust.dev/v1sends traffic to Braintrust's proxy/gateway, not a Chat Completions host.BRAINTRUST_API_KEYauthenticates Braintrust logging. It is not the upstream Bearer.A Chat Completions host whose public catalog is
GET https://api.pzero.studio/v1/models(no key) fitswrap_openaiifbase_urlis the/v1root andapi_keyis that host's Bearer.init_loggerstill usesBRAINTRUST_API_KEY.Keep embeddings off this host.