Course contentsShow
← AI Engineering
Lesson 215 of 1,8866. Embeddings and Semantic SearchFree lesson

OpenAI Embeddings API Overview

Using OpenAI's text-embedding models, API parameters, and understanding model versions and dimensions.

OpenAI Embeddings API Overview

What you'll learn: How to use OpenAI's text-embedding models to convert text into numerical vectors through their API.

What Is the OpenAI Embeddings API?

OpenAI provides dedicated models specifically for generating embeddings—numerical representations of text that capture semantic meaning. Rather than building your own embedding models from scratch, you can send text to OpenAI's API and receive back high-quality vector embeddings ready for similarity comparisons, clustering, or search applications.

Think of it like a translation service: you send in human-readable text, and receive back a "language" that computers can mathematically compare and understand.

Key API Parameters

When calling the embeddings endpoint, you'll typically specify:

  • model: The embedding model version (e.g., text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002)
  • input: The text (or list of texts) you want to embed
  • dimensions (optional): For newer models, you can request fewer dimensions to reduce size and cost

Model Versions and Dimensions

OpenAI has released multiple embedding model generations:

  • text-embedding-ada-002: The previous standard model producing 1,536-dimensional vectors
  • text-embedding-3-small: Newer, more efficient model with 1,536 dimensions by default (supports dimension reduction)
  • text-embedding-3-large: Highest quality model with 3,072 dimensions by default (also supports dimension reduction)

Newer models let you trade accuracy for efficiency: requesting 512 dimensions instead of 1,536 reduces storage and computation while maintaining reasonable quality for many tasks.

Key Takeaway: OpenAI's Embeddings API transforms text into vectors through simple API calls, with newer models offering flexible dimensionality and improved performance over earlier versions.