From 104563f9ac965bd31169e69369095b4420db297f Mon Sep 17 00:00:00 2001 From: seven7763 <246023385+seven7763@users.noreply.github.com> Date: Mon, 3 Aug 2026 07:50:00 +0800 Subject: [PATCH] docs(tutorials): note OpenAI-compatible base_url for chat apps Document that the OpenAI Python client accepts a custom base_url for OpenAI-compatible endpoints (local runtimes or multi-model gateways such as DaoXE). Docs only; example remains commented optional. Co-Authored-By: Claude Fable 5 --- .../develop/tutorials/llms/conversational-apps.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/develop/tutorials/llms/conversational-apps.md b/content/develop/tutorials/llms/conversational-apps.md index fd4ab916d..0e307d590 100644 --- a/content/develop/tutorials/llms/conversational-apps.md +++ b/content/develop/tutorials/llms/conversational-apps.md @@ -331,6 +331,20 @@ Next, let's add our OpenAI API key to [Streamlit secrets](/develop/concepts/conn OPENAI_API_KEY = "YOUR_API_KEY" ``` +The OpenAI Python client also accepts a custom `base_url`. Point it at any +OpenAI-compatible endpoint — for example a local runtime, or a multi-model +gateway such as [DaoXE](https://daoxe.com) (`https://api.daoxe.com/v1`). Use an +API key **issued by that endpoint**, and set `openai_model` to a model id the +endpoint actually serves (`GET /v1/models`). + +```python +client = OpenAI( + api_key=st.secrets["OPENAI_API_KEY"], + # Optional: OpenAI-compatible multi-model gateway (example: DaoXE) + # base_url="https://api.daoxe.com/v1", +) +``` + ### Write the app Now let's write the app. We'll use the same code as before, but we'll replace the list of responses with a call to the OpenAI API. We'll also add a few more tweaks to make the app more ChatGPT-like.