DEV Community

Alex Spinov
Alex Spinov

Posted on

Qdrant Has a Free API — Heres How to Build Vector Search for AI Applications

Qdrant is a vector similarity search engine — purpose-built for AI applications like semantic search, RAG, recommendations, and anomaly detection.

Why Qdrant?

  • Purpose-built: Optimized for vector similarity search
  • Rust-powered: Fast and memory-efficient
  • Filtering: Combine vector search with metadata filters
  • Multi-tenancy: Isolated namespaces per tenant
  • Quantization: Reduce memory usage by 4-32x
  • Self-hosted or cloud: Both options available
  • Free tier: 1GB RAM free on Qdrant Cloud

Docker Setup

docker run -p 6333:6333 -p 6334:6334 \
  -v qdrant-data:/qdrant/storage \
  qdrant/qdrant
Enter fullscreen mode Exit fullscreen mode

Create Collection

curl -X PUT http://localhost:6333/collections/articles \
  -H 'Content-Type: application/json' \
  -d '{
    "vectors": {
      "size": 1536,
      "distance": "Cosine"
    }
  }'
Enter fullscreen mode Exit fullscreen mode

Upsert Points

curl -X PUT http://localhost:6333/collections/articles/points \
  -H 'Content-Type: application/json' \
  -d '{
    "points": [
      {
        "id": 1,
        "vector": [0.05, 0.61, 0.76, ...],
        "payload": {
          "title": "Introduction to RAG",
          "category": "AI",
          "author": "Alice",
          "date": "2026-03-15"
        }
      },
      {
        "id": 2,
        "vector": [0.19, 0.81, 0.23, ...],
        "payload": {
          "title": "Building Search Engines",
          "category": "Backend",
          "author": "Bob"
        }
      }
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

Search

curl -X POST http://localhost:6333/collections/articles/points/search \
  -H 'Content-Type: application/json' \
  -d '{
    "vector": [0.2, 0.1, 0.9, ...],
    "limit": 5,
    "with_payload": true
  }'
Enter fullscreen mode Exit fullscreen mode

Filtered Search

curl -X POST http://localhost:6333/collections/articles/points/search \
  -H 'Content-Type: application/json' \
  -d '{
    "vector": [0.2, 0.1, 0.9, ...],
    "limit": 5,
    "filter": {
      "must": [
        {"key": "category", "match": {"value": "AI"}},
        {"key": "date", "range": {"gte": "2026-01-01"}}
      ]
    }
  }'
Enter fullscreen mode Exit fullscreen mode

Python SDK

from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams, PointStruct

client = QdrantClient(host='localhost', port=6333)

# Create collection
client.create_collection(
    collection_name='articles',
    vectors_config=VectorParams(size=1536, distance=Distance.COSINE)
)

# Upsert
client.upsert(
    collection_name='articles',
    points=[
        PointStruct(id=1, vector=embedding, payload={'title': 'My Article'})
    ]
)

# Search
results = client.search(
    collection_name='articles',
    query_vector=query_embedding,
    limit=5
)
Enter fullscreen mode Exit fullscreen mode

RAG Pipeline Example

import openai
from qdrant_client import QdrantClient

client = QdrantClient(host='localhost', port=6333)

def rag_query(question: str):
    # 1. Embed the question
    embedding = openai.embeddings.create(input=question, model='text-embedding-3-small').data[0].embedding

    # 2. Search Qdrant
    results = client.search(collection_name='docs', query_vector=embedding, limit=3)
    context = '\n'.join([r.payload['text'] for r in results])

    # 3. Generate answer
    response = openai.chat.completions.create(
        model='gpt-4',
        messages=[{'role': 'user', 'content': f'Context: {context}\n\nQuestion: {question}'}]
    )
    return response.choices[0].message.content
Enter fullscreen mode Exit fullscreen mode

Real-World Use Case

An e-commerce site added Qdrant for product recommendations. Instead of collaborative filtering, they embedded product descriptions and searched by similarity. Recommendation click-through rate improved 34% because the results actually matched what users were looking for.


Need to automate data collection? Check out my Apify actors for ready-made scrapers, or email spinov001@gmail.com for custom solutions.

Top comments (0)