{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreih34qt6nqg2fiyzlatf4hol2kb5a5by3zyyl67uohyvflsh6l2szm",
    "uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3mh6zcbaxsrk2"
  },
  "path": "/t/how-do-i-send-a-gpt-4-api-request-from-python/1376906#post_3",
  "publishedAt": "2026-03-16T15:54:02.000Z",
  "site": "https://community.openai.com",
  "tags": [
    "I am getting an error while using code interpreter in Response Api",
    "Request for example of a custom tool Function Call back using the client.responses.create() method"
  ],
  "textContent": "GPT-4 is an AI model, and you’ll likely want to start with gpt-5-nano for testing (and with a new organization where you have gone through “create building”, you might have minimal free usage before needing to prepay for credits.\n\nHere’s sending a request, and the rest of API support for “build a simple AI chatbot” - by way of searching the forum.\n\nI am getting an error while using code interpreter in Response Api\n\n> If you still want to go at it, here’s some console Python chat code for you. It uses the previous response ID method and non-streaming simply because the alternate is massive event code and custom database, and supports nothing other than code interpreter. I just tacked the tool and support onto other example code I had open.\n>\n>   * A container ID is created but no other management of the lifecycle.\n>   * Any files created that the AI cites for you will automatically be downloaded to a `code-files` sub-directory.\n>   * There is a function to upload, but no interface to upload. You could hard-code a list of files to iterate over to upload to the container after it is created.\n>   * exit, and the response IDs are cleaned from the server (and the container is allowed to expire).\n>\n\n\nRequest for example of a custom tool Function Call back using the client.responses.create() method\n\n>\n>     \"\"\"Console chatbot: Conversations + Custom Tools + Persistent Memory\n>\n>     Demonstrates OpenAI's Responses API with:\n>     - Server-side conversation state\n>     - Custom tools (plain-text inputs/outputs)\n>     - Cross-session memory storage\n>     - Guaranteed cleanup of server-side artifacts\n>\n>     Requirements:\n>       pip install httpx\n>       export OPENAI_API_KEY=\"...\"\n>\n>     Run:\n>       python chatbot_custom_tools_memory.py\n>",
  "title": "How do I send a GPT-4 API request from Python?"
}