When exactly do costs arise for using the assistant?

Hi guys, I think I’ve come across something strange or I’m missing something serious. I use the API and create an assistant with (GPT 4 Turbo 128k) and attach a .txt to the knowldge. I also attach another file as a message attachment. After running the thread. I check my costs in my dashboard and see. I was only charged for using the GPT 4 model and no costs for the Assistant. Does that mean that the Assistant wasn’t used at all?

1 Like

Do you have a copy of the logs or anything that could help?

Process Step Modul: <module ‘process.createknowledgefile’ from ‘/Users/admin/Documents/Coding/Python/Ai_Worker/AI/src/aimarketing_worker/process/createknowledgefile.py’>
Process Step: <class ‘process.createknowledgefile.Createknowledgefile’>
New Created Knowledge File: writingrules.txt
[2024-03-02 21:12:41,020] DEBUG @ processRunner.py::computeSuccessor - Successors: [3]
[2024-03-02 21:12:41,020] DEBUG @ processRunner.py::run - Output: writingrules.txt
[2024-03-02 21:12:41,021] INFO @ processRunner.py::run - running step #3 of type createparagraphscontent
[2024-03-02 21:12:41,061] DEBUG @ _trace.py::trace - close.started
[2024-03-02 21:12:41,061] DEBUG @ _trace.py::trace - close.complete
[2024-03-02 21:12:41,061] DEBUG @ _trace.py::trace - close.started
[2024-03-02 21:12:41,061] DEBUG @ _trace.py::trace - close.complete
Process Step Modul: <module ‘process.createparagraphscontent’ from ‘/Users/admin/Documents/Coding/Python/Ai_Worker/AI/src/aimarketing_worker/process/createparagraphscontent.py’>
Process Step: <class ‘process.createparagraphscontent.Createparagraphscontent’>
Starting
[2024-03-02 21:12:41,064] DEBUG @ _config.py::load_ssl_context - load_ssl_context verify=True cert=None trust_env=True http2=False
[2024-03-02 21:12:41,064] DEBUG @ _config.py::load_ssl_context_verify - load_verify_locations cafile=‘/Users/admin/Documents/Coding/Python/Ai_Worker/AI/lib/python3.9/site-packages/certifi/cacert.pem’
params.instructions: You are a very proficient SEO content writer writes fluently {language}. Use your knowledge base to best write seo optimized articles.
Knowldge Path for setting Up Assistant: writingrules.txt
[2024-03-02 21:12:41,127] DEBUG @ _base_client.py::_build_request - Request options: {‘method’: ‘get’, ‘url’: ‘/assistants’, ‘params’: {‘limit’: 100}, ‘headers’: {‘OpenAI-Beta’: ‘assistants=v1’}, ‘json_data’: None, ‘post_parser’: <function SyncAPIClient._request_api_list.._parser at 0x1117a88b0>}
[2024-03-02 21:12:41,127] DEBUG @ _trace.py::trace - connect_tcp.started host=‘’ port=443 local_address=None timeout=5.0 socket_options=None
[2024-03-02 21:12:41,153] DEBUG @ _trace.py::trace - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x11216a310>
[2024-03-02 21:12:41,153] DEBUG @ _trace.py::trace - start_tls.started ssl_context=<ssl.SSLContext object at 0x111734f40> server_hostname=’ timeout=5.0
[2024-03-02 21:12:41,178] DEBUG @ _trace.py::trace - start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x11216a490>
[2024-03-02 21:12:41,178] DEBUG @ _trace.py::trace - send_request_headers.started request=<Request [b’GET’]>
[2024-03-02 21:12:41,179] DEBUG @ _trace.py::trace - send_request_headers.complete
[2024-03-02 21:12:41,179] DEBUG @ _trace.py::trace - send_request_body.started request=<Request [b’GET’]>
[2024-03-02 21:12:41,179] DEBUG @ _trace.py::trace - send_request_body.complete
[2024-03-02 21:12:41,179] DEBUG @ _trace.py::trace - receive_response_headers.started request=<Request [b’GET’]>
[2024-03-02 21:12:41,474] DEBUG @ _trace.py::trace - receive_response_headers.complete return_value=(b’HTTP/1.1’, 200, b’OK’, [(b’Date’, b’Sat, 02 Mar 2024 20:12:41 GMT’), (b’Content-Type’, b’application/json’), (b’Transfer-Encoding’, b’chunked’), (b’Connection’, b’keep-alive’), (b’openai-version’, b’2020-10-01’), (b’openai-organization’, b’user-qj0iyzehnljyk3kzhcphmnzy’), (b’x-request-id’, b’req_0ad9dc32531209f4b2282b32bd5f42af’), (b’openai-processing-ms’, b’123’), (b’strict-transport-security’, b’max-age=15724800; includeSubDomains’), (b’CF-Cache-Status’, b’DYNAMIC’), (b’Set-Cookie’, b’__cf_bm=iAMuwyopTD.ShoJn4WQLj9Bl3J.AWAIFu63gs075qN4-1709410361-1.0.1.1-gh2pNYYDOtxuy86j.5R0PgBSsKgLytYTaJnGko7Qg3pI0Z9MOgNq2OqMIK1eD1R2vi0yHElJ.Ce7SaXYlohRnw; path=/; expires=Sat, 02-Mar-24 20:42:41 GMT; domain=; HttpOnly; Secure; SameSite=None’), (b’Set-Cookie’, b’_cfuvid=xlGlqK2b5LU_09mc__LSA_HASAz3pmwr_lNEZVoyI1g-1709410361499-0.0.1.1-604800000; path=/; domain=; HttpOnly; Secure; SameSite=None’), (b’Server’, b’cloudflare’), (b’CF-RAY’, b’85e40b05a9c36304-HAM’), (b’Content-Encoding’, b’gzip’), (b’alt-svc’, b’h3=“:443”; ma=86400’)])
[2024-03-02 21:12:41,475] INFO @ _client.py::_send_single_request - HTTP Request:
[2024-03-02 21:12:41,475] DEBUG @ _trace.py::trace - receive_response_body.started request=<Request [b’GET’]>
[2024-03-02 21:12:41,601] DEBUG @ _trace.py::trace - receive_response_body.complete
[2024-03-02 21:12:41,601] DEBUG @ _trace.py::trace - response_closed.started
[2024-03-02 21:12:41,601] DEBUG @ _trace.py::trace - response_closed.complete
[2024-03-02 21:12:41,601] DEBUG @ _base_client.py::_request - HTTP Request:
Assistant not found by name adspiration_12769
Actuall Knowldge File Path when creating create_assistant: writingrules.txt
[2024-03-02 21:12:41,646] DEBUG @ _base_client.py::_build_request - Request options: {‘method’: ‘post’, ‘url’: ‘/assistants’, ‘headers’: {‘OpenAI-Beta’: ‘assistants=v1’}, ‘files’: None, ‘json_data’: {‘model’: ‘gpt-4-1106-preview’, ‘instructions’: ‘You are a very proficient SEO content writer writes fluently deutsch. Use your knowledge base to best write seo optimized articles.’, ‘name’: ‘adspiration_12769’, ‘tools’: [{‘type’: ‘code_interpreter’}]}}
[2024-03-02 21:12:41,647] DEBUG @ _trace.py::trace - send_request_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,647] DEBUG @ _trace.py::trace - send_request_headers.complete
[2024-03-02 21:12:41,647] DEBUG @ _trace.py::trace - send_request_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,647] DEBUG @ _trace.py::trace - send_request_body.complete
[2024-03-02 21:12:41,647] DEBUG @ _trace.py::trace - receive_response_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,938] DEBUG @ _trace.py::trace - receive_response_headers.complete return_value=(b’HTTP/1.1’, 200, b’OK’, [(b’Date’, b’Sat, 02 Mar 2024 20:12:41 GMT’), (b’Content-Type’, b’application/json’), (b’Transfer-Encoding’, b’chunked’), (b’Connection’, b’keep-alive’), (b’openai-version’, b’2020-10-01’), (b’openai-organization’, b’user-qj0iyzehnljyk3kzhcphmnzy’), (b’x-request-id’, b’req_f2da5d067b1e4f8328d9ba3226a67c31’), (b’openai-processing-ms’, b’127’), (b’strict-transport-security’, b’max-age=15724800; includeSubDomains’), (b’CF-Cache-Status’, b’DYNAMIC’), (b’Server’, b’cloudflare’), (b’CF-RAY’, b’85e40b089bac6304-HAM’), (b’Content-Encoding’, b’gzip’), (b’alt-svc’, b’h3=“:443”; ma=86400’)])
[2024-03-02 21:12:41,940] INFO @ _client.py::_send_single_request - HTTP Request: [2024-03-02 21:12:41,940] DEBUG @ _trace.py::trace - receive_response_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,941] DEBUG @ _trace.py::trace - receive_response_body.complete
[2024-03-02 21:12:41,941] DEBUG @ _trace.py::trace - response_closed.started
[2024-03-02 21:12:41,941] DEBUG @ _trace.py::trace - response_closed.complete
[2024-03-02 21:12:41,941] DEBUG @ _base_client.py::_request - HTTP Request:
[2024-03-02 21:12:41,944] DEBUG @ _base_client.py::_build_request - Request options: {‘method’: ‘post’, ‘url’: ‘/files’, ‘headers’: {‘Content-Type’: ‘multipart/form-data’}, ‘files’: [(‘file’, (‘writingrules.txt’, b"[Rules for writing]\n- The content must be ever 100% #deutsch#\n- Make 100% sure that the paragraph is at least #250# words long!\n- The content must be ever formatted in markdown\n- The content must bold important words, especially the keyword ‘#Kryptow\xc3\xa4hrungen#’\n- If it makes sense, lists and enumerations should be incorporated into the content\n- Important terms shall be highlighted and lists shall be displayed correctly.\n- A line-break should be inserted every 4-5 sentences\n- The content should be written in your own words and not copied and pasted from other sources\n- Content must be written in #f\xc3\xb6rmlich# ‘we’ language that engages to the reader\n- Content should be written in a #informierend# style as written by a human #f\xc3\xb6rmlich# tone, with personal pronouns, kept simple, active voice, with rhetorical questions and incorporate analogies and metaphors)\n- The article must maintain a keyword density of min 0.5% for the term ‘#Kryptow\xc3\xa4hrungen#’\n- Repetition should be avoided\n- The main heading of the article ‘## Alles, was du \xc3\xbcber Kryptow\xc3\xa4hrungen wissen musst#’ should not appear in the content\n- Your own additions to your approach or other information not requested must never be included in the requested answer.\n- If you are unable to complete a task or can only complete it with additional information, always reply with the word ‘ERROR’\n- The content must not contain placeholders and should be ready for publication without any further editing\n- What has been written about the entire article so far can be found in the section [The article] (also in the attached file).\n- If the [The article] section is empty, ignore the following instruction:\n- Make sure that your new section does not contain any information that has already been mentioned in the contents of [The article] section.\n"))], ‘json_data’: {‘purpose’: ‘assistants’}}
[2024-03-02 21:12:41,947] DEBUG @ _trace.py::trace - send_request_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,948] DEBUG @ _trace.py::trace - send_request_headers.complete
[2024-03-02 21:12:41,948] DEBUG @ _trace.py::trace - send_request_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:41,948] DEBUG @ _trace.py::trace - send_request_body.complete
[2024-03-02 21:12:41,948] DEBUG @ _trace.py::trace - receive_response_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,578] DEBUG @ _trace.py::trace - receive_response_headers.complete return_value=(b’HTTP/1.1’, 200, b’OK’, [(b’Date’, b’Sat, 02 Mar 2024 20:12:42 GMT’), (b’Content-Type’, b’application/json’), (b’Transfer-Encoding’, b’chunked’), (b’Connection’, b’keep-alive’), (b’openai-version’, b’2020-10-01’), (b’openai-organization’, b’user-qj0iyzehnljyk3kzhcphmnzy’), (b’x-request-id’, b’req_611c56f4a6e192dd451431031586419b’), (b’openai-processing-ms’, b’452’), (b’access-control-allow-origin’, b’*‘), (b’strict-transport-security’, b’max-age=15724800; includeSubDomains’), (b’CF-Cache-Status’, b’DYNAMIC’), (b’Server’, b’cloudflare’), (b’CF-RAY’, b’85e40b0a7d0d6304-HAM’), (b’Content-Encoding’, b’gzip’), (b’alt-svc’, b’h3=“:443”; ma=86400’)])
[2024-03-02 21:12:42,578] INFO @ _client.py::_send_single_request - HTTP Request:
[2024-03-02 21:12:42,578] DEBUG @ _trace.py::trace - receive_response_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,579] DEBUG @ _trace.py::trace - receive_response_body.complete
[2024-03-02 21:12:42,579] DEBUG @ _trace.py::trace - response_closed.started
[2024-03-02 21:12:42,579] DEBUG @ _trace.py::trace - response_closed.complete
[2024-03-02 21:12:42,579] DEBUG @ _base_client.py::_request - HTTP Request:
File uploaded! ID: file-edHQnuQJxx8UbRkQYN4fbNkV
File Object ID that is attached to assistant: file-edHQnuQJxx8UbRkQYN4fbNkV
[2024-03-02 21:12:42,581] DEBUG @ _base_client.py::_build_request - Request options: {‘method’: ‘post’, ‘url’: ‘/assistants/asst_wZ92GA6JwQ5PG3Ol3sFd2fYB/files’, ‘headers’: {‘OpenAI-Beta’: ‘assistants=v1’}, ‘files’: None, ‘json_data’: {‘file_id’: ‘file-edHQnuQJxx8UbRkQYN4fbNkV’}}
[2024-03-02 21:12:42,582] DEBUG @ _trace.py::trace - send_request_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,583] DEBUG @ _trace.py::trace - send_request_headers.complete
[2024-03-02 21:12:42,583] DEBUG @ _trace.py::trace - send_request_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,583] DEBUG @ _trace.py::trace - send_request_body.complete
[2024-03-02 21:12:42,583] DEBUG @ _trace.py::trace - receive_response_headers.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,980] DEBUG @ _trace.py::trace - receive_response_headers.complete return_value=(b’HTTP/1.1’, 200, b’OK’, [(b’Date’, b’Sat, 02 Mar 2024 20:12:43 GMT’), (b’Content-Type’, b’application/json’), (b’Transfer-Encoding’, b’chunked’), (b’Connection’, b’keep-alive’), (b’openai-version’, b’2020-10-01’), (b’openai-organization’, b’user-qj0iyzehnljyk3kzhcphmnzy’), (b’x-request-id’, b’req_3b366e15f2db43b88aa8af5f5a615691’), (b’openai-processing-ms’, b’219’), (b’strict-transport-security’, b’max-age=15724800; includeSubDomains’), (b’CF-Cache-Status’, b’DYNAMIC’), (b’Server’, b’cloudflare’), (b’CF-RAY’, b’85e40b0e6fa66304-HAM’), (b’Content-Encoding’, b’gzip’), (b’alt-svc’, b’h3=“:443”; ma=86400’)])
[2024-03-02 21:12:42,981] INFO @ _client.py::_send_single_request - HTTP Request:
[2024-03-02 21:12:42,981] DEBUG @ _trace.py::trace - receive_response_body.started request=<Request [b’POST’]>
[2024-03-02 21:12:42,982] DEBUG @ _trace.py::trace - receive_response_body.complete
[2024-03-02 21:12:42,982] DEBUG @ _trace.py::trace - response_closed.started
[2024-03-02 21:12:42,982] DEBUG @ _trace.py::trace - response_closed.complete
[2024-03-02 21:12:42,982] DEBUG @ _base_client.py::_request - HTTP Request:
File attached to assistant! ID: file-edHQnuQJxx8UbRkQYN4fbNkV
Assistant created! ID: asst_wZ92GA6JwQ5PG3Ol3sFd2fYB

