Images Videos Audio Pricing Docs View as Markdown (Agent) Get started
Human Agent

Save AI outputs before their links expire

Goal: keep what a model produced at a permanent URL, without downloading it first or knowing whether it is an image, a video or audio. One call to POST /v1/media (or the save_url MCP tool) does it.

Why the links break

Generation APIs hand back a temporary link or raw bytes, and their docs tell you to store the file yourself:

ProviderWhat you getHow long it lasts
ReplicateA replicate.delivery URLDeleted after 1 hour (API predictions)
OpenAI ImagesA url, or b64_jsonURLs are valid for 60 minutes
RunwayAn output URLExpires within 24 to 48 hours
GeminiInline base64, or a Files API URIFiles are deleted after 48 hours
falA fal.media URLKept at least 7 days by default
ElevenLabsAudio bytes in the responseNo URL; keep the bytes yourself

Provider CDNs also tend to serve every file as application/octet-stream, so the link alone does not say what it is.

Send the link as url right after the result arrives. A secret API key is required. PixelVault reads the first bytes, decides the type, and stores the file through the same pipeline as upload_image, upload_video or upload_audio: same validation, plan limits, video posters and webhooks.

Save a link
{ "data": {
  "id": "img_abc123",
  "kind": "image",
  "url": "https://img.pixelvault.dev/proj_xyz789/generations/img_abc123.webp",
  "optimized_url": "https://img.pixelvault.dev/proj_xyz789/generations/img_abc123.webp?fmt=auto&q=85",
  "mime_type": "image/webp",
  "size": 198694,
  "width": 1024,
  "height": 1024,
  "filename": "out-0.webp",
  "folder": "generations",
  "metadata": { "model": "flux-schnell", "prediction": "7f3a" },
  "source_host": "replicate.delivery",
  "created_at": "2026-11-29T12:00:00.000Z"
} }

The response is the asset's own object, so check kind (image, document, video or audio): videos come back with poster_url, audio with duration and codec. source_host records where the file came from; PixelVault keeps the host only, never the URL, because provider links carry credentials in their query strings.

Retries: pass an Idempotency-Key built from the provider's own id (a Replicate prediction id, a fal request id). A repeat returns the file the first call saved, with replayed: true, instead of storing a copy. See Idempotency.

2. Save inline bytes

Some providers return the file itself, not a link: Gemini's inline images, OpenAI's b64_json, ElevenLabs audio. Send it as data, plain base64 or a data: URL, up to 10 MB decoded. For bigger files, upload them with POST /v1/videos or POST /v1/audio instead.

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});
const result = await ai.models.generateContent({
  model: "gemini-2.5-flash-image",
  contents: "a lighthouse at dusk, flat vector",
});
const part = result.candidates[0].content.parts.find((p) => p.inlineData);

// Inline bytes have no URL at all: send them as base64 (up to 10 MB decoded).
const res = await fetch("https://api.pixelvault.dev/v1/media", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PIXELVAULT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ data: part.inlineData.data, filename: "lighthouse.png" }),
});
console.log((await res.json()).data.url);

3. From an agent (MCP)

The hosted MCP server exposes the same call as save_url. Its result adds a ready-to-paste markdown snippet: images embed, and videos show the poster linked to a player page, because GitHub and most Markdown renderers will not play a video hosted elsewhere.

save_url({ "url": "https://replicate.delivery/xezq/abc123/out-0.mp4",
           "idempotency_key": "replicate-7f3a" })

→ { "id": "vid_abc123", "kind": "video",
    "url": "https://img.pixelvault.dev/proj_xyz789/vid_abc123.mp4",
    "poster_url": "https://img.pixelvault.dev/proj_xyz789/vid_abc123.poster.jpg",
    "source_host": "replicate.delivery",
    "markdown": "[![out-0.mp4](<…poster.jpg>)](<https://pixelvault.dev/i/proj_xyz789/vid_abc123.mp4?…>)",
    … }

Formats and limits

  • Images and PDFs: JPEG, PNG, GIF, WebP, AVIF, SVG and PDF, up to 5 MB on Free, 10 MB on Starter and 15 MB on Pro. Unverified accounts can store 5 files before verifying their email.
  • Video: MP4, up to 25 MB on Free, 100 MB on Starter and 250 MB on Pro. A verified email is required, and the source must send Content-Length.
  • Audio: MP3, WAV, M4A and OGG, up to 25 MB on Free, 100 MB on Starter and 250 MB on Pro. A verified email is required.

MOV and WebM links are converted to an MP4 on the way in (up to 60 seconds and 100 MB, using the monthly video-optimization allowance; see normalize on ingest). Anything else returns 415 unsupported_media_type with detected_format naming what it found: heic (convert to JPEG), flac or aac (convert to MP3), avi (convert to MP4). An expired link fails with url_fetch_failed; generate it again.

A URL is requested twice: a short probe that reads the first 4 KB, then the import itself. Both happen within the same call.

Next steps