#!/usr/bin/env bash # computer_use_preview tool + computer-use-preview model with a 1x1 PNG screenshot. STATUS: ACCOUNT_RESTRICTED 2026-09-18 (404 model_not_found with our key). # Run: bash examples/openai/tools/computer-use/computer_use.sh set -eo pipefail # no -u: oai() runs in $(...) subshells, so OAI_STATUS may be unset in the parent source "$(dirname "$0")/../../../../scripts/lib.sh" PNG1="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4//8/AwAFAAIKLC0+hQAAAABJRU5ErkJggg==" R=$(oai POST /v1/responses -d "{\"model\":\"computer-use-preview\",\"truncation\":\"auto\",\"max_output_tokens\":32, \"tools\":[{\"type\":\"computer_use_preview\",\"display_width\":1,\"display_height\":1,\"environment\":\"browser\"}], \"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Do nothing. Reply with OK.\"},{\"type\":\"input_image\",\"image_url\":\"data:image/png;base64,$PNG1\"}]}]}") log_request openai POST /v1/responses "${OAI_STATUS:-200}" 0 "computer_use.sh" echo "$R" | jq -c '.error // [.output[] | {type, call_id, action, pending_safety_checks}]' # our key: error.code == "model_not_found"