Vector
A vector index for embeddings, in one command.
AI/LLM: this page is available in plain markdown at /docs/resources/vector.md
npx extraorbital add vector --dimensions 1536✓ Provisioned vector/default (1536 dimensions, COSINE)
✓ Wrote 2 variables to .env
UPSTASH_VECTOR_REST_URL, UPSTASH_VECTOR_REST_TOKENA project that mentions either UPSTASH_VECTOR_REST_* variable gets this from
extraorbital provision at the default 1536
dimensions. Name it explicitly when your embedding model needs a different size.
What it writes
| Variable | Example |
|---|---|
UPSTASH_VECTOR_REST_URL | https://vector.extraorbital.dev/cosmic-otter-default |
UPSTASH_VECTOR_REST_TOKEN | ABkFMHZlY3Rvci… |
Options
npx extraorbital add vector [--slug <name>] [--dimensions <n>] \
[--similarity-function <fn>] [--embedding-model <model>] [--region <region>]| Flag | Default | Description |
|---|---|---|
--slug | default | A second, fully separate index in the same project |
--dimensions | 1536 | Vector dimensions, 1–4096. Match your embedding model |
--similarity-function | COSINE | One of COSINE, EUCLIDEAN, DOT_PRODUCT |
--embedding-model | — | Let the index embed raw text for you |
--region | us-east-1 | One of us-east-1, eu-central-1, ap-southeast-1 |
Dimensions and the similarity function are fixed at creation. To change them, provision a new slug and re-index:
npx extraorbital add vector --slug small --dimensions 384Prototype allowance
10K queries plus 10K updates per day and 1 GB of data free on the Prototype plan, counted across your whole account and shared by up to five indexes. Past it, $0.40/100K requests and $0.25/GB-mo — our own cost, with nothing added — on a paid plan.
Use it
import { Index } from "@upstash/vector";
const index = Index.fromEnv(); // reads UPSTASH_VECTOR_REST_URL and _TOKEN
await index.upsert({
id: "doc-42",
vector: embedding, // number[1536]
metadata: { title: "Q3 report" },
});
const hits = await index.query({ vector: queryEmbedding, topK: 5, includeMetadata: true });Next
- AI Gateway — a key to generate the embeddings with
- Pricing — plans, allowances and rates