The only thing “assistants” you would be billed for is code interpreter sessions, and in the future, knowledge files attached to each assistant.

So you are paying for AI tokens of the model used. Tokens of the documents and past thread chats that the Assistants backend loads the AI up with, and those same tokens of context that are sent to the model every further function call the AI makes internally.

So you mean when i use “Retrieval” instead of “Code Interpreter” as tool type, i am not charged “Assistant” Costs at the moment?

So i already did 2 Tests. One time with Retrieval and the other one with Code Interpreter. In both cases i created an assistant and then attached a knowledge file to it. Later when creating a message and running the thread i also attached a file to the message.

Everything seems to work fine, i got my results they look good but i am not charged Assistant Costs.

The daily charges for having files attached to assistants, the size of the data multiplied by each assistant, has been pushed forward to April.

The cost in use is still quite high, as the backend tries to maximize knowledge use and chat use (over quality and technique), and can make iterative calls, (if someone said "find the best method for x and y from all the PDFs, and then write code for alice, bob, and claude and find the results.) . A single API run can be well over a dollar on GPT-4-Turbo 128k models.

Ok good to know.

But that doesn’t answer my question. I just tested a simple process with assistant. Again attaching a file to the assistant and attaching a file to a message and just run a simple question.

And now i got charged Assistant Costs.

I don’t know what is happening here, why am i not charged. What could be going wrong?
After my code i run a cleaning process and it shows me that an asistant was deleted and the files.
So why am i not getting charged for the assistant although it was definitely created and files attached. :thinking:

The presentation of information in the usage page is poor. We cannot help that OpenAI went out of their way to obfuscate costs, releasing this new usage without showing actual costs of model calls, deliberately, on the same day assistants was released.

  • On the activity tab, you need to pick a models dropdown in order to see specific or all AI models you might have used. They are not all shown by default. There you’d see the token usage.
  • The appearance of billings can have a considerable delay, even showing up within the previous day after the 00:00 UTC cutoff between days.

Perhaps after selecting all models (and then you have to click the “models” dropdown selector again to make the list go away) you can share what you are seeing that is unexpected.

On the activity page I see the same as on the cost overview page.

Two Assistants activities have been executed with the Code Interpreter. I am aware of this. These two activities are from my test to see if the Assistants API is recorded at all.

The problem is that in my actual code to be executed, the assistant is also created and a file is attached, but only the costs for GPT 4 Turbo are listed. As if the assistant is created with an attached file, but is not used for the creation but only the GPT 4 Turbo model. Can this be the case?

You describe accurately. You are not billed in any separate section for your use of the Assistant you specify when you create an Assistant, and assistant functions like uploading files, adding messages, deleting threads, do not cost you simply for that activity.

Your usage is billed for the tokens of input and output to the AI model selected when you run and actually utilize the AI model (like GPT-4-0125-preview), and still appear under the usage category of the model name.