[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
The Embeddings API
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)
| Model | Dimensions | Max Tokens | Best For |
|---|---|---|---|
| text-embedding-3-small | 1,536 | 8,191 | Cost-effective, high-volume search |
| text-embedding-3-large | 3,072 | 8,191 | Maximum 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 XPTurn 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.
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