← Back to dashboard
pineconedatabasefreshReader view (for NotebookLM)

Pinecone Integration Guide

What is a vector database?

The real model

ANN indexes (HNSW) over learned embeddings — RAG's retrieval half.

Pinecone is serverless ANN search over dense and sparse vectors, plus BM25 full-text search on schema-based document indexes (GA on API 2026-07). The killer feature for everyone tired of running an embedding service is integrated inference: `pc.indexes.createForModel` (SDK v9, Node 22+) binds an embedding model (e.g. `multilingual-e5-large`) to the index, so you `upsertRecords` and `searchRecords` with raw text — Pinecone embeds server-side. Records are scoped by `namespace` (per-tenant isolation, free). In the same `searchRecords` call you can add a `rerank` step (`bge-reranker-v2-m3`) to boost precision. For codeAmani the e5-large model is the unlock: Swahili and English live in the same 1024-dim space (507-token window, so keep chunks short), and a mixed-language query retrieves docs in either language without translation.

The five primitives

Index holds the data; namespace isolates it; records carry it; hybrid (sparse or BM25 + dense) and rerank turn good results into great ones. Tap a card to dig in.

Feel the top-K happen

Twelve documents across three topics, laid out where their meanings would put them. Click anywhere in the plot — or pick a preset — and watch the nearest neighbours re-rank. Real embeddings live in 384+ dimensions, but the intuition transfers: near in space ≈ near in meaning.

2D similarity playgroundquery at (50, 50)
Presets
Top-K
queryAIPayAuth

Tip: click anywhere in the plot to move the query — top-K updates instantly.

topK resultscosine ~ similarity
  1. 1RLS policies in Supabase85.8%
  2. 2Clerk session management82.5%
  3. 3JWT signing and verification79.8%
… 9 more docs not shown at this top-K.

In a real index these points live in 384–1024 dimensions, not two — but the rule is the same: documents about the same thing cluster together. Click halfway between two clusters and watch how the ranking mixes — that's the same behaviour you'd see on a query like “how do I bill for Daraja API access?” which sits between Payments and AI/Pricing.

The codeAmani angle: Pinecone's hosted multilingual-e5-large places Swahili and English about the same concept right next to each other — a query in either language retrieves docs in both, with zero translation step.

Text
██████╗ ██╗███╗   ██╗███████╗ ██████╗ ██████╗ ███╗   ██╗███████╗
██╔══██╗██║████╗  ██║██╔════╝██╔════╝██╔═══██╗████╗  ██║██╔════╝
██████╔╝██║██╔██╗ ██║█████╗  ██║     ██║   ██║██╔██╗ ██║█████╗
██╔═══╝ ██║██║╚██╗██║██╔══╝  ██║     ██║   ██║██║╚██╗██║██╔══╝
██║     ██║██║ ╚████║███████╗╚██████╗╚██████╔╝██║ ╚████║███████╗
╚═╝     ╚═╝╚═╝  ╚═══╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝╚══════╝

Pinecone Integration Guide

Focus: The retrieval layer for codeAmani's AI. Pinecone is a serverless vector database for RAG: store knowledge, retrieve the most relevant chunks, and feed them into a Claude prompt. With integrated inference you skip running an embedding model entirely, because Pinecone embeds text server-side (including multilingual-e5-large for Swahili + English).

What changed in 2026 (read this first)

