[ ABORT TO HUD ]
SEQ. 1
SEQ. 2

The Embeddings API

🧲 Embeddings & Vector Search 12 min 200 BASE XP⌨ HANDS-ON LAB

Turning Text into Numbers

Embeddings are dense vector representations of text that capture semantic meaning. Two texts about the same topic will have similar embeddings, even if they use completely different words.

Available Models (2026)

ModelDimensionsMax TokensBest For
text-embedding-3-small1,5368,191Cost-effective, high-volume search
text-embedding-3-large3,0728,191Maximum accuracy, complex similarity
const embedding = await openai.embeddings.create({
  model: "text-embedding-3-small",
  input: "How do I reset my password?",
  dimensions: 1024  // Optional: reduce dimensions for efficiency
});
// Returns: { embedding: [0.0023, -0.0091, 0.0154, ...] }

Dimension Reduction

Both models support native dimension reduction. You can request fewer dimensions (e.g., 256, 512, 1024) to save storage and improve search speed with minimal accuracy loss.

Use Cases

  • Semantic Search: Find documents by meaning, not keywords
  • RAG: Retrieve relevant context for LLM prompts
  • Clustering: Group similar content automatically
  • Anomaly Detection: Find outliers in text datasets
  • Recommendations: "Users who liked X also liked Y"
💡 Pro Tip: Use text-embedding-3-small with 1,024 dimensions for 90% of use cases. Only upgrade to large when you need maximum precision for nuanced similarity tasks.
⌨ HANDS-ON LABGenerate Your First Embedding
⭐ +150 XP

Turn raw text into a vector. Call /v1/embeddings with the text-embedding-3-small model and inspect the response shape.

1POST to https://api.openai.com/v1/embeddings with curl, using model text-embedding-3-small.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
What is a text embedding?
A compressed version of text
A dense vector representation that captures semantic meaning
An encrypted string
A database index