Getting Started with REM

Store, search, and manage vector embeddings at scale with the REM decentralized network.

1. Install the SDK

bash
pip install rem-sdk

2. Initialize the Client

python
from rem_sdk import REMClient

client = REMClient(api_key="rem_your_api_key_here")

3. Create a Collection

python
client.create_collection(
    name="my-collection",
    dimension=1536,        # Match your embedding model
    metric="cosine"        # cosine | euclidean | dot_product
)

4. Upsert Vectors

python
client.upsert("my-collection", vectors=[
    {"id": "doc-1", "values": [0.1, 0.2, ...], "metadata": {"source": "wiki"}},
    {"id": "doc-2", "values": [0.3, 0.4, ...], "metadata": {"source": "blog"}},
])

5. Query

python
results = client.query(
    "my-collection",
    vector=[0.1, 0.2, ...],
    top_k=10,
    filter={"source": "wiki"}
)

for match in results["matches"]:
    print(f"{match['id']}: {match['score']:.4f}")

Authentication

All API requests require an API key. You can generate keys from the dashboard.

Using the SDK

python
client = REMClient(api_key="rem_xxx")

Using the REST API

bash
curl -X GET https://api.getrem.online/v1/collections \
  -H "X-API-Key: rem_your_api_key_here"

Keep your API keys secure. Never expose them in client-side code or public repositories. Use environment variables in production.

Collections

A collection is a named group of vectors with a fixed dimension and distance metric. Collections are automatically distributed across miners for redundancy.

Create a Collection

python
client.create_collection(
    name="products",
    dimension=384,
    metric="cosine",          # "cosine" | "euclidean" | "dot_product"
)

Supported Dimensions

DimensionCommon Models
384all-MiniLM-L6-v2, BGE-small
768all-mpnet-base-v2, BGE-base, E5-base
1024Cohere embed-v3, BGE-large
1536OpenAI text-embedding-3-small, text-embedding-ada-002
3072OpenAI text-embedding-3-large

Any integer dimension from 1 to 4096 is supported. The table above shows common embedding model dimensions.

Distance Metrics

MetricBest ForRange
cosineText similarity, semantic search, RAG0 to 1 (higher = more similar)
euclideanSpatial data, image features0 to ∞ (lower = more similar)
dot_productPre-normalized vectors, recommendations-∞ to ∞ (higher = more similar)

List Collections

python
collections = client.list_collections()
for col in collections["collections"]:
    print(f"{col['name']} — {col['dimension']}d, {col['metric']}")

Delete a Collection

python
client.delete_collection("products")

Vectors

Vectors are the core data unit. Each vector has an ID, a list of float values, and optional metadata for filtering.

Upsert Vectors

Insert or update vectors. If a vector with the same ID exists, it will be overwritten.

python
client.upsert("products", vectors=[
    {
        "id": "prod-001",
        "values": [0.12, -0.34, 0.56, ...],  # Must match collection dimension
        "metadata": {
            "category": "electronics",
            "price": 299.99,
            "in_stock": True
        }
    },
    {
        "id": "prod-002",
        "values": [0.78, 0.91, -0.23, ...],
        "metadata": {
            "category": "clothing",
            "price": 49.99,
            "in_stock": False
        }
    }
])

Fetch Vectors by ID

python
vectors = client.fetch("products", ids=["prod-001", "prod-002"])

Delete Vectors

python
# Delete specific vectors
client.delete("products", ids=["prod-001"])

# Delete by metadata filter
client.delete("products", filter={"category": "electronics"})

Querying

Find the most similar vectors to a given query vector. Queries are automatically routed to the nearest miner for lowest latency.

Basic Query

python
results = client.query(
    "products",
    vector=[0.12, -0.34, 0.56, ...],
    top_k=10
)

Query with Metadata Filter

python
results = client.query(
    "products",
    vector=[0.12, -0.34, 0.56, ...],
    top_k=5,
    filter={
        "category": "electronics",
        "price": {"$lte": 500},
        "in_stock": True
    }
)

Filter Operators

OperatorDescriptionExample
$eqEqual to (default){"field": "value"}
$neNot equal to{"field": {"$ne": "x"}}
$gtGreater than{"price": {"$gt": 100}}
$gteGreater than or equal{"price": {"$gte": 100}}
$ltLess than{"price": {"$lt": 50}}
$lteLess than or equal{"price": {"$lte": 50}}
$inIn array{"cat": {"$in": ["a","b"]}}

Response Format

json
{
  "matches": [
    {
      "id": "prod-001",
      "score": 0.9542,
      "metadata": {"category": "electronics", "price": 299.99}
    },
    {
      "id": "prod-003",
      "score": 0.8891,
      "metadata": {"category": "electronics", "price": 149.99}
    }
  ]
}

Python SDK Reference

Full reference for the rem-sdk Python package.

Installation

bash
pip install rem-sdk

REMClient

python
from rem_sdk import REMClient

client = REMClient(
    api_key="rem_xxx",                          # Required
    base_url="https://api.getrem.online",       # Optional (default)
    timeout=30,                                  # Request timeout in seconds
)

Methods

create_collection(name, dimension, metric)Create a new vector collection
list_collections(cursor?, limit?)List all collections (paginated)
delete_collection(name)Delete a collection and all its vectors
upsert(collection, vectors)Insert or update vectors
query(collection, vector, top_k, filter?)Find similar vectors
fetch(collection, ids)Fetch vectors by ID
delete(collection, ids?, filter?)Delete vectors by ID or filter

REST API Reference

Base URL: https://api.getrem.online/v1

All requests must include the X-API-Key header.

POST/collectionsCreate a collection
{"name": "products", "dimension": 384, "metric": "cosine"}
GET/collectionsList collections
DELETE/collections/{name}Delete a collection
POST/collections/{name}/vectors/upsertUpsert vectors
{"vectors": [{"id": "v1", "values": [...], "metadata": {...}}]}
POST/collections/{name}/vectors/queryQuery vectors
{"vector": [...], "top_k": 10, "filter": {...}}
POST/collections/{name}/vectors/fetchFetch vectors by ID
{"ids": ["v1", "v2"]}
POST/collections/{name}/vectors/deleteDelete vectors
{"ids": ["v1"]}

Rate Limits

PlanRequests/minMax Vectors/Upsert
Free60100
Pro6001,000
Business6,00010,000

Need help? Join our Discord or email support@getrem.online