fs_write_file
Write a file into your project by downloading it from an allowlisted OpenAI host using a file reference and lease ID. Moves uploaded or ImageGen-generated files from ChatGPT storage into your workspace.
Instructions
Write a binary file from a ChatGPT host file reference (openai/fileParams: download_url + file_id). Requires lease_id. Preferred way to move an uploaded or ImageGen-generated file into a project — pass the file itself, never Base64 of it. Downloads over HTTPS from an allowlisted OpenAI host only, including the code-interpreter sandbox storage that backs /mnt/data (no redirects; size capped at 2_000_000 bytes during stream). Same SHA/create/write gates as fs_write_binary. Portable clients should use fs_write_binary (Base64) instead. path is authoritative — file_name/mime_type are metadata only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ChatGPT openai/fileParams object (adaptation). Strings only — no nulls in schema. | |
| path | Yes | ||
| create | No | ||
| project | No | demo | |
| lease_id | Yes | ||
| expected_sha256 | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||