From 6bd0b37247508407435c44bd0afc8b8e93624dd7 Mon Sep 17 00:00:00 2001 From: Muttaqi110 <140283743+Muttaqi110@users.noreply.github.com> Date: Fri, 27 Mar 2026 12:06:42 +0500 Subject: [PATCH 1/2] Add non-OpenAI provider setup example Add a minimal code example demonstrating how to configure a non-OpenAI provider using OpenAIChatCompletionsModel with a custom base_url, api_key, and set_tracing_disabled in the Non-OpenAI models section. --- docs/models/index.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/models/index.md b/docs/models/index.md index fa818611d1..089469e5f4 100644 --- a/docs/models/index.md +++ b/docs/models/index.md @@ -199,6 +199,25 @@ You can integrate other LLM providers with these built-in paths: In cases where you do not have an API key from `platform.openai.com`, we recommend disabling tracing via `set_tracing_disabled()`, or setting up a [different tracing processor](../tracing.md). +``` python +from agents import Agent, AsyncOpenAI, OpenAIChatCompletionsModel, set_tracing_disabled + +set_tracing_disabled(disabled=True) + +provider = AsyncOpenAI( + api_key="Api_Key", + base_url="Base URL of Provider", +) + +model = OpenAIChatCompletionsModel( + model="Model_Name", + openai_client=provider +) + + +agent= Agent(name="Helping Agent", instructions="You are a Helping Agent", model=model) +``` + !!! note In these examples, we use the Chat Completions API/model, because many LLM providers still do not support the Responses API. If your LLM provider does support it, we recommend using Responses. From a066b42185de2be9c8d5dad155f68d5522261960 Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Fri, 27 Mar 2026 16:38:53 +0900 Subject: [PATCH 2/2] adjust code example --- docs/models/index.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/models/index.md b/docs/models/index.md index 089469e5f4..021da1fb24 100644 --- a/docs/models/index.md +++ b/docs/models/index.md @@ -204,16 +204,8 @@ from agents import Agent, AsyncOpenAI, OpenAIChatCompletionsModel, set_tracing_d set_tracing_disabled(disabled=True) -provider = AsyncOpenAI( - api_key="Api_Key", - base_url="Base URL of Provider", -) - -model = OpenAIChatCompletionsModel( - model="Model_Name", - openai_client=provider -) - +provider = AsyncOpenAI(api_key="Api_Key", base_url="Base URL of Provider") +model = OpenAIChatCompletionsModel(model="Model_Name", openai_client=provider) agent= Agent(name="Helping Agent", instructions="You are a Helping Agent", model=model) ```