OpenAI Embeddings Guide: Which Model, How Many Dimensions, What It Costs
OpenAI embeddings turn text into a list of numbers whose distance reflects meaning. The current models are text-embedding-3-small (1536 dimensions, $0.02 per 1M tokens) and text-embedding-3-large (3072 dimensions, $0.13 per 1M tokens). You call client.embeddings.create, store the vectors and compare them with a dot product, because OpenAI normalizes every vector to length 1. Below: how the models compare, how many dimensions to keep, what the API accepts and returns, what a real collection costs and what to build next.
The OpenAI Embeddings course has 8 lessons of 25 minutes, from the first API call to semantic search, classification and recommendations. The first 2 lessons are open without sign-up, and signing up gives 7 days of full access, no card needed.
Updated October 31, 2026. Model numbers, prices and limits were checked against the OpenAI API documentation on that date; the sources are linked in each section.
What OpenAI embeddings are
An embedding is a vector of floating-point numbers that represents a piece of text. Texts with related meaning get vectors that sit close together, so "bad delivery" lands near reviews about late parcels even when they share no words. OpenAI lists the typical uses in its guide: search, clustering, recommendations, anomaly detection, diversity measurement and classification. Embeddings also power the retrieval step of RAG, where the closest chunks of your documents go into the prompt of a chat model.
You get the vector from one endpoint, /v1/embeddings, and pay only for the input tokens. There are no output tokens and no chat history in the bill.
OpenAI embedding models compared
OpenAI currently offers two third-generation embedding models, text-embedding-3-small and text-embedding-3-large, plus the older text-embedding-ada-002. All three take up to 8192 tokens per input. The difference is in vector size, quality on the MTEB benchmark and price.
| Model | Dimensions | Max input, tokens | Price per 1M tokens | MTEB |
|---|---|---|---|---|
| text-embedding-3-small | 1536 | 8192 | $0.02 | 62.3% |
| text-embedding-3-large | 3072 | 8192 | $0.13 | 64.6% |
| text-embedding-ada-002 (older) | 1536 | 8192 | $0.10 | 61.0% |
In OpenAI's own estimate of about 800 tokens per page, one dollar embeds about 62,500 pages with -3-small, 9,615 with -3-large and 12,500 with ada-002. Only the -3 models accept the dimensions parameter. Sources: OpenAI Vector embeddings guide, OpenAI API pricing.
Which OpenAI embedding model to choose
- Start with text-embedding-3-small. It is the cheapest model, scores higher on MTEB than ada-002 and returns 1536 dimensions.
- Move to text-embedding-3-large when you can measure the gain. Collect real queries from your users together with the documents that should come back, compare hit rates for both models on your own data, and only then pay 6.5 times more per token.
- Need large quality in a smaller index? Request text-embedding-3-large with
dimensions=1024ordimensions=256. OpenAI reports that large cut to 256 dimensions still outperforms ada-002 at its full 1536. - On ada-002 today? Vectors from different models live in different spaces, so switching means re-embedding the whole collection and the queries with the new model. With text-embedding-3-small, re-embedding 8M tokens costs $0.16.
One limitation from the guide: the -3 models lack knowledge of events after September 2021. OpenAI notes that this matters less for embeddings than for text generation, yet very new product names or terms can land less precisely.
How many dimensions to keep
The dimensions parameter shortens the vector on OpenAI's side while keeping its meaning; it works only on text-embedding-3 and later models. If you cut a vector yourself, renormalize it to length 1, otherwise the dot product no longer equals cosine similarity. Shorter vectors take less memory and search faster, and the table shows how much storage each size needs as raw 32-bit floats, before any index overhead:
| Dimensions | Per vector | Per 1M vectors | Typical choice |
|---|---|---|---|
| 256 | 1 KB | ≈ 1.0 GB | -3-large shortened for a small, fast index |
| 1024 | 4 KB | ≈ 4.1 GB | -3-large in a store capped at 1024 |
| 1536 | 6 KB | ≈ 6.1 GB | -3-small default |
| 3072 | 12 KB | ≈ 12.3 GB | -3-large default |
from openai import OpenAI
client = OpenAI() # OPENAI_API_KEY
resp = client.embeddings.create(
model="text-embedding-3-large",
input="Refunds take 5 days",
dimensions=1024,
)
vec = resp.data[0].embedding
print(len(vec)) # 1024
client.embeddings.create: the call, the response and the limits
The basic call from OpenAI's guide takes a model and an input and returns the vector in response.data[0].embedding. Pass a list of strings to embed a batch in one request; the order of data follows index. Here is a small search over three documents:
from openai import OpenAI
import numpy as np
client = OpenAI()
MODEL = "text-embedding-3-small"
docs = [
"Refunds take 5 business days",
"How to reset your password",
"We ship to Canada and the US",
]
resp = client.embeddings.create(
model=MODEL, input=docs
)
D = np.array([d.embedding for d in resp.data])
q = client.embeddings.create(
model=MODEL,
input="when do I get my money back?",
)
v = np.array(q.data[0].embedding)
# length 1 vectors: dot = cosine
scores = D @ v
print(docs[int(scores.argmax())])
The response is a JSON object of this shape (the vector is cut to two numbers here):
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [-0.0069, -0.0053]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}
| Parameter | What the reference says |
|---|---|
| input | A string or an array of strings or token arrays; up to 8192 tokens per input, 1 to 2048 items per array, 300,000 tokens per request in total; empty strings are rejected |
| model | text-embedding-3-small, text-embedding-3-large or text-embedding-ada-002 |
| dimensions | An integer from 1, supported only in text-embedding-3 and later models |
| encoding_ | float (default) or base64 |
| user | An identifier of your end user that OpenAI uses to monitor and detect abuse |
Count tokens before sending with tiktoken and the cl100k_base encoding, which OpenAI names for the -3 models. Sources: OpenAI API reference: Embeddings. A production wrapper with retries on rate limits and batching instead of a loop is the subject of the free lesson OpenAI Embeddings: Basic Usage in Python.
What OpenAI embeddings cost on a real collection
Embeddings are billed per input token only: $0.02 per 1M tokens for text-embedding-3-small and $0.13 for text-embedding-3-large. A collection is embedded once; after that you pay only for new documents and for the queries, which are usually short.
| Model | Standard API | Batch API (−50%) |
|---|---|---|
| text-embedding-3-small | $0.16 | $0.08 |
| text-embedding-3-large | $1.04 | $0.52 |
| text-embedding-ada-002 | $0.80 | $0.40 |
The Batch API supports /v1/embeddings with a 50% discount against the synchronous API. Each batch completes within 24 hours, and an embeddings batch holds at most 50,000 inputs across all its requests. That suits the initial load of a large archive; live queries still go through the regular endpoint. Cache every vector you compute, so the same text is never paid for twice.
What you can build with OpenAI embeddings
Each use case below starts from the same vectors; the difference is what you do with the distances. The right column links to the lesson of the Academl course where you build it in Python, based on the OpenAI Cookbook recipe.
| Task | How embeddings are used | Lesson |
|---|---|---|
| Semantic search | Embed documents and the query, return the nearest documents | Semantic Text Search (free) |
| Code search | Embed functions from a repository, find one by a plain-English description | Code Search via Embeddings |
| Reranking | Take the top results from vector search and reorder them with a cross-encoder | Reranking with Cross-Encoders |
| Classification | Use vectors as features for a classifier or compare against class examples | Text Classification via Embeddings |
| Clustering | Group similar texts, then name each group with a chat model | Transaction Clustering |
| Q&A over documents | Retrieve the closest chunks and pass them to a chat model as context | Q&A via Embeddings-based Search |
| Recommendations | Suggest the nearest items to the one a user is looking at | Recommendations via Nearest Neighbor Search |
Where to store the vectors
A few thousand vectors fit in a NumPy array or a Parquet file, and a matrix product like the one above is enough to search them. For fast nearest-neighbour search over many vectors, OpenAI's guide recommends a vector database. Pinecone, Qdrant, pgvector, Chroma and FAISS are compared hands-on in the lesson Vector Stores: Pinecone, Qdrant, pgvector, Chroma, FAISS, and chunking, hybrid search and RAG evaluation follow in the same course.
Whatever the store, keep three things fixed per index: the model, the number of dimensions and the way you split text into chunks. Changing any of them means embedding the collection again.
Common mistakes with OpenAI embeddings
- Mixing models in one index. A query embedded with text-embedding-3-small cannot be compared with documents embedded by ada-002 or by -3-large.
- Inputs over 8192 tokens. The API rejects them. Split long documents into chunks and store the chunk text next to its vector.
- Calling the API once per text in a loop. Send lists of up to 2048 inputs instead and retry with exponential backoff on rate-limit errors.
- Hard-coded similarity thresholds. Scores shift between models and data sets. Pick a cut-off on your own labelled examples and recheck it after a model change.
- Shortening vectors by hand without renormalizing. Use the dimensions parameter, or divide the shortened vector by its length.
- Mixing up tokenizers. Token counts for embeddings come from cl100k_base. How different tokenizers split text is explained in the lesson BPE vs WordPiece vs SentencePiece.
Where to practice: courses with OpenAI embeddings
Every Academl lesson ends with a coding task that the AI reviews, a quiz and an AI tutor; after all lessons you get a certificate with a verification code.
| Course | Length | What you build |
|---|---|---|
| OpenAI Embeddings: Complete Guide | 8 lessons of 25 minutes, about 3 h 20 min | Basic usage, semantic and code search, reranking, classification, clustering, Q&A, recommendations |
| RAG & Vector Databases | 12 lessons, about 6 hours | Vector stores, chunking, hybrid search, reranking, an end-to-end RAG pipeline, RAGAS evaluation |
| OpenAI API from A to Z | 16 lessons, about 6 h 20 min | The whole API, with a lesson on embeddings and semantic search next to function calling and structured outputs |
Time. At 30 minutes a day, 5 days a week, the embeddings course takes about a week and a half. Your pace depends on how long the coding tasks take you.
Price. The first 2 lessons of every course are free; sign-up gives 7 days of full access to the whole catalog with no card, then Pro is $9 a month or $79 a year (pricing). OpenAI bills API usage separately on your own account. A broader route through LLM engineering is collected on the LLM courses page.
FAQ
What are OpenAI embeddings?
An embedding is a list of floating-point numbers that represents the meaning of a text. OpenAI returns one vector per input from the embeddings endpoint, and the distance between two vectors reflects how related the texts are. Search, clustering, recommendations, anomaly detection and classification are all built on that distance.
Which OpenAI embedding model should I use?
Start with text-embedding-3-small: 1536 dimensions, $0.02 per 1M tokens and 62.3% on MTEB. text-embedding-3-large returns 3072 dimensions and scores 64.6% at $0.13 per 1M tokens. Move to large only after you have measured retrieval quality on your own queries. text-embedding-ada-002 is the older model.
How many dimensions do OpenAI embeddings have?
text-embedding-3-small returns 1536 by default and text-embedding-3-large 3072. Both accept the dimensions parameter, so you can ask for shorter vectors, for example 1024 when your vector store caps the size. According to OpenAI, text-embedding-3-large cut to 256 dimensions still beats ada-002 at 1536 on MTEB.
How much do OpenAI embeddings cost?
You pay per input token: $0.02 per 1M tokens for text-embedding-3-small, $0.13 for -3-large and $0.10 for ada-002. 10,000 documents of about 800 tokens come to $0.16 with the small model. The Batch API supports the embeddings endpoint at a 50% discount, with results within 24 hours.
What does client.embeddings.create return?
A list object whose data array holds one embedding per input, each with an index and the vector as floats, plus the model name and usage with prompt_tokens and total_tokens. With a single string, read response.data[0].embedding. With encoding_format base64 the vector comes back as a base64 string.
What are the input limits of the OpenAI embeddings API?
Each input can be up to 8192 tokens, an array can hold up to 2048 inputs, one request is capped at 300,000 tokens in total, and empty strings are rejected. Count tokens with tiktoken using the cl100k_base encoding and split longer documents into chunks.
Do I need a vector database for OpenAI embeddings?
For a few thousand vectors a NumPy array or a Parquet file and a dot product are enough. For fast nearest-neighbour search over many vectors, OpenAI's guide recommends a vector database. Keep one embedding model per index: vectors from different models cannot be compared.
Is there a course on OpenAI embeddings?
Academl's OpenAI Embeddings course has 8 lessons of 25 minutes on OpenAI Cookbook recipes: basic usage, semantic search, code search, reranking, classification, clustering, Q&A and recommendations. The first 2 lessons are free; sign-up gives 7 days of full access with no card, then Pro is $9 a month or $79 a year.
Open the first 2 lessons of the OpenAI Embeddings course for free: your first embeddings call and semantic search over product reviews. For AI-reviewed tasks and the remaining 6 lessons, sign up for 7 days of full access with no card, then Pro is $9 a month or $79 a year.
