OpenAI Embeddings

OpenAI's embedding models are among the most widely used ways to turn text into vectors. They live behind a simple API, deliver strong quality, and support flexible dimensions — which makes them the default choice for a huge number of semantic-search and RAG systems. You send text; you get back a vector.

💡 In one line: OpenAI Embeddings are hosted, easy-to-use embedding models — send text to an API and get high-quality vectors back.

What Are OpenAI Embeddings?

They're hosted embedding models accessed through the OpenAI API. They're proprietary (you can't download them) and priced per token, and they power search, RAG, clustering, classification, and recommendations. Because they're a managed service, there's no infrastructure for you to run.

The Models

OpenAI's current generation is the v3 family:

ModelDefault dimsCost (approx.)Best for
text-embedding-3-small1536~$0.02 / 1M tokensThe cheap default — search & RAG at scale
text-embedding-3-large3072~$0.13 / 1M tokensMaximum quality when accuracy matters
text-embedding-ada-0021536(legacy)Older 2022 model — superseded, still supported

For most applications, 3-small is the go-to; reach for 3-large only when you need the extra accuracy. (Prices are approximate as of 2026 — check OpenAI for current numbers.)

Matryoshka Dimensions (Shortening)

A standout feature: you can shorten the vector via a dimensions parameter — dropping from 3072 to, say, 1024 or 256 — with only modest quality loss. This "Matryoshka" training means the first N numbers already carry most of the meaning. Remarkably, a 256-dim 3-large embedding can still beat a full 1536-dim ada-002 one. It's a direct storage-vs-accuracy dial.

Normalised Output

OpenAI embeddings are L2-normalised to length 1 by default. A handy consequence: cosine similarity reduces to a plain dot product, which is faster to compute at scale.

How to Use

The typical flow.

Whiteboard
Whiteboard diagram

Code Example


Strengths & Trade-offs

Strengths

  • Easy — one SDK, one API, no infrastructure.
  • Cheap and fast, with strong general quality.
  • Flexible dimensions and multilingual support.

Trade-offs

  • Closed / hosted — data leaves your servers (though, by default, it isn't used to train models).
  • Pay per token and no self-hosting.
  • Not always best-in-class on multilingual or specialised tasks versus some rivals.

When to Use It

  • A great default when convenience matters most.
  • Use 3-large for peak accuracy, 3-small for cost and scale.
  • If you need self-hosting, privacy, or cost control, look at open models — Sentence Transformers, BGE, and E5 (the next subtopics).

Summary

  • OpenAI Embeddings are hosted models accessed via a simple API.
  • The v3 family offers 3-small (cheap default) and 3-large (best quality), plus legacy ada-002.
  • Matryoshka dimensions let you shorten vectors to trade accuracy for storage.
  • Outputs are normalised, so cosine similarity is just a dot product.
  • They win on convenience; open models win on control — covered next. EOF echo created