Bug Description
ServerlessBackend raises openai.AuthenticationError: 401 - Not authenticated when using openai>=2.x locally, even with a valid
WANDB_API_KEY. The same code and key work in Google Colab (where openai 1.x may be installed).
Root Cause
In openai 2.x, the base client (BaseClient) injects auth via _auth_headers(security) (method with underscore), not the
auth_headers property. The relevant line in openai/_base_client.py:
headers_dict = _merge_mappings({**self._auth_headers(options.security), **self.default_headers}, custom_headers)
art/serverless/client.py overrides auth_headers (the 1.x property), but _auth_headers is never overridden and returns {} by default
— so the Authorization header is never sent.
Steps to Reproduce
- Create a fresh venv with openpipe-art==0.5.9 and openai>=2.14.0 (as required by the package)
- Run any script that calls model.register(ServerlessBackend())
- Observe 401 - Not authenticated despite a valid WANDB_API_KEY
Environment
- openpipe-art: 0.5.9
- openai: 2.37.0
- Python: 3.12.12
Bug Description
ServerlessBackendraisesopenai.AuthenticationError: 401 - Not authenticatedwhen usingopenai>=2.xlocally, even with a validWANDB_API_KEY. The same code and key work in Google Colab (where openai 1.x may be installed).Root Cause
In openai 2.x, the base client (
BaseClient) injects auth via_auth_headers(security)(method with underscore), not theauth_headersproperty. The relevant line inopenai/_base_client.py:art/serverless/client.py overrides auth_headers (the 1.x property), but _auth_headers is never overridden and returns {} by default
— so the Authorization header is never sent.
Steps to Reproduce
Environment