Getting Started with REM
Store, search, and manage vector embeddings at scale with the REM decentralized network.
1. Install the SDK
pip install rem-sdk2. Initialize the Client
from rem_sdk import REMClient
client = REMClient(api_key="rem_your_api_key_here")3. Create a Collection
client.create_collection(
name="my-collection",
dimension=1536, # Match your embedding model
metric="cosine" # cosine | euclidean | dot_product
)4. Upsert Vectors
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
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
client = REMClient(api_key="rem_xxx")Using the REST API
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
client.create_collection(
name="products",
dimension=384,
metric="cosine", # "cosine" | "euclidean" | "dot_product"
)Supported Dimensions
| Dimension | Common Models |
|---|---|
| 384 | all-MiniLM-L6-v2, BGE-small |
| 768 | all-mpnet-base-v2, BGE-base, E5-base |
| 1024 | Cohere embed-v3, BGE-large |
| 1536 | OpenAI text-embedding-3-small, text-embedding-ada-002 |
| 3072 | OpenAI text-embedding-3-large |
Any integer dimension from 1 to 4096 is supported. The table above shows common embedding model dimensions.
Distance Metrics
| Metric | Best For | Range |
|---|---|---|
| cosine | Text similarity, semantic search, RAG | 0 to 1 (higher = more similar) |
| euclidean | Spatial data, image features | 0 to ∞ (lower = more similar) |
| dot_product | Pre-normalized vectors, recommendations | -∞ to ∞ (higher = more similar) |
List Collections
collections = client.list_collections()
for col in collections["collections"]:
print(f"{col['name']} — {col['dimension']}d, {col['metric']}")Delete a Collection
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.
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
vectors = client.fetch("products", ids=["prod-001", "prod-002"])Delete Vectors
# 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
results = client.query(
"products",
vector=[0.12, -0.34, 0.56, ...],
top_k=10
)Query with Metadata Filter
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
| Operator | Description | Example |
|---|---|---|
| $eq | Equal to (default) | {"field": "value"} |
| $ne | Not equal to | {"field": {"$ne": "x"}} |
| $gt | Greater than | {"price": {"$gt": 100}} |
| $gte | Greater than or equal | {"price": {"$gte": 100}} |
| $lt | Less than | {"price": {"$lt": 50}} |
| $lte | Less than or equal | {"price": {"$lte": 50}} |
| $in | In array | {"cat": {"$in": ["a","b"]}} |
Response Format
{
"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
pip install rem-sdkREMClient
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 collectionlist_collections(cursor?, limit?)List all collections (paginated)delete_collection(name)Delete a collection and all its vectorsupsert(collection, vectors)Insert or update vectorsquery(collection, vector, top_k, filter?)Find similar vectorsfetch(collection, ids)Fetch vectors by IDdelete(collection, ids?, filter?)Delete vectors by ID or filterREST API Reference
Base URL: https://api.getrem.online/v1
All requests must include the X-API-Key header.
/collectionsCreate a collection{"name": "products", "dimension": 384, "metric": "cosine"}/collectionsList collections/collections/{name}Delete a collection/collections/{name}/vectors/upsertUpsert vectors{"vectors": [{"id": "v1", "values": [...], "metadata": {...}}]}/collections/{name}/vectors/queryQuery vectors{"vector": [...], "top_k": 10, "filter": {...}}/collections/{name}/vectors/fetchFetch vectors by ID{"ids": ["v1", "v2"]}/collections/{name}/vectors/deleteDelete vectors{"ids": ["v1"]}Rate Limits
| Plan | Requests/min | Max Vectors/Upsert |
|---|---|---|
| Free | 60 | 100 |
| Pro | 600 | 1,000 |
| Business | 6,000 | 10,000 |
Need help? Join our Discord or email support@getrem.online