How to Add Web Search to Any OpenAI-Compatible API
If you already use the OpenAI Python SDK, you already know how to call a model: from openai import OpenAI client = OpenAI( api_key="sk-or-...", base_url="https://api.openai.com/v1" ) response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "What changed in EU AI regulation this week?"}] ) print(response.choices[0].message.content) Now add one thing: live web search. With most OpenAI-compatible gateways, you don’t need tools, a search key, or an agent loop. You only change the base_url. ...