Pinecone Guide 2025: Vector Database for AI & RAG Applications
A practical guide to Pinecone for developers building RAG pipelines, semantic search, and AI-powered retrieval — from first index to production query.
What Is Pinecone?
Pinecone is a fully managed vector database. Instead of storing rows and columns, it stores embedding vectors — high-dimensional numerical representations of text, images, or audio generated by machine learning models. You can then search for vectors that are semantically similar to a query vector, even if they don't share exact keywords.
The dominant use case is RAG (Retrieval-Augmented Generation): you embed your documents, store them in Pinecone, and at query time retrieve the most relevant chunks to pass as context to Claude, GPT-4o, or any LLM. This lets the model answer questions about your private data without fine-tuning.
Python SDK Quickstart
# Install
pip install pinecone openai
# Create index, upsert vectors, query
from pinecone import Pinecone, ServerlessSpec
from openai import OpenAI
pc = Pinecone(api_key="YOUR_PINECONE_API_KEY")
oai = OpenAI(api_key="YOUR_OPENAI_API_KEY")
# Create a serverless index (one-time setup)
pc.create_index(
name="my-rag-index",
dimension=1536, # must match your embedding model
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1")
)
index = pc.Index("my-rag-index")
# Embed and upsert documents
texts = ["Claude is an AI assistant by Anthropic.", "GPT-4o is OpenAI's flagship model."]
embeddings = oai.embeddings.create(model="text-embedding-3-small", input=texts)
vectors = [
{"id": f"doc-{i}", "values": e.embedding, "metadata": {"text": texts[i]}}
for i, e in enumerate(embeddings.data)
]
index.upsert(vectors=vectors)
# Query: find the most similar document
query = "Who made Claude?"
q_embed = oai.embeddings.create(model="text-embedding-3-small", input=[query])
results = index.query(vector=q_embed.data[0].embedding, top_k=3, include_metadata=True)
for match in results["matches"]:
print(f"Score: {match['score']:.3f} | {match['metadata']['text']}") Get your API key: Sign up at app.pinecone.io, go to API Keys in the left sidebar, and create a key. The free tier includes 2 GB of serverless storage.
Core Concepts
Indexes
An index is a named collection of vectors with a fixed dimension and distance metric. You cannot change dimension or metric after creation. Use one index per embedding model.
Namespaces
Namespaces partition vectors within an index — useful for multi-tenant apps where each user has their own data. Query with namespace="user-123" to scope results.
Metadata filtering
Attach JSON metadata to each vector and filter at query time: filter={"category": {"$eq": "finance"}}. Filtering happens before similarity scoring — only filtered vectors are considered.
Distance metrics
Cosine — measures angle between vectors, independent of magnitude (best for text). Euclidean — measures straight-line distance (best for dense image embeddings). Dotproduct — product of magnitudes (use when your model normalizes for this).
Common Embedding Dimensions
| Model | Provider | Dimension |
|---|---|---|
| text-embedding-3-small | OpenAI | 1536 |
| text-embedding-3-large | OpenAI | 3072 |
| embed-english-v3.0 | Cohere | 1024 |
| textembedding-gecko | 768 | |
| multilingual-e5-large | Microsoft / HuggingFace | 1024 |
Pinecone Pricing
| Tier | Price | Notes |
|---|---|---|
| Serverless (free) | $0 | 2 GB storage, 5 indexes, no credit card |
| Serverless (pay-as-you-go) | ~$0.033/GB/mo storage + read/write units | Scales to zero, variable traffic |
| Pod-based (p1.x1) | ~$70/mo | Dedicated, predictable latency, 1M 768d vectors |
Pinecone vs Alternatives
| Database | Type | Best for | Free tier |
|---|---|---|---|
| Pinecone | Managed cloud | Production RAG, fastest setup | 2 GB serverless |
| Weaviate | Open-source / cloud | Hybrid search (vector + keyword), self-host | Sandbox (14 days) |
| Qdrant | Open-source / cloud | High performance, self-host, filtering | 1 GB cloud free |
| Chroma | Open-source, local | Local dev, prototyping, Python notebooks | Fully free (local) |
| pgvector | PostgreSQL extension | Already on Postgres, small-medium scale | Free (self-host) |
For more on RAG pipelines with Pinecone, see LlamaIndex guide and LangChain guide.
Monitor Pinecone Status
Pinecone has had outages affecting RAG pipelines in production. Prismix tracks live Pinecone status and sends instant alerts — so your on-call team knows before your users do.
Pinecone Troubleshooting Guide →