ChangeDateWhat to do
Node SDK v9.0.0 targets API 2026-07 and requires Node.js ≥ 222026-09-09Pin @pinecone-database/pinecone@9.0.0. Stay on 8.x only if a runtime is stuck on Node 20.
Control plane moved to resource clients (pc.indexes.*, pc.backups.*, pc.backupSchedules.*, pc.assistants.*)v9Flat pc.createIndexForModel(), pc.listIndexes() and friends still work but are deprecated. New code uses pc.indexes.createForModel() and pc.indexes.list().
Python SDK v10.0.0 (API 2026-07, Python 3.10 to 3.14), pinecone.preview removed2026-09-03pip install pinecone==10.0.0. pc.create_index(dimension=..., spec=...) is unchanged.
Full-text search + Documents API generally available2026-09-02New schema-based "document indexes" combine BM25 text, dense and sparse fields. See §5.
Index responses expose schema + deployment; dimension/metric/spec are compatibility getters that can throwv9Don't spread or serialize IndexModel. Read model.host and model.schema.
Egress metering: 1 GB/mo Starter, 10 GB Builder, 100 GB Standard/Enterprise, then $0.10/GB2026-09-01Return only the fields you need. Starter/Builder reads are blocked at the cap.
New Builder plan, $20/month flat with no overages2026-05-04Middle step between Starter and Standard.
Dedicated Read Nodes GA (Standard/Enterprise)2026-04-15Provisioned read hardware at an hourly rate instead of read units. See §6.
Scheduled backups (pc.backupSchedules) and namespace aliasesv9 / 2026-09-29Nightly backups; blue/green namespace swaps. See §6.
cohere-rerank-3.5 deprecated → cohere-rerank-4-fast2026-07-01Codeamani uses bge-reranker-v2-m3, so no action needed.
Pinecone Local (Docker emulator) end of life2026-10-07Test against a separate dev project or mock the API.

Overview

Pinecone (API 2026-07) gives you three kinds of index. Pick one per knowledge base:

Index kindCreate with (TS v9)Read/write withUse when
Integrated embedding (codeAmani default for RAG)pc.indexes.createForModel({ embed: { model, fieldMap } })upsertRecords / searchRecords (Records API)You want to send raw text and never handle vectors. Supports server-side rerank, and it is the only kind the Pinecone MCP can drive.
Vector index (bring your own vectors)pc.indexes.create({ dimension, metric, spec })upsert / query / fetch (Vectors API)You need a specific embedding model (e.g. OpenAI text-embedding-3-small).
Document index (new, GA)pc.indexes.create({ schema: { fields } })index.documents.* (Documents API)You need BM25 full-text and/or Lucene query syntax on the same data as dense vectors.

An index's data plane is fixed when it is created. Upgrading the SDK never moves an existing index to a different API.

  • Integrated inference. Pinecone's quickstart default model is llama-text-embed-v2 (1024-dim, 2048-token window, $0.16/M tokens). codeAmani deliberately picks multilingual-e5-large (1024-dim, 507-token window, $0.08/M tokens) for its Swahili + English coverage. Optional server-side reranking (bge-reranker-v2-m3) sharpens results.
  • Namespaces partition an index (e.g. per tenant/SME). They are the multi-tenant isolation primitive.
  • In Claude Code, the Pinecone developer MCP (npx -y @pinecone-database/mcp) can search the docs, create integrated indexes and upsert/search records. See §8, including the connect-timeout fix.

Here is the integrated-inference path at a glance. The embedding happens server-side, so your app never touches a vector:

RAG decision notes

