Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env bash2# Code interpreter (auto container) via curl, then GET / files / DELETE on /v1/containers. STATUS: LIVE_VERIFIED 2026-09-18 (gpt-5.4-nano). $0.03/session.3# Run: bash examples/openai/tools/code-interpreter/code_interpreter.sh4set -eo pipefail # no -u: oai() runs in $(...) subshells, so OAI_STATUS may be unset in the parent5source "$(dirname "$0")/../../../../scripts/lib.sh"6R=$(oai POST /v1/responses -d '{"model":"gpt-5.4-nano","input":"Run print(2+2) in python and reply with just the number.",7 "tools":[{"type":"code_interpreter","container":{"type":"auto"}}],"tool_choice":{"type":"code_interpreter"},"include":["code_interpreter_call.outputs"],"max_output_tokens":400,"reasoning":{"effort":"low"}}')8log_request openai POST /v1/responses "${OAI_STATUS:-200}" 0.03 "code_interpreter.sh"9echo "$R" | jq -c '.output[] | select(.type=="code_interpreter_call") | {status, container_id, code, outputs}'10CID=$(echo "$R" | jq -r '.output[] | select(.type=="code_interpreter_call") | .container_id')11oai GET "/v1/containers/$CID" | jq -c '{id, status, memory_limit, expires_after, name}'; log_request openai GET /v1/containers/{id} "${OAI_STATUS:-200}" 0 "code_interpreter.sh retrieve"12oai GET "/v1/containers/$CID/files" | jq -c '{object, n: (.data|length)}'; log_request openai GET /v1/containers/{id}/files "${OAI_STATUS:-200}" 0 "code_interpreter.sh files"13oai DELETE "/v1/containers/$CID" | jq -c .; log_request openai DELETE /v1/containers/{id} "${OAI_STATUS:-200}" 0 "code_interpreter.sh delete"14