If I order a GPT-4 API Model and I want to use that to upload Files because I want to work with this. How many tokens are a File or what other things do I have to consider and how would they be priced?
Hi mate, !
you can use the NLTK python library to count tokens.
import nltk
en = "hi! how are you? "
print(len(nltk.word_tokenize(en)))
6
We also have this library GitHub - openai/tiktoken: tiktoken is a fast BPE tokeniser for use with OpenAI's models. which help us to count and vectorize words/tokens.
to get final price, you can calculate with the pricing table:
Those screenshots could give one idea
Hi Mike,
Thank you for your answer but that don’t resolve my doubt.
How the API counts a file upload? 1 token is 1 File? or it’s depends on number of pages.
File retrieval is model independent I believe.
You don’t upload a file to a model, you upload it for use in the Assistant API:
See: https://platform.openai.com/docs/assistants/tools/uploading-files-for-retrieval
“Retrieval is priced at $0.20/GB per assistant per day. Attaching a single file ID to multiple assistants will incur the per assistant per day charge when the retrieval tool is enabled. For example, if you attach the same 1 GB file to two different Assistants with the retrieval tool enabled (e.g., customer-facing Assistant #1 and internal employee Assistant #2), you’ll be charged twice for this storage fee (2 * $0.20 per day). This fee does not vary with the number of end users and threads retrieving knowledge from a given assistant.”
See:
https://platform.openai.com/docs/assistants/tools/retrieval-pricing
so if i upload one, and don’t attach it to any assistants, im charged nothing? it can live there for free forever?
My understanding aligns with yours, and I hope someone can confirm whether it’s indeed the case.
When uploading a file you have to pay for the storage and the ability to attach it to a assistant.
It’s a possibility to not add a file to an assistant but you will still have to pay.
That’s the baseline.
Also, don’t forget to check if there are any pricing updates. Sometimes new features are free for a limited period of time.