The headline trade-off (Pinecone's integrated inference vs. running your own embeddings) is summarized in the Insight callout at the top of this page. A few more decision points worth knowing:

  • When NOT to use integrated inference: if you need a specific embedding model (e.g. to match vectors you already store elsewhere, or a domain-tuned model), use the bring-your-own-vectors path (§4) and embed with the AI SDK instead.
  • When to add full-text search: semantic search blurs exact tokens such as product SKUs, M-Pesa receipt codes (QK12AB34CD), error strings and names. A document index (§5) adds BM25 and $match_phrase filters for those. Integrated-embedding indexes cannot do BM25.
  • Reranking earns its cost: a 2-stage retrieve→rerank (bge-reranker-v2-m3) noticeably lifts answer quality for FAQ/support RAG. Keep topK wide (e.g. 20) and topN tight (e.g. 3). Starter includes 500 rerank requests/month; Standard pays $2 per 1k requests.
  • Chunking matters more than the DB: retrieval quality is dominated by how you split source docs (size + overlap), not by Pinecone config. Tune chunks first.
  • Serverless = no idle compute: you pay for storage ($0.33/GB/mo on Standard) plus reads/writes, so a per-product knowledge base is cheap for early-stage SME features. Standard still has a $50/month minimum.

Chunking strategy

Since chunking dominates retrieval quality (see the note above), here is concrete guidance. All sizes are in tokens, not characters.

Size: start fixed, then iterate. Pinecone's chunking guide recommends starting with fixed-size chunking and only moving to fancier strategies once it proves insufficient. For sizing, the guide says to "start by exploring a variety of chunk sizes, including smaller chunks (e.g. 128 or 256 tokens) ... and larger chunks (e.g. 512 or 1024 tokens)" (pinecone.io/learn/chunking-strategies). With multilingual-e5-large the hard ceiling is 507 tokens, so the practical default for FAQ/support docs is ~400–450 tokens. Smaller chunks give sharper, more precise matches. Larger chunks carry more context per hit but dilute the embedding.

Overlap: 10–20% is the commonly documented range. Pinecone's guide itself does not prescribe a fixed overlap percentage. It instead favours chunk expansion (pulling neighbouring chunks at query time) to recover context. Across the broader RAG literature, a 10–20% overlap (e.g. 50–80 tokens on a 450-token chunk) is the widely cited starting point to avoid splitting a sentence's meaning across a boundary. Treat it as a knob to tune, not gospel. Some recent benchmarks find overlap adds indexing cost with little gain, so measure on your own corpus.

Semantic vs fixed splitting: when to switch.

  • Fixed-size (token windows + overlap): deterministic, fast, zero document understanding. Use as your default and for uniform text (support tickets, chat logs, plain prose).
  • Content-aware / recursive (split on \n\n, \n, sentences, then fall back): respects structure. Use for Markdown/HTML docs, USSD scripts, code where paragraph and heading boundaries are meaningful.
  • Semantic (embed sentences, cut where the topic shifts): highest quality, highest cost. Use only for long, topic-switching documents (multi-section policy/compliance PDFs) where fixed splitting visibly hurts answer quality.

Keep chunk_text (the field in your index fieldMap) as the only text field per record, and store source metadata (doc_id, section, chunk_index) so you can rebuild context.

TypeScript
// Fixed-size, overlapping chunker. Run BEFORE upsertRecords (§2).
// Approximate tokens with a chars-per-token ratio (English ~4; tune for Swahili).
const CHARS_PER_TOKEN = 4;

function chunkText(
  text: string,
  { chunkTokens = 450, overlapTokens = 60 } = {},
): string[] {
  const size = chunkTokens * CHARS_PER_TOKEN;        // ~1800 chars
  const overlap = overlapTokens * CHARS_PER_TOKEN;    // ~240 chars
  const stride = Math.max(size - overlap, 1);         // guard: overlap < size
  const chunks: string[] = [];
  for (let start = 0; start < text.length; start += stride) {
    const slice = text.slice(start, start + size).trim();
    if (slice) chunks.push(slice);
  }
  return chunks;
}

// Wire chunks into the §2 integrated-inference upsert (max 96 text records per call):
const records = chunkText(sourceDoc).map((chunk, i) => ({
  id: `faq-mpesa#${i}`,           // stable id = doc + chunk index
  chunk_text: chunk,             // must match the index fieldMap
  doc_id: "faq-mpesa",
  chunk_index: i,
  topic: "payments",
}));
for (let i = 0; i < records.length; i += 96) {
  await index.upsertRecords({ records: records.slice(i, i + 96) });
}

Gotcha: chunk sizes are measured in tokens, but most splitters (including the char-based helper above) cut on characters. The ~4-chars-per-token ratio is an English approximation. Swahili and other non-English text often run fewer chars per token, so a "450-token" char window can silently overshoot the embedding model's context limit and get truncated server-side. For production, count with a real tokenizer (e.g. js-tiktoken) instead of a fixed ratio, and verify against your model's window (multilingual-e5-large = 507 tokens; llama-text-embed-v2 = 2048 tokens).

Official Documentation


1. Install + credentials

Bash
npm install @pinecone-database/pinecone@9.0.0   # JS/TS. Requires Node.js >= 22
pip install pinecone==10.0.0                     # Python 3.10 to 3.14
Bash
PINECONE_API_KEY=pcsk_...    # server-side only (.env.local / Vercel env / Hazina vault)

Non-secret settings (keep these in config, not in the vault):

SettingValueNotes
Cloud / regionaws / us-east-1Starter is us-east-1 only. Builder and above can use any GA region (e.g. eu-central-1, ap-southeast-1).
Embedding modelmultilingual-e5-large1024-dim, 507-token window
Rerank modelbge-reranker-v2-m3The only rerank model on Starter/Builder
API version header2026-07Only for raw REST calls (X-Pinecone-Api-Version). The SDKs set it for you.
Debug loggingPINECONE_DEBUGLogs requests with Api-Key redacted (v9)

new Pinecone() with no arguments reads PINECONE_API_KEY from the environment. The v9 client uses globalThis.fetch and no longer eagerly loads Node built-ins, so it constructs in Edge/Workers runtimes. Assistant file uploads and streaming still need Node.js.

Optional: the pc CLI (scripting index/project ops outside the app):

Bash
brew tap pinecone-io/tap && brew install pinecone-io/tap/pinecone   # macOS
# Windows/Linux: download a binary from https://github.com/pinecone-io/cli/releases
pc auth login                                                        # browser auth
pc index create -n kb -d 1024 -m cosine -c aws -r us-east-1
pc index list

2. RAG with integrated inference (no embedding layer): TypeScript

TypeScript
import { Pinecone } from "@pinecone-database/pinecone";

const pc = new Pinecone(); // reads PINECONE_API_KEY

// 2a. Create an index bound to an embedding model (multilingual = Swahili + English)
const model = await pc.indexes.createForModel({
  name: "kb",
  cloud: "aws",
  region: "us-east-1",
  embed: { model: "multilingual-e5-large", fieldMap: { text: "chunk_text" } },
  waitUntilReady: true,
});
const index = pc.index({ host: model.host, namespace: "tenant-acme" });

// 2b. Upsert RAW TEXT (max 96 records per call). Pinecone embeds it server-side.
await index.upsertRecords({
  records: [
    { id: "doc1", chunk_text: "M-Pesa STK Push prompts the user on their phone.", topic: "payments" },
    { id: "doc2", chunk_text: "Daraja tokens expire after one hour.", topic: "payments" },
  ],
});

// 2c. Search with a text query (+ optional rerank)
const res = await index.searchRecords({
  query: { topK: 10, inputs: { text: "how does M-Pesa checkout work?" }, filter: { topic: { $eq: "payments" } } },
  rerank: { model: "bge-reranker-v2-m3", topN: 3, rankFields: ["chunk_text"] },
  fields: ["chunk_text", "topic"],
});
// hit.fields is typed `object` in v9, so narrow it before reading
const chunks = res.result.hits.map((h) => String((h.fields as Record<string, unknown>).chunk_text));

Writes are eventually consistent. waitUntilReady covers index creation only, so seed scripts should poll a search (with a timeout) before asserting on freshly upserted data.

3. Close the RAG loop (Pinecone → Claude via the AI SDK)

You are one short hop from a full answer. Retrieved chunks become Claude's context, with Pinecone as memory and Claude as generator:

TypeScript
import { generateText } from "ai";

const context = chunks.map((c, i) => `[${i + 1}] ${c}`).join("\n---\n");
const { text } = await generateText({
  model: "anthropic/claude-sonnet-5",               // via Vercel AI Gateway (Claude 5 family)
  system: "Answer ONLY from the numbered context and cite like [1].",
  prompt: `Context:\n${context}\n\nQ: How does M-Pesa checkout work?`,
});

Full version: examples/rag-answer.ts.

4. Bring-your-own-vectors (Python v10, explicit dimension)

Python
from pinecone import Pinecone, ServerlessSpec

pc = Pinecone()  # reads PINECONE_API_KEY
pc.create_index(name="kb-byov", dimension=1536, metric="cosine",
                spec=ServerlessSpec(cloud="aws", region="us-east-1"))  # unchanged in v10
index = pc.index("kb-byov")   # lowercase pc.index(); capital pc.Index() is the old form
index.upsert(vectors=[("id1", embedding_1536d)], namespace="tenant-a")
res = index.query(vector=query_vec, top_k=10, namespace="tenant-a")  # top_k must be 1..10,000

In TypeScript, pc.indexes.create({ dimension, metric, spec }) still works. The SDK translates it to a schema with the reserved _values field, and the index stays on the classic Vectors API. See examples/byov-backups.ts. On v10, an empty filter={} now raises PineconeValueError client-side, so omit the filter instead.

5. Full-text + hybrid search (Documents API, GA on 2026-07)

A document index declares its fields in a schema: string fields with fullTextSearch (BM25), at most one dense_vector and one sparse_vector. Undeclared fields are stored as filterable metadata. Documents use _id and top-level fields.

TypeScript
const model = await pc.indexes.create({
  name: "support-docs",
  deployment: { deploymentType: "managed", cloud: "aws", region: "us-east-1" },
  schema: {
    fields: {
      body: { type: "string", fullTextSearch: {} },
      embedding: { type: "dense_vector", dimension: 1536, metric: "cosine" },
    },
  },
  waitUntilReady: true,
});
const docs = pc.index({ host: model.host, namespace: "tenant-acme" }).documents;

// Keyword (BM25). Also: { type: "query_string", query: "body:refund~1" } for Lucene + fuzzy
const kw = await docs.search({
  scoreBy: [{ type: "text", fields: ["body"], query: "QK12AB34CD refund" }],
  topK: 5,
  includeFields: ["body"],
});

// Hybrid in ONE request: exact-phrase filter, then dense ranking
const hy = await docs.search({
  scoreBy: [{ type: "dense_vector", fields: ["embedding"], values: queryEmbedding }],
  filter: { body: { $match_phrase: "original card" } },
  topK: 5,
});

Rules worth knowing (from the 2026-07 docs):

  • A vector (dense_vector/sparse_vector) clause must be the only clause in scoreBy. There is no single combined dense + sparse document query, so fuse separate searches client-side with reciprocal rank fusion (RRF) when both signals should rank.
  • Limits: 1,000 documents / 2 MB per upsert, 100 KB and 10,000 tokens per full-text field, at most 100 full-text fields per schema.
  • Existing sparse+dense vector indexes (Vectors API, dotproduct, alpha weighting) keep working for hybrid. pinecone-sparse-english-v0 ($0.08/M tokens) is the hosted sparse model.
  • Integrated embedding on document indexes is a source discrepancy. The TS v9 SDK guide documents embed / sparseEmbed on string fields and calls createForModel "legacy". The official docs FAQ says integrated embedding "isn't available on schema-based (document) indexes" and tells you to keep using create_index_for_model. codeAmani follows the docs: keep RAG on createForModel until the docs confirm it (see NOTES.md).

6. Production operations

  • Namespaces per index: Starter 100, Builder 1,000, Standard 100,000, Enterprise 1,000,000. Data-plane calls are limited to 100 requests/second per namespace. Prefer a namespace per tenant over large $in filters (capped at 10,000 values per $in/$nin). A query costs 1 RU per GB of the namespace, so small tenant namespaces are also cheaper.
  • Namespace aliases (REST API 2026-07 / console): a repointable read name. Ingest into kb-v2, then atomically point alias kb-live at it, with no redeploy. Writes must target the real namespace. Up to 1,000 aliases per index, free to keep.
  • Backups (Standard/Enterprise): pc.backups.create(indexName, { name }), and recurring pc.backupSchedules.create(indexName, { name, frequency: "daily", retentionDays: 30 }). Restore with pc.backups.createIndex(backupId, { name }). Backup storage is $0.10/GB/mo and restore $0.15/GB. Cross-region restore adds a transfer fee (since 2026-10-13).
  • Dedicated Read Nodes (DRN): provisioned read hardware (node type × shards × replicas) at an hourly rate. No read-unit charges or read rate limits, everything is kept warm, and you scale manually. Use it only for sustained high-QPS, large single-namespace workloads. Not needed for SME knowledge bases.
  • Deletion protection: pass deletionProtection: "enabled" on production indexes.
  • Errors: v9 adds Errors.PineconePaymentRequiredError (402) and PineconeFailedPreconditionError (412). Quota and rate limits surface as 403 QUOTA_EXCEEDED / 429 TOO_MANY_REQUESTS.

7. Pricing snapshot (pinecone.io/pricing, 2026-10-20)

StarterBuilderStandardEnterprise
PriceFree$20/mo flat (blocked, not billed, past quota)$50/mo minimum, then pay as you go$500/mo minimum
Indexes5 (us-east-1 only)10 per project20 per project200 per project
Storage2 GB10 GB$0.33/GB/mo$0.33/GB/mo
Read units1M/mo2M/mo$16–$18 per M$24–$27 per M
Write units2M/mo5M/mo$4–$4.50 per M$6–$6.75 per M
Egress1 GB/mo10 GB/mo100 GB incl., then $0.10/GBsame
Embedding5M tokens/mo10M tokens/moe5-large $0.08/M, llama-v2 $0.16/Msame
Rerank500 req/mo (bge only)1,000 req/mo$2 per 1k requestssame

How usage is metered: a query costs 1 RU per GB of namespace (minimum 0.25 RU), regardless of topK. A fetch costs 1 RU per 10 records. An upsert costs 1 WU per KB (minimum 5 WU). Unit prices vary by cloud and region. The HIPAA add-on on Standard is $190/mo. Full table: reference/limits-and-pricing.md.

8. Claude Code: MCP servers, plugin and troubleshooting

Pinecone ships three different MCP servers. Don't mix them up:

ServerTransport / launchToolsUse for
Developer MCP @pinecone-database/mcp (v0.3.0)stdio, npx -y @pinecone-database/mcpsearch-docs, list-indexes, describe-index, describe-index-stats, create-index-for-model, upsert-records, search-records, cascading-search, rerank-documentsBuilding/inspecting integrated-embedding indexes from the editor. BYOV and document indexes, assistants, and raw vector search are not supported.
Assistant MCP (one per assistant)Remote streamable HTTP https://<ASSISTANT_HOST>/mcp/assistants/<NAME> with Authorization: Bearer <key>, or Docker ghcr.io/pinecone-io/assistant-mcpcontext-snippet retrievalGiving an agent grounded context from a Pinecone Assistant's files
Nexus MCPRemote streamable HTTP https://<WORKSPACE_HOST>/mcp via mcp-remotelist_contexts, query_context, get_queryQuerying Pinecone Nexus contexts (GA 2026-08-06)

Install the developer MCP. Either install the official plugin (claude plugin install pinecone, which bundles the MCP server and the /pinecone:* skills) or add only the server:

Bash
claude mcp add-json pinecone-mcp '{"type":"stdio","command":"npx","args":["-y","@pinecone-database/mcp"],"env":{"PINECONE_API_KEY":"<from vault>"}}'
claude mcp add --transport http my-assistant https://<ASSISTANT_HOST>/mcp/assistants/<NAME> --header "Authorization: Bearer <key>"

Troubleshooting: "MCP server plugin:pinecone:pinecone connection timed out after 30000ms"

Measured on this Windows machine on 2026-10-20: a cold npx -y @pinecone-database/mcp took 40.8 s to print Pinecone MCP Server running on stdio. A warm run (package already in the npx cache) took 10.8 s. Claude Code's MCP startup budget gave up at 30 s, so the first launch of a session (or after an npm cache clean) times out. Fixes, in order of preference:

  1. Warm the cache once, then restart Claude Code: run npx -y @pinecone-database/mcp in a terminal, wait for running on stdio, then press Ctrl+C.
  2. Raise the startup timeout before launching Claude Code (PowerShell): $env:MCP_TIMEOUT = "60000"; claude.
  3. Skip npx entirely: npm install -g @pinecone-database/mcp, then point a user-scoped server at the pinecone-mcp binary ("command": "pinecone-mcp") instead of npx. On Windows, if npx itself isn't found, use "command": "cmd", "args": ["/c", "npx", "-y", "@pinecone-database/mcp"].
  4. Set PINECONE_API_KEY in the environment that launches Claude Code. The plugin passes ${PINECONE_API_KEY} through. Without it the server still starts, but every database tool errors ("Database tools will return an error until it is provided") and only search-docs works.
  5. Check node --version (the MCP needs ≥ 20; SDK v9 apps need ≥ 22), then run /mcp to confirm ✓ connected.
  6. Behind a corporate firewall, allow api.pinecone.io and the index hosts (*.pinecone.io).

9. Pinecone Assistant (managed RAG)

Upload files to an assistant, then chat with it (citations included) or pull context snippets for your own LLM. It is fully usage-based since 2026-04-01, with no per-assistant hourly fee. On Standard: $8/M input tokens, $15/M output tokens, $5/M context tokens, $3/GB/mo storage and $0.0005 per ingestion unit (~400 tokens). Starter includes 500k input, 300k output and 500k context tokens plus 1,000 ingestion units per month. Chat models include claude-sonnet-4-5, gpt-5 and gemini-3.5-flash. Use it for quick internal doc Q&A. For product RAG, codeAmani keeps the generator in its own Claude call (§3) so routing, prompting and cost stay under our control.

codeAmani notes

  • Fills the retrieval gap: this is the missing layer for RAG over codeAmani docs/FAQs/ product knowledge. Retrieve top-k chunks, then pass them to Claude via the Vercel AI SDK (see vercel-ai-sdk). Keep Claude as the generator and Pinecone as the memory (AI routing policy: Claude for reasoning and generation).
  • Multilingual by choice: codeAmani picks multilingual-e5-large (Pinecone's default is llama-text-embed-v2) because it embeds Swahili and English in one space. East-African content (mixed-language support FAQs, USSD scripts) works without a custom model, at half the llama price. Strong fit for the AFRICAN_MARKET_GUIDE.md audience on Kenya-targeted projects. The trade-off is the 507-token window, so chunk accordingly.
  • Multi-tenant: use a namespace per customer/SME for isolation (RLS-like separation), and never a giant $in filter of tenant IDs.
  • Security: PINECONE_API_KEY is server-side only (.env.local / Vercel env, or the Hazina vault). Query from API routes / server actions, never the browser. Sanitize user text before it goes into inputs.text or a filter. Starter indexes always live in AWS us-east-1. On paid plans, pick a US region for US-first customers unless a project needs other data residency.
  • Runtime: SDK v9 needs Node.js 22+. Pin engines.node >= 22 in apps that import it, and check Vercel/Netlify function runtimes before upgrading from 8.x.
  • Cost: Standard has a $50/mo floor. Many SME knowledge bases fit Starter (free) or Builder ($20 flat). Reads cost RUs by namespace size, reranking costs per request and egress is now metered, so cache hot queries (Upstash), keep topK/topN tight and request only needed fields.
  • Payments are unrelated: Pinecone billing is by card in Pinecone's console. App payments still follow the stack rule (Stripe by default, M-Pesa only for Kenya-targeted projects). The M-Pesa strings in these examples are just sample knowledge-base content.
  • Claude Code: the Pinecone plugin/MCP (@pinecone-database/mcp) and the pc CLI let you build and inspect indexes without leaving the editor. If the MCP times out on connect, see §8.