Learning resourcesReviewed · OpenAI

OpenAI Vector Embeddings Guide

OpenAI's Vector embeddings guide is a tutorial for developers building text search and recommendations, but a working feature requires paid API access and additional application code. It explains how to turn text into numeric vectors, compare their similarity and use them for retrieval, classification and clustering.

Researched 13 Nov 2026

In short.

OpenAI's Vector embeddings guide teaches developers to build meaning-based text features, but it leaves paid API usage, storage and application integration to the reader. It covers embedding requests, similarity ranking, adjustable vector dimensions and downstream machine-learning examples. Its practical value is explaining the components and their tradeoffs; current prices, production behavior and accuracy on a reader's own data are not established by the page.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage is the complete captured learning resource at [https://developers.openai.com/api/docs/guides/embeddings.md], including its inline examples, model table, FAQ and ownership statement. The supplied text contains no explicit documentation or sample-code redistribution licence. Linked pages, notebooks, datasets, repositories and other folders are excluded. The captured source revision is sha256:ab389d16ef0c187647d0f67a7ac545274c0e2b4a8e175d71d10945a58bf78b95. No examples or API calls were executed; linked material, current commercial terms, task-specific accuracy and production behavior remain unassessed.

The overview

Identity

This is OpenAI's Vector embeddings documentation page at [https://developers.openai.com/api/docs/guides/embeddings.md]. It is a learning resource about the hosted embeddings API, including explanations, inline code, model comparisons and links to further examples.

Its central subject is text embeddings: lists of floating-point numbers that represent text so software can compare relatedness. Embedding requests return vectors rather than written answers.

Assessment

The guide provides a useful bridge from the basic idea of text similarity to API requests and application patterns. Readers can see how the same vectors support document search, code search, recommendations and machine-learning features.

It is strongest as an implementation introduction. It does not provide a complete production search application, a workload-specific cost estimate or evidence that its illustrative results will transfer to another dataset. The examples were not executed.

Users

Developers adding relevance search, related-item recommendations or text classification are the clearest audience. Data scientists can also use the sections on clustering, visualization, regression and classification.

Beginners receive a plain explanation of vectors and similarity, but need programming knowledge to turn the snippets into an application. Experienced developers get concrete details about dimensions, normalization, token counting and similarity calculations, while deployment architecture and operational behavior remain unspecified.

Capabilities

The page illustrates single-text and multiple-text embedding requests, saving vectors, ranking text and code by similarity, recommending related items, and comparing text against class descriptions without labeled training data. Additional examples use embeddings as inputs to random forests, KMeans clustering and t-SNE visualization.

Anomaly detection and diversity measurement are listed applications without corresponding worked examples. The question-answering section explains supplying relevant information to a text-generation model; its inline snippets demonstrate context provision rather than a complete embedding-based retrieval pipeline.

API examples appear in TypeScript, Python, Go, Java, C# and Ruby, with a curl request also supplied. The detailed statistical examples primarily use Python.

Using it

Requirements

Following the API examples requires OpenAI API access, an API key, network access and either a suitable SDK or an HTTP client. Text is sent to OpenAI's hosted endpoint. Data retention, residency and privacy settings are not specified on this page.

The model table lists an 8,192-token maximum input for each model shown. The guide recommends tiktoken with the cl100k_base encoding for counting tokens for third-generation embedding models. Other request limits and account quotas are not supplied.

The Python data-analysis examples additionally rely on datasets and packages such as NumPy, pandas, scikit-learn and Matplotlib. Some snippets assume previously defined variables or helper functions. Exact dependency versions and a complete environment specification are not provided.

Mechanism

An embedding maps text to a numeric vector. The search examples embed documents and a query using the same model, calculate cosine similarity and rank documents by score. The guide states that OpenAI embeddings have unit length, allowing cosine similarity to be computed as a dot product; Euclidean distance produces the same ranking.

Default vector lengths are 1,536 for text-embedding-3-small and 3,072 for text-embedding-3-large. Both support the dimensions parameter to request shorter vectors. Shortening can reduce storage and comparison work, with an accuracy tradeoff.

The guide recommends requesting the desired dimensions through the API. If a vector is manually truncated afterward, its examples normalize the shortened vector back to unit length.

Setup

The basic request supplies a model name and input text, then extracts the returned embedding. The curl example posts JSON to [https://api.openai.com/v1/embeddings] with bearer authentication using OPENAI_API_KEY. SDK examples show equivalent operations.

For search, the documented sequence is to embed the searchable text, retain its vectors, embed each query and rank candidates by similarity. The guide recommends a vector database for fast nearest-neighbor retrieval over many vectors, but does not configure a particular database.

Several examples are fragments rather than standalone programs. The Python review-search example, for instance, needs an existing dataframe, saved embeddings and a cosine_similarity helper.

Example

The TypeScript semantic-search example sends three food descriptions and the query 'delicious beans' to text-embedding-3-small. It separates the query vector, computes cosine similarity against each description and sorts the descriptions from highest to lowest score.

This demonstrates how a relevance ranking is constructed. The supplied page does not establish an observed ranking or latency for that snippet, and no result was reproduced.

A separate zero-shot classification example embeds the labels 'negative' and 'positive' alongside a review, then selects the more similar label. This illustrates classification without labeled training examples; it does not establish accuracy for a reader's labels or documents.

Assessment & evidence

Limitations

The FAQ states that text-embedding-3-small and text-embedding-3-large lack knowledge of events after September 2021 and that this can reduce performance in some cases. The page does not quantify the effect on retrieval involving newer documents or entities.

Some examples require missing setup or helpers. The CSV column named ada_embedding is also used for vectors generated with text-embedding-3-small, so that column name should not be treated as the model identifier. The basic recommendation example retains the source item among its candidates rather than explicitly excluding it.

The page broadly asserts that embeddings improve machine-learning models with relevant free-text inputs. Its illustrative experiments do not establish that universal claim. Reported regression, clustering and classification behavior should not be assumed for other data.

Reasoning

The guide's practical value comes from separating text representation from later operations. A saved embedding can support similarity ranking, clustering or a trained predictor, depending on the application code. This makes the material useful when several features need to work with related text.

The key choice is whether the representation captures the distinctions that matter for the intended task. The guide's benchmarks and food-review examples do not answer that question for a particular document collection. Its dimension controls provide a concrete storage-versus-accuracy tradeoff, but the appropriate vector length requires task-specific evaluation.

Alternatives

Within the guide, text-embedding-3-small offers shorter default vectors and a higher estimated number of pages per dollar. text-embedding-3-large offers a higher publisher-reported MTEB score and supports shortened output for stores with smaller dimension limits.

The table reports MTEB scores of 62.3% for text-embedding-3-small, 64.6% for text-embedding-3-large and 61.0% for text-embedding-ada-002. These figures are comparison points rather than evidence of accuracy on a specific workload.

The page does not evaluate other providers or locally hosted embedding models. Their relative quality, cost and operational requirements are unknown within this resource.

Evidence

The supporting material is first-party OpenAI documentation containing explanations, code and publisher-reported results. Linked notebooks, benchmark repositories, datasets, pricing pages and terms are references; their contents are not included.

The food-review discussion describes a 1,000-review illustration drawn from a dataset of 568,454 reviews and reports a regression mean absolute error of 0.39 stars. These are source-reported results, not independently reproduced findings. No code, API request or benchmark was executed, so runtime correctness, latency and reproducibility remain unassessed.

Access & freshness

Costs

Embedding requests are billed by input tokens. The page estimates 62,500 pages per US dollar for text-embedding-3-small and 9,615 for text-embedding-3-large, assuming approximately 800 tokens per page. These are the page's illustrative figures; current per-token rates are unknown from the supplied evidence. It references pricing at [https://openai.com/api/pricing/].

Larger vectors generally require more downstream storage, memory and computation. The page does not establish a reduction in API token charges from shortening vectors. Total application cost is unknown, including embedding volume, vector storage, retrieval infrastructure and any separate text-generation calls.

Rights

The FAQ states that customers own their model inputs and outputs, including embeddings, and may share embeddings online. It also says customers are responsible for ensuring their inputs comply with applicable law and OpenAI's terms, referenced at [https://openai.com/policies/terms-of-use]. The linked terms are outside the supplied page.

That output-ownership statement does not establish a licence for the documentation or its sample code. No explicit documentation or sample-code redistribution licence appears in the supplied text. Rights for linked datasets and notebooks are also not established.

Freshness

The supplied page was captured on 13 November 2026 at 20:33:01.808 UTC. No publication or last-updated date appears in its text. The capture date does not establish when individual examples, pricing estimates or benchmark claims were revised.

The model knowledge cutoff of September 2021 is a separate limitation from documentation freshness. Current API availability, SDK compatibility and pricing are not verified by this capture.

Actions

Begin with one documented task, such as ranking a small collection of texts against a query. Resolve the chosen snippet's dependencies, count input tokens and use a consistent model and vector length for documents and queries.

Before adopting the approach, evaluate relevance on representative queries and compare the supported model and dimension choices against storage needs. Check current API pricing and applicable terms separately, since the page does not establish current rates or all usage conditions.

For question answering, account for both retrieval and the separate answer-generation step. For recommendations, decide whether to exclude the source item. These application decisions are not completed by the introductory snippets.

Evidence for this report

selected-page.txtselected · checked 2026-11-13