Is it indeed correct you can upload more than 20 files in a thread? My testing shows you can

For my app I have one “master” assistant and a dedicated thread per user, so each user has their own context/experience.

So I was reading the docs and saw you can upload a maximum of 20 files per assistant. Initially I thought this therefore means that over all users, a maximum of 20 files can be uploaded across all threads in total, as all threads sit under the one assistant, as this assistant has a max file limit of 20.

HOWEVER, I did some testing by uploading 22 simple, unique text files in a single thread. I expected an error to occur whilst trying to create a message with the 21st file attached to it. However, all 22 uploaded successfully. See the image below: I simply print out all the file_ids I have in the thread.

I then uploaded 50 more text files just to be sure. There’s over 70 messages created in this thread each with a unique text file uploaded with it. All have been successfully uploaded.

So it turns out you can do more than 20? I’m so confused. Do you know why? I had a thought as to maybe why it’s possible. I remember reading somewhere that threads are independent to assistants – that is, multiple assistants can act on a given thread (one at a time, that is). Is it therefore the case that because threads are not a subset of a given assistant, and that they’re their own thing, they do not have a limit as to how many messages with files attached & uploaded with them can be sent in a thread? And that the “20 file limit” is specifically referring ONLY to attaching files at the assistant level – attaching a file when creating an assistant?

Is this correct? Quite confused here.

Thanks!

The link in the docs that prompted my anxiety:

https://platform.openai.com/docs/assistants/how-it-works/creating-assistants#:~:text=You%20can%20attach%20a%20maximum%20of%2020%20files%20per%20Assistant%2C%20and%20they%20can%20be%20at%20most%20512%20MB%20each

In the Assistants API, there are two kinds of files:

  • Assistant Files (v1/assistants/:id/files), which are limited to at most 20, and are used by the assistant in every thread it runs on.
  • Message Files (v1/threads/:id/messages/:id/files), which are limited to 10 per message, but there is no upper bound on total files on a thread. These are used on runs on that thread, and not shared across threads.

Hope that helps!

5 Likes

Thank you for the clear response. This is good news! Do you know where I can see the pricing of files per thread? Is there storage costs of files in a thread? Because as you said there’s no upper-bound on the number of files per thread, it seems like this needs to be carefully controlled for financial reasons.

Have you found out what the pricing is yet?