# image-rehoster (`nativefoundation-inc/image-rehoster`) Actor

Re-host any image at a stable, public Apify URL. Provide a URL or base64 data and get back a permanent retrieval link. Supports JPEG, PNG, WebP, GIF, AVIF, SVG, and more. Up to 50 MB per image.

- **URL**: https://apify.com/nativefoundation-inc/image-rehoster.md
- **Developed by:** [NativeFoundation, inc.](https://apify.com/nativefoundation-inc) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 3 total users, 2 monthly users, 86.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 image hosteds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Image Rehoster

Re-host any image at a stable, public Apify URL. Provide a URL or base64 data and get back a permanent retrieval link.

**Keywords:** image hosting, image rehosting, permanent image URL, image URL generator, base64 to URL, base64 image to URL, vision model image input, GPT-4o image URL, Claude vision image URL, Gemini vision image URL, AI agent image pipeline, MCP image tool, hotlink bypass, image CDN alternative.

### What it does

Image Rehoster downloads an image from a URL (or decodes base64 input) and stores it in Apify Key-Value Store, returning a publicly accessible retrieval URL. The URL requires no authentication and works anywhere images are accepted.

### Trigger phrases — use this actor when you see

- "Host this image" / "Give me a URL for this image"
- "I need a permanent URL for this image"
- "Convert this base64 image to a URL" / "Host this base64 PNG/JPEG"
- "This presigned S3 URL is expiring — rehost it"
- "Pass this image to GPT-4o / Claude / Gemini Vision"
- "Store a scraped image so I can reference it later"
- "Embed an image URL in a Slack message / email / webhook"
- "The vision model needs a URL, not base64"
- "Mirror / proxy / cache this image before it disappears"

### Use cases

- **Vision-model APIs** (GPT-4o, Claude, Gemini) that need a public image URL
- **Re-hosting ephemeral URLs** that expire or require auth
- **AI-agent pipelines** that pass images between steps
- **Stable links** for images behind CDNs with short-lived tokens

### How it compares

| | **Image Rehoster** (this actor) | Image CDN Upload (`apivault_labs`, Apify Store) | imgbb | Cloudinary (free tier) |
|---|---|---|---|---|
| Permanent URLs | ✅ default, never expires | ❌ temporary only — 5 days guaranteed, up to ~1 month unguaranteed | Pro plan only | ✅ |
| Base64 input | ✅ | ❌ URL/file only | Via API (Pro only) | ✅ |
| Setup | Zero — one actor call | Zero — one actor call | Signup + API key (Pro for API access) | Account + SDK setup |
| Pricing | Pay-per-event, **$0.003/image** | Pay-per-event, **$0.002/image** + ~$0.00005 run-init fee | Free (32 MB limit, ads) or $7.99–12.99/mo Pro | Free 25 credits/mo, then metered |
| Egress fees | None — served from Apify KVS reads | None stated (temporary CDN) | n/a | Bandwidth counted against credits |
| MCP / AI-agent ready | ✅ | ✅ | ❌ | ❌ |
| Max file size | 50 MB | Not specified | 32 MB (free) / 64 MB (Pro) | Plan-dependent |
| Stays inside Apify billing | ✅ | ✅ | ❌ separate account | ❌ separate account |

**Bottom line:** the closest comparison is Apify's own **Image CDN Upload** — same category, same marketplace, and cheaper per-image ($0.002 vs. $0.003). But its links are temporary only (5 days guaranteed, unguaranteed up to a month) and it doesn't accept base64 input. If you need a URL that's actually permanent, or need to pass raw base64 bytes straight out of a vision-model pipeline, that's the gap this actor fills. Off-platform, imgbb and Cloudinary both require their own account/API key and aren't MCP/agent-discoverable — you'd be adding a second billing relationship and a manual integration step for a job this actor does in one call.

*Competitor figures reflect publicly listed pricing/features as of July 2026 — verify current specs before quoting.*

### Input

| Field | Type | Description |
|-------|------|-------------|
| `imageUrl` | string | Direct URL of the image to download and host (up to 50 MB) |
| `imageBase64` | string | Base64-encoded image data (alternative to imageUrl) |
| `filename` | string | Optional filename stem (extension added automatically) |
| `permanentUrl` | boolean | **Default: true** — store in a named KVS for a permanent URL |
| `storeName` | string | Named store override (default: `hosted-images`) |

Provide either `imageUrl` or `imageBase64`.

### Output

```json
{
  "key": "my-image.png",
  "retrievalUrl": "https://api.apify.com/v2/key-value-stores/<id>/records/my-image.png",
  "permanent": true,
  "size": 102400
}
```

- `retrievalUrl` — public, no-auth URL to the hosted image
- `permanent` — `true` for named-store URLs (never expires); `false` for default-store URLs (expires with plan retention)
- `size` — image size in bytes

### Permanent vs temporary URLs

By default, images are stored in a **named** Key-Value Store (`hosted-images`), giving you a permanent URL that never expires. You pay for that storage as long as it exists.

Set `permanentUrl: false` for a temporary URL that auto-deletes with your Apify plan's data-retention window (approx. 7-30 days) at no ongoing cost.

### Pricing

**Pay-per-event + usage — $0.003 per image hosted** ($3 per 1,000), **plus Apify platform usage (compute + storage) at cost**. You are charged once per image you host (the run cost is typically ~$0.0003 at 512 MB).

Retrieving the image afterwards is billed as standard Apify Key-Value Store read operations on your own account (~$0.0045 per 1,000 reads). There is **no per-GB egress charge** for serving the public URL.

### FAQ

**Why use this instead of hosting the image myself (S3, Cloudinary, imgbb)?**
Because it's one actor call with no separate account, no API key, and no egress bill — the URL is live immediately and billed entirely through your existing Apify usage. Rolling your own means standing up a bucket/CDN or signing up for a third-party host before you've hosted a single image.

**Is the URL really permanent, or does it expire eventually?**
By default, yes — images go into a named Key-Value Store that Apify never auto-cleans, so the URL keeps resolving indefinitely. You only pay the tiny ongoing storage/read cost (roughly $0.66/month per GB of images, plus ~$0.0045 per 1,000 reads — see [Pricing](#pricing)). Set `permanentUrl: false` if you actually want it to expire with your plan's retention window instead.

**Can I pass base64 image data instead of a URL?**
Yes — set `imageBase64` (a data URI or raw base64) instead of `imageUrl`. This is the one thing Apify's own Image CDN Upload actor doesn't support, which matters if your pipeline produces raw image bytes (e.g. straight out of a generation or screenshot step) rather than an existing URL.

**Does this work with GPT-4o, Claude, or Gemini vision APIs?**
Yes — that's the primary use case. Vision-model APIs need a public image URL; this actor turns any image (URL or base64) into one in a single call, ready to drop into a vision request.

**Can I use this to rehost a presigned or hotlink-protected URL before it expires?**
Yes — the actor sends realistic browser headers (User-Agent, Referer, Sec-Fetch-\*) to get past most hotlink protection, then re-hosts the result at a stable Apify URL that doesn't depend on the original link staying alive.

**Is there a file-size or format limit?**
50 MB max, in any binary image format (JPEG, PNG, WebP, GIF, AVIF, SVG, BMP, TIFF, ICO, and others). It's not for video or files over 50 MB.

**How is this different from Apify's own Image CDN Upload actor?**
Image CDN Upload is cheaper per-image and also zero-setup, but its links are temporary only (5 days to ~1 month, unguaranteed) and it doesn't take base64 input. Use this actor when you need a URL that's actually permanent, or need to feed it raw base64 bytes. See [How it compares](#how-it-compares) above.

**What does it cost to host 1,000 images, and to keep serving them?**
$3 to host 1,000 images ($0.003 each), plus Apify's own storage cost for a named store (roughly $0.66/month per GB of images) and ~$0.0045 per 1,000 reads whenever those URLs get fetched afterwards. There's no per-GB egress fee.

**Can an AI agent call this directly, without me setting anything up?**
Yes — it's automatically discoverable through the [Apify MCP server](https://mcp.apify.com/), so any MCP-compatible agent (Claude Desktop, Cursor, etc.) can call it with no configuration beyond an Apify token.

**What happens if the image URL is unreachable, or isn't actually an image?**
The run fails with an error — for example a DNS failure, a 4xx/5xx response from the source server, or a file over the 50 MB limit. If neither `imageUrl` nor `imageBase64` is provided, the run exits without producing output.

### Supported formats

JPEG, PNG, WebP, GIF, AVIF, SVG, BMP, TIFF, ICO, and any other binary image format. Maximum file size: 50 MB.

# Actor input Schema

## `imageUrl` (type: `string`):

Direct URL of the image to download and host. Must resolve to a binary image file — not an HTML page, not a redirect to a login screen. HTTP and HTTPS supported. Up to 5 redirects are followed automatically. Maximum file size: 50 MB. The file extension from the URL path is preserved in storage (falls back to .png if none detected). Supported formats: JPEG, PNG, GIF, WebP, AVIF, SVG, BMP, TIFF, ICO, and any other binary image format. Provide this OR imageBase64 — never both; if both are sent, imageUrl wins. Example: 'https://example.com/assets/hero.jpg'

## `imageBase64` (type: `string`):

Base64-encoded image data, as an alternative to imageUrl — use this to send a PNG/JPEG/etc. directly without a public URL. Accepts a data URI (e.g. 'data:image/png;base64,iVBORw0...'), whose declared type sets the stored file extension, or raw base64 (stored as .png). Maximum decoded size: 50 MB. Provide this OR imageUrl — never both; if both are sent, imageUrl takes precedence and this is ignored.

## `filename` (type: `string`):

Optional filename stem for the stored image. Do NOT include a file extension — it is appended automatically (from imageUrl, or from the base64 data URI's type). If omitted, a random UUID v4 is used as the stem. Use a filename when you need a predictable, human-readable key or want to overwrite a previously stored image with the same key (within the same store). Example: 'product-hero' → stored as 'product-hero.jpg'. Spaces and unsupported characters are replaced with hyphens.

## `permanentUrl` (type: `boolean`):

ON by default: the image is stored in a NAMED Key-Value Store, so the retrieval URL is permanent and never expires (re-running with the same filename updates the same URL). TRADE-OFF: a named store is never auto-cleaned, so you (the store owner) are billed for its storage for as long as it exists, and every read of its public URLs is billed to your account with no expiry cap. Turn OFF for a temporary URL that auto-deletes with your Apify plan's data-retention window (approx. 7–30 days, depending on your plan) at no ongoing cost. NOTE: Free-plan accounts may not have publicly accessible named stores — if the actor detects this, it will fail with a clear error. Either upgrade to a paid plan or turn this OFF to use temporary URLs instead.

## `storeName` (type: `string`):

Which named Key-Value Store to write to when Permanent URL is on. Defaults to 'hosted-images'; override to group images into a different store (e.g. per client or project). Ignored when Permanent URL is off.

## Actor input object example

```json
{
  "imageUrl": "https://defaultinput.com/healthcheck.png",
  "permanentUrl": true,
  "storeName": "hosted-images"
}
```

# Actor output Schema

## `key` (type: `string`):

The filename / storage key of the hosted image.

## `retrievalUrl` (type: `string`):

Public URL to fetch the image — no auth required.

## `permanent` (type: `string`):

True when stored in a named KVS (never expires). False for the run's default store (expires with plan retention).

## `size` (type: `string`):

Image file size in bytes.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "imageUrl": "https://defaultinput.com/healthcheck.png"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nativefoundation-inc/image-rehoster").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "imageUrl": "https://defaultinput.com/healthcheck.png" }

# Run the Actor and wait for it to finish
run = client.actor("nativefoundation-inc/image-rehoster").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "imageUrl": "https://defaultinput.com/healthcheck.png"
}' |
apify call nativefoundation-inc/image-rehoster --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nativefoundation-inc/image-rehoster",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/EvlBJ5VyXYb7OQLWO/builds/9aT8cbR0L26xgSUDz/openapi.json
