Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Vercel’s native Image Optimization API transforms images on demand at runtime. You control it through the project’s images configuration: permitted widths, quality values, local and remote source patterns, cache lifetime, output formats, SVG handling, and response headers. The practical workflow is to configure those allowlists, request images with next/image or the optimization endpoint, then monitor failures and transformation usage.

This guide explains the request contract, a safe configuration, common INVALID_IMAGE_OPTIMIZE_REQUEST failures, cost controls, and source-image cache invalidation.

What the Vercel Image API does

Vercel describes the images property as defining the behavior of its native Image Optimization API, which “allows on-demand optimization of images at runtime.” The service fetches an approved source, produces the requested dimensions and format, and caches the transformed result.

In a Next.js application, the normal entry point is next/image. The component generates requests for device-appropriate sizes and modern formats; exact defaults depend on the Next.js version installed in your project, so check that version’s documentation before relying on an implicit value. Vercel’s overview is available in Images on the web.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure the image request space

Configuration is an allowlist, not merely a set of preferences. A request using a width or quality that is not permitted can fail, and a remote URL that does not match a configured pattern is rejected before optimization.

Core options

Option What it controls Operational effect
deviceSizes and imageSizes Allowed output widths Only configured widths are valid for optimization requests; fewer widths reduce variants and cache entries.
remotePatterns and local patterns Which source URLs may be fetched Tight patterns prevent accidental or hostile origins; every requested remote URL must match.
qualities Allowed quality values Quality must be an integer from 1 through 100 and, when configured, must appear in this list.
formats Output formats such as WebP or AVIF Multiple formats can improve browser delivery but create more transformation variants.
minimumCacheTTL Minimum cache lifetime Longer retention reduces repeat work but delays source changes.
dangerouslyAllowSVG Whether SVG input is accepted SVG is disabled by default; enable it only with an appropriate security policy.
contentSecurityPolicy and contentDispositionType Response security and disposition behavior Use these to control how optimized responses are handled by browsers.

The complete configuration reference is Vercel’s programmatic configuration documentation.

Example configuration

The following illustrates the shape of a restrictive configuration. Adjust domains, widths, formats, and qualities to your application rather than copying the values blindly.

import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  images: {
    deviceSizes: [640, 1080, 1920],
    imageSizes: [32, 64, 128, 256],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'images.example.com',
        pathname: '/assets/**',
      },
    ],
    formats: ['image/avif', 'image/webp'],
    qualities: [60, 75, 85],
    minimumCacheTTL: 2678400,
    dangerouslyAllowSVG: false,
  },
}

export default nextConfig

A 31-day value such as 2678400 is the example Vercel gives for images that are not expected to change within a month. Set a shorter value when source edits must appear quickly, or use source-level invalidation where available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Request images correctly

Using next/image

import Image from 'next/image'

export default function ProductPhoto() {
  return (
    <Image
      src="https://images.example.com/assets/product.jpg"
      alt="Product front view"
      width={1200}
      height={800}
      sizes="(max-width: 768px) 100vw, 50vw"
      quality={75}
    />
  )
}

The source must return an image/ content type. The requested width generated by the component must be one of the configured sizes, and the quality must satisfy the configured allowlist.

Calling the optimization endpoint directly

For debugging, inspect the generated URL’s url, w, and q query parameters. A valid request has an approved source URL, an allowed integer width, and an allowed quality from 1 to 100.

Why optimization requests fail

Vercel’s error reference calls the failure INVALID_IMAGE_OPTIMIZE_REQUEST. Check these conditions in order.

1. Width is not configured

The w parameter must be an integer present in the project’s device or image size lists. If a browser or component requests a width you removed, add that width deliberately or change the component’s sizing behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Quality is invalid

q must be an integer from 1 through 100. If qualities is configured, the value must also be listed there. A request for q=80 fails when the allowlist contains only 60, 75, and 85.

3. The source URL is not allowed

Remote sources must match every relevant part of a remotePatterns rule: protocol, hostname, port when specified, pathname, and search constraints. Local sources must also use an accepted local form. Prefer narrow patterns instead of allowing an entire internet domain.

