OpenAI Agents SDK
The OpenAI Agents SDK honors OPENAI_BASE_URL for a zero-code path, or you can set a custom AsyncOpenAI client explicitly for finer control.
# Zero-code path: the Agents SDK reads OPENAI_BASE_URL.
# export OPENAI_BASE_URL="http://127.0.0.1:8787/w/my-service/openai/v1"
# Or set a custom client explicitly:
import os
from openai import AsyncOpenAI
from agents import Agent, Runner, set_default_openai_client
set_default_openai_client(
AsyncOpenAI(
base_url="http://127.0.0.1:8787/w/my-service/openai/v1",
api_key=os.environ["OPENAI_API_KEY"],
),
use_for_tracing=False,
)
agent = Agent(name="assistant", instructions="Be concise.")
result = Runner.run_sync(agent, "Why is the sky blue?")The Agents SDK honors OPENAI_BASE_URL — zero code — or a custom client for finer control.
Local vs. connected
The base URL above is the local proxy default (http://127.0.0.1:8787). Connected or managed use swaps in the cloud gateway URL and adds x-cave-api-key (gateway auth) plus x-cave-upstream-key (your per-request provider key) as request headers on the same client.