APIها
Files
Upload an image, a video or an audio file to use as a task input, and how long input and result files are kept.
این صفحه هنوز ترجمه نشده است. نسخه انگلیسی نمایش داده میشود.
Some models take media as input: reference images of the people, objects or styles a result should keep. An input is always passed as a URL. If your file is already reachable at a public https URL, pass that URL. If it is not, upload it to Minu first and pass the URL you get back.
Upload a file
POST /v1/files with a multipart form. The file goes in a field named file.
curl https://api.minu.ai/v1/files \
-H "Authorization: Bearer $MINU_API_KEY" \
-F file=@product.jpgimport fs from 'node:fs';
const form = new FormData();
form.append('file', new Blob([fs.readFileSync('product.jpg')]), 'product.jpg');
const file = await fetch('https://api.minu.ai/v1/files', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.MINU_API_KEY}` },
body: form,
}).then((response) => response.json());
console.log(file.url);import os
import requests
with open("product.jpg", "rb") as handle:
file = requests.post(
"https://api.minu.ai/v1/files",
headers={"Authorization": f"Bearer {os.environ['MINU_API_KEY']}"},
files={"file": handle},
).json()
print(file["url"])Do not set the Content-Type header yourself: your HTTP client adds the multipart boundary.
{
"id": "file_1k8r2m4p0d3f5h7k9m1p3r5t",
"object": "file",
"url": "https://…",
"mime": "image/jpeg",
"bytes": 482113,
"expires_at": 1797379200
}| Field | Description |
|---|---|
id | Identifier of the file, starting with file_. |
url | The URL to pass in a task input. |
mime | Media type, detected from the file's content. |
bytes | Size of the file. |
expires_at | When the file is deleted, in Unix seconds. |
Limits
- One file per request, in the field
file. - 30 MB at most. A larger file is refused with
413 file_too_large. - Images, video and audio only. The type is decided by the content of the file, not by its name or the type your client declares. Anything else is refused with
400 unsupported_media.
Use the file in a task
Put the url where the model expects media. The parameter name depends on the model; the model reference lists each model's parameters.
curl https://api.minu.ai/v1/tasks \
-H "Authorization: Bearer $MINU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-2",
"input": {
"prompt": "Put this product on a marble kitchen counter, morning light",
"image_urls": ["https://…"]
}
}'URLs you supply yourself, for inputs and for callback_url, must be https and publicly reachable. A URL that is not gets 400 url_not_allowed.
How long files are kept
- Uploaded inputs are deleted at
expires_at, which is your organization's retention period after the upload. - Result files of tasks are kept for the same retention period after the task ends.
The retention period is 14 days by default. An owner or an admin can set it between 1 and 30 days in the console, under Settings. A change applies to files stored from then on.
Once a file is deleted, its URL stops working. Copy the results you want to keep into your own storage, ideally as soon as the task ends.