Hello everyone,
So I’m using OpenAI vector store to store my chunks to retrieve them using the file search method, from what I read , if the vector store size is less than 1GB, then the file search is free. My vector store has less than 1GB of data, but when I do file search, there are additional costs that appear on my dashboard, I don’t understand why?
Hi!
Just a quick clarification: there’s a difference between storing data on OpenAI’s servers and searching through it.
Storage is free up to 1 GB, but using the file search via the Responses API does come with a small cost. As of today, it’s $2.50 per 1,000 searches.
Hi, thank you for your response.
Now it makes sense, but what do you mean by ‘1000 searches’ ? does a search mean simply a query ? or the number of documents being searched to find the most suitable one for the request ?
According to the pricing table it’s ‘per call’, which I described as a ‘search’. You can search through several files with a single call. For example, when using a vector store containing the embeddings from several files.
I see, well that’s weird because after calling the file search once, I got charged 0.03$ (sometimes I get charged less, sometimes more, I don’t get it…) instead of 0.0025$. (in my use case we might need to call the file search up to 9k times per month so that small fraction of difference matters)
But thank you for your help.
The vector store search as its own endpoint is rather quite missing from the pricing and billing information.
One has to extrapolate that the cost of using the endpoint would be the same as Responses AI calling for search internally.
It does make sense that a single call would be rounded to a display amount, although the old usage page previously presented smaller values.
We can discover the underlying costs by making a series of calls of more significance…
Write a function:
def search_vs(id, query="a placeholder text", max=10) -> dict:
"""use the search endpoint for a query, get "max" results."""
import os, httpx
api_key = os.environ.get("OPENAI_API_KEY")
if not api_key:
raise EnvironmentError("Search: OPENAI_API_KEY not set")
url = f"https://api.openai.com/v1/vector_stores/{id}/search"
headers = {"Authorization": f"Bearer {api_key}"}
body = {
"query": query,
"max_num_results": max,
}
with httpx.Client(timeout=20.0) as client:
response = client.post(url, headers=headers, json=body)
response.raise_for_status()
return response.json()
Maybe then call the “search” endpoint a few times…how about 100x
for _ in range(100):
response = search_vs(id)
print(response)
For what is then ultimately running 300 tokens of cl100k embeddings behind the scenes as the only additional AI:
100
calls thus aligns with the 1000
calls pricing:
Thank you for your very clear response,
I see, i will investigate more to see if im calling the file search more than once in my script.
Thank you so much for the effort !