An SSL certificate error from the OpenAI SDK after changing base_url is almost always a local trust-store or corporate-proxy problem, not the host, and the endpoint it is refusing to trust is plain HTTPS at https://api.uplinkswitch.com/v1 with an ordinary publicly-signed certificate. The error surfaces as a Python ssl.SSLCertVerificationError, whose reason reads CERTIFICATE_VERIFY_FAILED, bubbled up through whichever HTTP library the SDK rides on. That exception is raised by your machine while deciding whether to trust the chain it was handed; the server never sees it. So the fix lives in your environment's certificate configuration, and the checks below walk from the cheapest test to the deepest cause.
Server or your machine: settle it in one command
Start by proving the host answers over TLS at all, with no key and no model call, so nothing can be charged and no credential can muddy the result. The public catalog is the right probe because it needs no authentication and allows any origin:
curl https://api.uplinkswitch.com/v1/catalogIf curl returns the catalog JSON, the certificate is valid and the chain is complete from a normal root. A failure only inside Python, while the browser and curl succeed, is the tell that the trust anchors your Python process loads differ from the ones the browser uses. That split is the whole of this bug.
Why Python raises it when the browser does not
A browser and most system tools validate against the operating system's certificate store, which your IT department, the OS vendor and every installer keep current. Which store Python reads depends on the HTTP library under the SDK and on its version. The requests library and the original httpx ship their trust anchors through the certifi package and verify against certifi.where(), a bundled cacert.pem, and OpenAI SDK releases built on httpx inherit that. Current releases of the OpenAI Python SDK ride on HTTPX2, which verifies against the operating system store through the truststore package and no longer installs certifi. So an older SDK fails on a stale or missing bundle, a current one fails where the system store itself is thin, as in a minimal container image with no CA certificates, and either fails when an environment variable points the bundle somewhere empty. Nothing about the destination changed when you edited base_url; you simply started making the call from Python, under its own rules.
Check the bundle Python is actually using
On a certifi stack (requests, or an SDK release that still imports httpx), print the path and confirm the file exists:
python -c "import certifi; print(certifi.where())"An old virtual environment can carry a certifi from years ago that predates a root your proxy or a CDN now uses. Upgrading it is the single most common fix:
pip install --upgrade certifiA current SDK reads the system's certificates, so in a slim container the matching repair is installing the distribution's CA certificates package.
On macOS, a Python installed from python.org ships an Install Certificates.command in its application folder that wires the interpreter to a fresh bundle; running it once resolves the same class of failure for people who never touched pip.
Point the transport at the right CA bundle
When the chain needs a root that the default bundle lacks, name a bundle explicitly rather than widening trust blindly. Both transports honour environment variables, so you often need no code change:
export SSL_CERT_FILE=/absolute/path/to/ca-bundle.pem
# requests also reads:
export REQUESTS_CA_BUNDLE=/absolute/path/to/ca-bundle.pemHTTPX2, which current OpenAI Python SDK releases use, respects SSL_CERT_FILE and SSL_CERT_DIR, as the original httpx does. If you would rather be explicit in code, build a context and hand the SDK its own HTTP client:
import ssl
from openai import OpenAI, DefaultHttpx2Client
ctx = ssl.create_default_context(cafile="/absolute/path/to/ca-bundle.pem")
client = OpenAI(
base_url="https://api.uplinkswitch.com/v1",
api_key="sk-uplink-live-...",
http_client=DefaultHttpx2Client(verify=ctx),
)On an SDK release from before HTTPX2 the same context goes to httpx.Client(verify=ctx).
For the requests style, pass the bundle to the call: requests.post(url, verify="/path/to/ca-bundle.pem").
When a corporate proxy is in the path
Many workplaces route outbound HTTPS through an inspecting proxy that terminates the connection and re-signs it with a private root certificate your company controls. Your browser trusts that root because IT installed it into the OS store; a certifi stack does not, so every request through the proxy fails verification. The correct repair is to make Python trust the same private root, not to switch verification off. A current SDK already reads the operating system store, so there the repair is confirming the company root is installed in it, or naming a bundle through SSL_CERT_FILE. On an httpx release, append your company root to a copy of the certifi bundle (never edit the installed file in place) and point SSL_CERT_FILE at the copy, or read the operating system store directly with the truststore package:
import ssl, truststore, httpx
from openai import OpenAI
ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
client = OpenAI(
base_url="https://api.uplinkswitch.com/v1",
api_key="sk-uplink-live-...",
http_client=httpx.Client(verify=ctx),
)truststore delegates to the native store, so the private root your browser already trusts is honoured without hand-editing any bundle.
What not to reach for
Disabling verification with verify=False makes the error vanish and your traffic readable to anyone sitting between you and the host, including a hostile proxy impersonating one. It defeats the entire purpose of TLS and should never ship. If you are tempted to use it to confirm the diagnosis, do so once on a throwaway run and then put a real bundle in place. A valid certificate on a standard HTTPS endpoint is doing its job by refusing a chain your environment cannot vouch for; the fix is to teach your environment the missing root, not to stop checking.
A short checklist
curl https://api.uplinkswitch.com/v1/catalog: if it works, the host is fine and the problem is local.- On a
certifistack:python -c "import certifi; print(certifi.where())", thenpip install --upgrade certifi. - On macOS, run the interpreter's
Install Certificates.command. - Behind a proxy, add the company root to a bundle copy and set
SSL_CERT_FILE, or usetruststore. - Keep verification on;
verify=Falseis never the answer.
The base URL and key sit in environment variables as the SDK guide and the OpenAI alternative pages set out, so none of these certificate steps touch your request code.