How Can I Log or Display Exact URLs Accessed by Retrieval Tools When Using the OpenAI API?

I’m developing a mobile app that uses the OpenAI API, and I rely on retrieval-augmented responses—such as those generated via the new API “agents” or any web-search/RAG pipeline (including third-party tool integrations). Here’s my main issue:

Problem:
When the model cites external sources (product links, news, documentation, etc.), the URLs in the output sometimes appear hallucinated or are simply the ones surfaced in the retrieved context—not necessarily exactly what was accessed or visited by the underlying search/retrieval tool.

I need the API to return (in the response or via correlated logs) a list of the exact URLs that the retrieval/search tool visited or pulled data from during the reasoning process—ideally per request.

My understanding is that the model can not view the workings of the seach tool in any great detail. - the perplexity api is no better either.

Appologes if this is a navive question - still very much learning

Thanks all

Unfortunately you don’t have that much control.

But if you really need, you can make a proxy function or a MCP that searches the web using your own way (or using another search API like jina.ai), then you will be able to log the requests that are feeding openai models. It is a ton of extra work though.