# OpenAI Embeddings — card for AI agents

OpenAI API endpoint that turns text into vectors with text-embedding-3 models for search and RAG.

Maker: OpenAI · category: Embeddings and rerank

## Price (official page)
- Free tier: none listed
- Usage price: $0.02/1M tokens (text-embedding-3-small); $0.13/1M (text-embedding-3-large); $0.10/1M (text-embedding-ada-002)
- Pricing page: https://developers.openai.com/api/docs/pricing (checked 2026-10-09)
- Note: Pay-as-you-go per input token; part of the general OpenAI API account.

## Connect
- npm: `npm install openai`
- PyPI: `pip install openai`
- Repository: https://github.com/openai/openai-python
- Status: All Systems Operational

## For AI agents on OpenAI's own site (AgentGid check 2026-11-13: 4 of 6)
- llms.txt: https://developers.openai.com/llms.txt (full text: https://developers.openai.com/llms-full.txt)
- Docs pages as Markdown: 78% of the pages llms.txt lists
- OpenAPI description: none found at the usual places
- Official MCP server: no · official SDK: yes · status page: yes
- robots.txt lets AI assistants (ChatGPT-User, Claude-User) read the site: yes

## A year of price history (Internet Archive copies of the pricing page, read by rules)
- Months read: 1 (2026-02 to 2026-02) of https://developers.openai.com/api/docs/pricing
- A figure is any "$X/month" on the page (plans, seats and add-ons alike); open the archived copy to see which plan it is.

## Price history in AgentGid's catalog (since 2026-10-10)
- Changes recorded: 0 (a vendor price change or an editor's correction; the evidence archive keeps the pricing page of each date)

## Other APIs in this category
- Voyage AI: https://agentgid.com/apis/voyage-ai/agent.md
- BGE (FlagEmbedding): https://agentgid.com/apis/bge-embeddings/agent.md
- Nomic: https://agentgid.com/apis/nomic/agent.md
- Mixedbread: https://agentgid.com/apis/mixedbread-ai/agent.md

## Links
- AgentGid page: https://agentgid.com/apis/openai-embeddings/


## OpenAI Embeddings: text turned into numbers for search

OpenAI Embeddings is a paid online service that turns a piece of text into a long list of numbers that captures its meaning. Texts about the same thing get similar numbers, so your app can find related articles, products or questions even when the words differ. You keep the numbers in your own database and compare them when someone searches.

### Where to use it
- Search that understands meaning: A help center where "can't log in" also finds the article called "Reset your password", because the meaning matches, not the words.
- "You may also like" suggestions: Show products, recipes or articles whose descriptions are close to the one a visitor is reading.
- Sort support tickets by topic: Put each new ticket into the closest category, such as billing, delivery or login, by comparing it with a short description of each category.
- Check the bill before a big import: Count the tokens of all your texts on your own computer first, and see what embedding them will cost before you send anything.
- Save space with shorter vectors: Ask for fewer numbers per text when you store millions of items, so your database stays smaller and searches stay fast.
- Spot duplicate questions: Before a new forum question or idea is posted, show the closest existing ones so people join the old thread instead. (idea, not from the official pages)

### How to start
- Create an OpenAI API key and keep it in OPENAI_API_KEY on the server.

```
export OPENAI_API_KEY="your_api_key_here"
```

- Install the official package (pip install openai or npm install openai) and send your text with the model name.

```
from openai import OpenAI
client = OpenAI()

response = client.embeddings.create(
    input="Your text string goes here", model="text-embedding-3-small"
)

print(response.data[0].embedding)
```

- Store each vector in a vector database (for example Postgres with pgvector) and search it by similarity.

### License
It is a paid online service, not open source. You own the text you send and the numbers you get back, so you may use and even share them. Your text must not break the law or OpenAI's terms of use.

### Good to know
- You need an OpenAI account, prepaid credits and a secret key that stays on your server.
- Each text may be at most 8,192 tokens, so split long documents into parts first.
- The models know nothing about events after September 2021, which rarely matters for search but can in edge cases.
- Vectors from different models cannot be compared, so if you switch models you must embed all your texts again.

Checked 2026-11-10 against: https://developers.openai.com/api/docs/guides/embeddings.md, https://developers.openai.com/api/reference/resources/embeddings/methods/create.md, https://developers.openai.com/api/docs/guides/retrieval.md, https://developers.openai.com/api/docs/tutorials/web-qa-embeddings.md, https://developers.openai.com/api/docs/pricing.md, https://developers.openai.com/api/docs/quickstart.md, https://developers.openai.com/api/docs/guides/error-codes.md, https://developers.openai.com/api/docs/guides/rate-limits.md, https://developers.openai.com/api/docs/guides/your-data.md, https://developers.openai.com/api/docs/guides/api-keys.md, https://developers.openai.com/api/docs/guides/batch.md, https://developers.openai.com/api/reference/overview.md, https://developers.openai.com/learn/docs-mcp.md, https://supabase.com/docs/guides/ai/vector-columns.md, https://supabase.com/docs/guides/ai/semantic-search.md, https://supabase.com/docs/guides/ai/vector-indexes/hnsw-indexes.md, https://pypi.org/pypi/openai/3.48.0/json, https://registry.npmjs.org/openai/7.54.0, https://pypi.org/pypi/tiktoken/json

### Mistakes to avoid
- Don't: Mixing vectors from text-embedding-3-small and text-embedding-3-large (or another vendor) in one search table → Do: Use one model for all stored texts and for the search query; re-embed everything when you change models (Distances between vectors from different models mean nothing.)
- Don't: Storing 3072-number vectors from text-embedding-3-large in a pgvector column and adding a normal HNSW index → Do: Request dimensions of 2000 or fewer, or index the column as halfvec (pgvector indexes plain vectors only up to 2,000 numbers, and text-embedding-3-large returns 3072 by default.)
- Don't: Sending a whole book chapter, an empty string, or 5,000 texts in one request → Do: Split texts under 8,192 tokens, skip empty ones, and send at most 2,048 texts (300,000 tokens) per request (The endpoint rejects inputs over these limits.)
- Don't: Counting tokens with a different tokenizer or by splitting on spaces → Do: tiktoken.get_encoding("cl100k_base") (The docs name cl100k_base for the third-generation embedding models.)
- Don't: Comparing a query vector with every stored vector in a loop in your app code → Do: Keep vectors in a vector database (for example pgvector) and let it find the nearest ones (The docs recommend a vector database for searching many vectors quickly.)

### Questions
- What does it cost? Billed per input token. List prices per 1M tokens are $0.02 for text-embedding-3-small and $0.13 for text-embedding-3-large.
- How many numbers does one text become? 1536 for text-embedding-3-small and 3072 for text-embedding-3-large by default; you can ask for fewer.
- Can I share or publish the vectors I get? Yes. The docs say customers own their input and output, including embeddings.
- How do I compare two vectors? The docs recommend cosine similarity; since the vectors have length 1, a dot product gives the same result faster.
- Does OpenAI keep or train on the texts I embed? It does not train on them; safety logs for embedding requests are kept up to 30 days.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
