Upstash

Configure @vitehub/vector against the Upstash Vector HTTP API.

Use the Upstash provider when you want a hosted vector API and do not want to manage your own vector database.

Before you start

Install @vitehub/vector and @upstash/vector:

Terminal
pnpm add https://pkg.pr.new/vite-hub/vitehub/@vitehub/vector@main @upstash/vector

Set the Upstash REST URL and token in your runtime environment or pass them in top-level vector config.

Configure Upstash

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@vitehub/vector/nuxt'],
  vector: {
    provider: 'upstash',
    url: process.env.UPSTASH_VECTOR_REST_URL,
    token: process.env.UPSTASH_VECTOR_REST_TOKEN,
    namespace: 'docs',
  },
})

Define a vector

server/vectors/docs.ts
export default defineVector({
  dimensions: 1536,
  filterable: ['tenantId'],
  providers: {
    upstash: {
      namespace: 'search',
    },
  },
})

Use namespace or indexName when you want a prefix before the discovered vector name.

Query the vector

const docs = getVector('docs')

const matches = await docs.query({
  vector: [0.1, 0.2, 0.3],
  topK: 5,
  filter: {
    tenantId: 'acme',
  },
})

Upstash-specific options

OptionUse it for
urlPoint ViteHub at the Upstash Vector REST endpoint.
tokenAuthenticate requests to the Upstash Vector API.
namespacePrefix the discovered vector name globally.
providers.upstash.namespacePrefix the discovered vector name for one vector definition only.

What changes on Upstash

ConcernBehavior
URL and tokenViteHub reads them from top-level config or environment variables.
Namespace namingViteHub prefixes the discovered vector name with namespace or indexName when you set one.
Runtime APIThe public ViteHub vector API stays the same as the other providers.
Native handlegetVector(name).native gives you the raw Upstash index handle.
Choose Upstash when you want a hosted vector service with the same ViteHub runtime API used by the other providers.