How to analyse CSV files with the Responses API

My use case is to analyse a stored CSV file via the responses API using code interpreter but I keep getting “Invalid input: Expected context stuffing file type to be a supported format: .pdf but got .csv”.

Even though the Responses API is the future, am I correct in thinking that at the time of writing that the Assistants API currently has the only public interface for Code Interpreter + CSV execution?

If not, I would appreciate any guidance for the use case, thank you!

It sounds like you are using the user content method for PDF files in messages, which is not for arbitrary file input, but is for document extraction of PDF only.

For other files, they need to be placed into the code interpreter container as file IDs.

https://platform.openai.com/docs/api-reference/container-files/createContainerFile

If you want to use auto-created containers, paying on-demand for their creation when a tool is invoked instead of an ID that you maintain yourself (which is required for self-management of chat history), the storage file id can be added with the tool specification:

{
    "model": "o4-mini",
    "tools": [{
      "type": "code_interpreter",
      "container": { "type": "auto", "file_ids": ["file-1", "file-2"] }
    }],
    "instructions": "A helpful AI uses python tool scripts for calculated answers.",
    "input": "Python environment has CSVs uploaded, list them."
  }