Skip to content

Move from legacy proxy to gateway#191

Open
Erin McNulty (erin2722) wants to merge 6 commits into
mainfrom
move-to-gateway
Open

Move from legacy proxy to gateway#191
Erin McNulty (erin2722) wants to merge 6 commits into
mainfrom
move-to-gateway

Conversation

@erin2722
Copy link
Copy Markdown

The AI Proxy will be deprecated soon, and the AI Gateway is being continually updated with bug fixes and new features, and so we should move this repository to use that.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Braintrust eval report

Evals failed: Error: Command failed with exit code 1

Comment thread py/autoevals/oai.py

self._is_wrapped = isinstance(self.openai, NamedWrapper)
self._is_wrapped = isinstance(self.openai, NamedWrapper) or (
not has_customization and wrap_openai.__module__.startswith("braintrust.")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by, the test was broken

Copy link
Copy Markdown
Collaborator

@ibolmo Olmo Maldonado (ibolmo) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just various nits, but none blocking. i wonder if you'd want to. bump the version as either minor or major. i'd ask in sdk channel.

Comment thread js/oai.ts Outdated
}

const PROXY_URL = "https://api.braintrust.dev/v1/proxy";
const GATEWAY_URL = "https://gateway.braintrust.dev";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i know it's outside of your change, but) we should move to an env var, and default to this.

Comment thread js/oai.ts
*
* @example
* // Using with Anthropic via Braintrust proxy
* // Using with Anthropic via Braintrust Gateway
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#nit Braintrust AI Gateway? what's the official product name? 🤔

Copy link
Copy Markdown
Author

@erin2722 Erin McNulty (erin2722) Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread py/autoevals/__init__.py Outdated
# Configure client to use the Braintrust Gateway with Claude
client = AsyncOpenAI(
base_url="https://api.braintrust.dev/v1/proxy",
base_url="https://gateway.braintrust.dev",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto os.getenv('BRAINTRUST_AI_GATEWAY_URL') or 'https://...'

Comment thread py/autoevals/oai.py
from typing import Any, Optional, Protocol, TypedDict, TypeVar, Union, cast, runtime_checkable

PROXY_URL = "https://api.braintrust.dev/v1/proxy"
GATEWAY_URL = "https://gateway.braintrust.dev"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

@ibolmo Olmo Maldonado (ibolmo) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing blocking, ty!

Comment thread js/oai.ts Outdated
const DEFAULT_GATEWAY_URL = "https://gateway.braintrust.dev";

const getGatewayURL = (): string =>
process.env.BRAINTRUST_AI_GATEWAY_URL || DEFAULT_GATEWAY_URL;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd encourage a sanitizing like:

(process.env.BRAINTRUST_AI_GATEWAY_URL ?? '').trim() || DEFAULT_GATEWAY_URL

Comment thread py/autoevals/test_oai.py


def test_prepare_openai_defaults_to_gateway(monkeypatch: pytest.MonkeyPatch):
monkeypatch.delenv("OPENAI_BASE_URL", raising=False)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fyi) i like to use getEnv() and similar helpers to avoid monkey patching. you can then just set/unset env vars more easily.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants