Skip to content

OpenAI-compat: wrap_openai with base_url /v1, not the Braintrust proxy #717

Description

@cursor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions