import_media
Import media from a URL
Fetch a file the client cannot upload itself and store it as an account upload. When the user attaches a picture, clip or sound in ChatGPT, pass it as file; otherwise pass url. The result's reference goes into any generate tool. A file with no URL this server can reach (a claude.ai attachment) needs request_upload_link instead.
Only these hosts are fetched: files.oaiusercontent.com.
Scope
generation.write— Makes, edits, imports, shares and deletes media in the account.
Behaviour
- Writes
- Creates or changes items in the caller's own account.
- Adds or updates
- Adds or updates; nothing the caller already has is deleted or overwritten.
- Reaches outside
- Fetches a file from an allow-listed outside host (such as a ChatGPT attachment) into the caller's library.
Inputs
urlstring · optionaluri
fileobject or string · optionalfilenamestring · optionalat least 1 character · at most 220 characters
mime_typestring · optionalat least 1 character · at most 120 characters
Example call
A tools/call request with the required arguments only, each a placeholder read off the schema. Replace them before sending.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "import_media",
"arguments": {}
}
}Input schema
As the server sends it in tools/list.
{
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"file": {
"anyOf": [
{
"type": "object",
"properties": {
"download_url": {
"type": "string",
"format": "uri"
},
"file_id": {
"type": "string",
"maxLength": 200
},
"mime_type": {
"type": "string",
"maxLength": 120
},
"file_name": {
"type": "string",
"maxLength": 220
}
},
"required": [
"download_url",
"file_id"
],
"additionalProperties": false
},
{
"type": "string",
"maxLength": 2000
}
]
},
"filename": {
"type": "string",
"minLength": 1,
"maxLength": 220
},
"mime_type": {
"type": "string",
"minLength": 1,
"maxLength": 120
}
},
"additionalProperties": false
}Related tools
- request_upload_link
Get a link the user taps to send pictures or videos from their own phone or computer straight into the account, with no setup and no sign-in.
- generate_clip
Start a short video clip generation.
- create_upload
Reserve an upload and get a presigned URL to PUT the bytes to.