4. The origin did not return an image

The fetched response must have an image/ content type. HTML error pages, JSON responses, redirects to login screens, and misconfigured object storage commonly trigger this problem.

5. The source response is too large

Vercel documents a maximum response body of 300 MB, reduced to 100 MB on Hobby. Resize or recompress oversized originals at the source, or bypass optimization for assets that do not benefit from transformation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. SVG or security settings conflict

SVG input is disabled by default. If SVG is genuinely required, enable it only after deciding how the response should be served and secured; otherwise deliver trusted SVG files without passing them through the optimizer.

Vercel’s error page, last updated February 9, 2026, lists these request-format checks at INVALID_IMAGE_OPTIMIZE_REQUEST.

Control transformations, cache, and cost

Every additional combination of source, width, quality, and output format can create another transformation and cache entry. The main design trade-offs are:

  • More widths versus fewer variants: many breakpoints can reduce delivered pixels but increase transformations.
  • More formats versus processing: AVIF and WebP can reduce file size, while multiple configured formats add variants.
  • Longer TTL versus freshness: a long cache lowers repeat work but keeps old source content longer.
  • Broad sources versus control: flexible patterns simplify integrations but permit more origins and potential variants.

Vercel’s cost-management guidance recommends reviewing cache age, output formats, source patterns, quality allowlists, and image-size allowlists. It also recommends using the unoptimized option selectively for assets that gain little from transformation, including small images, SVGs, and animated GIFs. Read Managing Usage & Costs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Dated pricing context

Vercel’s February 18, 2025 announcement described an opt-in transformation-based model starting at $0.05 per 1,000 image transformations, $0.40 per million cache read units, and $4.00 per million cache write units. Those are announcement starting rates, not a current quote for every account. The announcement said existing customers and new projects for existing customers had no automatic changes at that time, while new customers started on the new model; eligible Pro and self-serve Enterprise customers could opt in. Check your dashboard and current plan terms before forecasting spend. The announcement is Faster transformations and reduced pricing for Image Optimization.

For broader usage controls, see Vercel’s usage-management documentation. Do not treat the dated figures as a universal rate card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Invalidate a transformed image when the source changes

On November 20, 2025, Vercel announced source-image invalidation for transformed images on plans using the new image-optimization price. Interfaces include the dashboard, CLI, Function API, and REST API. Invalidation marks derived images stale; stale content can be served while revalidation runs in the background.

That behavior differs from deleting the cache. Deletion can increase latency while the image regenerates and can create an outage if the origin is unavailable. Prefer invalidation when you need freshness without deliberately removing a usable cached response. Details are in Vercel’s cache-invalidation announcement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Performance and reliability checklist

  • Use a finite, evidence-based set of widths rather than every possible pixel value.
  • Keep quality values intentional and consistent across components.
  • Allow only the image hosts and paths your application needs.
  • Ensure object storage sends the correct Content-Type.
  • Keep originals below the plan-specific response limit.
  • Choose a cache TTL that matches how often sources change.
  • Use unoptimized for assets such as tiny icons, SVGs, or animated GIFs when transformation adds no value.
  • Inspect cache and transformation usage after deploying a new format or breakpoint.

Or skip the browser setup

If your actual task is taking a clean screenshot of a page rather than optimizing an image asset for delivery, ScreenshotNeo is a direct alternative. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; and its MCP server lets Claude, Cursor, or another MCP client call screenshot tools.

One request returns a PNG, JPEG, WebP, or PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://vercel.com -o shot.webp

See the ScreenshotNeo API documentation for options and response headers. The free plan includes 1,000 screenshots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Can I use any URL as an image source?

No. The URL must use an accepted local or remote form and match your configured source patterns.

Does a longer cache TTL permanently prevent updates?

No. It controls normal cache retention. Where supported by your plan, source-image invalidation marks derived images stale and revalidates them in the background.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Are Vercel’s 2025 rates guaranteed for my project?

No. They were dated starting rates from a February 18, 2025 announcement. Your account’s plan and current terms determine actual pricing.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.