Responses Code Interpreter File Input Error

Hello,
I am trying to attach files for use in the code interpreter while creating a new Response object however I am getting an “unknown_parameter” error despite following the exact format of the documentation:

my request:
{
“model”: “gpt-4.1”,
“tools”: [{
“type”: “code_interpreter”,
“container”: {“type”: “auto”, “files”: [“file-RHX729yPuiDrbrjkouw2RH”, “file-JKhgNcpEbLZJz58vYu7iaK”]}
}],
“instructions”: “You are a chatbot that analysis telematics csv files”,
“input”: “What is the average idling duration in minutes?”
}

Response:
{
“error”: {
“message”: “Unknown parameter: ‘tools[0].container.files’.”,
“type”: “invalid_request_error”,
“param”: “tools[0].container.files”,
“code”: “unknown_parameter”
}
}

Documentation shows the following:

““container”: { “type”: “auto”, files: [“file-1”, “file-2”] }”

Any help would be greatly appreciated

It seems the doc has a typo.

It is not “files” but “file_ids”:

tools=[
    {
      "type": "code_interpreter",
      "container": {
        "type": "auto",
        "file_ids": [
          "file-xyz", "file-xyz2"
        ]
      }
    }
5 Likes

Would you look at that, it worked perfectly. Thank you sir!!!

2 Likes

We’ve got a great dev community here. Hope you stick around!

1 Like

You are the savior! Thanks!
I confirmed the solution - It is not “files” but “file_ids”

I also wonder how do you know it is a typo in the doc?

The playground creates code examples as you interact. The code generator there got it right.

1 Like

Brutal, this cost me a couple of hours of my life today. Fix your docs OpenAI!

2 Likes