Claude API Embeddings Generation: Practical Guide
Does the Claude API generate embeddings?
No — not directly. Anthropic's Claude API is built for chat completions, tool use, and long-context reasoning, but it does not expose an /embeddings endpoint the way OpenAI's API does. If you're searching for "Claude API embeddings generation," the short answer is: you'll need a separate embeddings model, and then use Claude for the reasoning/generation step on top of whatever you retrieve.
This isn't a gap you have to work around with hacks. Anthropic explicitly recommends Voyage AI for embeddings in retrieval-augmented generation (RAG) pipelines that use Claude for the answer-generation side. This guide covers how that split works in practice: where embeddings fit, which models to use, and how to wire the retrieval step into a Claude-based generation call.
Why Claude doesn't do embeddings natively
Embeddings and chat completions are different workloads with different infrastructure needs. An embeddings model is a single forward pass that outputs a fixed-size vector; a chat model like Claude runs autoregressive generation with much heavier compute per token. Anthropic has chosen to focus the API on generation, tool use, and agentic workflows, and to let specialized providers handle the vector side.
This separation is actually useful in practice: you can swap embedding models independently of your generation model, pick the embedding dimensionality that fits your vector database, and avoid paying generation-model rates for a task that doesn't need them.
What to use instead
For most Claude-based RAG systems, pick one of these:
- Voyage AI — Anthropic's recommended partner. Models like
voyage-2andvoyage-large-2are tuned for retrieval quality and pair well with Claude's context handling. - OpenAI embeddings (
text-embedding-3-small/large) — a solid default if you already have infrastructure around OpenAI's API. - Open-source models (e.g.,
bge-large,e5-large,nomic-embed-text) — run locally or via Hugging Face inference endpoints if you want full control over cost and data residency.
The choice doesn't need to be perfect on day one. What matters more is consistency: use the same embedding model for both your document corpus and your queries, and re-embed everything if you ever switch models.
A typical embeddings + Claude pipeline
A standard RAG flow looks like this:
- Chunk your documents (by paragraph, section, or token count).
- Generate embeddings for each chunk and store them in a vector database (pgvector, Pinecone, Weaviate, Qdrant, etc.).
- At query time, embed the user's question with the same model.
- Retrieve the top-k most similar chunks by cosine similarity.
- Pass the retrieved chunks plus the question to Claude for the actual answer.
Steps 1–4 are the "embeddings generation" part. Step 5 is where Claude's reasoning does the work — synthesizing an answer from retrieved context, citing sources, or deciding when retrieval didn't return anything useful.
Example: embedding a query with Voyage AI
curl https://api.voyageai.com/v1/embeddings \
-H "Authorization: Bearer $VOYAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": ["How do I reset a user password in the admin panel?"],
"model": "voyage-2"
}'
This returns a float vector you compare against your stored document embeddings to find the closest matches.
Example: generation step with retrieved context
Once you have your top matching chunks, send them to Claude along with the question. If you're calling Claude through SubToAPI, this looks like a normal messages request:
const response = await fetch("https://api.subtoapi.app/v1/messages", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "claude-sonnet-4",
max_tokens: 500,
messages: [
{
role: "user",
content: `Context:\n${retrievedChunks.join("\n\n")}\n\nQuestion: ${userQuestion}\n\nAnswer using only the context above. If the context doesn't contain the answer, say so.`
}
]
})
});
const data = await response.json();
console.log(data.content[0].text);
This pattern — embeddings model for retrieval, Claude for generation — is the standard architecture for Claude-based RAG, and it's what most production systems using Claude actually run.
Where SubToAPI fits
SubToAPI doesn't generate embeddings — that part of your stack stays with Voyage AI, OpenAI, or an open-source model, same as above. What SubToAPI handles is the generation half: it turns your existing Claude access into a standard HTTPS API with application keys (sub_live_...), streaming, tool use, and usage metadata, so the generation step in your RAG pipeline is a normal authenticated API call rather than something tied to a single login session.
If you're building a retrieval pipeline and want the Claude side to be production-ready — key rotation, per-key usage tracking, team seats for shared projects — it's worth checking the quickstart and the messages endpoint docs. Streaming responses for long generated answers are covered in the streaming docs, and if your RAG pipeline needs Claude to call functions (e.g., re-querying the vector store mid-answer), see the tools docs.
Pricing is per seat: Solo at €9, Team at €19/seat, Scale at €49/seat, with a free trial at signup. Full details are on the pricing page.
Practical tips for the embeddings layer
- Match chunk size to your retrieval granularity. Smaller chunks (200–400 tokens) retrieve more precisely but may lose surrounding context; larger chunks give more context per hit but dilute relevance scoring.
- Normalize your vectors if your vector database expects unit-length embeddings for cosine similarity — some models output unnormalized vectors.
- Re-embed on model upgrades. If you switch from
voyage-2to a newer model, old embeddings won't be comparable to new query embeddings. Re-index the whole corpus. - Cache embeddings for static content. Documents that don't change don't need to be re-embedded on every deploy — store embeddings alongside a content hash and only regenerate when the hash changes.
questions
Does Anthropic offer its own embeddings model? No. Anthropic does not ship a native embeddings endpoint in the Claude API. For RAG pipelines, Anthropic recommends using Voyage AI's embedding models alongside Claude for generation.
Can I use OpenAI embeddings with Claude for generation? Yes. Embeddings and generation models don't need to come from the same provider. Many production RAG systems embed with OpenAI or Voyage AI and generate answers with Claude.
Do I need embeddings if I'm just using Claude for chat? No. Embeddings matter when you need to retrieve relevant information from a large corpus before answering. For simple chat or tasks that fit entirely in Claude's context window, you can skip embeddings and pass the content directly.