Cloud Parts

Vectorize

Cloudflare’s serverless vector database for Workers, which stores embeddings in R2-backed indexes and bills only for vector dimensions stored and queried.

Type
Commercial product
License
Proprietary
Facts checked
12 October 2026

What it is

You create an index with a fixed number of dimensions (up to 1,536, as 32-bit floats) and a fixed distance metric (cosine, euclidean or dot-product), neither of which can change later. Workers insert and query through a binding; embeddings can come from Workers AI, for example @cf/baai/bge-base-en-v1.5 with 768 dimensions, or from any other model. An index holds up to 20 million vectors. Under the hood the index files live in R2 and are read through Cloudflare’s cache; Vectorize clusters vectors with an inverted file index (IVF) and compresses them with product quantization, so a query scans only the clusters nearest to it.

Each vector can carry up to 10 KiB of JSON metadata and belong to one namespace. To filter on a metadata field you first create a metadata index for it (up to 10 per index, on string, number or boolean fields). The filter is applied before the top-K search, and supports $eq, $ne, $in, $nin and ranges, which also gives prefix matching on strings. Writes go through a write-ahead log and are applied asynchronously, so new vectors show up in queries after a short delay. Pricing counts dimensions: the paid plan includes 50 million queried and 10 million stored dimensions a month, then $0.01 per million queried and $0.05 per 100 million stored, with no charge for idle indexes.

Why teams pick it

  • No servers, CPU or “active index hours” to pay for, and Cloudflare’s own example of 50,000 768-dimension vectors queried 200,000 times a month comes to $1.94
  • A Workers binding next to Workers AI, so embedding, storing and searching fit in one Worker
  • Metadata filtering is applied before the nearest-neighbor search, with namespaces for cheap per-tenant isolation
  • Up to 20 million vectors per index and 50,000 indexes per account on the paid plan

Watch out for

  • At most 1,536 dimensions, and dimensions and metric are fixed at creation, so changing embedding models means a new index
  • Eventually consistent: writes are applied asynchronously, so a vector may not appear in queries right after an upsert
  • Filtering needs a metadata index created before the vectors are inserted, only the first 64 bytes of a string are indexed, and range filters over about 10 million vectors may lose accuracy
  • Returns at most 50 results with values or metadata (100 without)

Alternatives

What all vector databases have in common →

How it fits with other technologies

Embed a question with Workers AI and search only one platform’s items · ts

// npx wrangler vectorize create catalog --dimensions=768 --metric=cosine
// npx wrangler vectorize create-metadata-index catalog --property-name=streaming_platform --type=string
export default {
  async fetch(request, env): Promise<Response> {
    const question = new URL(request.url).searchParams.get("q") ?? "";

    // bge-base-en-v1.5 returns 768-dimension vectors, matching the index
    const { data } = await env.AI.run("@cf/baai/bge-base-en-v1.5", { text: [question] });

    const { matches } = await env.VECTORIZE.query(data[0], {
      topK: 5,
      filter: { streaming_platform: { $in: ["netflix", "hbo"] } },
      returnMetadata: "all",
    });
    return Response.json(matches.map(m => ({ id: m.id, score: m.score, url: m.metadata?.url })));
  },
} satisfies ExportedHandler<{ AI: Ai; VECTORIZE: Vectorize }>;

See it in a real stack

No architecture uses Vectorize yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2023–2024

Language models only know what they were trained on. To answer questions about your own documents, an app embeds them as vectors and, for each query, finds the nearest ones to pass to the model as context. Cloudflare’s launch post described doing that without a vector database, by sending its whole 2.1 GB docs dataset along with every query, as impractical.

Vectorize launched in open beta on 27 September 2023, alongside Workers AI and AI Gateway, so that the whole retrieval loop could run in Workers. The first version was limited to 200,000 vectors per index and 20 results per query.

For general availability on 26 September 2024 Cloudflare rebuilt it: indexes of up to 5 million vectors, median query latency down from 500 ms to 30 ms, up to 100 results, and query prices cut by 75% and storage by 98%. A follow-up post in October 2024 described the new design on R2, Cloudflare’s cache, Durable Objects and its container platform. The vector limit per index has since grown to 20 million.

Why it’s built this way

Index files in R2, read through the cache
Storing indexes as objects lets any Cloudflare data center serve queries without dedicated database servers, and reading through the cache keeps hot index files close to the compute.
IVF clustering with product quantization
To search multi-million-vector indexes within the CPU, memory and I/O of shared servers, Vectorize prunes the search to the nearest clusters and compresses vectors, then refines the best candidates.
A write-ahead log in a Durable Object
A single coordinator applies writes in strict order and commits each new index version atomically, while heavier executors rewrite the index files, so queries always read a consistent snapshot.

Timeline

  1. 2023

    Open beta on 27 September, with Workers AI and AI Gateway

  2. 2024

    Rebuilt and generally available on 26 September: 5 million vectors per index, 30 ms median queries

  3. 2024

    Cloudflare publishes the new design on R2, Durable Objects and containers on 22 October

  4. 2024

    Legacy V1 indexes can no longer be created after December

Sources6 · facts checked 12 October 2026

Improve this page on GitHub