Skip to content

Vectorize

Vectorize is a vector index binding for Workers. Store embeddings you already computed, filter by metadata, and run similarity queries. open-compute implements the stable post-beta Vectorize API with deterministic exact search on one node.

For example, you can use Vectorize for:

  • Semantic search over document embeddings
  • Recommendation / nearest-neighbor lookups from a Worker
  • Metadata-filtered retrieval before an LLM call
ts
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const { matches } = await env.VECTORIZE.query([0.12, 0.34, /* … */], {
      topK: 5,
      returnMetadata: "indexed",
    });
    return Response.json(matches);
  },
} satisfies ExportedHandler<{ VECTORIZE: Vectorize }>;

Create an index (Wrangler or v4), then bind it:

json
{
  "name": "vector-app",
  "main": "src/index.ts",
  "vectorize": [{ "binding": "VECTORIZE", "index_name": "embeddings" }]
}

Official reference: Cloudflare Vectorize. Binding grammar: bindings.

Compatibility

TopicCloudflareopen-compute
Worker APIStable post-beta Vectorize (describe / query / queryById / insert / upsert / deleteByIds / getByIds)Same methods and response shape
SearchManaged approximate / distributed indexDeterministic exact search on one node
Dimensions / metrics32–1536; cosine, euclidean, dot-productSame public ranges and score/order semantics
MutationsAsynchronous mutationIdDurable async mutations on local authority
Beta VectorizeIndexLegacyOut of scope — not provided
Placement / replicationGlobalSingle-node; Local/S3 as configured by the operator

Next